Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS4
-rw-r--r--activity/activity.info2
-rw-r--r--util.py14
3 files changed, 8 insertions, 12 deletions
diff --git a/NEWS b/NEWS
index 8606f44..6163247 100644
--- a/NEWS
+++ b/NEWS
@@ -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
diff --git a/util.py b/util.py
index 254471c..f96b650 100644
--- a/util.py
+++ b/util.py
@@ -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