dabo Commit
Revision 6491
Date: 2011-03-04 13:40:34 -0800 (Fri, 04 Mar 2011)
Author: Ed
Trac: http://trac.dabodev.com/changeset/6491

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

Log:
The DataSource property can now be set to a callable, which will be evaluated 
each time the property is accessed. This makes it possible to have a dynamic 
DataSource.


Diff:
Modified: trunk/dabo/ui/dDataControlMixinBase.py
===================================================================
--- trunk/dabo/ui/dDataControlMixinBase.py      2011-03-04 21:12:57 UTC (rev 
6490)
+++ trunk/dabo/ui/dDataControlMixinBase.py      2011-03-04 21:40:34 UTC (rev 
6491)
@@ -417,7 +417,7 @@
                self._SaveRestoreValue = bool(value)
 
 
-       def _getSrc(self):
+       def _getSource(self):
                if self.__src is None:
                        ds = self.DataSource
                        self._srcIsBizobj = False
@@ -463,6 +463,10 @@
                                                                        form = 
form.Form
                                                        if self.__src:
                                                                
self._srcIsBizobj = True
+                               elif callable(ds):
+                                       # Instead of a fixed source, call the 
function to determine the source.
+                                       # We *don't* want to store the result 
in self.__src!
+                                       return ds()
                                else:
                                        # It's an object reference
                                        self.__src = ds
@@ -496,7 +500,7 @@
                        bound to a dataSource and you want to persist the 
value, as in
                        an options dialog. Default=False.  (bool)""") )
 
-       Source = property(_getSrc, None, None,
+       Source = property(_getSource, None, None,
                        _("Reference to the object to which this control's 
Value is bound  (object)") )
 
        Value = property(None, None, None,



_______________________________________________
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]

Reply via email to