diff options
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | activity/activity.info | 2 | ||||
-rw-r--r-- | util.py | 14 |
3 files changed, 8 insertions, 12 deletions
@@ -1,3 +1,7 @@ +23 + +* Remove dependency on xpdyinfo + 21 * GTK-3 conversion by Flavio Danesse diff --git a/activity/activity.info b/activity/activity.info index abf6e84..23ff3ac 100644 --- a/activity/activity.info +++ b/activity/activity.info @@ -3,7 +3,7 @@ name = Ruler bundle_id = com.laptop.Ruler exec = sugar-activity RulerActivity.RulerActivity icon = activity-ruler -activity_version = 21 +activity_version = 23 show_launcher = yes license = GPLv3+ summary = scaled images of a ruler, protractor, and a checker board @@ -80,17 +80,9 @@ def dimensions_mm(dpi, w, h): def calc_dpi(): - '''Looking for 'dimensions' line in xdpyinfo - dimensions: 1280x800 pixels (339x212 millimeters)''' - output = check_output('/usr/bin/xdpyinfo', 'xdpyinfo failed') - if output is not None: - strings = output[find(output, 'dimensions:'):].split() - w = int(strings[1].split('x')[0]) # e.g., 1280x800 - mm = int(strings[3][1:].split('x')[0]) # e.g., (339x212) - return int((w * 25.4 / mm) + 0.5), True - else: - return 96, False - + xft_dpi = Gtk.Settings.get_default().get_property('gtk-xft-dpi') + dpi = float(xft_dpi / 1024) + return dpi, True # # Cairo-related utilities |