diff options
author | Josh Blum <josh@joshknows.com> | 2011-01-20 22:31:31 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-03-01 17:02:06 -0800 |
commit | e30f0a7ca02801732ad7a25ab83e1d27dc45c6ce (patch) | |
tree | 4dce85c1bac97c380c243195ac8d05afa5afc7b2 /grc/python/Param.py | |
parent | a284640decd1fd6634f35bd1e20fd69b9194a7b6 (diff) |
grc: added tabbed widget in qtgui for grc
created gui_hint type to handle tab descriptor + position markup,
and to handle the generation of the name of the parent widget.
No support python modules required in gr-qtgui.
Diffstat (limited to 'grc/python/Param.py')
-rw-r--r-- | grc/python/Param.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/grc/python/Param.py b/grc/python/Param.py index 6dd008d1d0..27258faabb 100644 --- a/grc/python/Param.py +++ b/grc/python/Param.py @@ -99,7 +99,7 @@ class Param(_Param, _GUIParam): 'hex', 'string', 'bool', 'file_open', 'file_save', 'id', 'stream_id', - 'grid_pos', 'notebook', + 'grid_pos', 'notebook', 'gui_hint', 'import', ) @@ -354,6 +354,29 @@ class Param(_Param, _GUIParam): except: raise Exception, 'Stream ID "%s" is not found.'%v return v ######################### + # GUI Position/Hint + ######################### + elif t == 'gui_hint': + if ':' in v: tab, pos = v.split(':') + elif '@' in v: tab, pos = v, '' + else: tab, pos = '', v + + if '@' in tab: tab, index = tab.split('@') + else: index = '?' + + widget_str = ({ + (True, True): 'self.%(tab)s_grid_layout_%(index)s.addWidget(%(widget)s, %(pos)s)', + (True, False): 'self.%(tab)s_layout_%(index)s.addWidget(%(widget)s)', + (False, True): 'self.top_grid_layout.addWidget(%(widget)s, %(pos)s)', + (False, False): 'self.top_layout.addWidget(%(widget)s)', + }[bool(tab), bool(pos)])%{'tab': tab, 'index': index, 'widget': '%s', 'pos': pos} + + def gui_hint(ws, w): + if 'layout' in w: ws = ws.replace('addWidget', 'addLayout') + return ws%w + + return lambda w: gui_hint(widget_str, w) + ######################### # Grid Position Type ######################### elif t == 'grid_pos': |