[GRASS-SVN] r57108 - grass/trunk/gui/wxpython/mapdisp
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jul 14 03:05:39 PDT 2013
Author: annakrat
Date: 2013-07-14 03:05:38 -0700 (Sun, 14 Jul 2013)
New Revision: 57108
Modified:
grass/trunk/gui/wxpython/mapdisp/frame.py
grass/trunk/gui/wxpython/mapdisp/statusbar.py
Log:
wxGUI: fix statusbar update
Modified: grass/trunk/gui/wxpython/mapdisp/frame.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/frame.py 2013-07-14 09:58:54 UTC (rev 57107)
+++ grass/trunk/gui/wxpython/mapdisp/frame.py 2013-07-14 10:05:38 UTC (rev 57108)
@@ -135,7 +135,7 @@
self.statusbarManager.Update()
#
- self.Map.updateProgress.connect(self.ProcessProgress)
+ self.Map.updateProgress.connect(self.statusbarManager.SetProgress)
# init decoration objects
self.decorations = {}
@@ -1347,12 +1347,3 @@
toolbar.action['id'] = vars(toolbar)["pointer"]
toolbar.OnTool(None)
self.OnPointer(event=None)
-
- def ProcessProgress(self, range, value, text):
- """!Update progress bar during rendering"""
- bar = self.statusbarManager.GetProgressBar()
- bar.SetRange(range)
- bar.SetValue(value)
- # minimalize the damage in the status bar text
- if text:
- self.SetStatusText(text)
Modified: grass/trunk/gui/wxpython/mapdisp/statusbar.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/statusbar.py 2013-07-14 09:58:54 UTC (rev 57107)
+++ grass/trunk/gui/wxpython/mapdisp/statusbar.py 2013-07-14 10:05:38 UTC (rev 57108)
@@ -84,7 +84,11 @@
self._postInitialized = False
self.progressbar = SbProgress(self.mapFrame, self.statusbar, self)
-
+ self.progressbar.progressShown.connect(self._progressShown)
+ self.progressbar.progressHidden.connect(self._progressHidden)
+
+ self._oldStatus = ''
+
self._hiddenItems = {}
def SetProperty(self, name, value):
@@ -271,7 +275,15 @@
def GetProgressBar(self):
"""!Returns progress bar"""
return self.progressbar
-
+
+ def _progressShown(self):
+ self._oldStatus = self.statusbar.GetStatusText(0)
+ print 'show:'+self._oldStatus
+
+ def _progressHidden(self):
+ self.statusbar.SetStatusText(self._oldStatus, 0)
+ print 'hide:'+self._oldStatus
+
def OnToggleStatus(self, event):
"""!Toggle status text
"""
@@ -288,6 +300,13 @@
"""!Returns current mode"""
return self.choice.GetSelection()
+ def SetProgress(self, range, value, text):
+ """Update progress."""
+ self.progressbar.SetRange(range)
+ self.progressbar.SetValue(value)
+ if text:
+ self.statusbar.SetStatusText(text)
+
class SbItem:
"""!Base class for statusbar items.
@@ -969,14 +988,17 @@
Underlaying widget is wx.Gauge.
"""
def __init__(self, mapframe, statusbar, sbManager, position = 0):
+ self.progressShown = Signal('SbProgress.progressShown')
+ self.progressHidden = Signal('SbProgress.progressHidden')
SbItem.__init__(self, mapframe, statusbar, position)
self.name = 'progress'
self.sbManager = sbManager
# on-render gauge
self.widget = wx.Gauge(parent = self.statusbar, id = wx.ID_ANY,
range = 0, style = wx.GA_HORIZONTAL)
- self.widget.Hide()
+ self.Hide()
+
def GetRange(self):
"""!Returns progress range."""
return self.widget.GetRange()
@@ -986,10 +1008,20 @@
if range > 0:
if self.GetRange() != range:
self.widget.SetRange(range)
+ self.Show()
+ else:
+ self.Hide()
+
+ def Show(self):
+ if not self.IsShown():
+ self.progressShown.emit()
self.widget.Show()
- else:
+
+ def Hide(self):
+ if self.IsShown():
+ self.progressHidden.emit()
self.widget.Hide()
-
+
def IsShown(self):
"""!Is progress bar shown
"""
@@ -1000,7 +1032,7 @@
return
self.widget.SetValue(value)
if value == self.GetRange():
- self.widget.Hide()
+ self.Hide()
wx.Yield()
More information about the grass-commit
mailing list