proper custom wxPython event, in wxPython style
authorjblum <jblum@221aa14e-8319-0410-a670-987f0aec2ac5>
Thu, 9 Oct 2008 01:42:25 +0000 (01:42 +0000)
committerjblum <jblum@221aa14e-8319-0410-a670-987f0aec2ac5>
Thu, 9 Oct 2008 01:42:25 +0000 (01:42 +0000)
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9760 221aa14e-8319-0410-a670-987f0aec2ac5

gr-wxgui/src/python/common.py
gr-wxgui/src/python/number_window.py

index e54f4dbf154981d317f34e594483fe7811c9a711..f31e1a7085aac9983889668c2c8a72496815f464 100644 (file)
@@ -24,18 +24,21 @@ import numpy
 import math
 import wx
 
-EVT_DATA = wx.NewEventType()
-class DataEvent(wx.PyEvent):
-       def __init__(self, data):
-               wx.PyEvent.__init__(self, wx.NewId(), EVT_DATA)
-               self.data = data
-
 class prop_setter(object):
        def _register_set_prop(self, controller, control_key, *args):
                def set_method(value): controller[control_key] = value
                if args: set_method(args[0])
                setattr(self, 'set_%s'%control_key, set_method)
 
+##################################################
+# Custom Data Event
+##################################################
+EVT_DATA = wx.PyEventBinder(wx.NewEventType())
+class DataEvent(wx.PyEvent):
+       def __init__(self, data):
+               wx.PyEvent.__init__(self, wx.NewId(), EVT_DATA.typeId)
+               self.data = data
+
 ##################################################
 # Input Watcher Thread
 ##################################################
index dbdb68120294538f402f8e3db90a028505612525..e766c68c1d41684816b9a1585ad29f00d1323231 100644 (file)
@@ -135,7 +135,7 @@ class number_window(wx.Panel, pubsub.pubsub, common.prop_setter):
                self._register_set_prop(self, RUNNING_KEY, True)
                #register events
                self.ext_controller.subscribe(msg_key, self.handle_msg)
-               self.Connect(wx.ID_ANY, wx.ID_ANY, common.EVT_DATA, self.update)
+               self.Bind(common.EVT_DATA, self.update)
 
        def show_gauges(self, show_gauge):
                """