File: dpiFetcher.py

package info (click to toggle)
playonlinux 4.3.4-5
  • links: PTS, VCS
  • area: contrib
  • in suites: trixie
  • size: 8,252 kB
  • sloc: sh: 5,390; python: 5,150; ansic: 72; makefile: 57; xml: 47
file content (16 lines) | stat: -rw-r--r-- 492 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import subprocess

class dpiFetcher():
    def fetchDPI(self):
        try:
            process = subprocess.Popen("xrdb -query|grep Xft.dpi|awk '{print $2}'", stdout=subprocess.PIPE, shell=True)
            (output, err) = process.communicate()
            return int(output)
        except ValueError:
            return 96

    # Should be fixed as possible...
    def fetch_extra_pixel(self):
        factor = self.fetchDPI() / 96
        print(factor)
        return 68.75 * factor - 50