diff options
author | Josh Blum | 2009-09-06 01:58:25 -0700 |
---|---|---|
committer | Josh Blum | 2009-09-06 01:58:25 -0700 |
commit | 6b1d8817a7fc6dd99a770cb11fac7ca48a3c81b0 (patch) | |
tree | 9afb4f16562d64aa44682fb9b7d19fbc2031e9b1 | |
parent | e39507bf32666f9b17d2249106aac0d6cbcacc58 (diff) | |
download | gnuradio-6b1d8817a7fc6dd99a770cb11fac7ca48a3c81b0.tar.gz gnuradio-6b1d8817a7fc6dd99a770cb11fac7ca48a3c81b0.tar.bz2 gnuradio-6b1d8817a7fc6dd99a770cb11fac7ca48a3c81b0.zip |
Fixed the usrp and usrp2 probe scripts to work with the new gui param api.
Also fixed the scripts to work since they were broken by previous changes.
Get input in param class now pases a param instance (self) into the object.
-rw-r--r-- | grc/gui/Param.py | 14 | ||||
-rw-r--r-- | grc/gui/PropsDialog.py | 2 | ||||
-rw-r--r-- | grc/python/Param.py | 2 | ||||
-rwxr-xr-x | grc/scripts/usrp2_probe | 13 | ||||
-rwxr-xr-x | grc/scripts/usrp_probe | 13 | ||||
-rw-r--r-- | grc/todo.txt | 1 |
6 files changed, 27 insertions, 18 deletions
diff --git a/grc/gui/Param.py b/grc/gui/Param.py index b84598e61..7fabb6671 100644 --- a/grc/gui/Param.py +++ b/grc/gui/Param.py @@ -30,7 +30,7 @@ class InputParam(gtk.HBox): gtk.HBox.__init__(self) self.param = param self._callback = callback - self.label = gtk.Label('') #no label, markup is added by set_markup + self.label = gtk.Label() #no label, markup is added by set_markup self.label.set_size_request(150, -1) self.pack_start(self.label, False) self.set_markup = lambda m: self.label.set_markup(m) @@ -66,7 +66,11 @@ class InputParam(gtk.HBox): self.param.set_value(self.get_text()) #call the callback if self._callback: self._callback() - #self.update() #dont update here, parent will update + else: + #no callback mode (used in supporting gui scripts) + #internally re-validate the param and update the gui + self.param.validate() + self.update() class EntryParam(InputParam): """Provide an entry box for strings and numbers.""" @@ -155,9 +159,9 @@ class Param(Element): All others get a standard entry parameter. @return gtk input class """ - if self.is_enum(): return EnumParam(*args, **kwargs) - if self.get_options(): return EnumEntryParam(*args, **kwargs) - return EntryParam(*args, **kwargs) + if self.is_enum(): return EnumParam(self, *args, **kwargs) + if self.get_options(): return EnumEntryParam(self, *args, **kwargs) + return EntryParam(self, *args, **kwargs) def get_layout(self): """ diff --git a/grc/gui/PropsDialog.py b/grc/gui/PropsDialog.py index aa86f7214..34fd7ec17 100644 --- a/grc/gui/PropsDialog.py +++ b/grc/gui/PropsDialog.py @@ -123,7 +123,7 @@ class PropsDialog(gtk.Dialog): io_param.destroy() #repopulate the params box for param in self._block.get_params(): - io_param = param.get_input(param, callback=self._update) + io_param = param.get_input(self._update) self._input_object_params.append(io_param) self._params_box.pack_start(io_param, False) #update the gui inputs diff --git a/grc/python/Param.py b/grc/python/Param.py index c64659a08..387fab548 100644 --- a/grc/python/Param.py +++ b/grc/python/Param.py @@ -154,7 +154,7 @@ class Param(_Param, _GUIParam): return dt_str def get_input(self, *args, **kwargs): - if self.get_type() in ('file_open', 'file_save'): return FileParam(*args, **kwargs) + if self.get_type() in ('file_open', 'file_save'): return FileParam(self, *args, **kwargs) return _GUIParam.get_input(self, *args, **kwargs) def get_color(self): diff --git a/grc/scripts/usrp2_probe b/grc/scripts/usrp2_probe index 00d4366dd..689d41ecb 100755 --- a/grc/scripts/usrp2_probe +++ b/grc/scripts/usrp2_probe @@ -32,9 +32,6 @@ from gnuradio.grc.gui.Dialogs import TextDisplay from gnuradio.grc.python.Platform import Platform platform = Platform() -from gnuradio.grc.gui.Platform import Platform -platform = Platform(platform) - flow_graph = platform.get_new_flow_graph() block = flow_graph.get_new_block('usrp2_probe') @@ -42,6 +39,12 @@ block = flow_graph.get_new_block('usrp2_probe') usrp_interface_param = block.get_param('interface') usrp_type_param = block.get_param('type') +def get_input(param): + param.validate() + input = param.get_input() + input.update() + return input + class USRP2ProbeWindow(gtk.Window): """ The main window for USRP Dignostics. @@ -69,8 +72,8 @@ class USRP2ProbeWindow(gtk.Window): #create vbox for storage vbox = gtk.VBox() frame.add(vbox) - vbox.pack_start(usrp_interface_param.get_input_object(), False) - vbox.pack_start(usrp_type_param.get_input_object(), False) + vbox.pack_start(get_input(usrp_interface_param), False) + vbox.pack_start(get_input(usrp_type_param), False) #make the tree model for holding mac addrs self.treestore = gtk.TreeStore(gobject.TYPE_STRING) self.treeview = gtk.TreeView(self.treestore) diff --git a/grc/scripts/usrp_probe b/grc/scripts/usrp_probe index 6565612c1..985d481ce 100755 --- a/grc/scripts/usrp_probe +++ b/grc/scripts/usrp_probe @@ -30,9 +30,6 @@ from gnuradio.grc.gui.Dialogs import TextDisplay from gnuradio.grc.python.Platform import Platform platform = Platform() -from gnuradio.grc.gui.Platform import Platform -platform = Platform(platform) - flow_graph = platform.get_new_flow_graph() block = flow_graph.get_new_block('usrp_probe') @@ -40,6 +37,12 @@ block = flow_graph.get_new_block('usrp_probe') usrp_which_param = block.get_param('which') usrp_dboard_param = block.get_param('dboard') +def get_input(param): + param.validate() + input = param.get_input() + input.update() + return input + class USRPProbeWindow(gtk.Window): """ The main window for USRP Dignostics. @@ -66,8 +69,8 @@ class USRPProbeWindow(gtk.Window): #create vbox for storage vbox = gtk.VBox() frame.add(vbox) - vbox.pack_start(usrp_which_param.get_input_object(), False) - vbox.pack_start(usrp_dboard_param.get_input_object(), False) + vbox.pack_start(get_input(usrp_which_param), False) + vbox.pack_start(get_input(usrp_dboard_param), False) self.probe_button = gtk.Button('Probe') self.probe_button.connect('clicked', self._probe_usrp) vbox.pack_start(self.probe_button, False) diff --git a/grc/todo.txt b/grc/todo.txt index c675859d1..b4e3af39d 100644 --- a/grc/todo.txt +++ b/grc/todo.txt @@ -69,7 +69,6 @@ * threads dont die on exit in probe and variable sink * align param titles in properties dialog * weird grid params misbehaving -* fix param input stuff for usrp probes ################################################## # Future |