projects
/
lilass.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
09b026a
)
made aspect ratio accurate
author
Constantin Berhard
<git.mail.enormator@xoxy.net>
Fri, 20 Nov 2015 16:51:21 +0000
(17:51 +0100)
committer
Constantin Berhard
<git.mail.enormator@xoxy.net>
Fri, 20 Nov 2015 16:51:21 +0000
(17:51 +0100)
screen.py
patch
|
blob
|
history
diff --git
a/screen.py
b/screen.py
index f9bef55740804effac631a19b7d00b2b3f290eaa..b0c657737403be53b1a05ec7b4edef227b76f19c 100644
(file)
--- a/
screen.py
+++ b/
screen.py
@@
-18,6
+18,7
@@
import re, subprocess
from enum import Enum
import re, subprocess
from enum import Enum
+from fractions import Fraction
## utility functions
## utility functions
@@
-66,13
+67,8
@@
class Resolution:
def __str__(self):
# get ratio
def __str__(self):
# get ratio
- 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
+ ratio = Fraction(self.width, self.height) # automatically divides by the gcd
+ strRatio = "%d:%d" % (ratio.numerator, ratio.denominator)
return '%dx%d (%s)' %(self.width, self.height, strRatio)
def __repr__(self):
return '%dx%d (%s)' %(self.width, self.height, strRatio)
def __repr__(self):