diff options
Diffstat (limited to 'grc/core/generator/flow_graph.tmpl')
-rw-r--r-- | grc/core/generator/flow_graph.tmpl | 53 |
1 files changed, 17 insertions, 36 deletions
diff --git a/grc/core/generator/flow_graph.tmpl b/grc/core/generator/flow_graph.tmpl index fd5546e459..b8913bb087 100644 --- a/grc/core/generator/flow_graph.tmpl +++ b/grc/core/generator/flow_graph.tmpl @@ -35,9 +35,13 @@ $DIVIDER import threading #end if +#if $generate_options == 'qt_gui' +from distutils.version import StrictVersion +#end if + ## Call XInitThreads as the _very_ first thing. ## After some Qt import, it's too late -#if $generate_options in ('wx_gui', 'qt_gui') +#if $generate_options == 'qt_gui' if __name__ == '__main__': import ctypes import sys @@ -71,29 +75,11 @@ $imp ##Create Class ## Write the class declaration for a top or hier block. ## The parameter names are the arguments to __init__. -## Determine the absolute icon path (wx gui only). ## Setup the IO signature (hier block only). ######################################################## #set $class_name = $flow_graph.get_option('id') #set $param_str = ', '.join(['self'] + ['%s=%s'%(param.get_id(), param.get_make()) for param in $parameters]) -#if $generate_options == 'wx_gui' - #from gi.repository import Gtk - #try: - #set $icon = Gtk.IconTheme().load_icon('gnuradio-grc', 256, 0) - #except: - #set $icon = '' - #end try - - -class $(class_name)(grc_wxgui.top_block_gui): - - def __init__($param_str): - grc_wxgui.top_block_gui.__init__(self, title="$title") - #if $icon - _icon_path = "$icon.get_filename()" - self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) - #end if -#elif $generate_options == 'qt_gui' +#if $generate_options == 'qt_gui' class $(class_name)(gr.top_block, Qt.QWidget): @@ -119,7 +105,14 @@ class $(class_name)(gr.top_block, Qt.QWidget): self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "$class_name") - self.restoreGeometry(self.settings.value("geometry").toByteArray()) + + try: + if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): + self.restoreGeometry(self.settings.value("geometry").toByteArray()) + else: + self.restoreGeometry(self.settings.value("geometry")) + except: + pass #elif $generate_options == 'no_gui' @@ -359,20 +352,8 @@ def main(top_block_cls=$(class_name), options=None): print "Error: failed to enable real-time scheduling." #end if - #if $generate_options == 'wx_gui' - tb = top_block_cls($(', '.join($params_eq_list))) - #if $flow_graph.get_option('max_nouts') - tb.Run($flow_graph.get_option('run'), $flow_graph.get_option('max_nouts')) - #else - tb.Start($flow_graph.get_option('run')) - #for $m in $monitors - (tb.$m.get_id()).start() - #end for - tb.Wait() - #end if - #elif $generate_options == 'qt_gui' - from distutils.version import StrictVersion - if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"): + #if $generate_options == 'qt_gui' + if StrictVersion("4.5.0") <= StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): style = gr.prefs().get_string('qtgui', 'style', 'raster') Qt.QApplication.setGraphicsSystem(style) qapp = Qt.QApplication(sys.argv) @@ -393,7 +374,7 @@ def main(top_block_cls=$(class_name), options=None): def quitting(): tb.stop() tb.wait() - qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting) + qapp.aboutToQuit.connect(quitting) #for $m in $monitors if 'en' in $m.params: if $m.params['en'].get_value(): |