[3.9] bpo-33962: Use ttk spinbox for IDLE indent space config (GH-22954) by miss-islington · Pull Request #26648 · python/cpython
Methods: create_action_buttons
def ok(self): """Apply config changes, then dismiss dialog.
Methods: apply destroy: inherited """ """Apply config changes, then dismiss dialog.""" self.apply() self.destroy()
def apply(self): """Apply config changes and leave dialog open.
Methods: deactivate_current_config save_all_changed_extensions activate_config_changes """ """Apply config changes and leave dialog open.""" self.deactivate_current_config() changes.save_all() self.save_all_changed_extensions() self.extpage.save_all_changed_extensions() self.activate_config_changes()
def cancel(self):
def create_page_font_tab(self): """Return frame of widgets for Font/Tabs tab. def create_page_font(self): """Return frame of widgets for Font tab.
Fonts: Enable users to provisionally change font face, size, or boldness and to see the consequence of proposed choices. Each
Tabs: Enable users to change spaces entered for indent tabs. Changing indent_scale value with the mouse sets Var space_num, which invokes the default callback to add an entry to changes. Load_tab_cfg initializes space_num to default.
Widgets for FontPage(Frame): (*) widgets bound to self frame_font: LabelFrame frame_font_name: Frame
# Define frames and widgets. frame_font = LabelFrame( self, borderwidth=2, relief=GROOVE, text=' Shell/Editor Font ') frame_sample = LabelFrame( self, borderwidth=2, relief=GROOVE, text=' Font Sample (Editable) ') frame_indent = LabelFrame( self, borderwidth=2, relief=GROOVE, text=' Indentation Width ') frame_font = LabelFrame(self, borderwidth=2, relief=GROOVE, text=' Shell/Editor Font ') frame_sample = LabelFrame(self, borderwidth=2, relief=GROOVE, text=' Font Sample (Editable) ') # frame_font. frame_font_name = Frame(frame_font) frame_font_param = Frame(frame_font)
# Grid and pack widgets: self.columnconfigure(1, weight=1) self.rowconfigure(2, weight=1) frame_font.grid(row=0, column=0, padx=5, pady=5) frame_sample.grid(row=0, column=1, rowspan=3, padx=5, pady=5, sticky='nsew') frame_indent.grid(row=1, column=0, padx=5, pady=5, sticky='ew') # frame_font. frame_font_name.pack(side=TOP, padx=5, pady=5, fill=X) frame_font_param.pack(side=TOP, padx=5, pady=5, fill=X)
def load_font_cfg(self): """Load current configuration settings for the font options.
def load_tab_cfg(self): """Load current configuration settings for the tab options.
Attributes updated: space_num: Set to value from idleConf. """ # Set indent sizes. space_num = idleConf.GetOption( 'main', 'Indent', 'num-spaces', default=4, type='int') self.space_num.set(space_num)
def var_changed_space_num(self, *params): "Store change to indentation size." value = self.space_num.get() changes.add_option('main', 'Indent', 'num-spaces', value)
class HighPage(Frame):
def create_page_highlight(self): """Return frame of widgets for Highlighting tab. """Return frame of widgets for Highlights tab.
Enable users to provisionally change foreground and background colors applied to textual tags. Color mappings are stored in
Enable users to provisionally change general window options. Function load_windows_cfg initializes tk variables idleConf. Function load_windows_cfg initializes tk variable idleConf. Radiobuttons startup_shell_on and startup_editor_on set var startup_edit. Entry boxes win_width_int and win_height_int set var win_width and win_height. Setting var_name invokes the default callback that adds option to changes.
Widgets for WinPage(Frame): (*) widgets bound to self Widgets for WinPage(Frame): > vars, bound to self frame_window: LabelFrame frame_run: Frame startup_title: Label (*)startup_editor_on: Radiobutton - startup_edit (*)startup_shell_on: Radiobutton - startup_edit startup_editor_on: Radiobutton > startup_edit startup_shell_on: Radiobutton > startup_edit frame_win_size: Frame win_size_title: Label win_width_title: Label (*)win_width_int: Entry - win_width win_width_int: Entry > win_width win_height_title: Label (*)win_height_int: Entry - win_height frame_cursor_blink: Frame cursor_blink_title: Label (*)cursor_blink_bool: Checkbutton - cursor_blink win_height_int: Entry > win_height frame_cursor: Frame indent_title: Label indent_chooser: Spinbox (Combobox < 8.5.9) > indent_spaces blink_on: Checkbutton > cursor_blink frame_autocomplete: Frame auto_wait_title: Label (*)auto_wait_int: Entry - autocomplete_wait auto_wait_int: Entry > autocomplete_wait frame_paren1: Frame paren_style_title: Label (*)paren_style_type: OptionMenu - paren_style paren_style_type: OptionMenu > paren_style frame_paren2: Frame paren_time_title: Label (*)paren_flash_time: Entry - flash_delay (*)bell_on: Checkbutton - paren_bell paren_flash_time: Entry > flash_delay bell_on: Checkbutton > paren_bell frame_format: Frame format_width_title: Label (*)format_width_int: Entry - format_width format_width_int: Entry > format_width """ # Integer values need StringVar because int('') raises. self.startup_edit = tracers.add(
frame_cursor_blink = Frame(frame_window, borderwidth=0) cursor_blink_title = Label(frame_cursor_blink, text='Cursor Blink') self.cursor_blink_bool = Checkbutton(frame_cursor_blink, variable=self.cursor_blink, width=1) frame_cursor = Frame(frame_window, borderwidth=0) indent_title = Label(frame_cursor, text='Indent spaces (4 is standard)') try: self.indent_chooser = Spinbox( frame_cursor, textvariable=self.indent_spaces, from_=1, to=10, width=2, validatecommand=self.digits_only, validate='key') except TclError: self.indent_chooser = Combobox( frame_cursor, textvariable=self.indent_spaces, state="readonly", values=list(range(1,11)), width=3) cursor_blink_title = Label(frame_cursor, text='Cursor Blink') self.cursor_blink_bool = Checkbutton(frame_cursor, text="Cursor blink", variable=self.cursor_blink)
frame_autocomplete = Frame(frame_window, borderwidth=0,) auto_wait_title = Label(frame_autocomplete, text='Completions Popup Wait (milliseconds)') self.auto_wait_int = Entry(frame_autocomplete, width=6, textvariable=self.autocomplete_wait, validatecommand=self.digits_only, validate='key') text='Completions Popup Wait (milliseconds)') self.auto_wait_int = Entry( frame_autocomplete, textvariable=self.autocomplete_wait, width=6, validatecommand=self.digits_only, validate='key')
frame_paren1 = Frame(frame_window, borderwidth=0) paren_style_title = Label(frame_paren1, text='Paren Match Style')