From 7ed83c72dbd079a50a421661a874c3ac94a34bd6 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 5 Dec 2010 17:21:07 -0500 Subject: grc: added qtgui support to grc (just added sink) --- grc/python/flow_graph.tmpl | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'grc/python/flow_graph.tmpl') diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl index a1a9308aa..676da33b4 100644 --- a/grc/python/flow_graph.tmpl +++ b/grc/python/flow_graph.tmpl @@ -59,6 +59,12 @@ class $(class_name)(grc_wxgui.top_block_gui): _icon_path = "$icon.get_filename()" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) #end if +#elif $generate_options == 'qt_gui' +class $(class_name)(gr.top_block): + + def __init__($param_str): + gr.top_block.__init__(self, "$title") + self.qapp = QtGui.QApplication(sys.argv) #elif $generate_options == 'no_gui' class $(class_name)(gr.top_block): @@ -242,6 +248,9 @@ if __name__ == '__main__': tb = $(class_name)($(', '.join($params_eq_list))) #if $generate_options == 'wx_gui' tb.Run($flow_graph.get_option('run')) + #elif $generate_options == 'qt_gui' + tb.start() + tb.qapp.exec_() #elif $generate_options == 'no_gui' #set $run_options = $flow_graph.get_option('run_options') #if $run_options == 'prompt' -- cgit From 9ae8997e5f682bc16e58c0a0bba21794dbd705c5 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 6 Dec 2010 22:46:39 -0500 Subject: qtgui: created a forms module with a slider and text box, implemented in grc --- grc/python/flow_graph.tmpl | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'grc/python/flow_graph.tmpl') diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl index 676da33b4..108e15ca0 100644 --- a/grc/python/flow_graph.tmpl +++ b/grc/python/flow_graph.tmpl @@ -60,11 +60,12 @@ class $(class_name)(grc_wxgui.top_block_gui): self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) #end if #elif $generate_options == 'qt_gui' -class $(class_name)(gr.top_block): +class $(class_name)(gr.top_block, QtGui.QWidget): def __init__($param_str): gr.top_block.__init__(self, "$title") - self.qapp = QtGui.QApplication(sys.argv) + QtGui.QWidget.__init__(self) + self.layout = QtGui.QBoxLayout(QtGui.QBoxLayout.TopToBottom, self) #elif $generate_options == 'no_gui' class $(class_name)(gr.top_block): @@ -245,15 +246,19 @@ if __name__ == '__main__': if gr.enable_realtime_scheduling() != gr.RT_OK: print "Error: failed to enable realtime scheduling." #end if - tb = $(class_name)($(', '.join($params_eq_list))) #if $generate_options == 'wx_gui' + tb = $(class_name)($(', '.join($params_eq_list))) tb.Run($flow_graph.get_option('run')) #elif $generate_options == 'qt_gui' + qapp = QtGui.QApplication(sys.argv) + tb = $(class_name)($(', '.join($params_eq_list))) tb.start() - tb.qapp.exec_() + tb.show() + qapp.exec_() #elif $generate_options == 'no_gui' #set $run_options = $flow_graph.get_option('run_options') #if $run_options == 'prompt' + tb = $(class_name)($(', '.join($params_eq_list))) tb.start() raw_input('Press Enter to quit: ') tb.stop() -- cgit From e30f0a7ca02801732ad7a25ab83e1d27dc45c6ce Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 20 Jan 2011 22:31:31 -0800 Subject: 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. --- grc/python/flow_graph.tmpl | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'grc/python/flow_graph.tmpl') diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl index 108e15ca0..88049a9ef 100644 --- a/grc/python/flow_graph.tmpl +++ b/grc/python/flow_graph.tmpl @@ -60,12 +60,14 @@ class $(class_name)(grc_wxgui.top_block_gui): self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) #end if #elif $generate_options == 'qt_gui' -class $(class_name)(gr.top_block, QtGui.QWidget): +class $(class_name)(gr.top_block, Qt.QWidget): def __init__($param_str): gr.top_block.__init__(self, "$title") - QtGui.QWidget.__init__(self) - self.layout = QtGui.QBoxLayout(QtGui.QBoxLayout.TopToBottom, self) + Qt.QWidget.__init__(self) + self.top_layout = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self) + self.top_grid_layout = Qt.QGridLayout() + self.top_layout.addLayout(self.top_grid_layout) #elif $generate_options == 'no_gui' class $(class_name)(gr.top_block): @@ -203,6 +205,9 @@ self.$port.get_parent().get_id()#slurp ######################################################## #for $var in $parameters + $variables #set $id = $var.get_id() + def get_$(id)(self): + return self.$id + def set_$(id)(self, $id): self.$id = $id #for $callback in $var_id2cbs[$id] @@ -250,7 +255,7 @@ if __name__ == '__main__': tb = $(class_name)($(', '.join($params_eq_list))) tb.Run($flow_graph.get_option('run')) #elif $generate_options == 'qt_gui' - qapp = QtGui.QApplication(sys.argv) + qapp = Qt.QApplication(sys.argv) tb = $(class_name)($(', '.join($params_eq_list))) tb.start() tb.show() -- cgit From 47f621a14c9a6e3696155dd5a223da40bcb7721c Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 27 Feb 2011 23:18:11 -0800 Subject: grc: work on generator for gui flowgraphs to simplify generation generator does not differentiate between notebooks and controls, they are all block, but block are now sorted by variables present in the make also adjusted categories listed in the wx and qt widget related blocks --- grc/python/flow_graph.tmpl | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) (limited to 'grc/python/flow_graph.tmpl') diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl index 88049a9ef..8757b5204 100644 --- a/grc/python/flow_graph.tmpl +++ b/grc/python/flow_graph.tmpl @@ -5,8 +5,6 @@ ##@param imports the import statements ##@param flow_graph the flow_graph ##@param variables the variable blocks -##@param notebooks a list of notebook blocks -##@param controls the variables with gui controls ##@param parameters the paramater blocks ##@param blocks the signal blocks ##@param connections the connections @@ -121,30 +119,6 @@ gr.io_signaturev($(len($io_sigs)), $(len($io_sigs)), [$(', '.join($size_strs))]) $indent($var.get_var_make()) #end for ######################################################## -##Create Notebooks -######################################################## -#if $notebooks - - $DIVIDER - # Notebooks - $DIVIDER -#end if -#for $notebook in $notebooks - $indent($notebook.get_make()) -#end for -######################################################## -##Create Controls -######################################################## -#if $controls - - $DIVIDER - # Controls - $DIVIDER -#end if -#for $ctrl in $controls - $indent($ctrl.get_make()) -#end for -######################################################## ##Create Message Queues ######################################################## #if $messages @@ -166,7 +140,11 @@ gr.io_signaturev($(len($io_sigs)), $(len($io_sigs)), [$(', '.join($size_strs))]) $DIVIDER #end if #for $blk in filter(lambda b: b.get_make(), $blocks) + #if $blk in $variables + $indent($blk.get_make()) + #else self.$blk.get_id() = $indent($blk.get_make()) + #end if #end for ######################################################## ##Create Connections -- cgit From fedf4fbc9d217926ecbb1917d3c995516d88a8a9 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 1 Mar 2011 18:18:53 -0800 Subject: qtgui-grc: enable start/stop control through qt widgets --- grc/python/flow_graph.tmpl | 2 ++ 1 file changed, 2 insertions(+) (limited to 'grc/python/flow_graph.tmpl') diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl index 8757b5204..854d83967 100644 --- a/grc/python/flow_graph.tmpl +++ b/grc/python/flow_graph.tmpl @@ -235,7 +235,9 @@ if __name__ == '__main__': #elif $generate_options == 'qt_gui' qapp = Qt.QApplication(sys.argv) tb = $(class_name)($(', '.join($params_eq_list))) + #if $flow_graph.get_option('run') tb.start() + #end if tb.show() qapp.exec_() #elif $generate_options == 'no_gui' -- cgit From 028f105b345c937f69aa5701e0de7761a2c6fcf3 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 4 Mar 2011 09:08:37 -0800 Subject: qtgui-grc: use a vboxlayout for the top_layout --- grc/python/flow_graph.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'grc/python/flow_graph.tmpl') diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl index 854d83967..070ad7ed1 100644 --- a/grc/python/flow_graph.tmpl +++ b/grc/python/flow_graph.tmpl @@ -63,7 +63,7 @@ class $(class_name)(gr.top_block, Qt.QWidget): def __init__($param_str): gr.top_block.__init__(self, "$title") Qt.QWidget.__init__(self) - self.top_layout = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self) + self.top_layout = Qt.QVBoxLayout(self) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) #elif $generate_options == 'no_gui' -- cgit From 9121b75d68a0c90deee814edffe387480b52019b Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 7 Mar 2011 18:40:57 -0800 Subject: qtgui-grc: minor tweaks to the various things --- grc/python/flow_graph.tmpl | 1 + 1 file changed, 1 insertion(+) (limited to 'grc/python/flow_graph.tmpl') diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl index 070ad7ed1..1aea58838 100644 --- a/grc/python/flow_graph.tmpl +++ b/grc/python/flow_graph.tmpl @@ -235,6 +235,7 @@ if __name__ == '__main__': #elif $generate_options == 'qt_gui' qapp = Qt.QApplication(sys.argv) tb = $(class_name)($(', '.join($params_eq_list))) + tb.setWindowTitle("$title") #if $flow_graph.get_option('run') tb.start() #end if -- cgit From c86acebd1ab6adf994f49dab1669fcbbb6324637 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 7 Mar 2011 23:52:40 -0800 Subject: qtgui-grc: added suport in main template for theme icon --- grc/python/flow_graph.tmpl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'grc/python/flow_graph.tmpl') diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl index 1aea58838..5aaa99793 100644 --- a/grc/python/flow_graph.tmpl +++ b/grc/python/flow_graph.tmpl @@ -63,6 +63,8 @@ class $(class_name)(gr.top_block, Qt.QWidget): def __init__($param_str): gr.top_block.__init__(self, "$title") Qt.QWidget.__init__(self) + self.setWindowTitle("$title") + self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) self.top_layout = Qt.QVBoxLayout(self) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) @@ -235,7 +237,6 @@ if __name__ == '__main__': #elif $generate_options == 'qt_gui' qapp = Qt.QApplication(sys.argv) tb = $(class_name)($(', '.join($params_eq_list))) - tb.setWindowTitle("$title") #if $flow_graph.get_option('run') tb.start() #end if -- cgit From 11837de659a69d1d8aaf353a046f06ef7c260c5c Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 5 Apr 2011 10:38:47 -0700 Subject: grc: fix for generating top block when in run to completion mode --- grc/python/flow_graph.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'grc/python/flow_graph.tmpl') diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl index 5aaa99793..e16e86f5b 100644 --- a/grc/python/flow_graph.tmpl +++ b/grc/python/flow_graph.tmpl @@ -243,9 +243,9 @@ if __name__ == '__main__': tb.show() qapp.exec_() #elif $generate_options == 'no_gui' + tb = $(class_name)($(', '.join($params_eq_list))) #set $run_options = $flow_graph.get_option('run_options') #if $run_options == 'prompt' - tb = $(class_name)($(', '.join($params_eq_list))) tb.start() raw_input('Press Enter to quit: ') tb.stop() -- cgit