diff options
author | Sebastian Koslowski <koslowski@kit.edu> | 2016-10-12 15:17:09 +0200 |
---|---|---|
committer | Sebastian Koslowski <koslowski@kit.edu> | 2016-10-21 09:29:38 +0200 |
commit | ea3eaa5f930062fa57568c6132a5930b7399f5f7 (patch) | |
tree | 2225a7ad738151b365f06848b488515dcb0bc3a3 /grc/gui/Utils.py | |
parent | 1624da7772f1ff57232e2f2024281547d483629c (diff) |
grc: respect display scaling for block positions, canvas size and props dialog
Diffstat (limited to 'grc/gui/Utils.py')
-rw-r--r-- | grc/gui/Utils.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/grc/gui/Utils.py b/grc/gui/Utils.py index 51b9b19e9f..7d15d47142 100644 --- a/grc/gui/Utils.py +++ b/grc/gui/Utils.py @@ -24,7 +24,7 @@ import gobject from Cheetah.Template import Template -from Constants import POSSIBLE_ROTATIONS, CANVAS_GRID_SIZE +from Constants import POSSIBLE_ROTATIONS, CANVAS_GRID_SIZE, DPI_SCALING def rotate_pixmap(gc, src_pixmap, dst_pixmap, angle=gtk.gdk.PIXBUF_ROTATE_COUNTERCLOCKWISE): @@ -131,3 +131,8 @@ def align_to_grid(coor, mode=round): except TypeError: x = coor return align(coor) + + +def scale(coor, reverse=False): + factor = DPI_SCALING if not reverse else 1 / DPI_SCALING + return tuple(int(x * factor) for x in coor) |