diff options
author | Sebastian Koslowski <koslowski@kit.edu> | 2016-07-12 17:43:11 +0200 |
---|---|---|
committer | Sebastian Koslowski <koslowski@kit.edu> | 2016-07-13 16:35:50 +0200 |
commit | b479f54903c0b1b164393af2e844723aed8a1072 (patch) | |
tree | 42ccf4340bc84ad295976ee1ebac7e713ed7e3f8 | |
parent | db5ab0f2a0e694ca9149d66171e0dbbb87dd74da (diff) |
grc: refactor: fixup selection code and core connection changes
-rw-r--r-- | grc/core/Port.py | 6 | ||||
-rw-r--r-- | grc/core/generator/Generator.py | 2 | ||||
-rw-r--r-- | grc/gui/FlowGraph.py | 4 |
3 files changed, 7 insertions, 5 deletions
diff --git a/grc/core/Port.py b/grc/core/Port.py index 10d021b315..ef6a92c7b1 100644 --- a/grc/core/Port.py +++ b/grc/core/Port.py @@ -21,7 +21,7 @@ from __future__ import absolute_import from six.moves import filter -from .Element import Element +from .Element import Element, lazy_property from . import Constants @@ -323,11 +323,11 @@ class Port(Element): number = str(busses.index(self)) + '#' + str(len(self.get_associated_ports())) return self._name + number - @property + @lazy_property def is_sink(self): return self._dir == 'sink' - @property + @lazy_property def is_source(self): return self._dir == 'source' diff --git a/grc/core/generator/Generator.py b/grc/core/generator/Generator.py index e3f6bf38c9..637cf9e9df 100644 --- a/grc/core/generator/Generator.py +++ b/grc/core/generator/Generator.py @@ -173,7 +173,7 @@ class TopBlockGenerator(object): # Get the virtual blocks and resolve their connections virtual = [c for c in connections if c.source_block.is_virtual_source()] for connection in virtual: - source = connection.source.resolve_virtual_source() + source = connection.source_port.resolve_virtual_source() sink = connection.sink_port resolved = fg.parent.Connection(flow_graph=fg, porta=source, portb=sink) connections.append(resolved) diff --git a/grc/gui/FlowGraph.py b/grc/gui/FlowGraph.py index 7a0f2475ff..7176594460 100644 --- a/grc/gui/FlowGraph.py +++ b/grc/gui/FlowGraph.py @@ -28,6 +28,8 @@ from itertools import count import six from six.moves import filter +from gi.repository import GObject + from . import Actions, Colors, Utils, Bars, Dialogs from .Element import Element from .external_editor import ExternalEditor @@ -435,7 +437,7 @@ class FlowGraph(Element, _Flowgraph): selected_elements = self.selected_elements elements = self.get_elements() # remove deleted elements - for selected in selected_elements: + for selected in list(selected_elements): if selected in elements: continue selected_elements.remove(selected) |