def reload(cls): cls.STYLE = editConf.GetOption( 'extensions','ParenMatch','style', default='opener') cls.FLASH_DELAY = editConf.GetOption( 'extensions','ParenMatch','flash-delay', type='int',default=500) cls.BELL = editConf.GetOption( 'extensions','ParenMatch','bell', type='bool', default=1) cls.HILITE_CONFIG = editConf.GetHighlight(editConf.CurrentTheme(), 'hilite')
def getfilename(self): """Get source filename. If not saved, offer to save (or create) file The debugger requires a source file. Make sure there is one, and that the current version of the source buffer has been saved. If the user declines to save or cancels the Save As dialog, return None. If the user has configured edit for Autosave, the file will be silently saved if it already exists and is dirty. """ filename = self.editwin.io.filename if not self.editwin.get_saved(): autosave = editConf.GetOption('main', 'General', 'autosave', type='bool') if autosave and filename: self.editwin.io.save(None) else: confirm = self.ask_save_dialog() self.editwin.text.focus_set() if confirm: self.editwin.io.save(None) filename = self.editwin.io.filename else: filename = None return filename
def reload(cls): "Load class variables from config." cls.context_depth = editConf.GetOption("extensions", "CodeContext", "maxlines", type="int", default=15) cls.colors = editConf.GetHighlight(editConf.CurrentTheme(), 'context')
def test_init(self): self.assertIs(self.history.text, self.text) self.assertEqual(self.history.history, []) self.assertIsNone(self.history.prefix) self.assertIsNone(self.history.pointer) self.assertEqual( self.history.cyclic, editConf.GetOption("main", "History", "cyclic", 1, "bool"))
def __init__(self, text): '''Initialize data attributes and bind event methods. .text - edit wrapper of tk Text widget, with .bell(). .history - source statements, possibly with multiple lines. .prefix - source already entered at prompt; filters history list. .pointer - index into history. .cyclic - wrap around history list (or not). ''' self.text = text self.history = [] self.prefix = None self.pointer = None self.cyclic = editConf.GetOption("main", "History", "cyclic", 1, "bool") text.bind("<<history-previous>>", self.history_prev) text.bind("<<history-next>>", self.history_next)
def reload(cls): """Load class variables from config.""" cls.auto_squeeze_min_lines = editConf.GetOption( "main", "PyShell", "auto-squeeze-min-lines", type="int", default=50, ) # Loading the font info requires a Tk root. edit doesn't rely # on Tkinter's "default root", so the instance will reload # font info using its editor windows's Tk root. if cls._instance_weakref is not None: instance = cls._instance_weakref() if instance is not None: instance.load_font()
def reload(cls): cls.popupwait = editConf.GetOption("extensions", "AutoComplete", "popupwait", type="int", default=0)
def reload(cls): cls.max_width = editConf.GetOption('extensions', 'FormatParagraph', 'max-width', type='int', default=72)
def reload(cls): cls.ztext = editConf.GetOption('extensions', 'ZzDummy', 'z-text')
"Example extension, also used for testing." from edit.config import editConf ztext = editConf.GetOption('extensions', 'ZzDummy', 'z-text') class ZzDummy: ## menudefs = [ ## ('format', [ ## ('Z in', '<<z-in>>'), ## ('Z out', '<<z-out>>'), ## ] ) ## ] def __init__(self, editwin): self.text = editwin.text z_in = False @classmethod def reload(cls): cls.ztext = editConf.GetOption('extensions', 'ZzDummy', 'z-text') def z_in_event(self, event): """ """ text = self.text text.undo_block_start() for line in range(1, text.index('end')): text.insert('%d.0', ztest)
def set_editconf_option_with_cleanup(self, configType, section, option, value): prev_val = editConf.GetOption(configType, section, option) editConf.SetOption(configType, section, option, value) self.addCleanup(editConf.SetOption, configType, section, option, prev_val)