diff options
Diffstat (limited to 'grc/core/Block.py')
-rw-r--r-- | grc/core/Block.py | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/grc/core/Block.py b/grc/core/Block.py index 106e4bc89a..f67d990857 100644 --- a/grc/core/Block.py +++ b/grc/core/Block.py @@ -27,10 +27,10 @@ from . Constants import ( BLOCK_FLAG_NEED_QT_GUI, BLOCK_FLAG_NEED_WX_GUI, ADVANCED_PARAM_TAB, DEFAULT_PARAM_TAB, BLOCK_FLAG_THROTTLE, BLOCK_FLAG_DISABLE_BYPASS, + BLOCK_FLAG_DEPRECATED, BLOCK_ENABLED, BLOCK_BYPASSED, BLOCK_DISABLED ) from . Element import Element -from . FlowGraph import _variable_matcher def _get_keys(lst): @@ -149,15 +149,16 @@ class Block(Element): # indistinguishable from normal GR blocks. Make explicit # checks for them here since they have no work function or # buffers to manage. - is_virtual_or_pad = self._key in ( + self.is_virtual_or_pad = self._key in ( "virtual_source", "virtual_sink", "pad_source", "pad_sink") - is_variable = self._key.startswith('variable') + self.is_variable = self._key.startswith('variable') + self.is_import = (self._key == 'import') # Disable blocks that are virtual/pads or variables - if is_virtual_or_pad or is_variable: + if self.is_virtual_or_pad or self.is_variable: self._flags += BLOCK_FLAG_DISABLE_BYPASS - if not (is_virtual_or_pad or is_variable or self._key == 'options'): + if not (self.is_virtual_or_pad or self.is_variable or self._key == 'options'): self.get_params().append(self.get_parent().get_parent().Param( block=self, n=odict({'name': 'Block Alias', @@ -168,7 +169,7 @@ class Block(Element): }) )) - if (len(sources) or len(sinks)) and not is_virtual_or_pad: + if (len(sources) or len(sinks)) and not self.is_virtual_or_pad: self.get_params().append(self.get_parent().get_parent().Param( block=self, n=odict({'name': 'Core Affinity', @@ -178,7 +179,7 @@ class Block(Element): 'tab': ADVANCED_PARAM_TAB }) )) - if len(sources) and not is_virtual_or_pad: + if len(sources) and not self.is_virtual_or_pad: self.get_params().append(self.get_parent().get_parent().Param( block=self, n=odict({'name': 'Min Output Buffer', @@ -253,7 +254,7 @@ class Block(Element): self.add_error_message('Check "{}" did not evaluate.'.format(check)) # For variables check the value (only if var_value is used - if _variable_matcher.match(self.get_key()) and self._var_value != '$value': + if self.is_variable and self._var_value != '$value': value = self._var_value try: value = self.get_var_value() @@ -356,7 +357,7 @@ class Block(Element): """ Resolve all import statements. Split each import statement at newlines. - Combine all import statments into a list. + Combine all import statements into a list. Filter empty imports. Returns: @@ -626,6 +627,10 @@ class Block(Element): def bypass_disabled(self): return BLOCK_FLAG_DISABLE_BYPASS in self._flags + @property + def is_deprecated(self): + return BLOCK_FLAG_DEPRECATED in self._flags + ############################################## # Access Params ############################################## |