I can see his commits just fine.
The one in question:

Changed:
U   trunk/dabo/ui/
dDataControlMixinBase.py
U   trunk/dabo/ui/uiwx/dPemMixin.py

Log:
Added data controls on empty data source automatic enable/disable status
handling.

Diff:
Modified: trunk/dabo/ui/dDataControlMixinBase.py
===================================================================
--- trunk/dabo/ui/dDataControlMixinBase.py      2011-08-06 11:38:01 UTC (rev
6746)
+++ trunk/dabo/ui/dDataControlMixinBase.py      2011-08-06 11:48:48 UTC (rev
6747)
@@ -14,6 +14,8 @@
       """Provide common functionality for the data-aware controls."""
       def __init__(self, *args, **kwargs):
               self._fldValidFailed = False
+               # Control enabling/disabling on empty data source helper
attribute.
+               self._dsDisabled = False
               self.__src = self._srcIsBizobj = self._srcIsInstanceMethod =
None
               self._designerMode = None
               self._oldVal = None
@@ -95,6 +97,17 @@
               return None


+       def _verifyEnabledStatus(self, enable):
+               if enable:
+                       if self._dsDisabled:
+                               self._dsDisabled = False
+                               self.Enabled = True
+               else:
+                       if not self._dsDisabled:
+                               self._dsDisabled = True
+                               self.Enabled = False
+
+
       def update(self):
               """Update control's value to match the current value from the
source."""
               # We need to do the data handling stuff before calling
super()
@@ -117,8 +130,13 @@
                       self._inDataUpdate = True
                       try:
                               self.Value = src.getFieldVal(self.DataField)
-                       except (TypeError, dException.NoRecordsException):
+                               self._verifyEnabledStatus(True)
+                       except dException.NoRecordsException:
                               self.Value = self.getBlankValue()
+                               self._verifyEnabledStatus(False)
+                       except (TypeError):
+                               self.Value = self.getBlankValue()
+                               self._verifyEnabledStatus(True)
                       except dException.FieldNotFoundException:
                               # See if DataField refers to an attribute of
the bizobj:
                               att = getattr(src, self.DataField, None)
@@ -126,6 +144,7 @@
                                       self.Value = method()
                               else:
                                       self.Value = att
+                               self._verifyEnabledStatus(True)
                       self._inDataUpdate = False
               else:
                       if self._srcIsInstanceMethod is None and src is not
None:

Modified: trunk/dabo/ui/uiwx/dPemMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dPemMixin.py     2011-08-06 11:38:01 UTC (rev 6746)
+++ trunk/dabo/ui/uiwx/dPemMixin.py     2011-08-06 11:48:48 UTC (rev 6747)
@@ -43,6 +43,8 @@
               self._transparency = 255
               # Time to change transparency
               self._transparencyDelay = 0.25
+               # DataControl enabling/disabling helper attribute.
+               self._uiDisabled = False

               # There are a few controls that don't yet support 3-way inits
(grid, for
               # one). These controls will send the wx classref as the
preClass argument,
@@ -2094,6 +2096,22 @@

       def _setEnabled(self, val):
               if self._constructed():
+                       # Handle DataControl disabling on empty data source.
+                       try:
+                               inDataUpdate = self._inDataUpdate
+                       except AttributeError:
+                               inDataUpdate = False
+                       if inDataUpdate:
+                               if self._uiDisabled:
+                                       val = False
+                       else:
+                               self._uiDisabled = not val
+                               try:
+                                       dsDisabled = self._dsDisabled
+                               except AttributeError:
+                                       dsDisabled = False
+                               if dsDisabled:
+                                       val = False
                       self.Enable(val)
               else:
                       self._properties["Enabled"] = False


2011/8/6 John Fabiani <[email protected]>

> On Saturday, August 06, 2011 12:39:42 pm John Fabiani wrote:
> > Hi,
> > I'm not sure what 6747 actually changes (since I can never see JaceKK
> > commits - I have no idea as to the cause) but it breaks every form I have
> > created - all 60 or so.  No errors just everything is gray-ed out or
> > Enabled = False.
> >
> > Johnf
>
> I think I see the problem -
>
> All my forms open with No Records in the primary bizObj - the user provides
> information to retrieve the data before I retrieve data.  I still associate
> the DataSource and DataField with a control but when it opens it's not on a
> record.  I don't retrieve the record until the user has selected something
> I
> can filter on - mostly a PK.
>
> Johnf
>
[excessive quoting removed by server]

_______________________________________________
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/cadssririw_shknfpcdx2een4srzfwsqvkunyi6mryveorgd...@mail.gmail.com

Reply via email to