diff options
author | jblum | 2009-06-13 21:26:25 +0000 |
---|---|---|
committer | jblum | 2009-06-13 21:26:25 +0000 |
commit | 51af4269d3eebd3d611be918f8c799c96c650496 (patch) | |
tree | 2b21822a1bdcf3d39e935ac0943c760315088ec4 /gr-wxgui/src/python/const_window.py | |
parent | a1cc77945109dc15a97072107af6ae74c7ac65d5 (diff) | |
download | gnuradio-51af4269d3eebd3d611be918f8c799c96c650496.tar.gz gnuradio-51af4269d3eebd3d611be918f8c799c96c650496.tar.bz2 gnuradio-51af4269d3eebd3d611be918f8c799c96c650496.zip |
Merged wxgui/forms branch r11124:11183
The forms module is set of wxgui forms wrapped in pubsub aware convenience classes.
The forms module will be used by the wxgui window classes (fft, scope, waterfall...)
The forms module will be used in grc generated flowgraphs.
The forms module will be used by future gui apps (usrp siggen...).
Tasks:
Moved forms module into wxgui.
Modified *_window classes to use the forms module.
Added features to forms as required.
Removed pubsub aware forms in common.py.
Switched grc to use the forms module in wxgui.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11184 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-wxgui/src/python/const_window.py')
-rw-r--r-- | gr-wxgui/src/python/const_window.py | 68 |
1 files changed, 43 insertions, 25 deletions
diff --git a/gr-wxgui/src/python/const_window.py b/gr-wxgui/src/python/const_window.py index 8e0e61ac3..b128a4a98 100644 --- a/gr-wxgui/src/python/const_window.py +++ b/gr-wxgui/src/python/const_window.py @@ -30,6 +30,7 @@ import math import pubsub from constants import * from gnuradio import gr #for gr.prefs +import forms ################################################## # Constants @@ -63,34 +64,53 @@ class control_panel(wx.Panel): """ self.parent = parent wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER) - control_box = wx.BoxSizer(wx.VERTICAL) - self.marker_index = 2 - #begin control box - control_box.Add(common.LabelText(self, 'Options'), 0, wx.ALIGN_CENTER) + control_box = forms.static_box_sizer( + parent=self, label='Options', + bold=True, orient=wx.VERTICAL, + ) #alpha control_box.AddStretchSpacer() - alpha_slider = common.LogSliderController( - self, 'Alpha', - ALPHA_MIN_EXP, ALPHA_MAX_EXP, SLIDER_STEPS, - parent, ALPHA_KEY, + forms.text_box( + sizer=control_box, parent=self, label='Alpha', + converter=forms.float_converter(), + ps=parent, key=ALPHA_KEY, + ) + forms.log_slider( + sizer=control_box, parent=self, + min_exp=ALPHA_MIN_EXP, + max_exp=ALPHA_MAX_EXP, + num_steps=SLIDER_STEPS, + ps=parent, key=ALPHA_KEY, ) - control_box.Add(alpha_slider, 0, wx.EXPAND) #gain_mu control_box.AddStretchSpacer() - gain_mu_slider = common.LogSliderController( - self, 'Gain Mu', - GAIN_MU_MIN_EXP, GAIN_MU_MAX_EXP, SLIDER_STEPS, - parent, GAIN_MU_KEY, + forms.text_box( + sizer=control_box, parent=self, label='Gain Mu', + converter=forms.float_converter(), + ps=parent, key=GAIN_MU_KEY, + ) + forms.log_slider( + sizer=control_box, parent=self, + min_exp=GAIN_MU_MIN_EXP, + max_exp=GAIN_MU_MAX_EXP, + num_steps=SLIDER_STEPS, + ps=parent, key=GAIN_MU_KEY, ) - control_box.Add(gain_mu_slider, 0, wx.EXPAND) #marker control_box.AddStretchSpacer() - marker_chooser = common.DropDownController(self, MARKER_TYPES, parent, MARKER_KEY) - control_box.Add(common.LabelBox(self, 'Marker', marker_chooser), 0, wx.EXPAND) + forms.drop_down( + sizer=control_box, parent=self, + ps=parent, key=MARKER_KEY, label='Marker', + choices=map(lambda x: x[1], MARKER_TYPES), + labels=map(lambda x: x[0], MARKER_TYPES), + ) #run/stop control_box.AddStretchSpacer() - self.run_button = common.ToggleButtonController(self, parent, RUNNING_KEY, 'Stop', 'Run') - control_box.Add(self.run_button, 0, wx.EXPAND) + forms.toggle_button( + sizer=control_box, parent=self, + true_label='Stop', false_label='Run', + ps=parent, key=RUNNING_KEY, + ) #set sizer self.SetSizerAndFit(control_box) @@ -121,6 +141,11 @@ class const_window(wx.Panel, pubsub.pubsub): self.proxy(GAIN_OMEGA_KEY, controller, gain_omega_key) self.proxy(OMEGA_KEY, controller, omega_key) self.proxy(SAMPLE_RATE_KEY, controller, sample_rate_key) + #initialize values + self[RUNNING_KEY] = True + self[X_DIVS_KEY] = 8 + self[Y_DIVS_KEY] = 8 + self[MARKER_KEY] = DEFAULT_MARKER_TYPE #init panel and plot wx.Panel.__init__(self, parent, style=wx.SIMPLE_BORDER) self.plotter = plotter.channel_plotter(self) @@ -141,13 +166,6 @@ class const_window(wx.Panel, pubsub.pubsub): self.subscribe(ALPHA_KEY, set_beta) def set_gain_omega(gain_mu): self[GAIN_OMEGA_KEY] = .25*gain_mu**2 self.subscribe(GAIN_MU_KEY, set_gain_omega) - #initialize values - self[ALPHA_KEY] = self[ALPHA_KEY] - self[GAIN_MU_KEY] = self[GAIN_MU_KEY] - self[RUNNING_KEY] = True - self[X_DIVS_KEY] = 8 - self[Y_DIVS_KEY] = 8 - self[MARKER_KEY] = DEFAULT_MARKER_TYPE #register events self.subscribe(MSG_KEY, self.handle_msg) self.subscribe(X_DIVS_KEY, self.update_grid) |