From 76f8130f128c4b527ed47997586fe4c62ce87aee Mon Sep 17 00:00:00 2001 From: Maks Verver Date: Sat, 19 Apr 2014 18:03:54 +0200 Subject: Fix line splitting logic. --- src/redshift-gtk/statusicon.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/redshift-gtk/statusicon.py') diff --git a/src/redshift-gtk/statusicon.py b/src/redshift-gtk/statusicon.py index 08f28ef..ec0dfe8 100644 --- a/src/redshift-gtk/statusicon.py +++ b/src/redshift-gtk/statusicon.py @@ -289,7 +289,7 @@ class RedshiftStatusIcon(object): if key == 'Status': self.change_status(value != 'Disabled') elif key == 'Color temperature': - self.change_temperature(int(value[:-1], 10)) + self.change_temperature(int(value.rstrip('K'), 10)) elif key == 'Period': self.change_period(value) elif key == 'Location': @@ -308,9 +308,10 @@ class RedshiftStatusIcon(object): ib.buf += os.read(f, 256).decode('utf-8') # Split input at line break - sep = True - while sep != '': + while True: first, sep, last = ib.buf.partition('\n') + if sep == '': + break ib.buf = last ib.lines.append(first) if stdout: -- cgit v1.2.3-70-g09d2