diff options
author | Walter Bender <walter.bender@gmail.com> | 2012-10-30 12:07:55 (GMT) |
---|---|---|
committer | Walter Bender <walter.bender@gmail.com> | 2012-10-30 12:07:55 (GMT) |
commit | 7ddf1d9609655935f14279435e45b102afd30e8e (patch) | |
tree | 8a3fc945b41a558c48350f353c4d74b47346c0b7 | |
parent | ce5c5ac5993cee213277badc30e4ba121065f5bf (diff) |
remove dependency on xpdyinfo
-rw-r--r-- | TurtleArt/tautils.py | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/TurtleArt/tautils.py b/TurtleArt/tautils.py index daac4fe..3b3b974 100644 --- a/TurtleArt/tautils.py +++ b/TurtleArt/tautils.py @@ -722,16 +722,10 @@ def _get_dmi(node): def get_screen_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) - else: - return 96 + ''' Return screen DPI ''' + xft_dpi = gtk.settings_get_default().get_property('gtk-xft-dpi') + dpi = float(xft_dpi / 1024) + return dpi def check_output(command, warning): |