dabo Commit
Revision 1597
Date: 2005-11-29 11:46:35 -0800 (Tue, 29 Nov 2005)
Author: paul

Changed:
U   trunk/dabo/ui/dDataControlMixinBase.py
U   trunk/dabo/ui/uiwx/dCheckBox.py
U   trunk/dabo/ui/uiwx/dEditBox.py
U   trunk/dabo/ui/uiwx/dSpinner.py
U   trunk/dabo/ui/uiwx/dTextBox.py
U   trunk/dabo/ui/uiwx/dToggleButton.py
U   trunk/dabo/ui/uiwx/test.py

Log:
Suppressed the printing of a message when the data source can't be
evaluated, and instead set the control's value to the blank value,
just like it works when a bizobj datasource can't be evaluated.

Reworked getBlankValue() to be overridden in each data control
class.

Added a print statement to testAll to easily know which control
is causing trouble during init.


Diff:
Modified: trunk/dabo/ui/dDataControlMixinBase.py
===================================================================
--- trunk/dabo/ui/dDataControlMixinBase.py      2005-11-29 18:11:38 UTC (rev 
1596)
+++ trunk/dabo/ui/dDataControlMixinBase.py      2005-11-29 19:46:35 UTC (rev 
1597)
@@ -94,14 +94,7 @@
        def getBlankValue(self):
                """ Return the empty value of the control.
                """
-               if isinstance(self, (dabo.ui.dTextBox, dabo.ui.dEditBox) ):
-                       return ""
-               elif isinstance(self, dabo.ui.dCheckBox):
-                       return False
-               elif isinstance(self, dabo.ui.dSpinner):
-                       return 0
-               else:
-                       return None
+               return None
 
 
        def refresh(self):
@@ -127,7 +120,10 @@
                        try:
                                self.Value = eval(expr)
                        except:
-                               dabo.errorLog.write("Could not evaluate value 
for %s" % expr)
+                               ## Couldn't evaluate, for whatever reason. Do 
the same thing that we do
+                               ## for bizobj datasources: fill in the blank 
value.
+                               self.Value = self.getBlankValue()
+                               #dabo.errorLog.write("Could not evaluate value 
for %s" % expr)
                        
                        
        def select(self, position, length):

Modified: trunk/dabo/ui/uiwx/dCheckBox.py
===================================================================
--- trunk/dabo/ui/uiwx/dCheckBox.py     2005-11-29 18:11:38 UTC (rev 1596)
+++ trunk/dabo/ui/uiwx/dCheckBox.py     2005-11-29 19:46:35 UTC (rev 1597)
@@ -35,6 +35,10 @@
                dCheckBox.doDefault(evt)
 
        
+       def getBlankValue(self):
+               return False
+
+               
        # property get/set functions
        def _getValue(self):
                if not self._hasWindowStyleFlag(wx.CHK_3STATE):

Modified: trunk/dabo/ui/uiwx/dEditBox.py
===================================================================
--- trunk/dabo/ui/uiwx/dEditBox.py      2005-11-29 18:11:38 UTC (rev 1596)
+++ trunk/dabo/ui/uiwx/dEditBox.py      2005-11-29 19:46:35 UTC (rev 1597)
@@ -34,6 +34,10 @@
                self.SetSelection(-1, -1)
                
                
+       def getBlankValue(self):
+               return ""
+
+               
        # property get/set functions
        def _getAlignment(self):
                if self._hasWindowStyleFlag(wx.TE_RIGHT):

Modified: trunk/dabo/ui/uiwx/dSpinner.py
===================================================================
--- trunk/dabo/ui/uiwx/dSpinner.py      2005-11-29 18:11:38 UTC (rev 1596)
+++ trunk/dabo/ui/uiwx/dSpinner.py      2005-11-29 19:46:35 UTC (rev 1597)
@@ -42,6 +42,10 @@
                self.flushValue()
                super(dSpinner, self)._onWxHit(evt)
 
+
+       def getBlankValue(self):
+               return 0
+
                
        # Property get/set/del methods follow. Scroll to bottom to see the 
property
        # definitions themselves.

Modified: trunk/dabo/ui/uiwx/dTextBox.py
===================================================================
--- trunk/dabo/ui/uiwx/dTextBox.py      2005-11-29 18:11:38 UTC (rev 1596)
+++ trunk/dabo/ui/uiwx/dTextBox.py      2005-11-29 19:46:35 UTC (rev 1597)
@@ -57,6 +57,10 @@
                self.SetSelection(-1, -1)
                
                
+       def getBlankValue(self):
+               return ""
+
+               
        # property get/set functions
        def _getAlignment(self):
                if self._hasWindowStyleFlag(wx.TE_RIGHT):

Modified: trunk/dabo/ui/uiwx/dToggleButton.py
===================================================================
--- trunk/dabo/ui/uiwx/dToggleButton.py 2005-11-29 18:11:38 UTC (rev 1596)
+++ trunk/dabo/ui/uiwx/dToggleButton.py 2005-11-29 19:46:35 UTC (rev 1597)
@@ -25,6 +25,10 @@
                self.Bind(wx.EVT_TOGGLEBUTTON, self._onWxHit)
                
 
+       def getBlankValue(self):
+               return False
+
+               
 class _dToggleButton_test(dToggleButton):
        def afterInit(self):
                self.Caption = "Toggle me!"

Modified: trunk/dabo/ui/uiwx/test.py
===================================================================
--- trunk/dabo/ui/uiwx/test.py  2005-11-29 18:11:38 UTC (rev 1596)
+++ trunk/dabo/ui/uiwx/test.py  2005-11-29 19:46:35 UTC (rev 1597)
@@ -94,6 +94,7 @@
                        mod = __import__(modname)
                        objname = "_%s_test" % modname
                        if mod.__dict__.has_key(objname):
+                               print "Trying to instantiate %s..." % objname
                                try:
                                        obj = mod.__dict__[objname](panel)
                                except Exception, e:




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Reply via email to