Quellcode durchsuchen

wxGUI: continue replacing events (speedChanged)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@55389 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová vor 12 Jahren
Ursprung
Commit
1a2610097a
2 geänderte Dateien mit 6 neuen und 9 gelöschten Zeilen
  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 utils import TemporalMode, validateTimeseriesName, validateMapNames
 from nviztask import NvizTask
 from nviztask import NvizTask
 
 
-SpeedChangedEvent, EVT_SPEED_CHANGED = NewEvent()
+from grass.pydispatch.signal import Signal
 
 
 class SpeedDialog(wx.Dialog):
 class SpeedDialog(wx.Dialog):
     def __init__(self, parent, title = _("Adjust speed of animation"),
     def __init__(self, parent, title = _("Adjust speed of animation"),
@@ -48,7 +48,8 @@ class SpeedDialog(wx.Dialog):
                  initialSpeed = 200):#, framesCount = None
                  initialSpeed = 200):#, framesCount = None
         wx.Dialog.__init__(self, parent = parent, id = wx.ID_ANY, title = title,
         wx.Dialog.__init__(self, parent = parent, id = wx.ID_ANY, title = title,
                            style = wx.DEFAULT_DIALOG_STYLE)
                            style = wx.DEFAULT_DIALOG_STYLE)
-
+        # signal emitted when speed has changed; has attribute 'ms'
+        self.speedChanged = Signal('SpeedDialog.speedChanged')
         self.minimumDuration = minimumDuration
         self.minimumDuration = minimumDuration
         # self.framesCount = framesCount
         # self.framesCount = framesCount
         self.defaultSpeed = initialSpeed
         self.defaultSpeed = initialSpeed
@@ -235,8 +236,7 @@ class SpeedDialog(wx.Dialog):
         else:
         else:
             return
             return
 
 
-        event = SpeedChangedEvent(ms = ms)
-        wx.PostEvent(self, event)
+        self.speedChanged.emit(ms = ms)
 
 
     def _timedelta(self, unit, number):
     def _timedelta(self, unit, number):
         if unit == "years":
         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 controller import AnimationController
 from anim import Animation
 from anim import Animation
 from toolbars import MainToolbar, AnimationToolbar, MiscToolbar
 from toolbars import MainToolbar, AnimationToolbar, MiscToolbar
-from dialogs import SpeedDialog, EVT_SPEED_CHANGED
+from dialogs import SpeedDialog
 from utils import Orientation, ReplayMode, TemporalType
 from utils import Orientation, ReplayMode, TemporalType
 
 
 
 
@@ -217,12 +217,9 @@ class AnimationFrame(wx.Frame):
                               timeGranularity = self.controller.GetTimeGranularity(),
                               timeGranularity = self.controller.GetTimeGranularity(),
                               initialSpeed = self.controller.timeTick)
                               initialSpeed = self.controller.timeTick)
             self.dialogs['speed'] = win
             self.dialogs['speed'] = win
-            win.Bind(EVT_SPEED_CHANGED, self.OnChangeSpeed)
+            win.speedChanged.connect(self.ChangeSpeed)
             win.Show()
             win.Show()
 
 
-    def OnChangeSpeed(self, event):
-        self.ChangeSpeed(ms = event.ms)
-
     def ChangeSpeed(self, ms):
     def ChangeSpeed(self, ms):
         self.controller.timeTick = ms
         self.controller.timeTick = ms