[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 02/11: qtgui: fixed thread-safety in GRC va
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 02/11: qtgui: fixed thread-safety in GRC variable-type blocks |
Date: |
Thu, 9 Jan 2014 21:52:39 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
trondeau pushed a commit to branch maint
in repository gnuradio.
commit f64aa10b5bd035c5d6248e67243228fb706e204e
Author: Artem Pisarenko <address@hidden>
Date: Thu Dec 26 16:33:17 2013 +0700
qtgui: fixed thread-safety in GRC variable-type blocks
---
gr-qtgui/grc/qtgui_check_box.xml | 2 +-
gr-qtgui/grc/qtgui_chooser.xml | 13 ++++++++++---
gr-qtgui/grc/qtgui_entry.xml | 2 +-
gr-qtgui/grc/qtgui_label.xml | 2 +-
gr-qtgui/grc/qtgui_range.xml | 29 +++++++++++++++++++++--------
5 files changed, 34 insertions(+), 14 deletions(-)
diff --git a/gr-qtgui/grc/qtgui_check_box.xml b/gr-qtgui/grc/qtgui_check_box.xml
index e3a00d0..67c8848 100644
--- a/gr-qtgui/grc/qtgui_check_box.xml
+++ b/gr-qtgui/grc/qtgui_check_box.xml
@@ -17,7 +17,7 @@
$win = Qt.QCheckBox($label)
self._$(id)_choices = {True: $true, False: $false}
self._$(id)_choices_inv = dict((v,k) for k,v in
self._$(id)_choices.iteritems())
-self._$(id)_callback = lambda i: $(win).setChecked(self._$(id)_choices_inv[i])
+self._$(id)_callback = lambda i: Qt.QMetaObject.invokeMethod($(win),
"setChecked", Qt.Q_ARG("bool", self._$(id)_choices_inv[i]))
self._$(id)_callback(self.$id)
$(win).stateChanged.connect(lambda i:
self.set_$(id)(self._$(id)_choices[bool(i)]))
$(gui_hint()($win))</make>
diff --git a/gr-qtgui/grc/qtgui_chooser.xml b/gr-qtgui/grc/qtgui_chooser.xml
index 6a8760c..f018354 100644
--- a/gr-qtgui/grc/qtgui_chooser.xml
+++ b/gr-qtgui/grc/qtgui_chooser.xml
@@ -9,6 +9,7 @@
<name>QT GUI Chooser</name>
<key>variable_qtgui_chooser</key>
<import>from PyQt4 import Qt</import>
+ <import>from PyQt4.QtCore import QObject, pyqtSlot</import>
<var_make>self.$(id) = $(id) = $value</var_make>
<make>#slurp
#set $all_options = [$option0, $option1, $option2, $option3,
$option4][:int($num_opts())]
@@ -56,7 +57,7 @@ $(win).addWidget(Qt.QLabel($label+": "))
self._$(id)_combo_box = Qt.QComboBox()
$(win).addWidget(self._$(id)_combo_box)
for label in self._$(id)_labels: self._$(id)_combo_box.addItem(label)
-self._$(id)_callback = lambda i:
self._$(id)_combo_box.setCurrentIndex(self._$(id)_options.index(i))
+self._$(id)_callback = lambda i:
Qt.QMetaObject.invokeMethod(self._$(id)_combo_box, "setCurrentIndex",
Qt.Q_ARG("int", self._$(id)_options.index(i)))
self._$(id)_callback(self.$id)
self._$(id)_combo_box.currentIndexChanged.connect(
lambda i: self.set_$(id)(self._$(id)_options[i]))
@@ -68,13 +69,19 @@ self._$(id)_combo_box.currentIndexChanged.connect(
#set $win = 'self._%s_group_box'%$id
$win = Qt.QGroupBox($label)
self._$(id)_box = $(orient)()
-self._$(id)_button_group = Qt.QButtonGroup()
+class variable_chooser_button_group(Qt.QButtonGroup):
+ def __init__(self, parent=None):
+ Qt.QButtonGroup.__init__(self, parent)
+ @pyqtSlot(int)
+ def updateButtonChecked(self, button_id):
+ self.button(button_id).setChecked(True)
+self._$(id)_button_group = variable_chooser_button_group()
$(win).setLayout(self._$(id)_box)
for i, label in enumerate(self._$(id)_labels):
radio_button = Qt.QRadioButton(label)
self._$(id)_box.addWidget(radio_button)
self._$(id)_button_group.addButton(radio_button, i)
-self._$(id)_callback = lambda i:
self._$(id)_button_group.button(self._$(id)_options.index(i)).setChecked(True)
+self._$(id)_callback = lambda i:
Qt.QMetaObject.invokeMethod(self._$(id)_button_group, "updateButtonChecked",
Qt.Q_ARG("int", self._$(id)_options.index(i)))
self._$(id)_callback(self.$id)
self._$(id)_button_group.buttonClicked[int].connect(
lambda i: self.set_$(id)(self._$(id)_options[i]))
diff --git a/gr-qtgui/grc/qtgui_entry.xml b/gr-qtgui/grc/qtgui_entry.xml
index 514071a..6de6330 100644
--- a/gr-qtgui/grc/qtgui_entry.xml
+++ b/gr-qtgui/grc/qtgui_entry.xml
@@ -23,7 +23,7 @@ self._$(id)_line_edit.returnPressed.connect(
lambda:
self.set_$(id)($(type.conv)(self._$(id)_line_edit.text().toAscii())))
$(gui_hint()($win))</make>
<callback>self.set_$(id)($value)</callback>
- <callback>self._$(id)_line_edit.setText($(type.str)($id))</callback>
+ <callback>Qt.QMetaObject.invokeMethod(self._$(id)_line_edit, "setText",
Qt.Q_ARG("QString", $(type.str)($id)))</callback>
<param>
<name>Label</name>
<key>label</key>
diff --git a/gr-qtgui/grc/qtgui_label.xml b/gr-qtgui/grc/qtgui_label.xml
index 3615574..40cf385 100644
--- a/gr-qtgui/grc/qtgui_label.xml
+++ b/gr-qtgui/grc/qtgui_label.xml
@@ -21,7 +21,7 @@ self._$(id)_label = Qt.QLabel(str(self.$id))
self._$(id)_tool_bar.addWidget(self._$(id)_label)
$(gui_hint()($win))</make>
<callback>self.set_$(id)($value)</callback>
- <callback>self._$(id)_label.setText($(type.str)($id))</callback>
+ <callback>Qt.QMetaObject.invokeMethod(self._$(id)_label, "setText",
Qt.Q_ARG("QString", $(type.str)($id)))</callback>
<param>
<name>Label</name>
<key>label</key>
diff --git a/gr-qtgui/grc/qtgui_range.xml b/gr-qtgui/grc/qtgui_range.xml
index f2d42f1..d7e7c0a 100644
--- a/gr-qtgui/grc/qtgui_range.xml
+++ b/gr-qtgui/grc/qtgui_range.xml
@@ -9,6 +9,7 @@
<name>QT GUI Range</name>
<key>variable_qtgui_range</key>
<import>from PyQt4 import Qt</import>
+ <import>from PyQt4.QtCore import QObject, pyqtSlot</import>
<import>import PyQt4.Qwt5 as Qwt</import>
<var_make>self.$(id) = $(id) = $value</var_make>
<make>#set $win = 'self._%s_layout'%$id
@@ -53,7 +54,13 @@ $(win).addWidget(self._$(id)_label)
########################################################################
$win = Qt.QHBoxLayout()
$(win).addWidget(Qt.QLabel($label+": "))
-self._$(id)_counter = Qwt.QwtCounter()
+class qwt_counter_fixed(Qwt.QwtCounter):
+ def __init__(self, parent=None):
+ Qwt.QwtCounter.__init__(self, parent)
+ @pyqtSlot('double')
+ def setValue(self, value):
+ super(Qwt.QwtCounter, self).setValue(value)
+self._$(id)_counter = qwt_counter_fixed()
self._$(id)_counter.setRange($start, $stop, $step)
self._$(id)_counter.setNumButtons(2)
self._$(id)_counter.setMinimumWidth($min_len)
@@ -88,7 +95,13 @@ $win = Qt.QVBoxLayout()
self._$(id)_tool_bar = Qt.QToolBar(self)
$(win).addWidget(self._$(id)_tool_bar)
self._$(id)_tool_bar.addWidget(Qt.QLabel($label+": "))
-self._$(id)_counter = Qwt.QwtCounter()
+class qwt_counter_fixed(Qwt.QwtCounter):
+ def __init__(self, parent=None):
+ Qwt.QwtCounter.__init__(self, parent)
+ @pyqtSlot('double')
+ def setValue(self, value):
+ super(Qwt.QwtCounter, self).setValue(value)
+self._$(id)_counter = qwt_counter_fixed()
self._$(id)_counter.setRange($start, $stop, $step)
self._$(id)_counter.setNumButtons(2)
self._$(id)_counter.setValue(self.$id)
@@ -104,20 +117,20 @@ $(win).addWidget(self._$(id)_slider)
$(gui_hint()($win))</make>
<callback>self.set_$(id)($value)</callback>
<callback>#if $widget() == "knob"
-self._$(id)_knob.setValue($id)
+Qt.QMetaObject.invokeMethod(self._$(id)_knob, "setValue", Qt.Q_ARG("double",
$id))
#end if
#if $widget() == "thermo"
-self._$(id)_thermo.setValue($id)
+Qt.QMetaObject.invokeMethod(self._$(id)_thermo, "setValue", Qt.Q_ARG("double",
$id))
#end if
#if $widget() == "counter"
-self._$(id)_counter.setValue($id)
+Qt.QMetaObject.invokeMethod(self._$(id)_counter, "setValue",
Qt.Q_ARG("double", $id))
#end if
#if $widget() == "slider"
-self._$(id)_slider.setValue($id)
+Qt.QMetaObject.invokeMethod(self._$(id)_slider, "setValue", Qt.Q_ARG("double",
$id))
#end if
#if $widget() == "counter_slider"
-self._$(id)_counter.setValue($id)
-self._$(id)_slider.setValue($id)
+Qt.QMetaObject.invokeMethod(self._$(id)_counter, "setValue",
Qt.Q_ARG("double", $id))
+Qt.QMetaObject.invokeMethod(self._$(id)_slider, "setValue", Qt.Q_ARG("double",
$id))
#end if</callback>
<param>
<name>Label</name>
- [Commit-gnuradio] [gnuradio] 01/11: runtime: Disable CPU_SET macros for FreeBSD., (continued)
- [Commit-gnuradio] [gnuradio] 01/11: runtime: Disable CPU_SET macros for FreeBSD., git, 2014/01/09
- [Commit-gnuradio] [gnuradio] 05/11: volk: some versions of clang have problems with cvtpi32_ps., git, 2014/01/09
- [Commit-gnuradio] [gnuradio] 03/11: qtgui: fixed naming of classes for long-term use., git, 2014/01/09
- [Commit-gnuradio] [gnuradio] 11/11: grc: fix variable vlen for grc generated hier blocks, git, 2014/01/09
- [Commit-gnuradio] [gnuradio] 09/11: cmake: If Ice 3.4 found, check version of GCC and disable if >= 4.7., git, 2014/01/09
- [Commit-gnuradio] [gnuradio] 04/11: volk: clang sets GNUC_MINOR only to 2, so we need to check if we're building with clang. This patch enables xgetbv for clang >= 3.0., git, 2014/01/09
- [Commit-gnuradio] [gnuradio] 06/11: volk: test for clang version; if less than 3.2, disable SSE4a machine due to a bug in the compiler support., git, 2014/01/09
- [Commit-gnuradio] [gnuradio] 08/11: analog: additional docs for noise sources., git, 2014/01/09
- [Commit-gnuradio] [gnuradio] 10/11: volk: modifying tests for AVX and SSE4a support in compiler/CPU., git, 2014/01/09
- [Commit-gnuradio] [gnuradio] 07/11: filter: fixed an issue with filter delays for interp and rational_resampler filters., git, 2014/01/09
- [Commit-gnuradio] [gnuradio] 02/11: qtgui: fixed thread-safety in GRC variable-type blocks,
git <=