MCPcopy Index your code
hub / github.com/python/cpython / HighPage

Class HighPage

Lib/idlelib/configdialog.py:451–1108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

449
450
451class HighPage(Frame):
452
453 def __init__(self, master, extpage):
454 super().__init__(master)
455 self.extpage = extpage
456 self.cd = master.winfo_toplevel()
457 self.style = Style(master)
458 self.create_page_highlight()
459 self.load_theme_cfg()
460
461 def create_page_highlight(self):
462 """Return frame of widgets for Highlights tab.
463
464 Enable users to provisionally change foreground and background
465 colors applied to textual tags. Color mappings are stored in
466 complete listings called themes. Built-in themes in
467 idlelib/config-highlight.def are fixed as far as the dialog is
468 concerned. Any theme can be used as the base for a new custom
469 theme, stored in .idlerc/config-highlight.cfg.
470
471 Function load_theme_cfg() initializes tk variables and theme
472 lists and calls paint_theme_sample() and set_highlight_target()
473 for the current theme. Radiobuttons builtin_theme_on and
474 custom_theme_on toggle var theme_source, which controls if the
475 current set of colors are from a builtin or custom theme.
476 DynOptionMenus builtinlist and customlist contain lists of the
477 builtin and custom themes, respectively, and the current item
478 from each list is stored in vars builtin_name and custom_name.
479
480 Function paint_theme_sample() applies the colors from the theme
481 to the tags in text widget highlight_sample and then invokes
482 set_color_sample(). Function set_highlight_target() sets the state
483 of the radiobuttons fg_on and bg_on based on the tag and it also
484 invokes set_color_sample().
485
486 Function set_color_sample() sets the background color for the frame
487 holding the color selector. This provides a larger visual of the
488 color for the current tag and plane (foreground/background).
489
490 Note: set_color_sample() is called from many places and is often
491 called more than once when a change is made. It is invoked when
492 foreground or background is selected (radiobuttons), from
493 paint_theme_sample() (theme is changed or load_cfg is called), and
494 from set_highlight_target() (target tag is changed or load_cfg called).
495
496 Button delete_custom invokes delete_custom() to delete
497 a custom theme from idleConf.userCfg['highlight'] and changes.
498 Button save_custom invokes save_as_new_theme() which calls
499 get_new_theme_name() and create_new() to save a custom theme
500 and its colors to idleConf.userCfg['highlight'].
501
502 Radiobuttons fg_on and bg_on toggle var fg_bg_toggle to control
503 if the current selected color for a tag is for the foreground or
504 background.
505
506 DynOptionMenu targetlist contains a readable description of the
507 tags applied to Python source within IDLE. Selecting one of the
508 tags from this list populates highlight_target, which has a callback

Callers 1

create_widgetsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…