commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 62/101: grc: refactor: handle flowgraph and


From: git
Subject: [Commit-gnuradio] [gnuradio] 62/101: grc: refactor: handle flowgraph and connection super init same as in block
Date: Thu, 16 Mar 2017 14:58:07 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

jcorgan pushed a commit to branch python3
in repository gnuradio.

commit 52dadbf46f16b682348a6969a782ff64a129d9f8
Author: Sebastian Koslowski <address@hidden>
Date:   Sun Jul 31 21:13:17 2016 +0200

    grc: refactor: handle flowgraph and connection super init same as in block
---
 grc/core/FlowGraph.py | 6 +++---
 grc/core/Platform.py  | 2 +-
 grc/gui/Connection.py | 8 ++++----
 grc/gui/FlowGraph.py  | 9 +++++----
 4 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/grc/core/FlowGraph.py b/grc/core/FlowGraph.py
index 8246d86..18a5778 100644
--- a/grc/core/FlowGraph.py
+++ b/grc/core/FlowGraph.py
@@ -40,17 +40,17 @@ class FlowGraph(Element):
 
     is_flow_graph = True
 
-    def __init__(self, platform):
+    def __init__(self, parent):
         """
         Make a flow graph from the arguments.
 
         Args:
-            platform: a platforms with blocks and contrcutors
+            parent: a platforms with blocks and element factories
 
         Returns:
             the flow graph object
         """
-        Element.__init__(self, parent=platform)
+        Element.__init__(self, parent)
         self._timestamp = time.ctime()
         self._options_block = self.parent_platform.get_new_block(self, 
'options')
 
diff --git a/grc/core/Platform.py b/grc/core/Platform.py
index 2a8764a..9956391 100644
--- a/grc/core/Platform.py
+++ b/grc/core/Platform.py
@@ -326,7 +326,7 @@ class Platform(Element):
     }
 
     def get_new_flow_graph(self):
-        return self.FlowGraph(platform=self)
+        return self.FlowGraph(parent=self)
 
     def get_new_block(self, parent, key, **kwargs):
         cls = self.block_classes.get(key, self.block_classes[None])
diff --git a/grc/gui/Connection.py b/grc/gui/Connection.py
index b1ae32d..9498404 100644
--- a/grc/gui/Connection.py
+++ b/grc/gui/Connection.py
@@ -24,10 +24,10 @@ from .Constants import CONNECTOR_ARROW_BASE, 
CONNECTOR_ARROW_HEIGHT
 from .Element import Element
 
 from ..core.Element import nop_write
-from ..core.Connection import Connection as _Connection
+from ..core.Connection import Connection as CoreConnection
 
 
-class Connection(Element, _Connection):
+class Connection(CoreConnection, Element):
     """
     A graphical connection for ports.
     The connection has 2 parts, the arrow and the wire.
@@ -38,8 +38,8 @@ class Connection(Element, _Connection):
     """
 
     def __init__(self, *args, **kwargs):
+        super(self.__class__, self).__init__(*args, **kwargs)
         Element.__init__(self)
-        _Connection.__init__(self, *args, **kwargs)
 
         self._color = self._color2 = self._arrow_color = None
 
@@ -64,7 +64,7 @@ class Connection(Element, _Connection):
         return 0
 
     def create_shapes(self):
-        """Precalculate relative coordinates."""
+        """Pre-calculate relative coordinates."""
         Element.create_shapes(self)
         self._sink_rot = None
         self._source_rot = None
diff --git a/grc/gui/FlowGraph.py b/grc/gui/FlowGraph.py
index d573239..5cd575d 100644
--- a/grc/gui/FlowGraph.py
+++ b/grc/gui/FlowGraph.py
@@ -34,24 +34,25 @@ from . import Actions, Colors, Utils, Bars, Dialogs
 from .Element import Element
 from .external_editor import ExternalEditor
 
-from ..core.FlowGraph import FlowGraph as _Flowgraph
+from ..core.FlowGraph import FlowGraph as CoreFlowgraph
 from ..core import Messages
 
 
-class FlowGraph(Element, _Flowgraph):
+class FlowGraph(CoreFlowgraph, Element):
     """
     FlowGraph is the data structure to store graphical signal blocks,
     graphical inputs and outputs,
     and the connections between inputs and outputs.
     """
 
-    def __init__(self, **kwargs):
+    def __init__(self, parent, **kwargs):
         """
         FlowGraph constructor.
         Create a list for signal blocks and connections. Connect mouse 
handlers.
         """
+        super(self.__class__, self).__init__(parent, **kwargs)
         Element.__init__(self)
-        _Flowgraph.__init__(self, **kwargs)
+        self.drawing_area = None
         # important vars dealing with mouse event tracking
         self.element_moved = False
         self.mouse_pressed = False



reply via email to

[Prev in Thread] Current Thread [Next in Thread]