dabo Commit
Revision 6982
Date: 2011-11-25 10:06:17 -0800 (Fri, 25 Nov 2011)
Author: Ed
Trac: http://trac.dabodev.com/changeset/6982
Changed:
U trunk/dabo/ui/uiwx/dFormMixin.py
Log:
Added the IdleRefreshInterval property to allow more control on the redraw
process. Previously a refresh() was being called on every Idle event, causing a
lot of flicker. Now the default is one refresh per second, but that can be
increased or decreased as needed.
Diff:
Modified: trunk/dabo/ui/uiwx/dFormMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dFormMixin.py 2011-11-25 15:59:01 UTC (rev 6981)
+++ trunk/dabo/ui/uiwx/dFormMixin.py 2011-11-25 18:06:17 UTC (rev 6982)
@@ -24,6 +24,7 @@
self._sizersToOutline = []
self._recurseOutlinedSizers = True
self._alwaysDrawSizerOutlines = False
+ self._idleRefreshInterval = 1000
self._drawSizerChildren = False
self._statusBarClass = dabo.ui.dStatusBar
@@ -231,17 +232,21 @@
def __onIdle(self, evt):
if self.__needOutlineRedraw or self._alwaysDrawSizerOutlines:
- self.refresh()
- for sz in self.SizersToOutline:
- win = sz.getContainingWindow()
- try:
- sz.drawOutline(win,
recurse=self._recurseOutlinedSizers,
-
drawChildren=self._drawSizerChildren)
- except AttributeError:
- # Will happen if sz is None
- self.removeFromOutlinedSizers(sz)
+ dabo.ui.callAfterInterval(self.IdleRefreshInterval,
self._idleRedraw)
+ def _idleRedraw(self):
+ self.refresh()
+ for sz in self.SizersToOutline:
+ win = sz.getContainingWindow()
+ try:
+ sz.drawOutline(win,
recurse=self._recurseOutlinedSizers,
+
drawChildren=self._drawSizerChildren)
+ except AttributeError:
+ # Will happen if sz is None
+ self.removeFromOutlinedSizers(sz)
+
+
def __onClose(self, evt):
app = self.Application
@@ -307,6 +312,7 @@
else:
dabo.ui.callAfterInterval(interval, self.__refresh)
+
@dabo.ui.deadCheck
def __refresh(self):
super(dFormMixin, self).refresh()
@@ -818,6 +824,13 @@
self._properties["Icon"] = val
+ def _getIdleRefreshInterval(self):
+ return self._idleRefreshInterval
+
+ def _setIdleRefreshInterval(self, val):
+ self._setIdleRefreshInterval = val
+
+
def _getMDI(self):
## self._mdi defined in dForm.py/dFormMain.py:
try:
@@ -1163,6 +1176,14 @@
system will not have to scale the icon, resulting in a
much better
appearance."""))
+ IdleRefreshInterval = property(_getIdleRefreshInterval,
_setIdleRefreshInterval, None,
+ _("""Controls how often the form is refreshed when idle.
+
+ If you notice a lot of flicker when a form is 'doing
nothing', increase
+ this value. Likewise, if you notice that changes are
not reflected as
+ readily as you wish, decrease it. The value is in
milliseconds; the
+ default is 1000. (int)"""))
+
MDI = property(_getMDI, None, None,
_("""Returns True if this is a MDI (Multiple Document
Interface) form. (bool)
_______________________________________________
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]