diff options
Diffstat (limited to 'grc/src/grc_gnuradio/wxgui')
-rw-r--r-- | grc/src/grc_gnuradio/wxgui/Makefile.am | 4 | ||||
-rw-r--r-- | grc/src/grc_gnuradio/wxgui/__init__.py | 11 | ||||
-rw-r--r-- | grc/src/grc_gnuradio/wxgui/callback_controls.py | 32 | ||||
-rw-r--r-- | grc/src/grc_gnuradio/wxgui/top_block_gui.py | 11 |
4 files changed, 28 insertions, 30 deletions
diff --git a/grc/src/grc_gnuradio/wxgui/Makefile.am b/grc/src/grc_gnuradio/wxgui/Makefile.am index 2e7072eae..6f731f2cb 100644 --- a/grc/src/grc_gnuradio/wxgui/Makefile.am +++ b/grc/src/grc_gnuradio/wxgui/Makefile.am @@ -19,9 +19,9 @@ # Boston, MA 02110-1301, USA. # -include $(top_srcdir)/Makefile.common +include $(top_srcdir)/grc/Makefile.inc -ourpythondir = $(pythondir)/grc_gnuradio/wxgui +ourpythondir = $(grc_gnuradio_prefix)/wxgui ourpython_PYTHON = \ __init__.py \ diff --git a/grc/src/grc_gnuradio/wxgui/__init__.py b/grc/src/grc_gnuradio/wxgui/__init__.py index c0fdca52c..0b13ead9e 100644 --- a/grc/src/grc_gnuradio/wxgui/__init__.py +++ b/grc/src/grc_gnuradio/wxgui/__init__.py @@ -1,22 +1,22 @@ # 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. -# +# from callback_controls import \ button_control, \ @@ -27,4 +27,3 @@ from callback_controls import \ slider_vertical_control, \ text_box_control from top_block_gui import top_block_gui - diff --git a/grc/src/grc_gnuradio/wxgui/callback_controls.py b/grc/src/grc_gnuradio/wxgui/callback_controls.py index c1ba784eb..2bb0b994e 100644 --- a/grc/src/grc_gnuradio/wxgui/callback_controls.py +++ b/grc/src/grc_gnuradio/wxgui/callback_controls.py @@ -48,7 +48,7 @@ class _chooser_control_base(_control_base): """House a drop down or radio buttons for variable control.""" def __init__(self, window, callback, label='Label', index=0, choices=[0], labels=[]): - """! + """ Chooser contructor. Create the slider, text box, and label. @param window the wx parent window @@ -68,14 +68,14 @@ class _chooser_control_base(_control_base): self._init() def _handle_changed(self, event=None): - """! + """ A change is detected. Call the callback. """ try: self.call() except Exception, e: print >> sys.stderr, 'Error in exec callback from handle changed.\n', e def get_value(self): - """! + """ Update the chooser. @return one of the possible choices """ @@ -83,7 +83,7 @@ class _chooser_control_base(_control_base): return self.choices[self.index] ############################################################################################## -# Button Control +# Button Control ############################################################################################## class button_control(_chooser_control_base): """House a button for variable control.""" @@ -98,7 +98,7 @@ class button_control(_chooser_control_base): self.button.SetLabel(self.labels[self.index]) ############################################################################################## -# Drop Down Control +# Drop Down Control ############################################################################################## class drop_down_control(_chooser_control_base): """House a drop down for variable control.""" @@ -113,7 +113,7 @@ class drop_down_control(_chooser_control_base): self.index = self.drop_down.GetSelection() ############################################################################################## -# Radio Buttons Control +# Radio Buttons Control ############################################################################################## class _radio_buttons_control_base(_chooser_control_base): """House radio buttons for variable control.""" @@ -147,13 +147,13 @@ class radio_buttons_vertical_control(_radio_buttons_control_base): radio_button_align = wx.ALIGN_LEFT ############################################################################################## -# Slider Control +# Slider Control ############################################################################################## class _slider_control_base(_control_base): """House a Slider and a Text Box for variable control.""" def __init__(self, window, callback, label='Label', value=50, min=0, max=100, num_steps=100): - """! + """ Slider contructor. Create the slider, text box, and label. @param window the wx parent window @@ -191,14 +191,14 @@ class _slider_control_base(_control_base): self.text_box.SetValue(str(self._value)) def get_value(self): - """! + """ Get the current set value. @return the value (float) """ return self._value def _set_slider_value(self, real_value): - """! + """ Translate the real numerical value into a slider value and, write the value to the slider. @param real_value the numeric value the slider should represent @@ -207,7 +207,7 @@ class _slider_control_base(_control_base): self.slider.SetValue(slider_value) def _handle_scroll(self, event=None): - """! + """ A scroll event is detected. Read the slider, call the callback. """ slider_value = self.slider.GetValue() @@ -218,7 +218,7 @@ class _slider_control_base(_control_base): except Exception, e: print >> sys.stderr, 'Error in exec callback from handle scroll.\n', e def _handle_enter(self, event=None): - """! + """ An enter key was pressed. Read the text box, call the callback. """ new_value = float(self.text_box.GetValue()) @@ -237,13 +237,13 @@ class slider_vertical_control(_slider_control_base): slider_size = 20, 200 ############################################################################################## -# Text Box Control +# Text Box Control ############################################################################################## class text_box_control(_control_base): """House a Text Box for variable control.""" def __init__(self, window, callback, label='Label', value=50): - """! + """ Text box contructor. Create the text box, and label. @param window the wx parent window @@ -264,14 +264,14 @@ class text_box_control(_control_base): self.text_box.SetValue(str(value)) def get_value(self): - """! + """ Get the current set value. @return the value (float) """ return self._value def _handle_enter(self, event=None): - """! + """ An enter key was pressed. Read the text box, call the callback. If the text cannot be evaluated, do not try callback. """ diff --git a/grc/src/grc_gnuradio/wxgui/top_block_gui.py b/grc/src/grc_gnuradio/wxgui/top_block_gui.py index d56d20056..fef9d18ce 100644 --- a/grc/src/grc_gnuradio/wxgui/top_block_gui.py +++ b/grc/src/grc_gnuradio/wxgui/top_block_gui.py @@ -28,7 +28,7 @@ class top_block_gui(gr.top_block): """gr top block with wx gui app and grid sizer.""" def __init__(self, title='', size=default_gui_size, icon=None): - """! + """ Initialize the gr top block. Create the wx gui elements. @param title the main window title @@ -48,21 +48,21 @@ class top_block_gui(gr.top_block): self._wx_vbox = wx.BoxSizer(wx.VERTICAL) def GetWin(self): - """! + """ Get the window for wx elements to fit within. @return the wx frame """ return self._wx_frame def Add(self, win): - """! + """ Add a window to the wx vbox. @param win the wx window """ self._wx_vbox.Add(win, 0, wx.EXPAND) def GridAdd(self, win, row, col, row_span=1, col_span=1): - """! + """ Add a window to the wx grid at the given position. @param win the wx window @param row the row specification (integer >= 0) @@ -73,7 +73,7 @@ class top_block_gui(gr.top_block): self._wx_grid.Add(win, wx.GBPosition(row, col), wx.GBSpan(row_span, col_span), wx.EXPAND) def Run(self): - """! + """ Setup the wx gui elements. Start the gr top block. Block with the wx main loop. @@ -96,4 +96,3 @@ class top_block_gui(gr.top_block): gr.top_block.start(self) #blocking main loop self._wx_app.MainLoop() - |