Lines Matching +full:user +full:- +full:config
1 """idlelib.config -- Manage IDLE configuration information.
3 The comments at the beginning of config-main.def describe the
4 configuration files and the design implemented to update user
5 configuration information. In particular, user configuration choices
6 which duplicate the defaults will be removed from the user's
7 configuration files, and if a user file becomes empty, it will be
11 database keys are tuples (config-type, section, item). As implemented,
12 there are separate dicts for default and user values. Each has
13 config-type keys 'main', 'extensions', 'highlight', and 'keys'. The
15 to values. For 'main' and 'extensions', user values override
16 default values. For 'highlight' and 'keys', user sections augment the
22 the retrieval of config information. When a default is returned instead of
23 a requested config value, a message is printed to stderr to aid in
45 cfgFile - string, fully specified configuration file name
81 IdleConfigParser specialised for user configuration handling.
127 """Update user configuration file.
146 """Hold config parsers for all idle config files in singleton instance.
148 Default config files, self.defaultCfg --
150 (idle install dir)/config-{config-type}.def
152 User config files, self.userCfg --
154 (user home dir)/.idlerc/config-{config-type}.cfg
169 "Populate default and user config parser dictionaries."
174 os.path.join(idledir, f'config-{cfg_type}.def'))
176 os.path.join(userdir or '#', f'config-{cfg_type}.cfg'))
179 """Return a filesystem directory for storing user config files.
185 if userDir != '~': # expanduser() found user home dir
204 warn = ('\n Warning: unable to create user config directory\n' +
219 to the config parser. First try to return a valid value
220 (including type) from a user configuration. If that fails, try
224 Warn if either user or default configurations have an invalid value.
232 warning = ('\n Warning: config.py - IdleConf.GetOption -\n'
246 warning = ('\n Warning: config.py - IdleConf.GetOption -\n'
255 """Set section option to value in user config file."""
261 configSet must be either 'user' or 'default'
266 if configSet == 'user':
281 else 'user')
283 fore = theme_dict[element + '-foreground']
286 back = theme_dict[element + '-background']
292 type - string, 'default' or 'user' theme type
293 themeName - string, theme name
297 if type == 'user':
308 theme ={'normal-foreground':'#000000',
309 'normal-background':'#ffffff',
310 'keyword-foreground':'#000000',
311 'keyword-background':'#ffffff',
312 'builtin-foreground':'#000000',
313 'builtin-background':'#ffffff',
314 'comment-foreground':'#000000',
315 'comment-background':'#ffffff',
316 'string-foreground':'#000000',
317 'string-background':'#ffffff',
318 'definition-foreground':'#000000',
319 'definition-background':'#ffffff',
320 'hilite-foreground':'#000000',
321 'hilite-background':'gray',
322 'break-foreground':'#ffffff',
323 'break-background':'#000000',
324 'hit-foreground':'#ffffff',
325 'hit-background':'#000000',
326 'error-foreground':'#ffffff',
327 'error-background':'#000000',
328 'context-foreground':'#000000',
329 'context-background':'#ffffff',
330 'linenumber-foreground':'#000000',
331 'linenumber-background':'#ffffff',
333 'cursor-foreground':'#000000',
335 'stdout-foreground':'#000000',
336 'stdout-background':'#ffffff',
337 'stderr-foreground':'#000000',
338 'stderr-background':'#ffffff',
339 'console-foreground':'#000000',
340 'console-background':'#ffffff',
345 element.startswith(('context-', 'linenumber-'))):
347 warning = ('\n Warning: config.IdleConf.GetThemeDict'
348 ' -\n problem retrieving theme element %r'
368 idlelib.config-main.def ('default') includes these sections
380 Item 'name2', is used for built-in ('default') themes and keys
414 """Return extensions in default and user config-extensions files.
423 self.GetSectionList('user', 'extensions'))
425 if extn not in extns: #user has added own extension
430 # specific exclusions because we are storing config for mainlined old
431 # extensions in config-extensions.def for backward compatibility
460 virtualEvent - string, name of the virtual event to test for,
474 Events come from default config extension_cfgBindings section.
492 Events come from default config extension_cfgBindings section.
494 tries user config before default config.
510 Augment self.GetExtensionKeys(extensionName) with mapping of non-
511 configurable events (from default config) to GetOption splits,
516 #add the non-configurable bindings
530 keySetName - name of key binding set (config-keys section).
531 eventStr - virtual event, including brackets, as in '<<event>>'.
533 eventName = eventStr[2:-2] #trim off the angle brackets
549 v2 = [ x.replace('<Alt-', '<Option-') for x in v ]
556 """Return event-key dict for keySetName core plus active extensions.
576 virtualEvent - string, name of the virtual event to test for,
584 former_extension_events = { # Those with user-configurable keys.
585 '<<force-open-completions>>', '<<expand-word>>',
586 '<<force-open-calltip>>', '<<flash-paren>>', '<<format-paragraph>>',
587 '<<run-module>>', '<<check-module>>', '<<zoom-height>>',
588 '<<run-custom>>',
592 """Return dict of core virtual-key keybindings for keySetName.
595 dict. If keySetName is not None, bindings from the config
598 resort fallback' to the CUA-ish bindings defined here.
601 '<<copy>>': ['<Control-c>', '<Control-C>'],
602 '<<cut>>': ['<Control-x>', '<Control-X>'],
603 '<<paste>>': ['<Control-v>', '<Control-V>'],
604 '<<beginning-of-line>>': ['<Control-a>', '<Home>'],
605 '<<center-insert>>': ['<Control-l>'],
606 '<<close-all-windows>>': ['<Control-q>'],
607 '<<close-window>>': ['<Alt-F4>'],
608 '<<do-nothing>>': ['<Control-x>'],
609 '<<end-of-file>>': ['<Control-d>'],
610 '<<python-docs>>': ['<F1>'],
611 '<<python-context-help>>': ['<Shift-F1>'],
612 '<<history-next>>': ['<Alt-n>'],
613 '<<history-previous>>': ['<Alt-p>'],
614 '<<interrupt-execution>>': ['<Control-c>'],
615 '<<view-restart>>': ['<F6>'],
616 '<<restart-shell>>': ['<Control-F6>'],
617 '<<open-class-browser>>': ['<Alt-c>'],
618 '<<open-module>>': ['<Alt-m>'],
619 '<<open-new-window>>': ['<Control-n>'],
620 '<<open-window-from-file>>': ['<Control-o>'],
621 '<<plain-newline-and-indent>>': ['<Control-j>'],
622 '<<print-window>>': ['<Control-p>'],
623 '<<redo>>': ['<Control-y>'],
624 '<<remove-selection>>': ['<Escape>'],
625 '<<save-copy-of-window-as-file>>': ['<Alt-Shift-S>'],
626 '<<save-window-as-file>>': ['<Alt-s>'],
627 '<<save-window>>': ['<Control-s>'],
628 '<<select-all>>': ['<Alt-a>'],
629 '<<toggle-auto-coloring>>': ['<Control-slash>'],
630 '<<undo>>': ['<Control-z>'],
631 '<<find-again>>': ['<Control-g>', '<F3>'],
632 '<<find-in-files>>': ['<Alt-F3>'],
633 '<<find-selection>>': ['<Control-F3>'],
634 '<<find>>': ['<Control-f>'],
635 '<<replace>>': ['<Control-h>'],
636 '<<goto-line>>': ['<Alt-g>'],
637 '<<smart-backspace>>': ['<Key-BackSpace>'],
638 '<<newline-and-indent>>': ['<Key-Return>', '<Key-KP_Enter>'],
639 '<<smart-indent>>': ['<Key-Tab>'],
640 '<<indent-region>>': ['<Control-Key-bracketright>'],
641 '<<dedent-region>>': ['<Control-Key-bracketleft>'],
642 '<<comment-region>>': ['<Alt-Key-3>'],
643 '<<uncomment-region>>': ['<Alt-Key-4>'],
644 '<<tabify-region>>': ['<Alt-Key-5>'],
645 '<<untabify-region>>': ['<Alt-Key-6>'],
646 '<<toggle-tabs>>': ['<Alt-Key-t>'],
647 '<<change-indentwidth>>': ['<Alt-Key-u>'],
648 '<<del-word-left>>': ['<Control-Key-BackSpace>'],
649 '<<del-word-right>>': ['<Control-Key-Delete>'],
650 '<<force-open-completions>>': ['<Control-Key-space>'],
651 '<<expand-word>>': ['<Alt-Key-slash>'],
652 '<<force-open-calltip>>': ['<Control-Key-backslash>'],
653 '<<flash-paren>>': ['<Control-Key-0>'],
654 '<<format-paragraph>>': ['<Alt-Key-q>'],
655 '<<run-module>>': ['<Key-F5>'],
656 '<<run-custom>>': ['<Shift-Key-F5>'],
657 '<<check-module>>': ['<Alt-Key-x>'],
658 '<<zoom-height>>': ['<Alt-Key-2>'],
665 '\n Warning: config.py - IdleConf.GetCoreKeys -\n'
678 '\n Warning: config.py - IdleConf.GetCoreKeys -\n'
690 Valid configSets are 'user' or 'default'. Return a list of tuples of
698 if configSet == 'user':
707 if value.find(';') == -1: #malformed config entry with no ';'
710 else: #config entry contains ';' as expected
725 self.GetExtraHelpSourceList('user') )
729 """Retrieve a font from configuration (font, font-size, font-bold)
740 size = self.GetOption(configType, section, 'font-size', type='int',
742 bold = self.GetOption(configType, section, 'font-bold', default=0,
761 "Write all loaded user configuration files to disk."
780 """Manage a user's proposed configuration option changes.
783 page -- one of the 4 top-level dicts representing a
784 .idlerc/config-x.cfg file.
785 config_type -- name of a page.
786 section -- a section within a page/file.
787 option -- name of an option within a section.
788 value -- value for the option.
792 save_option: Save option and value to config parser.
793 save_all: Save all the changes to the config parser and file.
821 # The setting equals a default setting, remove it from user cfg.
827 """Save configuration changes to the user config file.
886 crc = crc32(txt.encode(encoding='utf-8'), crc)