diff options
-rw-r--r-- | grc/core/Block.py | 2 | ||||
-rw-r--r-- | grc/core/Connection.py | 4 | ||||
-rw-r--r-- | grc/core/Port.py | 17 | ||||
-rw-r--r-- | grc/core/generator/Generator.py | 2 | ||||
-rw-r--r-- | grc/core/generator/flow_graph.tmpl | 2 | ||||
-rw-r--r-- | grc/gui/Connection.py | 4 | ||||
-rw-r--r-- | grc/gui/Port.py | 16 |
7 files changed, 23 insertions, 24 deletions
diff --git a/grc/core/Block.py b/grc/core/Block.py index 013f2cdbd8..db71f4a8c9 100644 --- a/grc/core/Block.py +++ b/grc/core/Block.py @@ -249,7 +249,7 @@ class Block(Element): # Renumber non-message/message ports domain_specific_port_index = collections.defaultdict(int) for port in [p for p in ports if p.key.isdigit()]: - domain = port.get_domain() + domain = port.domain port.key = str(domain_specific_port_index[domain]) domain_specific_port_index[domain] += 1 diff --git a/grc/core/Connection.py b/grc/core/Connection.py index 44e3b6b5d8..7820603360 100644 --- a/grc/core/Connection.py +++ b/grc/core/Connection.py @@ -96,8 +96,8 @@ class Connection(Element): Element.validate(self) platform = self.parent_platform - source_domain = self.source_port.get_domain() - sink_domain = self.sink_port.get_domain() + source_domain = self.source_port.domain + sink_domain = self.sink_port.domain if (source_domain, sink_domain) not in platform.connection_templates: self.add_error_message('No connection known for domains "{}", "{}"'.format( diff --git a/grc/core/Port.py b/grc/core/Port.py index bb1e1fa9f2..10d021b315 100644 --- a/grc/core/Port.py +++ b/grc/core/Port.py @@ -133,7 +133,7 @@ class Port(Element): self._name = n['name'] self.key = n['key'] self._type = n.get('type', '') - self._domain = n.get('domain') + self.domain = n.get('domain') self._hide = n.get('hide', '') self._dir = dir self._hide_evaluated = False # Updated on rewrite() @@ -161,8 +161,8 @@ class Port(Element): if self.get_type() not in self.get_types(): self.add_error_message('Type "{}" is not a possible type.'.format(self.get_type())) platform = self.parent.parent.parent - if self.get_domain() not in platform.domains: - self.add_error_message('Domain key "{}" is not registered.'.format(self.get_domain())) + if self.domain not in platform.domains: + self.add_error_message('Domain key "{}" is not registered.'.format(self.domain)) if not self.get_enabled_connections() and not self.get_optional(): self.add_error_message('Port is not connected.') # Message port logic @@ -193,11 +193,11 @@ class Port(Element): # Update domain if was deduced from (dynamic) port type type_ = self.get_type() - if self._domain == Constants.GR_STREAM_DOMAIN and type_ == "message": - self._domain = Constants.GR_MESSAGE_DOMAIN + if self.domain == Constants.GR_STREAM_DOMAIN and type_ == "message": + self.domain = Constants.GR_MESSAGE_DOMAIN self.key = self._name - if self._domain == Constants.GR_MESSAGE_DOMAIN and type_ != "message": - self._domain = Constants.GR_STREAM_DOMAIN + if self.domain == Constants.GR_MESSAGE_DOMAIN and type_ != "message": + self.domain = Constants.GR_STREAM_DOMAIN self.key = '0' # Is rectified in rewrite() def resolve_virtual_source(self): @@ -334,9 +334,6 @@ class Port(Element): def get_type(self): return self.parent_block.resolve_dependencies(self._type) - def get_domain(self): - return self._domain - def get_hide(self): return self._hide_evaluated diff --git a/grc/core/generator/Generator.py b/grc/core/generator/Generator.py index 2486d68ec0..e3f6bf38c9 100644 --- a/grc/core/generator/Generator.py +++ b/grc/core/generator/Generator.py @@ -211,7 +211,7 @@ class TopBlockGenerator(object): # List of connections where each endpoint is enabled (sorted by domains, block names) connections.sort(key=lambda c: ( - c.source_port.get_domain(), c.sink_port.get_domain(), + c.source_port.domain, c.sink_port.domain, c.source_block.get_id(), c.sink_block.get_id() )) diff --git a/grc/core/generator/flow_graph.tmpl b/grc/core/generator/flow_graph.tmpl index 4e6a918872..7074aa0004 100644 --- a/grc/core/generator/flow_graph.tmpl +++ b/grc/core/generator/flow_graph.tmpl @@ -262,7 +262,7 @@ gr.io_signaturev($(len($io_sigs)), $(len($io_sigs)), [$(', '.join($size_strs))]) #for $con in $connections #set global $source = $con.source_port #set global $sink = $con.sink_port - #include source=$connection_templates[($source.get_domain(), $sink.get_domain())] + #include source=$connection_templates[($source.domain, $sink.domain)] #end for ######################################################## diff --git a/grc/gui/Connection.py b/grc/gui/Connection.py index 372c7c043b..9035e5e207 100644 --- a/grc/gui/Connection.py +++ b/grc/gui/Connection.py @@ -81,8 +81,8 @@ class Connection(Element, _Connection): Utils.get_rotated_coordinate((-CONNECTOR_ARROW_HEIGHT, -CONNECTOR_ARROW_BASE/2), self.sink_port.get_rotation()), Utils.get_rotated_coordinate((-CONNECTOR_ARROW_HEIGHT, CONNECTOR_ARROW_BASE/2), self.sink_port.get_rotation()), ] - source_domain = self.source_port.get_domain() - sink_domain = self.sink_port.get_domain() + source_domain = self.source_port.domain + sink_domain = self.sink_port.domain # self.line_attributes[0] = 2 if source_domain != sink_domain else 0 # self.line_attributes[1] = Gdk.LINE_DOUBLE_DASH \ # if not source_domain == sink_domain == GR_MESSAGE_DOMAIN \ diff --git a/grc/gui/Port.py b/grc/gui/Port.py index e0e585b482..b28881e6c8 100644 --- a/grc/gui/Port.py +++ b/grc/gui/Port.py @@ -26,7 +26,6 @@ from gi.repository import Gtk, PangoCairo from . import Actions, Colors, Utils, Constants from .Element import Element -from ..core.Constants import DEFAULT_DOMAIN, GR_MESSAGE_DOMAIN from ..core.Port import Port as _Port @@ -44,8 +43,9 @@ class Port(_Port, Element): self._hovering = True self._force_label_unhidden = False self._bg_color = (0, 0, 0) + self._line_width_factor = 1.0 - self.W = self.w = self.h = 0 + self.W = 0 self.H = 20 # todo: fix self.connector_length = 0 @@ -73,10 +73,10 @@ class Port(_Port, Element): if self.get_hide(): return # this port is hidden, no need to create shapes - if self.get_domain() == Constants.GR_MESSAGE_DOMAIN: - pass - elif self.get_domain() != Constants.DEFAULT_DOMAIN: - self.line_attributes[0] = 2 + if self.domain in (Constants.GR_MESSAGE_DOMAIN, Constants.DEFAULT_DOMAIN): + self._line_width_factor = 1.0 + else: + self._line_width_factor = 2.0 #get current rotation rotation = self.get_rotation() #get all sibling ports @@ -90,7 +90,7 @@ class Port(_Port, Element): try: index = ports.index(self) except: - if hasattr(self, '_connector_length'): + if hasattr(self, 'connector_length'): del self.connector_length return #reverse the order of ports for these rotations @@ -136,6 +136,8 @@ class Port(_Port, Element): """ Draw the socket with a label. """ + + cr.set_line_width(self._line_width_factor * cr.get_line_width()) Element.draw(self, widget, cr, border_color, self._bg_color) if not self._areas_list or self._label_hidden(): |