[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r8192 - gnuradio/branches/developers/michaelld/wxgui/g
From: |
michaelld |
Subject: |
[Commit-gnuradio] r8192 - gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python |
Date: |
Sat, 12 Apr 2008 12:42:07 -0600 (MDT) |
Author: michaelld
Date: 2008-04-12 12:42:06 -0600 (Sat, 12 Apr 2008)
New Revision: 8192
Modified:
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/fftsink2.py
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/input_watcher.py
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/numbersink2.py
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/scopesink2.py
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/waterfallsink2.py
Log:
Post-demo check in of updates:
* added an event_window class that creates a hidden panel to handle
the generation of new data events.
* updated the msgq watcher to use the new event_window
* updated GR widgets to use the new msgq watcher
Modified:
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/fftsink2.py
===================================================================
---
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/fftsink2.py
2008-04-12 18:36:16 UTC (rev 8191)
+++
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/fftsink2.py
2008-04-12 18:42:06 UTC (rev 8192)
@@ -188,10 +188,9 @@
self.Bind(wx.EVT_RIGHT_UP, self.on_right_click)
self.Bind(wx.EVT_MOTION, self.evt_motion)
- self.data_event = window_data_event (self, self.set_data)
- self.input_watcher = input_watcher (fftsink.msgq, self,
- self.data_event,
- self.msg_processor)
+ self.msgq_watcher = msgq_watcher (fftsink.msgq, self,
+ self.msg_processor,
+ self.set_data)
def msg_processor (self, msg):
itemsize = int (msg.arg1 ())
@@ -230,8 +229,8 @@
self.fftsink.set_baseband_freq(baseband_freq)
def do_close (self):
- # on close, stop the input_watcher
- self.input_watcher.stop ()
+ # on close, stop the msgq_watcher
+ self.msgq_watcher.stop ()
def set_data (self, evt):
dB = evt.data
Modified:
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/input_watcher.py
===================================================================
---
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/input_watcher.py
2008-04-12 18:36:16 UTC (rev 8191)
+++
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/input_watcher.py
2008-04-12 18:42:06 UTC (rev 8192)
@@ -57,15 +57,59 @@
def set_data (self, data):
self.data = data
-class input_watcher (threading.Thread):
- def __init__ (self, msgq, event_receiver, data_event,
- msg_proc_func, **kwds):
+class event_window (wx.Panel):
+ """
+ Hidden panel to handle the creation and generation of WX data
+ events. Uses the standard binding between the WX window and WX
+ event. The provided "parent" and "callback" must be valid.
+ """
+ def __init__ (self, parent, callback):
+ # error checkig on init parameters
+ has_error = False
+ if not parent:
+ has_error = True
+ print "event_window::__init__ : 'parent' must be provided."
+ if not callback:
+ has_error = True
+ print "event_window::__init__ : 'callback' must be provided."
+ if has_error:
+ sys.exit (-1)
+
+ # init the inherited class
+ wx.Panel.__init__ (self, parent)
+
+ # save variables
+ self._parent = parent
+
+ # create the bound data event
+ self._data_event = window_data_event (
+ self, callback)
+
+ # hide this panel from view; just use it to transer events to
+ # the parent GUI as they happen
+ self.Hide ()
+
+ def generate_data_event (self, data=[]):
+ # Create a copy of the provided data_event
+ t_de = self._data_event.copy ()
+
+ # set the date event's data to the returned records
+ t_de.set_data (data)
+
+ # post the event
+ wx.PostEvent (self, t_de)
+
+ # delete the temporary copy
+ del t_de
+
+class msgq_watcher (threading.Thread):
+ def __init__ (self, msgq, parent_window, msg_proc_func,
+ data_proc_func, **kwds):
threading.Thread.__init__ (self, **kwds)
self.setDaemon (1)
self.msgq = msgq
- self.event_receiver = event_receiver
- self.data_event = data_event
self.msg_proc_func = msg_proc_func
+ self.data_event = event_window (parent_window, data_proc_func)
self.running = True
self.start ()
@@ -84,19 +128,8 @@
continue
# if 'records' were returned, post them as an event.
+ self.data_event.generate_data_event (records)
- # Create a copy of the provided data_event
- t_de = self.data_event.copy ()
-
- # set the date event's data to the returned records
- t_de.set_data (records)
-
- # post the event
- wx.PostEvent (self.event_receiver, t_de)
-
- # delete the temporary copy
- del t_de
-
# once 'keep_running' is set to False, processing is complete;
# print "gr_input_watcher finishing"
Modified:
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/numbersink2.py
===================================================================
---
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/numbersink2.py
2008-04-12 18:36:16 UTC (rev 8191)
+++
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/numbersink2.py
2008-04-12 18:42:06 UTC (rev 8192)
@@ -340,10 +340,9 @@
self.peak_hold = False
self.peak_vals = None
- self.data_event = window_data_event (self, self.set_data)
- self.input_watcher = input_watcher (numbersink.msgq, self,
- self.data_event,
- self.msg_processor)
+ self.msgq_watcher = msgq_watcher (numbersink.msgq, self,
+ self.msg_processor,
+ self.set_data)
def msg_processor (self, msg):
itemsize = int (msg.arg1 ())
@@ -361,8 +360,8 @@
return numpy.fromstring (s, numpy.float32)
def do_close (self):
- # on close, stop the input_watcher
- self.input_watcher.stop ()
+ # on close, stop the msgq_watcher
+ self.msgq_watcher.stop ()
def set_show_gauge(self, enable):
self.show_gauge = enable
Modified:
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/scopesink2.py
===================================================================
---
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/scopesink2.py
2008-04-12 18:36:16 UTC (rev 8191)
+++
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/scopesink2.py
2008-04-12 18:42:06 UTC (rev 8192)
@@ -429,15 +429,12 @@
self.avg_y_max = None
self.avg_x_min = None
self.avg_x_max = None
-
- self.data_event = window_data_event (
- self, self.format_data, lambda e, w, h: w.Connect (-1, -1, e, h))
-
self.iscan = 0
- self.input_watcher = input_watcher (info.msgq, self,
- self.data_event,
- self.msg_processor)
+ self.msgq_watcher = msgq_watcher (info.msgq, self,
+ self.msg_processor,
+ self.format_data)
+
def msg_processor (self, msg):
# convert the incoming message to usable data;
# return [] or an array of data
@@ -471,8 +468,8 @@
return records
def do_close (self):
- # on close, stop the input_watcher
- self.input_watcher.stop ()
+ # on close, stop the msgq_watcher
+ self.msgq_watcher.stop ()
def channel_color (self, ch):
return self.channel_colors[ch % len(self.channel_colors)]
Modified:
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/waterfallsink2.py
===================================================================
---
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/waterfallsink2.py
2008-04-12 18:36:16 UTC (rev 8191)
+++
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/waterfallsink2.py
2008-04-12 18:42:06 UTC (rev 8192)
@@ -156,10 +156,8 @@
wx.EVT_PAINT (self, self.OnPaint)
self.Bind(wx.EVT_RIGHT_UP, self.on_right_click)
- self.data_event = window_data_event (self, self.set_data)
- self.input_watcher = input_watcher (fftsink.msgq, self,
- self.data_event,
- self.msg_processor)
+ self.msgq_watcher = msgq_watcher (fftsink.msgq, self,
+ self.msg_processor, self.set_data)
def msg_processor (self, msg):
itemsize = int (msg.arg1 ())
@@ -177,8 +175,8 @@
return numpy.fromstring (s, numpy.float32)
def do_close (self):
- # on close, stop the input_watcher
- self.input_watcher.stop ()
+ # on close, stop the msgq_watcher
+ self.msgq_watcher.stop ()
def const_list(self,const,len):
return [const] * len
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r8192 - gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python,
michaelld <=