summaryrefslogtreecommitdiffstats
path: root/src/monitor.py
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-02-24 16:10:21 +0100
committerMattias Andrée <maandree@operamail.com>2014-02-24 16:10:21 +0100
commit5c4e823b99ce422285ff7053f5073d6e6dbaacba (patch)
treeb5663150c18807ea708ca1d69153db17f00f1105 /src/monitor.py
parentmake lower_resultion's parameters optional (diff)
downloadblueshift-5c4e823b99ce422285ff7053f5073d6e6dbaacba.tar.gz
blueshift-5c4e823b99ce422285ff7053f5073d6e6dbaacba.tar.bz2
blueshift-5c4e823b99ce422285ff7053f5073d6e6dbaacba.tar.xz
improve print_curves with compact parameters + fix lower_resolution
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/monitor.py28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/monitor.py b/src/monitor.py
index 71343a4..67c2c16 100644
--- a/src/monitor.py
+++ b/src/monitor.py
@@ -178,17 +178,33 @@ def vidmode(*crtcs, screen = 0):
pass # Happens on exit by TERM signal
-def print_curves(*crtcs, screen = 0):
+def print_curves(*crtcs, screen = 0, compact = False):
'''
Prints the curves to stdout
- @param crtcs:*int Dummy parameter
- @param screen:int Dummy parameter
+ @param crtcs:*int Dummy parameter
+ @param screen:int Dummy parameter
+ @param compact:bool Whether to print in compact form
'''
(R_curve, G_curve, B_curve) = translate_to_integers()
- print(R_curve)
- print(G_curve)
- print(B_curve)
+ if compact:
+ for curve in (R_curve, G_curve, B_curve):
+ print('[', end = '')
+ last = None
+ count = 0
+ for i in range(i_size):
+ if curve[i] == last:
+ count += 1
+ else:
+ if last is not None:
+ print('%i {%i}, ' % (last, count), end = '')
+ last = curve[i]
+ count = 1
+ print('%i {%i}]' % (last, count))
+ else:
+ print(R_curve)
+ print(G_curve)
+ print(B_curve)