summaryrefslogtreecommitdiff
path: root/grc/gui/Port.py
diff options
context:
space:
mode:
authorSebastian Koslowski <koslowski@kit.edu>2016-08-01 17:25:50 +0200
committerSebastian Koslowski <koslowski@kit.edu>2016-08-03 21:46:12 +0200
commita59464a7a90715065b600416a3575a734cba51f2 (patch)
tree1a3724fccfd24ba9a38672788556c3a63fd45444 /grc/gui/Port.py
parent52dadbf46f16b682348a6969a782ff64a129d9f8 (diff)
grc: gtk3: speed up what_is_selected()
Diffstat (limited to 'grc/gui/Port.py')
-rw-r--r--grc/gui/Port.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/grc/gui/Port.py b/grc/gui/Port.py
index 5e7d9cab68..0880856b00 100644
--- a/grc/gui/Port.py
+++ b/grc/gui/Port.py
@@ -42,6 +42,8 @@ class Port(_Port, Element):
self._connector_coordinate = (0, 0)
self._hovering = False
self.force_show_label = False
+
+ self._area = []
self._bg_color = 0, 0, 0
self._line_width_factor = 1.0
self._label_layout_offsets = 0, 0
@@ -79,9 +81,10 @@ class Port(_Port, Element):
def create_shapes(self):
"""Create new areas and labels for the port."""
if self.is_horizontal():
- self.area = [0, 0, self.width, self.height]
+ self._area = (0, 0, self.width, self.height)
elif self.is_vertical():
- self.area = [0, 0, self.height, self.width]
+ self._area = (0, 0, self.height, self.width)
+ self.bounds_from_area(self._area)
self._connector_coordinate = {
0: (self.width, self.height / 2),
@@ -121,7 +124,7 @@ class Port(_Port, Element):
cr.set_line_width(self._line_width_factor * cr.get_line_width())
cr.translate(*self.coordinate)
- cr.rectangle(*self.area)
+ cr.rectangle(*self._area)
cr.set_source_rgb(*self._bg_color)
cr.fill_preserve()
cr.set_source_rgb(*border_color)