diff options
author | Tom Rondeau | 2011-03-15 13:46:02 -0400 |
---|---|---|
committer | Tom Rondeau | 2011-03-15 13:46:02 -0400 |
commit | 338b01e7b5ecad7e324098a2671d3fa650be035e (patch) | |
tree | 247b61f2fbfdadc6ce4f39ad2f637a22cd3163ae /grc/python/Param.py | |
parent | 1ecc511ad673f37498ebc29147c776ca9b4b6490 (diff) | |
parent | b4bd3e47189932b42ce821bb7076fce811b3e3eb (diff) | |
download | gnuradio-338b01e7b5ecad7e324098a2671d3fa650be035e.tar.gz gnuradio-338b01e7b5ecad7e324098a2671d3fa650be035e.tar.bz2 gnuradio-338b01e7b5ecad7e324098a2671d3fa650be035e.zip |
Merge branch 'next' of gnuradio.org:gnuradio into next
Diffstat (limited to 'grc/python/Param.py')
-rw-r--r-- | grc/python/Param.py | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/grc/python/Param.py b/grc/python/Param.py index 6dd008d1d..303ab3ed8 100644 --- a/grc/python/Param.py +++ b/grc/python/Param.py @@ -1,5 +1,5 @@ """ -Copyright 2008, 2009, 2010 Free Software Foundation, Inc. +Copyright 2008-2011 Free Software Foundation, Inc. This file is part of GNU Radio GNU Radio Companion is free software; you can redistribute it and/or @@ -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': |