diff options
-rw-r--r-- | grc/blocks/options.xml | 56 | ||||
-rw-r--r-- | grc/core/Block.py | 3 | ||||
-rw-r--r-- | grc/core/Connection.py | 3 | ||||
-rw-r--r-- | grc/core/Constants.py | 3 | ||||
-rw-r--r-- | grc/core/Param.py | 68 | ||||
-rw-r--r-- | grc/core/Port.py | 8 | ||||
-rw-r--r-- | grc/core/generator/Generator.py | 8 | ||||
-rw-r--r-- | grc/core/generator/flow_graph.tmpl | 44 |
8 files changed, 13 insertions, 180 deletions
diff --git a/grc/blocks/options.xml b/grc/blocks/options.xml index e03269292c..252a0b2e2d 100644 --- a/grc/blocks/options.xml +++ b/grc/blocks/options.xml @@ -11,11 +11,7 @@ <key>options</key> <import>from gnuradio import gr</import> <import>from gnuradio.filter import firdes</import> - <import>#if $generate_options() == 'wx_gui' -from grc_gnuradio import wxgui as grc_wxgui -import wx -#end if -#if $generate_options() == 'qt_gui' + <import>#if $generate_options() == 'qt_gui' from PyQt5 import Qt import sys #end if @@ -65,10 +61,6 @@ else: self.stop(); self.wait()</callback> <key>qt_gui</key> </option> <option> - <name>WX GUI</name> - <key>wx_gui</key> - </option> - <option> <name>No GUI</name> <key>no_gui</key> </option> @@ -108,17 +100,7 @@ else: self.stop(); self.wait()</callback> <key>run</key> <value>True</value> <type>bool</type> - <hide> -#if $generate_options() in ('qt_gui', 'wx_gui') - #if $run() - part - #else - none - #end if -#else - all -#end if - </hide> + <hide>#if $generate_options() == 'qt_gui' then ('part' if $run() else 'none') else 'all'#</hide> <option> <name>Autostart</name> <key>True</key> @@ -133,26 +115,14 @@ else: self.stop(); self.wait()</callback> <key>max_nouts</key> <value>0</value> <type>int</type> - <hide>#if $generate_options().startswith('hb') -all#slurp -#elif $max_nouts() -none#slurp -#else -part#slurp -#end if</hide> + <hide>#if $generate_options().startswith('hb') then 'all' else ('none' if $max_nouts() else 'part')#</hide> </param> <param> <name>Realtime Scheduling</name> <key>realtime_scheduling</key> <value></value> <type>enum</type> - <hide>#if $generate_options().startswith('hb') -all#slurp -#elif $realtime_scheduling() -none#slurp -#else -part#slurp -#end if</hide> + <hide>#if $generate_options().startswith('hb') then 'all' else ('none' if $realtime_scheduling() else 'part')#</hide> <option> <name>Off</name> <key></key> @@ -167,17 +137,7 @@ part#slurp <key>qt_qss_theme</key> <value></value> <type>file_open</type> - <hide> -#if $generate_options() in ('qt_gui',) - #if $qt_qss_theme() - none - #else - part - #end if -#else - all -#end if -</hide> + <hide>#if $generate_options() == 'qt_gui' then ('none' if $qt_qss_theme() else 'part') else 'all'#</hide> </param> <param> <name>Thread-safe setters</name> @@ -200,11 +160,7 @@ part#slurp <key>run_command</key> <value>{python} -u {filename}</value> <type>string</type> - <hide>#if $generate_options().startswith('hb') -all#slurp -#else -part#slurp -#end if</hide> + <hide>#if $generate_options().startswith('hb') then 'all' else 'part'</hide> <tab>Advanced</tab> </param> <param> diff --git a/grc/core/Block.py b/grc/core/Block.py index 8a683a2b6b..de1d83ee9a 100644 --- a/grc/core/Block.py +++ b/grc/core/Block.py @@ -24,7 +24,7 @@ from Cheetah.Template import Template from .utils import epy_block_io, odict from . Constants import ( - BLOCK_FLAG_NEED_QT_GUI, BLOCK_FLAG_NEED_WX_GUI, + BLOCK_FLAG_NEED_QT_GUI, ADVANCED_PARAM_TAB, DEFAULT_PARAM_TAB, BLOCK_FLAG_THROTTLE, BLOCK_FLAG_DISABLE_BYPASS, BLOCK_FLAG_DEPRECATED, @@ -275,7 +275,6 @@ class Block(Element): self.add_error_message("Can't generate this block in mode: {} ".format( repr(current_generate_option))) - check_generate_mode('WX GUI', BLOCK_FLAG_NEED_WX_GUI, ('wx_gui',)) check_generate_mode('QT GUI', BLOCK_FLAG_NEED_QT_GUI, ('qt_gui', 'hb_qt_gui')) if self._epy_reload_error: self.get_param('_source_code').add_error_message(str(self._epy_reload_error)) diff --git a/grc/core/Connection.py b/grc/core/Connection.py index 3aa32ef183..c028d89ddc 100644 --- a/grc/core/Connection.py +++ b/grc/core/Connection.py @@ -82,9 +82,6 @@ class Connection(Element): self.get_sink(), ) - def is_msg(self): - return self.get_source().get_type() == self.get_sink().get_type() == 'msg' - def is_bus(self): return self.get_source().get_type() == self.get_sink().get_type() == 'bus' diff --git a/grc/core/Constants.py b/grc/core/Constants.py index 61a44d0c78..edd3442a94 100644 --- a/grc/core/Constants.py +++ b/grc/core/Constants.py @@ -48,7 +48,6 @@ DEFAULT_DOMAIN = GR_STREAM_DOMAIN BLOCK_FLAG_THROTTLE = 'throttle' BLOCK_FLAG_DISABLE_BYPASS = 'disable_bypass' BLOCK_FLAG_NEED_QT_GUI = 'need_qt_gui' -BLOCK_FLAG_NEED_WX_GUI = 'need_wx_gui' BLOCK_FLAG_DEPRECATED = 'deprecated' # Block States @@ -109,7 +108,6 @@ CORE_TYPES = ( # name, key, sizeof, color ('Integer 16', 's16', 2, GRC_COLOR_YELLOW), ('Integer 8', 's8', 1, GRC_COLOR_PURPLE_A400), ('Bits (unpacked byte)', 'bit', 1, GRC_COLOR_PURPLE_A100), - ('Message Queue', 'msg', 0, GRC_COLOR_DARK_GREY), ('Async Message', 'message', 0, GRC_COLOR_GREY), ('Bus Connection', 'bus', 0, GRC_COLOR_WHITE), ('Wildcard', '', 0, GRC_COLOR_WHITE), @@ -148,4 +146,3 @@ SHORT_VECTOR_COLOR_SPEC = '#CCCC33' BYTE_VECTOR_COLOR_SPEC = '#CC66CC' ID_COLOR_SPEC = '#DDDDDD' WILDCARD_COLOR_SPEC = '#FFFFFF' -MSG_COLOR_SPEC = '#777777' diff --git a/grc/core/Param.py b/grc/core/Param.py index 201032d010..d0af9792b8 100644 --- a/grc/core/Param.py +++ b/grc/core/Param.py @@ -30,7 +30,7 @@ from .utils import odict import __builtin__ -ID_BLACKLIST = ['self', 'options', 'gr', 'blks2', 'wxgui', 'wx', 'math', 'forms', 'firdes'] + dir(__builtin__) +ID_BLACKLIST = ['self', 'options', 'gr', 'blks2', 'math', 'firdes'] + dir(__builtin__) try: from gnuradio import gr ID_BLACKLIST.extend(attr for attr in dir(gr.top_block()) if not attr.startswith('_')) @@ -215,7 +215,7 @@ class Param(Element): 'hex', 'string', 'bool', 'file_open', 'file_save', '_multiline', '_multiline_python_external', 'id', 'stream_id', - 'grid_pos', 'notebook', 'gui_hint', + 'gui_hint', 'import', ) @@ -317,8 +317,6 @@ class Param(Element): 'string': Constants.BYTE_VECTOR_COLOR_SPEC, 'id': Constants.ID_COLOR_SPEC, 'stream_id': Constants.ID_COLOR_SPEC, - 'grid_pos': Constants.INT_VECTOR_COLOR_SPEC, - 'notebook': Constants.INT_VECTOR_COLOR_SPEC, 'raw': Constants.WILDCARD_COLOR_SPEC, }[self.get_type()] except: @@ -354,9 +352,6 @@ class Param(Element): return 'part' except: pass - # Hide empty grid positions - if self.get_key() in ('grid_pos', 'notebook') and not self.get_value(): - return 'part' return hide def validate(self): @@ -551,65 +546,6 @@ class Param(Element): return self._ws return GuiHint(widget_str) ######################### - # Grid Position Type - ######################### - elif t == 'grid_pos': - if not v: - # Allow for empty grid pos - return '' - e = self.get_parent().get_parent().evaluate(v) - if not isinstance(e, (list, tuple)) or len(e) != 4 or not all([isinstance(ei, int) for ei in e]): - raise Exception('A grid position must be a list of 4 integers.') - row, col, row_span, col_span = e - # Check row, col - if row < 0 or col < 0: - raise Exception('Row and column must be non-negative.') - # Check row span, col span - if row_span <= 0 or col_span <= 0: - raise Exception('Row and column span must be greater than zero.') - # Get hostage cell parent - try: - my_parent = self.get_parent().get_param('notebook').evaluate() - except: - my_parent = '' - # Calculate hostage cells - for r in range(row_span): - for c in range(col_span): - self._hostage_cells.append((my_parent, (row+r, col+c))) - # Avoid collisions - params = filter(lambda p: p is not self, self.get_all_params('grid_pos')) - for param in params: - for parent, cell in param._hostage_cells: - if (parent, cell) in self._hostage_cells: - raise Exception('Another graphical element is using parent "{}", cell "{}".'.format(str(parent), str(cell))) - return e - ######################### - # Notebook Page Type - ######################### - elif t == 'notebook': - if not v: - # Allow for empty notebook - return '' - - # Get a list of all notebooks - notebook_blocks = filter(lambda b: b.get_key() == 'notebook', self.get_parent().get_parent().get_enabled_blocks()) - # Check for notebook param syntax - try: - notebook_id, page_index = map(str.strip, v.split(',')) - except: - raise Exception('Bad notebook page format.') - # Check that the notebook id is valid - try: - notebook_block = filter(lambda b: b.get_id() == notebook_id, notebook_blocks)[0] - except: - raise Exception('Notebook id "{}" is not an existing notebook id.'.format(notebook_id)) - - # Check that page index exists - if int(page_index) not in range(len(notebook_block.get_param('labels').evaluate())): - raise Exception('Page index "{}" is not a valid index number.'.format(page_index)) - return notebook_id, page_index - - ######################### # Import Type ######################### elif t == 'import': diff --git a/grc/core/Port.py b/grc/core/Port.py index 6a8f484082..88601dc87a 100644 --- a/grc/core/Port.py +++ b/grc/core/Port.py @@ -119,8 +119,6 @@ class Port(Element): elif n['domain'] == GR_MESSAGE_DOMAIN: n['key'] = n['name'] n['type'] = 'message' # For port color - if n['type'] == 'msg': - n['key'] = 'msg' if not n.find('key'): n['key'] = str(next(block.port_counters[dir == 'source'])) @@ -161,12 +159,6 @@ class Port(Element): self.add_error_message('Domain key "{}" is not registered.'.format(self.get_domain())) if not self.get_enabled_connections() and not self.get_optional(): self.add_error_message('Port is not connected.') - # Message port logic - if self.get_type() == 'msg': - if self.get_nports(): - self.add_error_message('A port of type "msg" cannot have "nports" set.') - if self.get_vlen() != 1: - self.add_error_message('A port of type "msg" must have a "vlen" of 1.') def rewrite(self): """ diff --git a/grc/core/generator/Generator.py b/grc/core/generator/Generator.py index 3062440814..33d50d6b19 100644 --- a/grc/core/generator/Generator.py +++ b/grc/core/generator/Generator.py @@ -133,10 +133,6 @@ class TopBlockGenerator(object): def _get_block_sort_text(block): code = block.get_make().replace(block.get_id(), ' ') try: - code += block.get_param('notebook').get_value() # Older gui markup w/ wxgui - except: - pass - try: code += block.get_param('gui_hint').get_value() # Newer gui markup w/ qtgui except: pass @@ -165,7 +161,7 @@ class TopBlockGenerator(object): # Filter out virtual sink connections def cf(c): - return not (c.is_bus() or c.is_msg() or c.get_sink().get_parent().is_virtual_sink()) + return not (c.is_bus() or c.get_sink().get_parent().is_virtual_sink()) connections = filter(cf, fg.get_enabled_connections()) # Get the virtual blocks and resolve their connections @@ -214,7 +210,6 @@ class TopBlockGenerator(object): )) connection_templates = fg.get_parent().connection_templates - msgs = filter(lambda c: c.is_msg(), fg.get_enabled_connections()) # List of variable names var_ids = [var.get_id() for var in parameters + variables] @@ -243,7 +238,6 @@ class TopBlockGenerator(object): 'blocks': blocks, 'connections': connections, 'connection_templates': connection_templates, - 'msgs': msgs, 'generate_options': self._generate_options, 'callbacks': callbacks, } diff --git a/grc/core/generator/flow_graph.tmpl b/grc/core/generator/flow_graph.tmpl index 4b275c0a5f..059703340e 100644 --- a/grc/core/generator/flow_graph.tmpl +++ b/grc/core/generator/flow_graph.tmpl @@ -11,7 +11,6 @@ ##@param parameters the parameter blocks ##@param blocks the signal blocks ##@param connections the connections -##@param msgs the msg type connections ##@param generate_options the type of flow graph ##@param callbacks variable id map to callback strings ######################################################## @@ -42,7 +41,7 @@ from distutils.version import StrictVersion ## 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 @@ -76,25 +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' - #import gtk - #set $icon = gtk.IconTheme().lookup_icon('gnuradio-grc', 32, 0) - - -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): @@ -207,18 +192,6 @@ gr.io_signaturev($(len($io_sigs)), $(len($io_sigs)), [$(', '.join($size_strs))]) $indent($var.get_var_make()) #end for ######################################################## -##Create Message Queues -######################################################## -#if $msgs - - $DIVIDER - # Message Queues - $DIVIDER -#end if -#for $msg in $msgs - $(msg.get_source().get_parent().get_id())_msgq_out = $(msg.get_sink().get_parent().get_id())_msgq_in = gr.msg_queue(2) -#end for -######################################################## ##Create Blocks ######################################################## #if $blocks @@ -379,18 +352,7 @@ 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' + #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) |