Browse Source

wxGUI: continue replacing events (speedChanged)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@55389 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 12 years ago
parent
commit
1a2610097a
2 changed files with 6 additions and 9 deletions
  1. 4 4
      gui/wxpython/animation/dialogs.py
  2. 2 5
      gui/wxpython/animation/frame.py

+ 4 - 4
gui/wxpython/animation/dialogs.py

@@ -40,7 +40,7 @@ from core.settings import UserSettings
 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 @@ class SpeedDialog(wx.Dialog):
                  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 @@ class SpeedDialog(wx.Dialog):
         else:
             return
 
-        event = SpeedChangedEvent(ms = ms)
-        wx.PostEvent(self, event)
+        self.speedChanged.emit(ms = ms)
 
     def _timedelta(self, unit, number):
         if unit == "years":

+ 2 - 5
gui/wxpython/animation/frame.py

@@ -34,7 +34,7 @@ from mapwindow import AnimationWindow, BitmapProvider, BitmapPool
 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 @@ class AnimationFrame(wx.Frame):
                               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