From 47ddd4c48916308817ff39919c1e39b0da3f9c3d Mon Sep 17 00:00:00 2001
From: Sebastian Koslowski <koslowski@kit.edu>
Date: Wed, 13 Jul 2016 10:53:09 +0200
Subject: grc: gtk3: remove coordinate getter/setter

---
 grc/gui/Block.py | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

(limited to 'grc/gui/Block.py')

diff --git a/grc/gui/Block.py b/grc/gui/Block.py
index e0899136f3..5efb571456 100644
--- a/grc/gui/Block.py
+++ b/grc/gui/Block.py
@@ -60,7 +60,8 @@ class Block(_Block, Element):
         self._bg_color = Colors.BLOCK_ENABLED_COLOR
         self.has_busses = [False, False]  # source, sink
 
-    def get_coordinate(self):
+    @property
+    def coordinate(self):
         """
         Get the coordinate from the position param.
 
@@ -69,7 +70,8 @@ class Block(_Block, Element):
         """
         return self.states['_coordinate']
 
-    def set_coordinate(self, coor):
+    @coordinate.setter
+    def coordinate(self, coor):
         """
         Set the coordinate into the position param.
 
@@ -121,12 +123,12 @@ class Block(_Block, Element):
             for index, port in enumerate(ports):
                 port.create_shapes()
 
-                port.set_coordinate({
+                port.coordinate = {
                     0: (+self.width, offset),
                     90: (offset, -port.width),
                     180: (-port.width, offset),
                     270: (offset, +self.width),
-                }[port.get_connector_direction()])
+                }[port.get_connector_direction()]
                 offset += PORT_SEPARATION if not has_busses else port.height + PORT_SPACING
 
                 port.connector_length = Constants.CONNECTOR_EXTENSION_MINIMAL + \
@@ -281,8 +283,8 @@ class Block(_Block, Element):
         """
         for port in self.active_ports():
             port_selected = port.what_is_selected(
-                coor=[a - b for a, b in zip(coor, self.get_coordinate())],
-                coor_m=[a - b for a, b in zip(coor, self.get_coordinate())] if coor_m is not None else None
+                coor=[a - b for a, b in zip(coor, self.coordinate)],
+                coor_m=[a - b for a, b in zip(coor, self.coordinate)] if coor_m is not None else None
             )
             if port_selected:
                 return port_selected
@@ -291,7 +293,7 @@ class Block(_Block, Element):
     def draw_comment(self, widget, cr):
         if not self._comment_layout:
             return
-        x, y = self.get_coordinate()
+        x, y = self.coordinate
 
         if self.is_horizontal():
             y += self.height + BLOCK_LABEL_PADDING
-- 
cgit v1.2.3