X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=grc%2Fpython%2FBlock.py;h=dd39b095de5a0c14920ee1db2bed655c43e5ae1a;hb=76aa7a496c3d5c2a40b7ff190d42b25e51d0cbc0;hp=47fe13a3cc11ee6c87d81d605e5d2e7317eda4c2;hpb=23fb5e602d48f6924e70b363bf9480fd41b928b0;p=debian%2Fgnuradio diff --git a/grc/python/Block.py b/grc/python/Block.py index 47fe13a3..dd39b095 100644 --- a/grc/python/Block.py +++ b/grc/python/Block.py @@ -18,10 +18,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ from .. base.Block import Block as _Block +from .. gui.Block import Block as _GUIBlock import extract_docs import extract_category -class Block(_Block): +class Block(_Block, _GUIBlock): + + def is_virtual_sink(self): return self.get_key() == 'virtual_sink' + def is_virtual_source(self): return self.get_key() == 'virtual_source' ##for make source to keep track of indexes _source_count = 0 @@ -48,13 +52,13 @@ class Block(_Block): flow_graph=flow_graph, n=n, ) + _GUIBlock.__init__(self) def validate(self): """ Validate this block. Call the base class validate. Evaluate the checks: each check must evaluate to True. - Adjust the nports. """ _Block.validate(self) #evaluate the checks @@ -65,6 +69,12 @@ class Block(_Block): try: assert check_eval except AssertionError: self.add_error_message('Check "%s" failed.'%check) except: self.add_error_message('Check "%s" did not evaluate.'%check) + + def rewrite(self): + """ + Add and remove ports to adjust for the nports. + """ + _Block.rewrite(self) #adjust nports for get_ports, get_port in ( (self.get_sources, self.get_source),