summaryrefslogtreecommitdiff
path: root/grc/gui/Port.py
diff options
context:
space:
mode:
authorSebastian Koslowski <koslowski@kit.edu>2014-08-19 17:02:33 +0200
committerSebastian Koslowski <koslowski@kit.edu>2014-08-19 17:31:33 +0200
commit0dd158155c074113ec1cc6a3de7ecdd2be7d65e8 (patch)
treec29e8d9382426d23ae110187a6b2c375c8864bd9 /grc/gui/Port.py
parent842d8c9d9aac5f7a48a78a9d6babc865570b81c8 (diff)
grc: snap-to-grid (WIP)
Diffstat (limited to 'grc/gui/Port.py')
-rw-r--r--grc/gui/Port.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/grc/gui/Port.py b/grc/gui/Port.py
index b81b162f6e..c56432d2b5 100644
--- a/grc/gui/Port.py
+++ b/grc/gui/Port.py
@@ -70,26 +70,26 @@ class Port(Element):
length = len(filter(lambda p: not p.get_hide(), ports))
#reverse the order of ports for these rotations
if rotation in (180, 270): index = length-index-1
- offset = (self.get_parent().H - length*self.H - (length-1)*PORT_SEPARATION)/2
+ offset = (self.get_parent().H - (length-1)*PORT_SEPARATION - self.H)/2
#create areas and connector coordinates
if (self.is_sink() and rotation == 0) or (self.is_source() and rotation == 180):
x = -1*W
- y = (PORT_SEPARATION+self.H)*index+offset
+ y = PORT_SEPARATION*index+offset
self.add_area((x, y), (W, self.H))
self._connector_coordinate = (x-1, y+self.H/2)
elif (self.is_source() and rotation == 0) or (self.is_sink() and rotation == 180):
x = self.get_parent().W
- y = (PORT_SEPARATION+self.H)*index+offset
+ y = PORT_SEPARATION*index+offset
self.add_area((x, y), (W, self.H))
self._connector_coordinate = (x+1+W, y+self.H/2)
elif (self.is_source() and rotation == 90) or (self.is_sink() and rotation == 270):
y = -1*W
- x = (PORT_SEPARATION+self.H)*index+offset
+ x = PORT_SEPARATION*index+offset
self.add_area((x, y), (self.H, W))
self._connector_coordinate = (x+self.H/2, y-1)
elif (self.is_sink() and rotation == 90) or (self.is_source() and rotation == 270):
y = self.get_parent().W
- x = (PORT_SEPARATION+self.H)*index+offset
+ x = PORT_SEPARATION*index+offset
self.add_area((x, y), (self.H, W))
self._connector_coordinate = (x+self.H/2, y+1+W)
#the connector length