summaryrefslogtreecommitdiff
path: root/grc/python/Block.py
diff options
context:
space:
mode:
authorSebastian Koslowski <koslowski@kit.edu>2016-04-21 15:19:30 +0200
committerSebastian Koslowski <koslowski@kit.edu>2016-04-21 15:57:10 +0200
commit2a68b6844eb89cf2660b9973cecb42c53959b9ca (patch)
tree830ef440f660599b35d1070ab3bf8666d457c780 /grc/python/Block.py
parent240fd75770bc71435630768ea4767d55ce24bf2b (diff)
grc: avoid name clashes when importing epy block and really fix epy block c&p
Diffstat (limited to 'grc/python/Block.py')
-rw-r--r--grc/python/Block.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/grc/python/Block.py b/grc/python/Block.py
index 8509aa3fc6..782893fd8f 100644
--- a/grc/python/Block.py
+++ b/grc/python/Block.py
@@ -247,7 +247,7 @@ class Block(_Block, _GUIBlock):
doc_end_tag = 'Block Documentation:'
src = param_src.get_value()
- src_hash = hash(src)
+ src_hash = hash((self.get_id(), src))
if src_hash == self._epy_source_hash:
return
@@ -265,12 +265,11 @@ class Block(_Block, _GUIBlock):
param_blk.set_value(repr(tuple(blk_io)))
# print "Rewriting embedded python block {!r}".format(self.get_id())
-
self._epy_source_hash = src_hash
self._name = blk_io.name or blk_io.cls
self._doc = self._doc.split(doc_end_tag)[0] + doc_end_tag + '\n' + blk_io.doc
- self._imports[0] = 'from {} import {}'.format(self.get_id(), blk_io.cls)
- self._make = '{}({})'.format(blk_io.cls, ', '.join(
+ self._imports[0] = 'import ' + self.get_id()
+ self._make = '{0}.{1}({2})'.format(self.get_id(), blk_io.cls, ', '.join(
'{0}=${0}'.format(key) for key, _ in blk_io.params))
params = {}