summaryrefslogtreecommitdiff
path: root/grc/python/Param.py
diff options
context:
space:
mode:
authorJohnathan Corgan <jcorgan@corganenterprises.com>2011-03-14 20:07:36 -0700
committerJohnathan Corgan <jcorgan@corganenterprises.com>2011-03-14 20:07:36 -0700
commit22deb62a872413bdeff63e4fb565b4bcce2c6508 (patch)
tree79571572f1f130b5153019d70d31b2c868cf0b97 /grc/python/Param.py
parentf3d373492fe415ced2bbf0be3f8e6da66576fcdc (diff)
parent4d5096c8b084c5832256dc2cd8bb617ee93d94a4 (diff)
Merge remote branch 'jblum/mergeme/qtgui/grc' into next
* jblum/mergeme/qtgui/grc: (27 commits) qtgui: removed python directory that was added, never used qtgui-grc: added suport in main template for theme icon qtgui-grc: minor tweaks to the various things qtgui-grc: added read-only thermo widget to range block qtgui-grc: fix for list option working in chooser block qtgui-grc: added check for pyqwt in config grc: added function args to probe block and documentation grc: rework the probe blocks and how they fit into grc qtgui-grc: moved slider to range, added knob and gui tweaks qtgui-grc: use a vboxlayout for the top_layout qtgui-grc: made slider widget components (counter/slider) optional qtgui-grc: add engineering notation to entry and label + other tweaks qtgui-grc: enable start/stop control through qt widgets qtgui-grc: rename the text entry and label blocks grc-qtgui: creaded check box widget with qtgui, cleanup label code grc-qtgui: added variable text box and static text widgets grc-qtgui: pick correct signal overload for variable chooser grc-qtgui: added radio button support, tweaks, more options grc-qtgui: work on variable chooser block grc: work on generator for gui flowgraphs to simplify generation ...
Diffstat (limited to 'grc/python/Param.py')
-rw-r--r--grc/python/Param.py27
1 files changed, 25 insertions, 2 deletions
diff --git a/grc/python/Param.py b/grc/python/Param.py
index 6dd008d1d0..303ab3ed8b 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':