Revert "made aspect ratio accurate"
authorRalf Jung <post@ralfj.de>
Tue, 22 Mar 2016 21:35:11 +0000 (22:35 +0100)
committerRalf Jung <post@ralfj.de>
Tue, 22 Mar 2016 21:35:11 +0000 (22:35 +0100)
This reverts commit 53c8405139ffdc848753335f50b6b746a7bafcb5. The aspect ratio code had some heuristics to make sure aspect ratios are shown as expected by the users.

screen.py

index 21774df08bd91cc96e9093ff3f9c05dcc01fa006..6ba9418ae39058429b092aa4e1a646d91582e489 100644 (file)
--- a/screen.py
+++ b/screen.py
@@ -18,7 +18,6 @@
 
 import re, subprocess
 from enum import Enum
-from fractions import Fraction
 
 ## utility functions
 
@@ -87,8 +86,13 @@ class Resolution:
     
     def __str__(self):
         # get ratio
-        ratio = Fraction(self.width, self.height) # automatically divides by the gcd
-        strRatio = "%d:%d" % (ratio.numerator, ratio.denominator)
+        ratio = int(round(16.0*self.height/self.width))
+        if ratio == 12: # 16:12 = 4:3
+            strRatio = '4:3'
+        elif ratio == 13: # 16:12.8 = 5:4
+            strRatio = '5:4'
+        else: # let's just hope this will never be 14 or more...
+            strRatio = '16:%d' % ratio
         return '%dx%d (%s)' %(self.width, self.height, strRatio)
     
     def __repr__(self):