[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 28/37: qtgui: adding a formatter to qtgui l
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 28/37: qtgui: adding a formatter to qtgui label widget to behave like formatter in the wxgui static text widget. |
Date: |
Thu, 17 Jul 2014 20:23:43 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
trondeau pushed a commit to branch master
in repository gnuradio.
commit 905188a3792f4a60ab6bf464375680b3e7c3dfab
Author: Tom Rondeau <address@hidden>
Date: Sat Jul 12 13:23:09 2014 -0400
qtgui: adding a formatter to qtgui label widget to behave like formatter in
the wxgui static text widget.
---
gr-qtgui/grc/qtgui_label.xml | 110 ++++++++++++++++++++++++++-----------------
1 file changed, 66 insertions(+), 44 deletions(-)
diff --git a/gr-qtgui/grc/qtgui_label.xml b/gr-qtgui/grc/qtgui_label.xml
index 40cf385..0d844a1 100644
--- a/gr-qtgui/grc/qtgui_label.xml
+++ b/gr-qtgui/grc/qtgui_label.xml
@@ -5,61 +5,83 @@
## a gui static text form
###################################################
-->
+
<block>
- <name>QT GUI Label</name>
- <key>variable_qtgui_label</key>
- <import>from PyQt4 import Qt</import>
- <import>from gnuradio import eng_notation</import>
- <var_make>self.$(id) = $(id) = $value</var_make>
- <make>#set $win = 'self._%s_tool_bar'%$id
+ <name>QT GUI Label</name>
+ <key>variable_qtgui_label</key>
+ <import>from PyQt4 import Qt</import>
+ <import>from gnuradio import eng_notation</import>
+ <var_make>self.$(id) = $(id) = $value</var_make>
+ <make>#set $win = 'self._%s_tool_bar'%$id
$win = Qt.QToolBar(self)
#if not $label()
#set $label = '"%s"'%$id
#end if
+
+if $(formatter):
+ self._$(id)_formatter = $formatter
+else:
+ self._$(id)_formatter = lambda x: x
+
$(win).addWidget(Qt.QLabel($label+": "))
-self._$(id)_label = Qt.QLabel(str(self.$id))
+self._$(id)_label = Qt.QLabel(str(self._$(id)_formatter(self.$id)))
self._$(id)_tool_bar.addWidget(self._$(id)_label)
-$(gui_hint()($win))</make>
- <callback>self.set_$(id)($value)</callback>
- <callback>Qt.QMetaObject.invokeMethod(self._$(id)_label, "setText",
Qt.Q_ARG("QString", $(type.str)($id)))</callback>
- <param>
- <name>Label</name>
- <key>label</key>
- <value></value>
- <type>string</type>
- <hide>#if $label() then 'none' else 'part'#</hide>
- </param>
- <param>
- <name>Type</name>
- <key>type</key>
- <value>int</value>
- <type>enum</type>
- <hide>part</hide>
-
<option><name>Float</name><key>real</key><opt>conv:eng_notation.str_to_num</opt><opt>str:eng_notation.num_to_str</opt></option>
-
<option><name>Integer</name><key>int</key><opt>conv:int</opt><opt>str:str</opt></option>
-
<option><name>String</name><key>string</key><opt>conv:str</opt><opt>str:str</opt></option>
-
<option><name>Boolean</name><key>bool</key><opt>conv:bool</opt><opt>str:str</opt></option>
-
<option><name>Any</name><key>raw</key><opt>conv:eval</opt><opt>str:repr</opt></option>
- </param>
- <param>
- <name>Default Value</name>
- <key>value</key>
- <value>0</value>
- <type>$type</type>
- </param>
- <param>
- <name>GUI Hint</name>
- <key>gui_hint</key>
- <value></value>
- <type>gui_hint</type>
- <hide>part</hide>
- </param>
- <doc>
+$(gui_hint()($win))
+ </make>
+
+ <callback>self.set_$(id)(self._$(id)_formatter($value))</callback>
+ <callback>Qt.QMetaObject.invokeMethod(self._$(id)_label, "setText",
Qt.Q_ARG("QString", $(type.str)($id)))</callback>
+
+ <param>
+ <name>Label</name>
+ <key>label</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $label() then 'none' else 'part'#</hide>
+ </param>
+
+ <param>
+ <name>Type</name>
+ <key>type</key>
+ <value>int</value>
+ <type>enum</type>
+ <hide>part</hide>
+
<option><name>Float</name><key>real</key><opt>conv:eng_notation.str_to_num</opt><opt>str:eng_notation.num_to_str</opt></option>
+
<option><name>Integer</name><key>int</key><opt>conv:int</opt><opt>str:str</opt></option>
+
<option><name>String</name><key>string</key><opt>conv:str</opt><opt>str:str</opt></option>
+
<option><name>Boolean</name><key>bool</key><opt>conv:bool</opt><opt>str:str</opt></option>
+
<option><name>Any</name><key>raw</key><opt>conv:eval</opt><opt>str:repr</opt></option>
+ </param>
+
+ <param>
+ <name>Default Value</name>
+ <key>value</key>
+ <value>0</value>
+ <type>$type</type>
+ </param>
+
+ <param>
+ <name>Formatter</name>
+ <key>formatter</key>
+ <value>None</value>
+ <type>raw</type>
+ <hide>part</hide>
+ </param>
+
+ <param>
+ <name>GUI Hint</name>
+ <key>gui_hint</key>
+ <value></value>
+ <type>gui_hint</type>
+ <hide>part</hide>
+ </param>
+
+ <doc>
This block creates a variable with a label widget for text. \
Leave the label blank to use the variable id as the label.
The GUI hint can be used to position the widget within the application. \
The hint is of the form address@hidden: [row, col, row_span, col_span]. \
Both the tab specification and the grid position are optional.
- </doc>
+ </doc>
</block>
- [Commit-gnuradio] [gnuradio] 24/37: qtgui: fixes waterfall plots., (continued)
- [Commit-gnuradio] [gnuradio] 24/37: qtgui: fixes waterfall plots., git, 2014/07/17
- [Commit-gnuradio] [gnuradio] 25/37: qtgui: adding menu item to frequency sink to set y min/max., git, 2014/07/17
- [Commit-gnuradio] [gnuradio] 14/37: grc: fixing xml files of some blocks with message control ports to be able to hide/show them as wanted., git, 2014/07/17
- [Commit-gnuradio] [gnuradio] 21/37: qtgui: updates number sink behavor., git, 2014/07/17
- [Commit-gnuradio] [gnuradio] 20/37: grc: toogle action to disable auto-hiding port labels, git, 2014/07/17
- [Commit-gnuradio] [gnuradio] 19/37: grc: auto-hide port labels, git, 2014/07/17
- [Commit-gnuradio] [gnuradio] 34/37: Merge remote-tracking branch 'mbant/uhd/msg_format' into qt_the_things, git, 2014/07/17
- [Commit-gnuradio] [gnuradio] 30/37: qtgui: minor fix to how number sink handles autoscale., git, 2014/07/17
- [Commit-gnuradio] [gnuradio] 37/37: Merge branch 'qt_the_things', git, 2014/07/17
- [Commit-gnuradio] [gnuradio] 29/37: Merge remote-tracking branch 'mbant/qtify-examples', git, 2014/07/17
- [Commit-gnuradio] [gnuradio] 28/37: qtgui: adding a formatter to qtgui label widget to behave like formatter in the wxgui static text widget.,
git <=
- [Commit-gnuradio] [gnuradio] 32/37: zeromq: updated zeromq examples to use qtgui., git, 2014/07/17
- [Commit-gnuradio] [gnuradio] 35/37: fec: updated fecapi blocks in grc to use new var_value concept., git, 2014/07/17
- [Commit-gnuradio] [gnuradio] 36/37: Merge branch 'maint', git, 2014/07/17
- [Commit-gnuradio] [gnuradio] 31/37: examples: minor tweaks to some examples., git, 2014/07/17
- [Commit-gnuradio] [gnuradio] 33/37: fcd: updating FCD examples to use qtgui., git, 2014/07/17
- [Commit-gnuradio] [gnuradio] 26/37: examples: fixed a few examples still using old style blocks., git, 2014/07/17
- [Commit-gnuradio] [gnuradio] 27/37: examples: Ported examples in GNU Radio tree to QT., git, 2014/07/17