commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r8049 - gnuradio/branches/developers/michaelld/wxgui/g


From: michaelld
Subject: [Commit-gnuradio] r8049 - gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python
Date: Wed, 19 Mar 2008 10:43:20 -0600 (MDT)

Author: michaelld
Date: 2008-03-19 10:43:19 -0600 (Wed, 19 Mar 2008)
New Revision: 8049

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:
Changed input_watcher methods to -not- start with "gr_", and the sinks
to use those new methods.

Change input_watcher class to use a copy of the data_event for
transporting data instead of reusing the user-provided object.



Modified: 
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/fftsink2.py
===================================================================
--- 
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/fftsink2.py    
    2008-03-19 16:28:24 UTC (rev 8048)
+++ 
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/fftsink2.py    
    2008-03-19 16:43:19 UTC (rev 8049)
@@ -187,10 +187,10 @@
         self.Bind(wx.EVT_RIGHT_UP, self.on_right_click)
         self.Bind(wx.EVT_MOTION, self.evt_motion)
 
-        self.data_event = gr_window_data_event (self, self.set_data)
-        self.input_watcher = gr_input_watcher (fftsink.msgq, self,
-                                               self.data_event,
-                                               self.msg_processor)
+        self.data_event = window_data_event (self, self.set_data)
+        self.input_watcher = input_watcher (fftsink.msgq, self,
+                                            self.data_event,
+                                            self.msg_processor)
 
     def msg_processor (self, msg):
         itemsize = int (msg.arg1 ())

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-03-19 16:28:24 UTC (rev 8048)
+++ 
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/input_watcher.py
   2008-03-19 16:43:19 UTC (rev 8049)
@@ -22,7 +22,7 @@
 
 import threading, sys, wx
 
-class gr_window_data_event (wx.PyEvent):
+class window_data_event (wx.PyEvent):
     """
     Create a new window data event.
     Inherit from this class to provide the specific functionality
@@ -42,14 +42,22 @@
             bind_func (event_type, window, handler)
         self.SetEventType (event_type)
         self.set_data (None)
+        self.window = window
+        self.handler = handler
+        self.bind_func = bind_func
+        self.event_type = event_type
 
     def Clone (self):
         self.__class__ (self.GetId ())
 
+    def copy (self):
+        return window_data_event (self.window, self.handler,
+                                  self.bind_func, self.event_type)
+
     def set_data (self, data):
         self.data = data
 
-class gr_input_watcher (threading.Thread):
+class input_watcher (threading.Thread):
     def __init__ (self, msgq, event_receiver, data_event,
                   msg_proc_func, **kwds):
         threading.Thread.__init__ (self, **kwds)
@@ -63,8 +71,6 @@
 
     def run (self):
 #      print "gr_input_watcher starting"
-        # get a local version of the data_event handler
-        de = self.data_event
         # loop while running
         while (self.running):
             # blocking read of message queue
@@ -77,18 +83,20 @@
             if records == []:
                 continue
 
-            # if 'records' were returned, post them as an event. Data
-            # processed via the 'PostEvent' is either (1) processed
-            # immediately or (2) copied (via the Clone() method) and
-            # processed later.  Either way, we can reuse the data
-            # event ('de').
+            # if 'records' were returned, post them as an event.
 
+            # Create a copy of the provided data_event
+            t_de = self.data_event.copy ()
+
             # set the date event's data to the returned records
-            de.set_data (records)
+            t_de.set_data (records)
 
             # post the event
-            wx.PostEvent (self.event_receiver, de)
+            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-03-19 16:28:24 UTC (rev 8048)
+++ 
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/numbersink2.py 
    2008-03-19 16:43:19 UTC (rev 8049)
@@ -340,10 +340,10 @@
         self.peak_hold = False
         self.peak_vals = None
 
-        self.data_event = gr_window_data_event (self, self.set_data)
-        self.input_watcher = gr_input_watcher (numbersink.msgq, self,
-                                               self.data_event,
-                                               self.msg_processor)
+        self.data_event = window_data_event (self, self.set_data)
+        self.input_watcher = input_watcher (numbersink.msgq, self,
+                                            self.data_event,
+                                            self.msg_processor)
 
     def msg_processor (self, msg):
         itemsize = int (msg.arg1 ())

Modified: 
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/scopesink2.py
===================================================================
--- 
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/scopesink2.py  
    2008-03-19 16:28:24 UTC (rev 8048)
+++ 
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/scopesink2.py  
    2008-03-19 16:43:19 UTC (rev 8049)
@@ -430,13 +430,13 @@
         self.avg_x_min = None
         self.avg_x_max = None
 
-        self.data_event = gr_window_data_event (
+        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 = gr_input_watcher (info.msgq, self,
-                                               self.data_event,
-                                               self.msg_processor)
+        self.input_watcher = input_watcher (info.msgq, self,
+                                            self.data_event,
+                                            self.msg_processor)
 
     def msg_processor (self, msg):
         # convert the incoming message to usable data;

Modified: 
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/waterfallsink2.py
===================================================================
--- 
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/waterfallsink2.py
  2008-03-19 16:28:24 UTC (rev 8048)
+++ 
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/waterfallsink2.py
  2008-03-19 16:43:19 UTC (rev 8049)
@@ -156,10 +156,10 @@
         wx.EVT_PAINT (self, self.OnPaint)
         self.Bind(wx.EVT_RIGHT_UP, self.on_right_click)
 
-        self.data_event = gr_window_data_event (self, self.set_data)
-        self.input_watcher = gr_input_watcher (fftsink.msgq, self,
-                                               self.data_event,
-                                               self.msg_processor)
+        self.data_event = window_data_event (self, self.set_data)
+        self.input_watcher = input_watcher (fftsink.msgq, self,
+                                            self.data_event,
+                                            self.msg_processor)
 
     def msg_processor (self, msg):
         itemsize = int (msg.arg1 ())





reply via email to

[Prev in Thread] Current Thread [Next in Thread]