Changeset 3808
- Timestamp:
- 12/17/07 17:09:47 (1 year ago)
- Files:
-
- trunk/ide/PrefEditor.cdxml (modified) (4 diffs)
- trunk/ide/PrefEditor.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ide/PrefEditor.cdxml
r3668 r3808 96 96 else: 97 97 typDict = {"String": str, "Unicode": unicode, "Integer": int, "Float": float, 98 "Boolean": bool, "List": list, "Tuple": tuple, "Dict": dict} 98 "Boolean": bool, "List": list, "Tuple": tuple, "Dict": dict, 99 "Datetime": datetime.datetime, "Date": datetime.date} 99 100 self.pref.addKey(newkey, typDict[typ], typDict[typ]()) 100 101 ]]> … … 118 119 </updatePref> 119 120 <importStatements><![CDATA[ 121 import datetime 120 122 from dabo.dLocalize import _ 121 123 ]]> … … 151 153 ctls = ((_("Preference Name?"), unicode, "prefname"), 152 154 (_("Type:"), ["String", "Unicode", "Integer", 153 "Float", "Boolean", "List", "Tuple", "Dict" ], "typ") )155 "Float", "Boolean", "List", "Tuple", "Dict", "Datetime", "Date"], "typ") ) 154 156 dlg = dabo.ui.dOkCancelDialog(self, Caption=_("Add Child Key")) 155 157 dlg.addControlSequence(ctls) … … 214 216 </dTextBox> 215 217 <dTextBox sizerInfo="{'Proportion': 0, 'ColExpand': True, 'Expand': True, 'RowExpand': False}" Name="dTextBox11" rowColPos="(0, 1)" ReadOnly="True" designerClass="controlMix" RegID="txtPrefName"></dTextBox> 216 <dDropdownList sizerInfo="{'Proportion': 0, 'ColExpand': True, 'Expand': True, 'RowExpand': False}" Name="dDropdownList1" rowColPos="(2, 1)" Choices="[u'-None-', u'String', u'Unicode', u'Integer', u'Float', u'Boolean', u'List', u'Tuple', u'Dict' ]" designerClass="controlMix" RegID="ddType">218 <dDropdownList sizerInfo="{'Proportion': 0, 'ColExpand': True, 'Expand': True, 'RowExpand': False}" Name="dDropdownList1" rowColPos="(2, 1)" Choices="[u'-None-', u'String', u'Unicode', u'Integer', u'Float', u'Boolean', u'List', u'Tuple', u'Dict', u'Datetime', u'Date']" designerClass="controlMix" RegID="ddType"> 217 219 <code> 218 220 <afterInit><![CDATA[ 219 221 def afterInit(self): 220 self.Keys = [type(None), str, unicode, int, float, bool, list, tuple, dict ]222 self.Keys = [type(None), str, unicode, int, float, bool, list, tuple, dict, datetime.datetime, datetime.date] 221 223 self.ValueMode = "Key" 222 224 ]]> trunk/ide/PrefEditor.py
r3515 r3808 1 #!/usr/bin/env python 1 2 # -*- coding: utf-8 -*- 2 3 import os 3 4 import inspect 4 5 import dabo 6 dabo.ui.loadUI("wx") 7 from dabo.dLocalize import _ 8 from dabo.ui.dialogs.PreferenceDialog import PreferenceDialog 9 10 11 class PrefEditorPrefDialog(PreferenceDialog): 12 def addPages(self): 13 dayMins = 24*60 14 pm = self.PreferenceManager 15 updKey = pm.web_update 16 self.preferenceKeys.append(updKey) 17 upPage = self.addCategory(_("Web Updates")) 18 19 sz = upPage.Sizer = dabo.ui.dSizer("v") 20 hsz = dabo.ui.dSizer("h") 21 chkUpdateCheck = dabo.ui.dCheckBox(upPage, OnHit=self.onChkUpdate, 22 Caption=_("Check for Preference Editor updates"), RegID="chkForPrefManUpdates", 23 DataSource=updKey, DataField="web_update", 24 ToolTipText="Should we check for updates to the Preference Editor?") 25 btnCheckNow = dabo.ui.dButton(upPage, Caption=_("Check now..."), 26 OnHit=self.onCheckNow, ToolTipText="Check the Dabo server for updates") 27 hsz.append(chkUpdateCheck, valign="middle") 28 hsz.appendSpacer(8) 29 hsz.append(btnCheckNow, valign="middle") 30 sz.append(hsz, halign="center", border=20) 31 32 radFrequency = dabo.ui.dRadioList(upPage, Orientation="Vertical", 33 Caption=_("Check every..."), RegID="radWebUpdateFrequency", 34 Choices=[_("Every time an app is run"), _("Once a day"), _("Once a week"), _("Once a month")], 35 Keys = [0, dayMins, dayMins*7,dayMins*30], 36 ValueMode="Keys", DataSource=updKey, DataField="update_interval", 37 ToolTipText=_("How often should we check for updates?"), 38 DynamicEnabled = lambda: self.chkForPrefManUpdates.Value) 39 sz.append(radFrequency, halign="center") 40 41 42 def onChkUpdate(self, evt): 43 self.update() 44 45 46 def onCheckNow(self, evt): 47 ret = self.Application.checkForUpdates(project="prf") 48 49 50 5 51 6 52 def main(): 7 app = dabo.dApp() 53 app = dabo.dApp(BasePrefKey="PrefEditor", MainFormClass="PrefEditor.cdxml", 54 PreferenceDialogClass=PrefEditorPrefDialog) 8 55 curdir = os.getcwd() 9 56 # Get the current location's path 10 fname = inspect.getfile(main) 11 pth = os.path.split(fname)[0] 12 if pth: 13 # Switch to that path 14 os.chdir(pth) 15 app.MainFormClass = "PrefEditor.cdxml" 57 fname = os.path.abspath(inspect.getfile(main)) 58 pth = os.path.dirname(fname) 59 # Switch to that path 60 os.chdir(pth) 16 61 app.start() 17 62 18 63 # Return to the original location 19 64 os.chdir(curdir) 20 21 65 22 if __name__ == '__main__': 66 67 68 if __name__ == "__main__": 23 69 main()
