summaryrefslogtreecommitdiff
path: root/grc/gui/Block.py
diff options
context:
space:
mode:
authorSebastian Koslowski <koslowski@kit.edu>2016-10-12 15:17:09 +0200
committerSebastian Koslowski <koslowski@kit.edu>2016-10-21 09:29:38 +0200
commitea3eaa5f930062fa57568c6132a5930b7399f5f7 (patch)
tree2225a7ad738151b365f06848b488515dcb0bc3a3 /grc/gui/Block.py
parent1624da7772f1ff57232e2f2024281547d483629c (diff)
grc: respect display scaling for block positions, canvas size and props dialog
Diffstat (limited to 'grc/gui/Block.py')
-rw-r--r--grc/gui/Block.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/grc/gui/Block.py b/grc/gui/Block.py
index 55c8805fae..b90ea485ee 100644
--- a/grc/gui/Block.py
+++ b/grc/gui/Block.py
@@ -95,9 +95,8 @@ class Block(Element, _Block):
"""
proximity = Constants.BORDER_PROXIMITY_SENSITIVITY
try: #should evaluate to tuple
- coor = eval(self.get_param('_coordinate').get_value())
- x, y = map(int, coor)
- fgW,fgH = self.get_parent().get_size()
+ x, y = Utils.scale(eval(self.get_param('_coordinate').get_value()))
+ fgW, fgH = self.get_parent().get_size()
if x <= 0:
x = 0
elif x >= fgW - proximity:
@@ -124,7 +123,7 @@ class Block(Element, _Block):
Utils.align_to_grid(coor[0] + offset_x) - offset_x,
Utils.align_to_grid(coor[1] + offset_y) - offset_y
)
- self.get_param('_coordinate').set_value(str(coor))
+ self.get_param('_coordinate').set_value(str(Utils.scale(coor, reverse=True)))
def bound_move_delta(self, delta_coor):
"""
@@ -141,11 +140,11 @@ class Block(Element, _Block):
try:
fgW, fgH = self.get_parent().get_size()
- x, y = map(int, eval(self.get_param("_coordinate").get_value()))
+ x, y = Utils.scale(eval(self.get_param('_coordinate').get_value()))
if self.is_horizontal():
- sW, sH = self.W, self.H
+ sW, sH = self.W, self.H
else:
- sW, sH = self.H, self.W
+ sW, sH = self.H, self.W
if x + dX < 0:
dX = -x
@@ -154,7 +153,7 @@ class Block(Element, _Block):
if y + dY < 0:
dY = -y
elif dY + y + sH >= fgH:
- dY = fgH - y - sH
+ dY = fgH - y - sH
except:
pass