Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2012-10-30 12:26:15 (GMT)
committer Walter Bender <walter.bender@gmail.com>2012-10-30 12:26:15 (GMT)
commit8ae611b1c9f6ccc4b65e493924fd075b102780f0 (patch)
treed5a09c6315538a9f5d0622b38dad0478bc67518b
parent0e4aaf0ad7bf1fe2173349c6618be9b0f2a2e6d9 (diff)
remove external dependency
-rw-r--r--util.py15
1 files changed, 4 insertions, 11 deletions
diff --git a/util.py b/util.py
index ee6e509..4a35b70 100644
--- a/util.py
+++ b/util.py
@@ -79,17 +79,10 @@ def dimensions_mm(dpi, w, h):
def calc_dpi():
- '''Looking for 'dimensions' line in xdpyinfo
- dimensions: 1280x800 pixels (339x212 millimeters)'''
- (status, output) = commands.getstatusoutput('/usr/bin/xdpyinfo')
- if status == 0:
- 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:
- # just in case the above fails
- return 96, False
+ ''' Return screen DPI '''
+ xft_dpi = gtk.settings_get_default().get_property('gtk-xft-dpi')
+ dpi = float(xft_dpi / 1024)
+ return dpi, True
#