def writeprefs(self): prefs = MacPrefs.GetPrefs(W.getapplication().preffilepath) prefs.console.show = self.isvisible() prefs.console.windowbounds = self.getbounds() prefs.console.fontsettings = self.consoletext.getfontsettings() prefs.console.tabsettings = self.consoletext.gettabsettings() prefs.save()
def seteditorprefs(fontsettings, tabsettings, windowsize): import MacPrefs prefs = MacPrefs.GetPrefs(W.getapplication().preffilepath) prefs.pyedit.fontsettings = fontsettings prefs.pyedit.tabsettings = tabsettings prefs.pyedit.windowsize = windowsize prefs.save()
def writeprefs(self): import MacPrefs self.getparmsfromwindow() prefs = MacPrefs.GetPrefs(W.getapplication().preffilepath) prefs.searchengine.casesens = self.parms["casesens"] prefs.searchengine.wrap = self.parms["wrap"] prefs.searchengine.wholeword = self.parms["wholeword"] prefs.save()
def writeprefs(self): if self.w is not None: prefs = MacPrefs.GetPrefs(W.getapplication().preffilepath) prefs.output.show = self.w.isvisible() prefs.output.windowbounds = self.w.getbounds() prefs.output.fontsettings = self.w.outputtext.getfontsettings() prefs.output.tabsettings = self.w.outputtext.gettabsettings() prefs.save()
def geteditorprefs(): import MacPrefs prefs = MacPrefs.GetPrefs(W.getapplication().preffilepath) try: fontsettings = prefs.pyedit.fontsettings tabsettings = prefs.pyedit.tabsettings windowsize = prefs.pyedit.windowsize except: fontsettings = prefs.pyedit.fontsettings = ("Geneva", 0, 10, (0, 0, 0)) tabsettings = prefs.pyedit.tabsettings = (8, 1) windowsize = prefs.pyedit.windowsize = (500, 250) sys.exc_traceback = None return fontsettings, tabsettings, windowsize
def installconsole(defaultshow = 1): global console prefs = MacPrefs.GetPrefs(W.getapplication().preffilepath) if not prefs.console or not hasattr(prefs.console, 'show'): prefs.console.show = defaultshow if not hasattr(prefs.console, "windowbounds"): prefs.console.windowbounds = (450, 250) if not hasattr(prefs.console, "fontsettings"): prefs.console.fontsettings = ("Monaco", 0, 9, (0, 0, 0)) if not hasattr(prefs.console, "tabsettings"): prefs.console.tabsettings = (32, 0) console = PyConsole(prefs.console.windowbounds, prefs.console.show, prefs.console.fontsettings, prefs.console.tabsettings, 1)
def __init__(self): self.visible = 0 self.w = None self.parms = { "find": "", "replace": "", "wrap": 1, "casesens": 1, "wholeword": 1 } import MacPrefs prefs = MacPrefs.GetPrefs(W.getapplication().preffilepath) if prefs.searchengine: self.parms["casesens"] = prefs.searchengine.casesens self.parms["wrap"] = prefs.searchengine.wrap self.parms["wholeword"] = prefs.searchengine.wholeword
def installoutput(defaultshow = 0, OutPutWindow = PyOutput): global output # quick 'n' dirty std in emulation sys.stdin = SimpleStdin() prefs = MacPrefs.GetPrefs(W.getapplication().preffilepath) if not prefs.output or not hasattr(prefs.output, 'show'): prefs.output.show = defaultshow if not hasattr(prefs.output, "windowbounds"): prefs.output.windowbounds = (450, 250) if not hasattr(prefs.output, "fontsettings"): prefs.output.fontsettings = ("Monaco", 0, 9, (0, 0, 0)) if not hasattr(prefs.output, "tabsettings"): prefs.output.tabsettings = (32, 0) output = OutPutWindow(prefs.output.windowbounds, prefs.output.show, prefs.output.fontsettings, prefs.output.tabsettings)
def close(self): prefs = MacPrefs.GetPrefs(W.getapplication().preffilepath) prefs.docsearchengine = self.getsettings()
def __init__(self): prefs = MacPrefs.GetPrefs(W.getapplication().preffilepath) try: (docpath, kind, case, word, tut, lib, ref, ext, api) = prefs.docsearchengine except: (docpath, kind, case, word, tut, lib, ref, ext, api) = prefs.docsearchengine = \ ("", 0, 0, 0, 1, 1, 0, 0, 0) if docpath and not verifydocpath(docpath): docpath = "" self.w = W.Window((400, 200), "Search the Python Documentation") self.w.searchtext = W.EditText((10, 10, -100, 20), callback=self.checkbuttons) self.w.searchbutton = W.Button((-90, 12, 80, 16), "Search", self.search) buttons = [] gutter = 10 width = 130 bookstart = width + 2 * gutter self.w.phraseradio = W.RadioButton((10, 38, width, 16), "As a phrase", buttons) self.w.allwordsradio = W.RadioButton((10, 58, width, 16), "All words", buttons) self.w.anywordsradio = W.RadioButton((10, 78, width, 16), "Any word", buttons) self.w.casesens = W.CheckBox((10, 98, width, 16), "Case sensitive") self.w.wholewords = W.CheckBox((10, 118, width, 16), "Whole words") self.w.tutorial = W.CheckBox((bookstart, 38, -10, 16), "Tutorial") self.w.library = W.CheckBox((bookstart, 58, -10, 16), "Library reference") self.w.langueref = W.CheckBox((bookstart, 78, -10, 16), "Lanuage reference manual") self.w.extending = W.CheckBox((bookstart, 98, -10, 16), "Extending & embedding") self.w.api = W.CheckBox((bookstart, 118, -10, 16), "C/C++ API") self.w.setdocfolderbutton = W.Button((10, -30, 100, 16), "Set doc folder", self.setdocpath) if docpath: self.w.setdefaultbutton(self.w.searchbutton) else: self.w.setdefaultbutton(self.w.setdocfolderbutton) self.docpath = docpath if not docpath: docpath = "(please select the Python html documentation folder)" self.w.docfolder = W.TextBox((120, -28, -10, 16), docpath) [self.w.phraseradio, self.w.allwordsradio, self.w.anywordsradio][kind].set(1) self.w.casesens.set(case) self.w.wholewords.set(word) self.w.tutorial.set(tut) self.w.library.set(lib) self.w.langueref.set(ref) self.w.extending.set(ext) self.w.api.set(api) self.w.open() self.w.wholewords.enable(0) self.w.bind('<close>', self.close) self.w.searchbutton.enable(0)