dabo Commit
Revision 5483
Date: 2009-10-23 05:29:23 -0700 (Fri, 23 Oct 2009)
Author: Ed
Trac: http://trac.dabodev.com/changeset/5483
Changed:
U trunk/dabo/ui/uiwx/dLed.py
Log:
Fixed this class so that you could actually save color settings. Previously,
any saved settings were overwritten by the afterInit() of the class. Also
changed the afterInit() to use _afterInit(), which is where framework code
belongs.
Diff:
Modified: trunk/dabo/ui/uiwx/dLed.py
===================================================================
--- trunk/dabo/ui/uiwx/dLed.py 2009-10-23 11:20:33 UTC (rev 5482)
+++ trunk/dabo/ui/uiwx/dLed.py 2009-10-23 12:29:23 UTC (rev 5483)
@@ -8,17 +8,21 @@
class dLed(dabo.ui.dPanel):
- def afterInit(self):
- self._baseClass = dLed
+ def __init__(self, *args, **kwargs):
self._offColor = "darkred"
self._onColor = "green"
self._on = False
- self.Buffered = False
+ super(dLed, self).__init__(*args, **kwargs)
+
+
+ def _afterInit(self):
+ self._baseClass = dLed
self.led = self.drawCircle(1,1,1)
self.led.DynamicXpos = lambda: self.Width/2
self.led.DynamicYpos = lambda: self.Height/2
self.led.DynamicRadius = lambda: min(self.Width, self.Height)/2
self.led.DynamicFillColor = lambda: self.Color
+ super(dLed, self)._afterInit()
self.update()
@@ -39,24 +43,32 @@
return self._offColor
def _setOffColor(self, val):
- self._offColor = val
- self.update()
+ if self._constructed():
+ self._offColor = val
+ self.update()
+ else:
+ self._properties["OffColor"] = val
def _getOn(self):
return self._on
def _setOn(self, val):
- self._on = val
- self.update()
+ if self._constructed():
+ self._on = val
+ self.update()
+ else:
+ self._properties["On"] = val
-
def _getOnColor(self):
return self._onColor
def _setOnColor(self, val):
- self._onColor = val
- self.update()
+ if self._constructed():
+ self._onColor = val
+ self.update()
+ else:
+ self._properties["OnColor"] = val
# Property Definitions
@@ -90,18 +102,18 @@
vs.appendSpacer(12)
vs.append(dabo.ui.dLabel(mp, Caption="On Color:"))
dd = dabo.ui.dDropdownList(mp,
Choices=dabo.dColors.colors,
- DataSource=self.LED,
DataField="OnColor", Value="green")
+ DataSource=self.LED,
DataField="OnColor", Value="mediumseagreen")
vs.append(dd)
vs.appendSpacer(12)
vs.append(dabo.ui.dLabel(mp, Caption="Off Color:"))
dd = dabo.ui.dDropdownList(mp,
Choices=dabo.dColors.colors,
- DataSource=self.LED,
DataField="OffColor", Value="darkred")
+ DataSource=self.LED,
DataField="OffColor", Value="orangered")
vs.append(dd)
mp.Sizer.append(vs)
self.LED.On = True
-
- self.layout()
+ self.update()
+
app = dabo.dApp()
app.MainFormClass = TestForm
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]