dabo Commit Revision 600 Date: 2004-11-30 13:29:53 -0800 (Tue, 30 Nov 2004) Author: paul
Log: Implemented the ability to pass property settings to the constructor of the Dabo UI objects. You can pass as individual keyword arguments, as a dict named 'properties', or both.
For the case where you want to create a bunch of labels, you could for example use this pattern:
styleDict = {"FontBold": True, "ForeColor": "Blue"} for caption in ("First Name", "Last Name", "Address"): panel.addObject(dLabel, Caption=caption, properties=styleDict)
At this time, this won't work with the properties that must be set before the wx object is created ("wx window style properties" such as Alignment, BorderStyle, and others).
At the moment, this doesn't interfere with sending wx-style properties to the constructor (I put in code to sort out the arguments - wx will receive wx args and dabo will process property args).
I really need to take another look at putting some of this __init__ stuff into common functions: lots of it is boilerplate code. I'm getting tired of having to touch all the __init__'s <g>. Like I said before, I think eventually all the inits will have signatures like:
def __init__(self, *args, **kwargs):
and common functions will parse the args and kwargs. This will make the implementation cleaner and more maintainable, but we'll have to explicitly document the argument options, such as sending a parent (if indeed we need a parent - interesting thought not requiring it and probably even possible with some "cleverness" if we really want that), properties, etc.
Changed: U trunk/common/propertyHelperMixin.py U trunk/ui/uiwx/dBitmapButton.py U trunk/ui/uiwx/dBox.py U trunk/ui/uiwx/dCheckBox.py U trunk/ui/uiwx/dComboBox.py U trunk/ui/uiwx/dCommandButton.py U trunk/ui/uiwx/dDateTextBox.py U trunk/ui/uiwx/dDialog.py U trunk/ui/uiwx/dDropdownList.py U trunk/ui/uiwx/dEditBox.py U trunk/ui/uiwx/dForm.py U trunk/ui/uiwx/dFormMain.py U trunk/ui/uiwx/dGauge.py U trunk/ui/uiwx/dGrid.py U trunk/ui/uiwx/dLabel.py U trunk/ui/uiwx/dLine.py U trunk/ui/uiwx/dListBox.py U trunk/ui/uiwx/dListbook.py U trunk/ui/uiwx/dPageFrame.py U trunk/ui/uiwx/dPanel.py U trunk/ui/uiwx/dRadioGroup.py U trunk/ui/uiwx/dSlider.py U trunk/ui/uiwx/dSpinner.py U trunk/ui/uiwx/dTextBox.py U trunk/ui/uiwx/dTimer.py U trunk/ui/uiwx/dToggleButton.py
Diff: Modified: trunk/common/propertyHelperMixin.py =================================================================== --- trunk/common/propertyHelperMixin.py 2004-11-30 18:43:27 UTC (rev 599) +++ trunk/common/propertyHelperMixin.py 2004-11-30 21:29:53 UTC (rev 600) @@ -2,6 +2,21 @@ """ Helper functions for getting information on class properties. """ + def extractKeywordProperties(self, kwdict, propdict): + """ Called from __init__: puts any property keyword arguments into + the property dictionary, so that __init__ can pass that dict to + setProperties() when appropriate (and so the property keywords are + removed before sending **kwargs to the wx constructor). + """ + if propdict is None: + propdict = {} + props = self.getPropertyList() + for arg in kwdict.keys(): + if arg in props: + propdict[arg] = kwdict[arg] + del kwdict[arg] + return propdict + def getProperties(self, propertySequence=(), *propertyArguments): """ Returns a dictionary of property name/value pairs.
Modified: trunk/ui/uiwx/dBitmapButton.py =================================================================== --- trunk/ui/uiwx/dBitmapButton.py 2004-11-30 18:43:27 UTC (rev 599) +++ trunk/ui/uiwx/dBitmapButton.py 2004-11-30 21:29:53 UTC (rev 600) @@ -11,11 +11,11 @@ class dBitmapButton(wx.BitmapButton, cm.dControlMixin): """ Allows the user to cause an action to occur by pushing a button. """ - def __init__(self, parent, id=-1, bitmap=None, style=0, *args, **kwargs): - + def __init__(self, parent, id=-1, bitmap=None, style=0, properties=None, *args, **kwargs): + self._baseClass = dBitmapButton - - name, _explicitName = self._processName(kwargs, "dBitmapButton") + properties = self.extractKeywordProperties(kwargs, properties) + name, _explicitName = self._processName(kwargs, self.__class__.__name__) pre = wx.PreBitmapButton() self._beforeInit(pre) @@ -30,6 +30,7 @@ cm.dControlMixin.__init__(self, name, _explicitName=_explicitName) + self.setProperties(properties) self._afterInit()
Modified: trunk/ui/uiwx/dBox.py =================================================================== --- trunk/ui/uiwx/dBox.py 2004-11-30 18:43:27 UTC (rev 599) +++ trunk/ui/uiwx/dBox.py 2004-11-30 21:29:53 UTC (rev 600) @@ -8,12 +8,13 @@ class dBox(wx.StaticBox, cm.dControlMixin): """ Create a static (not data-aware) box. """ - def __init__(self, parent, id=-1, label="", pos=(-1, -1), size=(-1, -1), style=0, *args, **kwargs): - + def __init__(self, parent, id=-1, label="", pos=(-1,-1), size=(-1,-1), + style=0, properties=None, *args, **kwargs): + self._baseClass = dBox + properties = self.extractKeywordProperties(kwargs, properties) + name, _explicitName = self._processName(kwargs, self.__class__.__name__) - name, _explicitName = self._processName(kwargs, "dBox") - pre = wx.PreStaticBox() self._beforeInit(pre) @@ -22,6 +23,7 @@ cm.dControlMixin.__init__(self, name, _explicitName=_explicitName) + self.setProperties(properties) self._afterInit()
Modified: trunk/ui/uiwx/dCheckBox.py =================================================================== --- trunk/ui/uiwx/dCheckBox.py 2004-11-30 18:43:27 UTC (rev 599) +++ trunk/ui/uiwx/dCheckBox.py 2004-11-30 21:29:53 UTC (rev 600) @@ -11,11 +11,11 @@ class dCheckBox(wx.CheckBox, dcm.dDataControlMixin): """ Allows visual editing of boolean values. """ - def __init__(self, parent, id=-1, style=0, *args, **kwargs): + def __init__(self, parent, id=-1, style=0, properties=None, *args, **kwargs): self._baseClass = dCheckBox - - name, _explicitName = self._processName(kwargs, "dCheckBox") + properties = self.extractKeywordProperties(kwargs, properties) + name, _explicitName = self._processName(kwargs, self.__class__.__name__) pre = wx.PreCheckBox() self._beforeInit(pre) @@ -23,6 +23,8 @@ self.PostCreate(pre) dcm.dDataControlMixin.__init__(self, name, _explicitName=_explicitName) + + self.setProperties(properties) self._afterInit()
Modified: trunk/ui/uiwx/dComboBox.py =================================================================== --- trunk/ui/uiwx/dComboBox.py 2004-11-30 18:43:27 UTC (rev 599) +++ trunk/ui/uiwx/dComboBox.py 2004-11-30 21:29:53 UTC (rev 600) @@ -10,11 +10,11 @@ well as a textbox where they can enter their own value. """ def __init__(self, parent, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, - choices=["Dabo", "Default"], style=0, *args, **kwargs): - + choices=["Dabo", "Default"], style=0, properties=None, *args, **kwargs): + self._baseClass = dComboBox - - name, _explicitName = self._processName(kwargs, "dComboBox") + properties = self.extractKeywordProperties(kwargs, properties) + name, _explicitName = self._processName(kwargs, self.__class__.__name__) pre = wx.PreComboBox() self._beforeInit(pre) @@ -24,6 +24,8 @@ self.PostCreate(pre) dcm.dDataControlMixin.__init__(self, name, _explicitName=_explicitName) + + self.setProperties(properties) self._afterInit()
Modified: trunk/ui/uiwx/dCommandButton.py =================================================================== --- trunk/ui/uiwx/dCommandButton.py 2004-11-30 18:43:27 UTC (rev 599) +++ trunk/ui/uiwx/dCommandButton.py 2004-11-30 21:29:53 UTC (rev 600) @@ -11,11 +11,11 @@ """ Allows the user to cause an action to occur by pushing a button. """ - def __init__(self, parent, id=-1, style=0, *args, **kwargs): + def __init__(self, parent, id=-1, style=0, properties=None, *args, **kwargs): self._baseClass = dCommandButton - - name, _explicitName = self._processName(kwargs, "dCommandButton") + properties = self.extractKeywordProperties(kwargs, properties) + name, _explicitName = self._processName(kwargs, self.__class__.__name__) pre = wx.PreButton() self._beforeInit(pre) @@ -24,6 +24,8 @@ self.PostCreate(pre) cm.dControlMixin.__init__(self, name, _explicitName=_explicitName) + + self.setProperties(properties) self._afterInit()
Modified: trunk/ui/uiwx/dDateTextBox.py =================================================================== --- trunk/ui/uiwx/dDateTextBox.py 2004-11-30 18:43:27 UTC (rev 599) +++ trunk/ui/uiwx/dDateTextBox.py 2004-11-30 21:29:53 UTC (rev 600) @@ -47,8 +47,7 @@ by Quicken, the popular personal finance program. """ def __init__(self, parent, id=-1, style=0, *args, **kwargs): - #dDateTextBox.doDefault(parent, id, name, style, *args, **kwargs) - name, _explicitName = self._processName(kwargs, "dDateTextBox") + name, _explicitName = self._processName(kwargs, self.__class__.__name__) kwargs["name"] = name kwargs["_explicitName"] = _explicitName super(dDateTextBox, self).__init__(parent, id, style, *args, **kwargs)
Modified: trunk/ui/uiwx/dDialog.py =================================================================== --- trunk/ui/uiwx/dDialog.py 2004-11-30 18:43:27 UTC (rev 599) +++ trunk/ui/uiwx/dDialog.py 2004-11-30 21:29:53 UTC (rev 600) @@ -3,10 +3,11 @@ class dDialog(wx.Dialog, dFormMixin.dFormMixin): def __init__(self, parent=None, id=-1, title='', - style=wx.DEFAULT_DIALOG_STYLE, *args, **kwargs): + style=wx.DEFAULT_DIALOG_STYLE, properties=None, *args, **kwargs): + self._baseClass = dDialog - - name, _explicitName = self._processName(kwargs, "dDialog") + properties = self.extractKeywordProperties(kwargs, properties) + name, _explicitName = self._processName(kwargs, self.__class__.__name__) pre = wx.PreDialog() self._beforeInit(pre) @@ -17,4 +18,5 @@ dFormMixin.dFormMixin.__init__(self, name=name, _explicitName=_explicitName) + self.setProperties(properties) self._afterInit()
Modified: trunk/ui/uiwx/dDropdownList.py =================================================================== --- trunk/ui/uiwx/dDropdownList.py 2004-11-30 18:43:27 UTC (rev 599) +++ trunk/ui/uiwx/dDropdownList.py 2004-11-30 21:29:53 UTC (rev 600) @@ -11,11 +11,11 @@ """ Allows presenting a choice of items for the user to choose from. """ def __init__(self, parent, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, - choices=["Dabo", "Default"], style=0, *args, **kwargs): + choices=["Dabo", "Default"], style=0, properties=None, *args, **kwargs): self._baseClass = dDropdownList - - name, _explicitName = self._processName(kwargs, "dDropdownList") + properties = self.extractKeywordProperties(kwargs, properties) + name, _explicitName = self._processName(kwargs, self.__class__.__name__) self._choices = list(choices) @@ -27,6 +27,8 @@ self.PostCreate(pre) dcm.dDataControlMixin.__init__(self, name, _explicitName=_explicitName) + + self.setProperties(properties) self._afterInit()
Modified: trunk/ui/uiwx/dEditBox.py =================================================================== --- trunk/ui/uiwx/dEditBox.py 2004-11-30 18:43:27 UTC (rev 599) +++ trunk/ui/uiwx/dEditBox.py 2004-11-30 21:29:53 UTC (rev 600) @@ -12,10 +12,11 @@ class dEditBox(wx.TextCtrl, dcm.dDataControlMixin): """ Allows editing of string or unicode data of unlimited length. """ - def __init__(self, parent, id=-1, style=0, *args, **kwargs): + def __init__(self, parent, id=-1, style=0, properties=None, *args, **kwargs): self._baseClass = dEditBox - name, _explicitName = self._processName(kwargs, "dEditBox") + properties = self.extractKeywordProperties(kwargs, properties) + name, _explicitName = self._processName(kwargs, self.__class__.__name__) style = style | wx.TE_MULTILINE | wx.TE_WORDWRAP | wx.TE_LINEWRAP @@ -26,6 +27,8 @@ self.PostCreate(pre) dcm.dDataControlMixin.__init__(self, name, _explicitName=_explicitName) + + self.setProperties(properties) self._afterInit()
Modified: trunk/ui/uiwx/dForm.py =================================================================== --- trunk/ui/uiwx/dForm.py 2004-11-30 18:43:27 UTC (rev 599) +++ trunk/ui/uiwx/dForm.py 2004-11-30 21:29:53 UTC (rev 600) @@ -32,9 +32,11 @@ dForm knows how to handle one or more dBizobjs, providing proxy methods like next(), last(), save(), and requery(). """ - def __init__(self, parent=None, id=-1, title='', *args, **kwargs): + def __init__(self, parent=None, id=-1, title='', properties=None, *args, **kwargs): + self._baseClass = dForm - name, _explicitName = self._processName(kwargs, "dForm") + properties = self.extractKeywordProperties(kwargs, properties) + name, _explicitName = self._processName(kwargs, self.__class__.__name__) if parent: style = wx.DEFAULT_FRAME_STYLE|wx.FRAME_FLOAT_ON_PARENT @@ -80,6 +82,7 @@ # trying to overwrite it self._holdStatusText = "" + self.setProperties(properties) self._afterInit() # defined in dPemMixin
Modified: trunk/ui/uiwx/dFormMain.py =================================================================== --- trunk/ui/uiwx/dFormMain.py 2004-11-30 18:43:27 UTC (rev 599) +++ trunk/ui/uiwx/dFormMain.py 2004-11-30 21:29:53 UTC (rev 600) @@ -26,8 +26,11 @@ class dFormMain(wxFrameClass, fm.dFormMixin): """ This is the main top-level form for the application. """ - def __init__(self): + def __init__(self, properties=None, *args, **kwargs): + self._baseClass = dFormMain + properties = self.extractKeywordProperties(kwargs, properties) + name, _explicitName = self._processName(kwargs, self.__class__.__name__) pre = wxPreFrameClass() self._beforeInit(pre) @@ -48,6 +51,7 @@ self.Sizer = dSizer.dSizer("vertical") self.Sizer.layout() + self.setProperties(properties) self._afterInit() def afterInit(self):
Modified: trunk/ui/uiwx/dGauge.py =================================================================== --- trunk/ui/uiwx/dGauge.py 2004-11-30 18:43:27 UTC (rev 599) +++ trunk/ui/uiwx/dGauge.py 2004-11-30 21:29:53 UTC (rev 600) @@ -8,10 +8,11 @@ class dGauge(wx.Gauge, cm.dControlMixin): """ Allows the creation of progress bars. """ - def __init__(self, parent, id=-1, style=0, *args, **kwargs): + def __init__(self, parent, id=-1, style=0, properties=None, *args, **kwargs): self._baseClass = dGauge - name, _explicitName = self._processName(kwargs, "dGauge") + properties = self.extractKeywordProperties(kwargs, properties) + name, _explicitName = self._processName(kwargs, self.__class__.__name__) pre = wx.PreGauge() self._beforeInit(pre) @@ -21,6 +22,8 @@ self.PostCreate(pre) cm.dControlMixin.__init__(self, name, _explicitName=_explicitName) + + self.setProperties(properties) self._afterInit()
Modified: trunk/ui/uiwx/dGrid.py =================================================================== --- trunk/ui/uiwx/dGrid.py 2004-11-30 18:43:27 UTC (rev 599) +++ trunk/ui/uiwx/dGrid.py 2004-11-30 21:29:53 UTC (rev 600) @@ -6,10 +6,11 @@ import dControlMixin as cm class dGrid(wx.grid.Grid, cm.dControlMixin): - def __init__(self, parent, id=-1, style=0, *args, **kwargs): + def __init__(self, parent, id=-1, style=0, properties=None, *args, **kwargs): self._baseClass = dGrid - name, _explicitName = self._processName(kwargs, "dGrid") + properties = self.extractKeywordProperties(kwargs, properties) + name, _explicitName = self._processName(kwargs, self.__class__.__name__) # no 3-stage create for grids #pre = wx.PreGrid() @@ -26,6 +27,7 @@ # problem (because there is code in the Size property to also set MinSize). self.Size = ((0,0)) + self.setProperties(properties) self._afterInit()
Modified: trunk/ui/uiwx/dLabel.py =================================================================== --- trunk/ui/uiwx/dLabel.py 2004-11-30 18:43:27 UTC (rev 599) +++ trunk/ui/uiwx/dLabel.py 2004-11-30 21:29:53 UTC (rev 600) @@ -8,10 +8,12 @@ class dLabel(wx.StaticText, cm.dControlMixin): """ Create a static (not data-aware) label. """ - def __init__(self, parent, id=-1, label="", caption="", style=0, *args, **kwargs): + def __init__(self, parent, id=-1, label="", caption="", style=0, + properties=None, *args, **kwargs): self._baseClass = dLabel - name, _explicitName = self._processName(kwargs, "dLabel") + properties = self.extractKeywordProperties(kwargs, properties) + name, _explicitName = self._processName(kwargs, self.__class__.__name__) pre = wx.PreStaticText() self._beforeInit(pre) @@ -24,6 +26,8 @@ self.PostCreate(pre) cm.dControlMixin.__init__(self, name, _explicitName=_explicitName) + + self.setProperties(properties) self._afterInit()
Modified: trunk/ui/uiwx/dLine.py =================================================================== --- trunk/ui/uiwx/dLine.py 2004-11-30 18:43:27 UTC (rev 599) +++ trunk/ui/uiwx/dLine.py 2004-11-30 21:29:53 UTC (rev 600) @@ -8,10 +8,11 @@ class dLine(wx.StaticLine, cm.dControlMixin): """ Create a static (not data-aware) line. """ - def __init__(self, parent, id=-1, style=0, *args, **kwargs): + def __init__(self, parent, id=-1, style=0, properties=None, *args, **kwargs): self._baseClass = dLine - name, _explicitName = self._processName(kwargs, "dLine") + properties = self.extractKeywordProperties(kwargs, properties) + name, _explicitName = self._processName(kwargs, self.__class__.__name__) pre = wx.PreStaticLine() self._beforeInit(pre) @@ -20,6 +21,8 @@ self.PostCreate(pre) cm.dControlMixin.__init__(self, name, _explicitName=_explicitName) + + self.setProperties(properties) self._afterInit()
Modified: trunk/ui/uiwx/dListBox.py =================================================================== --- trunk/ui/uiwx/dListBox.py 2004-11-30 18:43:27 UTC (rev 599) +++ trunk/ui/uiwx/dListBox.py 2004-11-30 21:29:53 UTC (rev 600) @@ -11,10 +11,11 @@ """ Allows presenting a choice of items for the user to choose from. """ def __init__(self, parent, id=-1, choices=["Dabo", "Default"], - style=0, selectionType="single", *args, **kwargs): + style=0, selectionType="single", properties=None, *args, **kwargs): self._baseClass = dListBox - name, _explicitName = self._processName(kwargs, "dListBox") + properties = self.extractKeywordProperties(kwargs, properties) + name, _explicitName = self._processName(kwargs, self.__class__.__name__) pre = wx.PreListBox() self._beforeInit(pre) @@ -34,6 +35,8 @@ self.PostCreate(pre) dcm.dDataControlMixin.__init__(self, name, _explicitName=_explicitName) + + self.setProperties(properties) self._afterInit()
Modified: trunk/ui/uiwx/dListbook.py =================================================================== --- trunk/ui/uiwx/dListbook.py 2004-11-30 18:43:27 UTC (rev 599) +++ trunk/ui/uiwx/dListbook.py 2004-11-30 21:29:53 UTC (rev 600) @@ -12,15 +12,16 @@ """ Create a container for an unlimited number of pages. """ def __init__(self, parent, id=-1, pos=wx.DefaultPosition, - size=wx.DefaultSize, style=0): + size=wx.DefaultSize, style=0, properties=None, *args, **kwargs): - self._baseClass = dListbook - name, _explicitName = self._processName(kwargs, "dListbook") + self.baseClass = dListbook + properties = self.extractKeywordProperties(kwargs, properties) + name, _explicitName = self._processName(kwargs, self.__class__.__name__) pre = wx.PreListbook() self._beforeInit(pre) style = style | pre.GetWindowStyle() - pre.Create(parent, id, pos, size, style) + pre.Create(parent, id, pos, size, style, *args, **kwargs) self.PostCreate(pre) @@ -29,6 +30,7 @@ self.lastSelection = 0 self.PageCount = 3 + self.setProperties(properties) self._afterInit()
Modified: trunk/ui/uiwx/dPageFrame.py =================================================================== --- trunk/ui/uiwx/dPageFrame.py 2004-11-30 18:43:27 UTC (rev 599) +++ trunk/ui/uiwx/dPageFrame.py 2004-11-30 21:29:53 UTC (rev 600) @@ -12,14 +12,15 @@ """ Create a container for an unlimited number of pages. """ def __init__(self, parent, id=-1, pos=wx.DefaultPosition, - size=wx.DefaultSize, style=0, name='dPageFrame'): + size=wx.DefaultSize, style=0, properties=None, *args, **kwargs): - self._baseClass = dPageFrame + properties = self.extractKeywordProperties(kwargs, properties) + name, _explicitName = self._processName(kwargs, self.__class__.__name__) pre = wx.PreNotebook() self._beforeInit(pre) style = style | pre.GetWindowStyle() - pre.Create(parent, id, pos, size, style, name) + pre.Create(parent, id, pos, size, style, *args, **kwargs) self.PostCreate(pre)
Modified: trunk/ui/uiwx/dPanel.py =================================================================== --- trunk/ui/uiwx/dPanel.py 2004-11-30 18:43:27 UTC (rev 599) +++ trunk/ui/uiwx/dPanel.py 2004-11-30 21:29:53 UTC (rev 600) @@ -13,11 +13,12 @@ instead, and then adding the panel to the form. """ - def __init__(self, parent, id=-1, style=wx.TAB_TRAVERSAL, *args, **kwargs): + def __init__(self, parent, id=-1, style=wx.TAB_TRAVERSAL, + properties=None, *args, **kwargs): self._baseClass = dPanel - - name, _explicitName = self._processName(kwargs, "dPanel") + properties = self.extractKeywordProperties(kwargs, properties) + name, _explicitName = self._processName(kwargs, self.__class__.__name__) pre = wx.PrePanel() self._beforeInit(pre) @@ -27,6 +28,7 @@ dControlMixin.dControlMixin.__init__(self, name, _explicitName=_explicitName) + self.setProperties(properties) self._afterInit()
Modified: trunk/ui/uiwx/dRadioGroup.py =================================================================== --- trunk/ui/uiwx/dRadioGroup.py 2004-11-30 18:43:27 UTC (rev 599) +++ trunk/ui/uiwx/dRadioGroup.py 2004-11-30 21:29:53 UTC (rev 600) @@ -11,10 +11,11 @@ """ Allows choosing one option from a list of options. """ def __init__(self, parent, id=-1, label='', - choices=['Option A', 'Option B'], style=0, *args, **kwargs): + choices=['Option A', 'Option B'], style=0, properties=None, *args, **kwargs): self._baseClass = dRadioGroup - name, _explicitName = self._processName(kwargs, "dRadioGroup") + properties = self.extractKeywordProperties(kwargs, properties) + name, _explicitName = self._processName(kwargs, self.__class__.__name__) pre = wx.PreRadioBox() self._beforeInit(pre) # defined in dPemMixin @@ -30,6 +31,8 @@ self.PostCreate(pre) dcm.dDataControlMixin.__init__(self, name, _explicitName=_explicitName) + + self.setProperties(properties) self._afterInit() # defined in dPemMixin
Modified: trunk/ui/uiwx/dSlider.py =================================================================== --- trunk/ui/uiwx/dSlider.py 2004-11-30 18:43:27 UTC (rev 599) +++ trunk/ui/uiwx/dSlider.py 2004-11-30 21:29:53 UTC (rev 600) @@ -12,10 +12,11 @@ Slider does not allow entering a value with the keyboard. """ - def __init__(self, parent, id=-1, style=0, *args, **kwargs): + def __init__(self, parent, id=-1, style=0, properties=None, *args, **kwargs): self._baseClass = dSlider - name, _explicitName = self._processName(kwargs, "dSlider") + properties = self.extractKeywordProperties(kwargs, properties) + name, _explicitName = self._processName(kwargs, self.__class__.__name__) pre = wx.PreSlider() self._beforeInit(pre) @@ -25,6 +26,8 @@ self.PostCreate(pre) dcm.dDataControlMixin.__init__(self, name, _explicitName=_explicitName) + + self.setProperties(properties) self._afterInit()
Modified: trunk/ui/uiwx/dSpinner.py =================================================================== --- trunk/ui/uiwx/dSpinner.py 2004-11-30 18:43:27 UTC (rev 599) +++ trunk/ui/uiwx/dSpinner.py 2004-11-30 21:29:53 UTC (rev 600) @@ -10,10 +10,11 @@ class dSpinner(wx.SpinCtrl, dcm.dDataControlMixin): """ Allows editing integer values. """ - def __init__(self, parent, id=-1, style=0, *args, **kwargs): + def __init__(self, parent, id=-1, style=0, properties=None, *args, **kwargs): self._baseClass = dSpinner - name, _explicitName = self._processName(kwargs, "dSpinner") + properties = self.extractKeywordProperties(kwargs, properties) + name, _explicitName = self._processName(kwargs, self.__class__.__name__) pre = wx.PreSpinCtrl() self._beforeInit(pre) @@ -22,6 +23,8 @@ self.PostCreate(pre) dcm.dDataControlMixin.__init__(self, name, _explicitName=_explicitName) + + self.setProperties(properties) self._afterInit()
Modified: trunk/ui/uiwx/dTextBox.py =================================================================== --- trunk/ui/uiwx/dTextBox.py 2004-11-30 18:43:27 UTC (rev 599) +++ trunk/ui/uiwx/dTextBox.py 2004-11-30 21:29:53 UTC (rev 600) @@ -9,10 +9,12 @@ class dTextBox(wx.TextCtrl, dcm.dDataControlMixin): """ Allows editing one line of string or unicode data. """ - def __init__(self, parent, id=-1, password=False, style=0, *args, **kwargs): + def __init__(self, parent, id=-1, password=False, style=0, + properties=None, *args, **kwargs): self._baseClass = dTextBox - name, _explicitName = self._processName(kwargs, "dTextBox") + properties = self.extractKeywordProperties(kwargs, properties) + name, _explicitName = self._processName(kwargs, self.__class__.__name__) # Handles different value types self.valueType = types.StringType @@ -28,6 +30,7 @@ dcm.dDataControlMixin.__init__(self, name, _explicitName=_explicitName) + self.setProperties(properties) self._afterInit()
Modified: trunk/ui/uiwx/dTimer.py =================================================================== --- trunk/ui/uiwx/dTimer.py 2004-11-30 18:43:27 UTC (rev 599) +++ trunk/ui/uiwx/dTimer.py 2004-11-30 21:29:53 UTC (rev 600) @@ -18,9 +18,11 @@ # also allow the timer to have visual representation in the designer # (but we need to design a bitmap) while being invisible at runtime. - def __init__(self, parent, *args, **kwargs): + def __init__(self, parent, properties=None, *args, **kwargs): + self._baseClass = dTimer - name, _explicitName = self._processName(kwargs, "dTimer") + properties = self.extractKeywordProperties(kwargs, properties) + name, _explicitName = self._processName(kwargs, self.__class__.__name__) self._beforeInit(None) # no 2-stage creation for Timers @@ -35,6 +37,7 @@ dControlMixin.dControlMixin.__init__(self, name, _explicitName=_explicitName) + self.setProperties(properties) self._afterInit()
Modified: trunk/ui/uiwx/dToggleButton.py =================================================================== --- trunk/ui/uiwx/dToggleButton.py 2004-11-30 18:43:27 UTC (rev 599) +++ trunk/ui/uiwx/dToggleButton.py 2004-11-30 21:29:53 UTC (rev 600) @@ -10,10 +10,11 @@ class dToggleButton(wx.ToggleButton, dcm.dDataControlMixin): """ Allows the user to set an on/off condition by pressing a button. """ - def __init__(self, parent, id=-1, style=0, *args, **kwargs): + def __init__(self, parent, id=-1, style=0, properties=None, *args, **kwargs): self._baseClass = dToggleButton - name, _explicitName = self._processName(kwargs, "dToggleButton") + properties = self.extractKeywordProperties(kwargs, properties) + name, _explicitName = self._processName(kwargs, self.__class__.__name__) pre = wx.PreToggleButton() self._beforeInit(pre) @@ -22,6 +23,8 @@ self.PostCreate(pre) dcm.dDataControlMixin.__init__(self, name, _explicitName=_explicitName) + + self.setProperties(properties) self._afterInit()
©2004 noreply /AT/ paulmcnett .D.O.T com |
|