diff options
author | jblum | 2008-08-14 19:53:37 +0000 |
---|---|---|
committer | jblum | 2008-08-14 19:53:37 +0000 |
commit | 2956c43f415c283ce1b1337e78debd896dc4c48a (patch) | |
tree | 70a71e2fb73883b41b530ebf7047e76faf963a22 /gr-wxgui/src | |
parent | c3c6eb14f1d8b250322f63fb6b6adc3fb60c67eb (diff) | |
download | gnuradio-2956c43f415c283ce1b1337e78debd896dc4c48a.tar.gz gnuradio-2956c43f415c283ce1b1337e78debd896dc4c48a.tar.bz2 gnuradio-2956c43f415c283ce1b1337e78debd896dc4c48a.zip |
more backwards compadibility, marker for scope/xy plotter
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9293 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-wxgui/src')
-rw-r--r-- | gr-wxgui/src/python/common.py | 4 | ||||
-rw-r--r-- | gr-wxgui/src/python/const_window.py | 2 | ||||
-rw-r--r-- | gr-wxgui/src/python/numbersink2.py | 2 | ||||
-rw-r--r-- | gr-wxgui/src/python/scope_window.py | 19 | ||||
-rw-r--r-- | gr-wxgui/src/python/scopesink_gl.py | 4 |
5 files changed, 27 insertions, 4 deletions
diff --git a/gr-wxgui/src/python/common.py b/gr-wxgui/src/python/common.py index 84b4c9c4c..21f741c98 100644 --- a/gr-wxgui/src/python/common.py +++ b/gr-wxgui/src/python/common.py @@ -25,9 +25,9 @@ import math import wx class prop_setter(object): - def _register_set_prop(self, controller, control_key, init=None): + def _register_set_prop(self, controller, control_key, *args): def set_method(value): controller[control_key] = value - if init is not None: set_method(init) + if args: set_method(args[0]) setattr(self, 'set_%s'%control_key, set_method) ################################################## diff --git a/gr-wxgui/src/python/const_window.py b/gr-wxgui/src/python/const_window.py index 9510416be..366242cb0 100644 --- a/gr-wxgui/src/python/const_window.py +++ b/gr-wxgui/src/python/const_window.py @@ -46,7 +46,7 @@ MARKER_TYPES = ( ('Dot Large', 3.0), ('Line Link', None), ) -DEFAULT_MARKER_TYPE = MARKER_TYPES[1][1] +DEFAULT_MARKER_TYPE = 2.0 ################################################## # Constellation window control panel diff --git a/gr-wxgui/src/python/numbersink2.py b/gr-wxgui/src/python/numbersink2.py index 43eb9e493..4b232d81d 100644 --- a/gr-wxgui/src/python/numbersink2.py +++ b/gr-wxgui/src/python/numbersink2.py @@ -118,6 +118,8 @@ class _number_sink_base(gr.hier_block2, common.prop_setter): for attr in filter(lambda a: a.startswith('set_'), dir(self.win)): setattr(self, attr, getattr(self.win, attr)) self._register_set_prop(self.controller, SAMPLE_RATE_KEY) + #backwards compadibility + self.set_show_gauge = self.win.show_gauges def get_average(self): return self._average def set_average(self, average): diff --git a/gr-wxgui/src/python/scope_window.py b/gr-wxgui/src/python/scope_window.py index 0c7326b1d..f587f3447 100644 --- a/gr-wxgui/src/python/scope_window.py +++ b/gr-wxgui/src/python/scope_window.py @@ -58,6 +58,13 @@ CHANNEL_COLOR_SPECS = ( (1, 0, 1), ) AUTORANGE_UPDATE_RATE = 0.5 #sec +MARKER_TYPES = ( + ('Dot Small', 1.0), + ('Dot Medium', 2.0), + ('Dot Large', 3.0), + ('Line Link', None), +) +DEFAULT_MARKER_TYPE = None ################################################## # Scope window control panel @@ -175,7 +182,11 @@ class control_panel(wx.Panel): #autorange check box self.autorange_check_box = common.CheckBoxController(self, 'Autorange', parent, AUTORANGE_KEY) control_box.Add(self.autorange_check_box, 0, wx.ALIGN_LEFT) - #run/stop + #marker + control_box.AddStretchSpacer() + self.marker_chooser = common.DropDownController(self, 'Marker', MARKER_TYPES, parent, MARKER_KEY) + control_box.Add(self.marker_chooser, 0, wx.EXPAND) + #xy mode control_box.AddStretchSpacer() self.scope_xy_mode_button = common.ToggleButtonController(self, parent, SCOPE_XY_MODE_KEY, 'Scope Mode', 'X:Y Mode') parent.subscribe(SCOPE_XY_MODE_KEY, self._on_scope_xy_mode) @@ -258,6 +269,7 @@ class scope_window(wx.Panel, pubsub.pubsub, common.prop_setter): #check num inputs assert num_inputs <= len(CHANNEL_COLOR_SPECS) #setup + self.sampleses = None self.ext_controller = controller self.num_inputs = num_inputs self.sample_rate_key = sample_rate_key @@ -303,6 +315,7 @@ class scope_window(wx.Panel, pubsub.pubsub, common.prop_setter): self._register_set_prop(self, TRIGGER_CHANNEL_KEY, 0) self._register_set_prop(self, TRIGGER_MODE_KEY, 1) self._register_set_prop(self, TRIGGER_LEVEL_KEY, None) + self._register_set_prop(self, MARKER_KEY, DEFAULT_MARKER_TYPE) #register events self.ext_controller.subscribe(msg_key, self.handle_msg) for key in ( @@ -314,6 +327,7 @@ class scope_window(wx.Panel, pubsub.pubsub, common.prop_setter): SCOPE_Y_CHANNEL_KEY, AUTORANGE_KEY, AC_COUPLE_KEY, + MARKER_KEY, ): self.subscribe(key, self.update_grid) #initial update, dont do this here, wait for handle_msg #HACK #self.update_grid() @@ -344,6 +358,7 @@ class scope_window(wx.Panel, pubsub.pubsub, common.prop_setter): Handle the cached samples from the scope input. Perform ac coupling, triggering, and auto ranging. """ + if not self.sampleses: return sampleses = self.sampleses #trigger level (must do before ac coupling) self.ext_controller[self.scope_trigger_channel_key] = self[TRIGGER_CHANNEL_KEY] @@ -382,6 +397,7 @@ class scope_window(wx.Panel, pubsub.pubsub, common.prop_setter): channel='XY', samples=(x_samples, y_samples), color_spec=CHANNEL_COLOR_SPECS[0], + marker=self[MARKER_KEY], ) #turn off each waveform for i, samples in enumerate(sampleses): @@ -421,6 +437,7 @@ class scope_window(wx.Panel, pubsub.pubsub, common.prop_setter): channel='Ch%d'%(i+1), samples=samples[:num_samps], color_spec=CHANNEL_COLOR_SPECS[i], + marker=self[MARKER_KEY], ) #turn XY channel off self.plotter.set_waveform( diff --git a/gr-wxgui/src/python/scopesink_gl.py b/gr-wxgui/src/python/scopesink_gl.py index 727e1dc0a..851e43d32 100644 --- a/gr-wxgui/src/python/scopesink_gl.py +++ b/gr-wxgui/src/python/scopesink_gl.py @@ -114,6 +114,10 @@ class _scope_sink_base(gr.hier_block2, common.prop_setter): for attr in filter(lambda a: a.startswith('set_'), dir(self.win)): setattr(self, attr, getattr(self.win, attr)) self._register_set_prop(self.controller, SAMPLE_RATE_KEY) + #backwards compadibility + self.win.set_format_line = lambda: setter(self.win, MARKER_KEY, None) + self.win.set_format_dot = lambda: setter(self.win, MARKER_KEY, 2.0) + self.win.set_format_plus = lambda: setter(self.win, MARKER_KEY, 3.0) class scope_sink_f(_scope_sink_base): _item_size = gr.sizeof_float |