summaryrefslogtreecommitdiff
path: root/grc/gui/Utils.py
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2016-10-24 17:07:06 -0700
committerJohnathan Corgan <johnathan@corganlabs.com>2016-10-24 17:07:06 -0700
commita411404005f3c24c8df51b68946e2cfd69e38d63 (patch)
tree9c823748f244e7b1890e2e3203cb6884a0d72c58 /grc/gui/Utils.py
parent065b0add8523e2f85afa0848391174889d1b61a9 (diff)
parentafadc5cb5564cb9b6136db046adccde5856edf57 (diff)
Merge branch 'maint'
Diffstat (limited to 'grc/gui/Utils.py')
-rw-r--r--grc/gui/Utils.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/grc/gui/Utils.py b/grc/gui/Utils.py
index 80dcb4283a..d85b846b3a 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)