def SaveFontPreferences(): win32ui.WriteProfileVal(sectionProfile, valueFormatTitle, str(formatTitle)) win32ui.WriteProfileVal(sectionProfile, valueFormatInput, str(formatInput)) win32ui.WriteProfileVal(sectionProfile, valueFormatOutput, str(formatOutput)) win32ui.WriteProfileVal(sectionProfile, valueFormatOutputError, str(formatOutputError))
def SaveState(self): items = [] for i in range(self.GetItemCount()-1): items.append(self.GetItemText(i,0)) win32ui.WriteProfileVal("Debugger Windows\\" + self.title, "Items", "\t".join(items)) win32ui.WriteProfileVal("Debugger Windows\\" + self.title, "Visible", self.IsWindowVisible()) return 1
def SaveWindowSize(section, rect): """ Writes a rectangle to an INI file Args: section = section name in the applications INI file rect = a rectangle in a (cy, cx, y, x) tuple (same format as CREATESTRUCT position tuples).""" left, top, right, bottom = rect win32ui.WriteProfileVal(section, "left", left) win32ui.WriteProfileVal(section, "top", top) win32ui.WriteProfileVal(section, "right", right) win32ui.WriteProfileVal(section, "bottom", bottom)
def saveInitParams(self): # Only save the flags, not the text boxes. paramstr = "\t%s\t\t%d\t%d" % ( self.filpattern, self.casesensitive, self.recurse, ) win32ui.WriteProfileVal("Grep", "Params", paramstr)
def SaveState(self): self.list.DeleteAllItems() self.listOK = 0 win32ui.WriteProfileVal( "Debugger Windows\\" + self.title, "Visible", self.IsWindowVisible())
def OnOK(self): dialog.PrintDialog.OnOK(self) strMag = self.magCtl.GetWindowText() try: self['mag'] = int(strMag) except: pass win32ui.WriteProfileVal(self.sectionPos, 'Document Magnification', self['mag'])
def __init__(self, pInfo, dlgID, flags=win32ui.PD_USEDEVMODECOPIES): dialog.PrintDialog.__init__(self, pInfo, dlgID, flags=flags) mag = win32ui.GetProfileVal(self.sectionPos, 'Document Magnification', 0) if mag <= 0: mag = 2 win32ui.WriteProfileVal(self.sectionPos, 'Document Magnification', mag) self['mag'] = mag
def OnOK(self): # Handle the edit controls - get all the fonts, put them back into interact, then # get interact to save its stuff! controlAttrs = [(win32ui.IDC_EDIT1, interact.STYLE_INTERACTIVE_PROMPT), (win32ui.IDC_EDIT2, interact.STYLE_INTERACTIVE_OUTPUT), (win32ui.IDC_EDIT3, interact.STYLE_INTERACTIVE_ERROR)] for id, key in controlAttrs: control = self.GetDlgItem(id) fmt = control.GetDefaultCharFormat() win32ui.WriteProfileVal(interact.sectionProfile, key, str(fmt)) # Save the other interactive window options. interact.SavePreference("Show at startup", self['bShowAtStartup']) interact.SavePreference("Docking", self['bDocking']) # And the other options. win32ui.WriteProfileVal("Settings", "Recent File List Size", self['MRUSize']) return 1
def WriteToolMenuItems(items): # Items is a list of (menu, command) # Delete the entire registry tree. try: mainKey = win32ui.GetAppRegistryKey() toolKey = win32api.RegOpenKey(mainKey, "Tools Menu") except win32ui.error: toolKey = None if toolKey is not None: while 1: try: subkey = win32api.RegEnumKey(toolKey, 0) except win32api.error: break win32api.RegDeleteKey(toolKey, subkey) # Keys are now removed - write the new ones. # But first check if we have the defaults - and if so, dont write anything! if items == defaultToolMenuItems: return itemNo = 1 for menu, cmd in items: win32ui.WriteProfileVal("Tools Menu\\%s" % itemNo, "", menu) win32ui.WriteProfileVal("Tools Menu\\%s" % itemNo, "Command", cmd) itemNo = itemNo + 1
def SavePreference(prefName, prefValue): win32ui.WriteProfileVal(sectionProfile, prefName, prefValue)
def saveInitParams(self): # Only save the flags, not the text boxes. paramstr = "\t\t\t%d\t%d" % (self.casesensitive, self.recurse) win32ui.WriteProfileVal("Pychecker", "Params", paramstr)
def SaveDebuggerOptions(opts): for key, val in opts.items(): win32ui.WriteProfileVal("Debugger Options", key, val)
def DeleteEditorOption(option): try: win32ui.WriteProfileVal("Editor", option, None) except win32ui.error: pass
def SetEditorOption(option, newValue): win32ui.WriteProfileVal("Editor", option, newValue)
def SavePreference(self, name, value): win32ui.WriteProfileVal("Format", name, value)
def SavePreference(self, name, value): ## LoadPreference uses -1 to indicate default if value is None: value=-1 win32ui.WriteProfileVal("Format", name, value)