From b17a9b3f0672318cb6fa240d14aed14ffffebe69 Mon Sep 17 00:00:00 2001
From: Sebastian Koslowski <sebastian.koslowski@gmail.com>
Date: Thu, 7 Feb 2019 22:41:39 +0100
Subject: grc: fixes in epy and virtual blocks (fixes #2039)

---
 grc/core/blocks/embedded_python.py | 34 +++++++++++++++-------------------
 1 file changed, 15 insertions(+), 19 deletions(-)

(limited to 'grc/core/blocks/embedded_python.py')

diff --git a/grc/core/blocks/embedded_python.py b/grc/core/blocks/embedded_python.py
index 57cf0ee4e9..548739ed52 100644
--- a/grc/core/blocks/embedded_python.py
+++ b/grc/core/blocks/embedded_python.py
@@ -26,7 +26,8 @@ from ._templates import MakoTemplates
 from .. import utils
 from ..base import Element
 
-from ._build import _build_params as build_core_params
+from ._build import build_params
+
 
 DEFAULT_CODE = '''\
 """
@@ -82,13 +83,12 @@ class EPyBlock(Block):
     label = 'Python Block'
     documentation = {'': DOC}
 
-    parameters_data = [dict(
-        label='Code',
-        id='_source_code',
-        dtype='_multiline_python_external',
-        default=DEFAULT_CODE,
-        hide='part',
-    )]
+    parameters_data = build_params(
+        params_raw=[
+            dict(label='Code', id='_source_code', dtype='_multiline_python_external',
+                 default=DEFAULT_CODE, hide='part')
+        ], have_inputs=True, have_outputs=True, flags=Block.flags, block_id=key
+    )
     inputs_data = []
     outputs_data = []
 
@@ -230,18 +230,14 @@ class EPyModule(Block):
         to set parameters of other blocks in your flowgraph.
     """)}
 
-    parameters = [dict(
-        label='Code',
-        id='source_code',
-        dtype='_multiline_python_external',
-        default='# this module will be imported in the into your flowgraph',
-        hide='part',
-    )]
+    parameters_data = build_params(
+        params_raw=[
+            dict(label='Code', id='source_code', dtype='_multiline_python_external',
+                 default='# this module will be imported in the into your flowgraph',
+                 hide='part')
+        ], have_inputs=False, have_outputs=False, flags=Block.flags, block_id=key
+    )
 
     templates = MakoTemplates(
         imports='import ${ id }  # embedded python module',
     )
-
-    def __init__(self, flow_graph, **kwargs):
-        self.parameters_data = build_core_params(self.parameters, False, False, self.flags, self.key)
-        super(EPyModule, self).__init__(flow_graph, **kwargs)
-- 
cgit v1.2.3