diff options
author | Johnathan Corgan <johnathan@corganlabs.com> | 2016-11-12 06:29:27 -0800 |
---|---|---|
committer | Johnathan Corgan <johnathan@corganlabs.com> | 2016-11-12 06:29:27 -0800 |
commit | 8ddebb888bd73bbdda48dcf00d1bd1234858bd3c (patch) | |
tree | 294856bf7c095e6dfa2901a16e18d04d83909aeb /grc/gui/Utils.py | |
parent | 7b0dfd802aa08c4d0aefde2df0361304d8f282f4 (diff) | |
parent | 1775fb0d48138e5ced15cdc2fbef01589f294a2c (diff) |
Merge branch 'maint'
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 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) |