def _visibility_trace(self, *args): visible = self.visible.get() if visible: self.show() else: self.hide() CONFIG.set('Code structure', 'visible', str(visible)) CONFIG.save()
def hide(self): try: layout = CONFIG.get("General", "layout") if layout in ["vertical", "horizontal2"]: self.manager.hide(self) else: # save layout old = CONFIG.get("Layout", layout).split() w = self.master.winfo_width() pos = '%.3f' % (self.master.sashpos(0)/w) CONFIG.set("Layout", layout, f"{pos} {old[1]}") CONFIG.save() self.manager.forget(self) except TclError: pass
def validate(self): # --- general CONFIG.set('General', 'theme', self.theme.get()) family = self.family.get() if family: CONFIG.set('General', 'fontfamily', family) try: size = int(self.size.get()) assert size > 0 except (ValueError, AssertionError): pass else: CONFIG.set('General', 'fontsize', str(size)) CONFIG.set('General', 'confirm_quit', str('selected' in self.confirm_quit.state())) # --- editor # --- --- comments CONFIG.set('Editor', 'toggle_comment_mode', self.comment_toggle_mode.get()) CONFIG.set('Editor', 'comment_marker', self.comment_marker.get()) # --- --- syntax highlighting estyle = self.editor_style.get() if estyle: CONFIG.set('Editor', 'style', estyle) CONFIG.set('Editor', 'matching_brackets', self.editor_matching_brackets.get_formatting()) CONFIG.set('Editor', 'unmatched_bracket', self.editor_unmatched_bracket.get_formatting()) cstyle = self.console_style.get() # --- --- code checking CONFIG.set('Editor', 'code_check', str('selected' in self.code_check.state())) CONFIG.set('Editor', 'style_check', str('selected' in self.style_check.state())) # --- console # --- --- history try: size = int(self.history_size.get()) assert size > 0 except (ValueError, AssertionError): pass else: CONFIG.set('History', 'max_size', str(size)) # --- --- syntax highlighting cstyle = self.console_style.get() if cstyle: CONFIG.set('Console', 'style', cstyle) CONFIG.set('Console', 'matching_brackets', self.console_matching_brackets.get_formatting()) CONFIG.set('Console', 'unmatched_bracket', self.console_unmatched_bracket.get_formatting()) CONFIG.set('Console', 'ipython_dir', self.ipythondir.get()) CONFIG.set('Console', 'jupyter_config_dir', self.jupyterdir.get()) CONFIG.set('Console', 'jupyter_options', self.jupyter_options.get()) # --- run console = self.run_console.get() CONFIG.set('Run', 'console', console) CONFIG.set('Run', 'external_interactive', str('selected' in self.external_interactive.state())) external_console = self.external_console.get() CONFIG.set('Run', 'external_console', external_console) CONFIG.set('Run', 'cell', self.run_cell_in.get()) if not external_console and console: ans = askokcancel( "Warning", 'No external terminal is set so executing code in an external terminal will fail.', self) if not ans: return CONFIG.save() self.destroy()
def ok(event=None): CONFIG.set('File browser', 'filename_filter', entry.get()) CONFIG.save() self.load_filters() self.populate(self.filetree.get_children()[0], history=False) top.destroy()
def _current_session_toggle(self): val = self._current_session.get() self.history.current_session = val self.history.reset_text() CONFIG.set('History', 'current_session', str(val)) CONFIG.save()