Changeset 9749
- Timestamp:
- 10/08/08 08:56:34
- Files:
-
- gnuradio/trunk/gr-wxgui/src/python/common.py (modified) (1 diff)
- gnuradio/trunk/gr-wxgui/src/python/number_window.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gnuradio/trunk/gr-wxgui/src/python/common.py
r9549 r9749 24 24 import math 25 25 import wx 26 27 EVT_DATA = wx.NewEventType() 28 class DataEvent(wx.PyEvent): 29 def __init__(self, data): 30 wx.PyEvent.__init__(self, wx.NewId(), EVT_DATA) 31 self.data = data 26 32 27 33 class prop_setter(object): gnuradio/trunk/gr-wxgui/src/python/number_window.py
r9637 r9749 136 136 #register events 137 137 self.ext_controller.subscribe(msg_key, self.handle_msg) 138 self.Connect(wx.ID_ANY, wx.ID_ANY, common.EVT_DATA, self.update) 138 139 139 140 def show_gauges(self, show_gauge): … … 150 151 def handle_msg(self, msg): 151 152 """ 153 Post this message into a data event. 154 Allow wx to handle the event to avoid threading issues. 155 @param msg the incoming numbersink data 156 """ 157 wx.PostEvent(self, common.DataEvent(msg)) 158 159 def update(self, event): 160 """ 152 161 Handle a message from the message queue. 153 162 Convert the string based message into a float or complex. 154 163 If more than one number was read, only take the last number. 155 164 Perform peak hold operations, set the gauges and display. 156 @param msgthe number sample as a character array165 @param event event.data is the number sample as a character array 157 166 """ 158 167 if not self[RUNNING_KEY]: return … … 165 174 format_string = "%%.%df"%self.decimal_places 166 175 if self.real: 167 sample = numpy.fromstring( msg, numpy.float32)[-1]176 sample = numpy.fromstring(event.data, numpy.float32)[-1] 168 177 if self[PEAK_HOLD_KEY]: sample = self.peak_val_real = max(self.peak_val_real, sample) 169 178 label_text = "%s %s"%(format_string%sample, self.units) 170 179 set_gauge_value(self.gauge_real, sample) 171 180 else: 172 sample = numpy.fromstring( msg, numpy.complex64)[-1]181 sample = numpy.fromstring(event.data, numpy.complex64)[-1] 173 182 if self[PEAK_HOLD_KEY]: 174 183 self.peak_val_real = max(self.peak_val_real, sample.real)
