dabo Commit
Revision 3091
Date: 2007-04-26 12:06:57 -0700 (Thu, 26 Apr 2007)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/3091

Changed:
U   trunk/dabo/ui/uiwx/dForm.py
U   trunk/dabo/ui/uiwx/test/test_dForm.py

Log:
Changed the 'force' parameter to refresh() and update() to an interval 
parameter. If no param is sent, the default of 100ms is used in 
callAfterInterval(). If a non-zero value is sent, that value (in ms) is used. 
If zero is passed, callAfterInterval() is skipped, and the refresh/update is 
executed immediately.

Updated the test to reflect this change.


Diff:
Modified: trunk/dabo/ui/uiwx/dForm.py
===================================================================
--- trunk/dabo/ui/uiwx/dForm.py 2007-04-26 16:41:54 UTC (rev 3090)
+++ trunk/dabo/ui/uiwx/dForm.py 2007-04-26 19:06:57 UTC (rev 3091)
@@ -96,30 +96,48 @@
                func(message=msg, title=title)
 
 
-       def refresh(self, force=False):
+       def refresh(self, interval=None):
                """Repaints the form and all contained objects.
 
-               When force is False, repeated calls to refresh() will be cached 
for
-               performance reasons. Send force=True to force an immediate 
refresh.
+               This method is called repeatedly from many different places 
during
+               a single change in the UI, so by default the actual execution 
is cached
+               using callAfterInterval(). The default interval is 100 
milliseconds. You
+               can change that to suit your app needs by passing a different 
interval
+               in milliseconds.
+               
+               Sometimes, though, you want to force immediate execution of the 
+               refresh. In these cases, pass an interval of 0 to this method, 
which
+               means don't wait; execute now.
                """
-               if force:
+               if interval is None:
+                       interval = 100
+               if interval == 0:
                        self.__refresh()
                else:
-                       dabo.ui.callAfterInterval(100, self.__refresh)
+                       dabo.ui.callAfterInterval(interval, self.__refresh)
        def __refresh(self):
                super(BaseForm, self).refresh()
                
                
-       def update(self, force=False):
+       def update(self, interval=None):
                """Updates the contained controls with current values from the 
source. 
 
-               When force is False, repeated calls to update() will be cached 
for
-               performance reasons. Send force=True to force an immediate 
update.
+               This method is called repeatedly from many different places 
during
+               a single change in the UI, so by default the actual execution 
is cached
+               using callAfterInterval(). The default interval is 100 
milliseconds. You
+               can change that to suit your app needs by passing a different 
interval
+               in milliseconds.
+               
+               Sometimes, though, you want to force immediate execution of the 
+               update. In these cases, pass an interval of 0 to this method, 
which
+               means don't wait; execute now.
                """
-               if force:
+               if interval is None:
+                       interval = 100
+               if interval == 0:
                        self.__update()
                else:
-                       dabo.ui.callAfterInterval(100, self.__update)
+                       dabo.ui.callAfterInterval(interval, self.__update)
        def __update(self):
                super(BaseForm, self).update()
                

Modified: trunk/dabo/ui/uiwx/test/test_dForm.py
===================================================================
--- trunk/dabo/ui/uiwx/test/test_dForm.py       2007-04-26 16:41:54 UTC (rev 
3090)
+++ trunk/dabo/ui/uiwx/test/test_dForm.py       2007-04-26 19:06:57 UTC (rev 
3091)
@@ -33,7 +33,7 @@
 
                ## force the frm to get the first record:
                frm.first()
-               frm.update(True)  ## need to force the update here because it 
is delayed by default, which doesn't work for scripted tests.
+               frm.update(interval=0)  ## need to force the update here 
because it is delayed by default, which doesn't work for scripted tests.
 
        def tearDown(self):
                self.biz = None
@@ -66,7 +66,7 @@
                biz = frm.getBizobj()
                self.assertEqual(frm.cField.Value, "Paul Keith McNett")
                frm.next()
-               frm.update(True)  ## Need to force the update here which would 
otherwise happen 100 ms in the future.
+               frm.update(interval=0)  ## Need to force the update here which 
would otherwise happen 100 ms in the future.
                self.assertEqual(biz.RowNumber, 1)
                self.assertEqual(frm.cField.Value, "Edward Leafe")
 
@@ -80,7 +80,7 @@
                frm.requery()
                self.assertEqual(biz.RowCount, 4)
                frm.last()
-               frm.update(True)  ## Need to force the update here, otherwise 
it won't happen until 100 ms in the future.
+               frm.update(interval=0)  ## Need to force the update here, 
otherwise it won't happen until 100 ms in the future.
                self.assertEqual(biz.RowNumber, 3)
                self.assertEqual(biz.Record.cField, None)
                self.assertEqual(biz.Record.iField, 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/dabo-dev/[EMAIL PROTECTED]

Reply via email to