[GRASS-SVN] r55389 - grass/trunk/gui/wxpython/animation

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Mar 14 15:56:26 PDT 2013


Author: annakrat
Date: 2013-03-14 15:56:25 -0700 (Thu, 14 Mar 2013)
New Revision: 55389

Modified:
   grass/trunk/gui/wxpython/animation/dialogs.py
   grass/trunk/gui/wxpython/animation/frame.py
Log:
wxGUI: continue replacing events (speedChanged)

Modified: grass/trunk/gui/wxpython/animation/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/animation/dialogs.py	2013-03-14 22:44:09 UTC (rev 55388)
+++ grass/trunk/gui/wxpython/animation/dialogs.py	2013-03-14 22:56:25 UTC (rev 55389)
@@ -40,7 +40,7 @@
 from utils import TemporalMode, validateTimeseriesName, validateMapNames
 from nviztask import NvizTask
 
-SpeedChangedEvent, EVT_SPEED_CHANGED = NewEvent()
+from grass.pydispatch.signal import Signal
 
 class SpeedDialog(wx.Dialog):
     def __init__(self, parent, title = _("Adjust speed of animation"),
@@ -48,7 +48,8 @@
                  initialSpeed = 200):#, framesCount = None
         wx.Dialog.__init__(self, parent = parent, id = wx.ID_ANY, title = title,
                            style = wx.DEFAULT_DIALOG_STYLE)
-
+        # signal emitted when speed has changed; has attribute 'ms'
+        self.speedChanged = Signal('SpeedDialog.speedChanged')
         self.minimumDuration = minimumDuration
         # self.framesCount = framesCount
         self.defaultSpeed = initialSpeed
@@ -235,8 +236,7 @@
         else:
             return
 
-        event = SpeedChangedEvent(ms = ms)
-        wx.PostEvent(self, event)
+        self.speedChanged.emit(ms = ms)
 
     def _timedelta(self, unit, number):
         if unit == "years":

Modified: grass/trunk/gui/wxpython/animation/frame.py
===================================================================
--- grass/trunk/gui/wxpython/animation/frame.py	2013-03-14 22:44:09 UTC (rev 55388)
+++ grass/trunk/gui/wxpython/animation/frame.py	2013-03-14 22:56:25 UTC (rev 55389)
@@ -34,7 +34,7 @@
 from controller import AnimationController
 from anim import Animation
 from toolbars import MainToolbar, AnimationToolbar, MiscToolbar
-from dialogs import SpeedDialog, EVT_SPEED_CHANGED
+from dialogs import SpeedDialog
 from utils import Orientation, ReplayMode, TemporalType
 
 
@@ -217,12 +217,9 @@
                               timeGranularity = self.controller.GetTimeGranularity(),
                               initialSpeed = self.controller.timeTick)
             self.dialogs['speed'] = win
-            win.Bind(EVT_SPEED_CHANGED, self.OnChangeSpeed)
+            win.speedChanged.connect(self.ChangeSpeed)
             win.Show()
 
-    def OnChangeSpeed(self, event):
-        self.ChangeSpeed(ms = event.ms)
-
     def ChangeSpeed(self, ms):
         self.controller.timeTick = ms
 



More information about the grass-commit mailing list