dabo Commit
Revision 4510
Date: 2008-09-08 12:32:27 -0700 (Mon, 08 Sep 2008)
Author: Paul
Trac: http://svn.dabodev.com/trac/dabo/changeset/4510
Changed:
U trunk/dabo/ui/dDataControlMixinBase.py
U trunk/dabo/ui/dPemMixinBase.py
U trunk/dabo/ui/uiwx/dPanel.py
U trunk/dabo/ui/uiwx/dPemMixin.py
U trunk/dabo/ui/uiwx/dSpinner.py
Log:
The callAfter() for restoreValue() that I put in place the other day caused
values to be restored too late for my other datanav-based apps. Because this
was meant to fix a problem with dSpinner, I elected to revert that change
and put in a dSpinner-only fix, which just re-calls restoreValue() after
the init is done (and after we have a valid name).
Fixed up a case in the name setting process that was neglecting to look
at the properties dict when determining the name.
Diff:
Modified: trunk/dabo/ui/dDataControlMixinBase.py
===================================================================
--- trunk/dabo/ui/dDataControlMixinBase.py 2008-09-08 17:55:54 UTC (rev
4509)
+++ trunk/dabo/ui/dDataControlMixinBase.py 2008-09-08 19:32:27 UTC (rev
4510)
@@ -37,7 +37,7 @@
def __onCreate(self, evt):
if self.SaveRestoreValue:
- dabo.ui.callAfter(self.restoreValue)
+ self.restoreValue()
def __onDestroy(self, evt):
Modified: trunk/dabo/ui/dPemMixinBase.py
===================================================================
--- trunk/dabo/ui/dPemMixinBase.py 2008-09-08 17:55:54 UTC (rev 4509)
+++ trunk/dabo/ui/dPemMixinBase.py 2008-09-08 19:32:27 UTC (rev 4510)
@@ -61,22 +61,28 @@
pass
- def _processName(self, kwargs, defaultName):
+ def _processName(self, properties, kwargs, defaultName):
# Called by the constructors of the dObjects, to properly set
the
# name of the object based on whether the user set it explicitly
# or Dabo is to provide it implicitly.
- _explicitName = kwargs.get("_explicitName", False)
+ propdict = {}
+ propdict.update(kwargs)
+ propdict.update(properties)
+
+ _explicitName = propdict.get("_explicitName", False)
- if "Name" in kwargs.keys():
- if "_explicitName" not in kwargs.keys():
+ if "Name" in propdict.keys():
+ if "_explicitName" not in propdict.keys():
# Name was sent; _explicitName wasn't.
_explicitName = True
- name = kwargs["Name"]
+ name = propdict["Name"]
else:
name = defaultName
if kwargs.has_key("_explicitName"):
del(kwargs["_explicitName"])
+ if properties.has_key("_explicitName"):
+ del(properties["_explicitName"])
return name, _explicitName
Modified: trunk/dabo/ui/uiwx/dPanel.py
===================================================================
--- trunk/dabo/ui/uiwx/dPanel.py 2008-09-08 17:55:54 UTC (rev 4509)
+++ trunk/dabo/ui/uiwx/dPanel.py 2008-09-08 19:32:27 UTC (rev 4510)
@@ -11,7 +11,7 @@
from dabo.ui import makeDynamicProperty
-class _BasePanelMixin:
+class _BasePanelMixin(object):
def __init__(self, superclass, preClass, parent, properties=None,
attProperties=None,
*args, **kwargs):
self._minSizerWidth = 10
Modified: trunk/dabo/ui/uiwx/dPemMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dPemMixin.py 2008-09-08 17:55:54 UTC (rev 4509)
+++ trunk/dabo/ui/uiwx/dPemMixin.py 2008-09-08 19:32:27 UTC (rev 4510)
@@ -177,10 +177,8 @@
self.PostCreate(pre)
self._pemObject = self
+ self._setNameAndProperties(properties, **kwargs)
- if self._constructed():
- self._setNameAndProperties(properties, **kwargs)
-
self._initEvents()
self._afterInit()
@@ -210,7 +208,7 @@
the given Name isn't unique among siblings.
"""
if not dabo.fastNameSet:
- name, _explicitName = self._processName(kwargs,
self.__class__.__name__)
+ name, _explicitName = self._processName(properties,
kwargs, self.__class__.__name__)
self._initName(name, _explicitName=_explicitName)
# Add any properties that were re-set
Modified: trunk/dabo/ui/uiwx/dSpinner.py
===================================================================
--- trunk/dabo/ui/uiwx/dSpinner.py 2008-09-08 17:55:54 UTC (rev 4509)
+++ trunk/dabo/ui/uiwx/dSpinner.py 2008-09-08 19:32:27 UTC (rev 4510)
@@ -48,9 +48,6 @@
self._increment = 1
val = self._extractKey((properties, attProperties, kwargs),
"Value", 0)
val = self._numericStringVal(val)
- nm = self._extractKey((properties, attProperties, kwargs),
"NameBase", "")
- if not nm:
- nm = self._extractKey((properties, attProperties,
kwargs), "Name", "dSpinner")
super(dSpinner, self).__init__(parent=parent,
properties=properties,
attProperties=attProperties, *args, **kwargs)
self._baseClass = dSpinner
@@ -66,7 +63,6 @@
self.fitToSizer()
# Because several properties could not be set until after the
child
# objects were created, we need to manually call
_setProperties() here.
- self._properties["NameBase"] = nm
self._setProperties(self._properties)
self.autoBindEvents()
ps = self._proxy_spinner
@@ -81,7 +77,13 @@
pt.Bind(wx.EVT_TEXT, self._onWxHit)
self.bindEvent(dEvents.KeyChar, self._onChar)
self.bindEvent(dEvents.LostFocus, self._onLostFocus)
+ self._rerestoreValue()
+ def _rerestoreValue(self):
+ # Hack because when restoreValue() was originally called in
onCreate,
+ # the name of the control hadn't been set yet.
+ if self.SaveRestoreValue:
+ self.restoreValue()
def _constructed(self):
"""Returns True if the ui object has been fully created yet,
False otherwise."""
_______________________________________________
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]