[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r8043 - gnuradio/branches/developers/michaelld/wxgui/g
From: |
michaelld |
Subject: |
[Commit-gnuradio] r8043 - gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python |
Date: |
Wed, 19 Mar 2008 06:47:59 -0600 (MDT) |
Author: michaelld
Date: 2008-03-19 06:47:58 -0600 (Wed, 19 Mar 2008)
New Revision: 8043
Added:
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/input_watcher.py
Removed:
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/gr_input_watcher.py
Modified:
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/fftsink2.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:
Moved gr_input_watcher.py to input_watcher.py; changed internal (to
that file) comment about reusing the data_event. Changed sinks to
include the new file.
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 02:25:56 UTC (rev 8042)
+++
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/fftsink2.py
2008-03-19 12:47:58 UTC (rev 8043)
@@ -22,7 +22,7 @@
from gnuradio import gr, gru, window
from gnuradio.wxgui import stdgui2, plot
-from gnuradio.wxgui.gr_input_watcher import *
+from gnuradio.wxgui.input_watcher import *
import wx, numpy, math
# programming to handle defaults and user preferences
Deleted:
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/gr_input_watcher.py
Added:
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/input_watcher.py
===================================================================
---
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/input_watcher.py
(rev 0)
+++
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/input_watcher.py
2008-03-19 12:47:58 UTC (rev 8043)
@@ -0,0 +1,102 @@
+#!/usr/bin/env python
+#
+# Copyright 2008 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+import threading, sys, wx
+
+class gr_window_data_event (wx.PyEvent):
+ """
+ Create a new window data event.
+ Inherit from this class to provide the specific functionality
+ required by the particular application.
+ """
+ def __init__ (self, window, handler, bind_func=None,
+ event_type=wx.NewEventType ()):
+ wx.PyEvent.__init__ (self)
+ if bind_func is None:
+ # if the binding function isn't provided: PyEventBinder()
+ # creates a new function, which takes as arguments the
+ # window and handler to bind together for this particular
+ # event type.
+ wx.PyEventBinder (event_type, 0) (window, handler)
+ else:
+ # use the provided function
+ bind_func (event_type, window, handler)
+ self.SetEventType (event_type)
+ self.set_data (None)
+
+ def Clone (self):
+ self.__class__ (self.GetId ())
+
+ def set_data (self, data):
+ self.data = data
+
+class gr_input_watcher (threading.Thread):
+ def __init__ (self, msgq, event_receiver, data_event,
+ msg_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.running = True
+ self.start ()
+
+ 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
+ msg = self.msgq.delete_head ()
+
+ # call the provided message processing function
+ records = self.msg_proc_func (msg)
+
+ # if the returned records is empty, just continue
+ 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').
+
+ # set the date event's data to the returned records
+ de.set_data (records)
+
+ # post the event
+ wx.PostEvent (self.event_receiver, de)
+
+ # once 'keep_running' is set to False, processing is complete;
+# print "gr_input_watcher finishing"
+
+ def stop (self):
+# print "gr_input_watcher: stop issued"
+ # tell the thread to stop running
+ self.running = False
+ # FIXME: 'abort' the msgq?
+# self.msgq.abort ()
+ # join the thread to wait for it to finish
+ self.join ()
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 02:25:56 UTC (rev 8042)
+++
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/numbersink2.py
2008-03-19 12:47:58 UTC (rev 8043)
@@ -22,7 +22,7 @@
from gnuradio import gr, gru, window
from gnuradio.wxgui import stdgui2, plot
-from gnuradio.wxgui.gr_input_watcher import *
+from gnuradio.wxgui.input_watcher import *
import wx, numpy, math
# programming to handle defaults and user preferences
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 02:25:56 UTC (rev 8042)
+++
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/scopesink2.py
2008-03-19 12:47:58 UTC (rev 8043)
@@ -22,7 +22,7 @@
from gnuradio import gr, gru, eng_notation
from gnuradio.wxgui import stdgui2, plot
-from gnuradio.wxgui.gr_input_watcher import *
+from gnuradio.wxgui.input_watcher import *
import wx, numpy, struct
# programming to handle defaults and user preferences
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 02:25:56 UTC (rev 8042)
+++
gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python/waterfallsink2.py
2008-03-19 12:47:58 UTC (rev 8043)
@@ -22,7 +22,7 @@
from gnuradio import gr, gru, window
from gnuradio.wxgui import stdgui2, plot
-from gnuradio.wxgui.gr_input_watcher import *
+from gnuradio.wxgui.input_watcher import *
import wx, numpy, os, math
# programming to handle defaults and user preferences
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r8043 - gnuradio/branches/developers/michaelld/wxgui/gr-wxgui/src/python,
michaelld <=