aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Lund Steffensen <jonlst@gmail.com>2014-04-20 19:31:52 +0200
committerJon Lund Steffensen <jonlst@gmail.com>2014-04-20 19:31:52 +0200
commit7a401e73e78f4890f876cfcf8fddb05d587c2117 (patch)
treebb98cc4ee3dc90434b56349e43b6ad2151f90d27
parentFix #64: Fix Geoclue support when run outside of X (diff)
parentFix line splitting logic. (diff)
downloadredshift-ng-7a401e73e78f4890f876cfcf8fddb05d587c2117.tar.gz
redshift-ng-7a401e73e78f4890f876cfcf8fddb05d587c2117.tar.bz2
redshift-ng-7a401e73e78f4890f876cfcf8fddb05d587c2117.tar.xz
Merge pull request #70 from maksverver/master
redshift-gtk: Fix line splitting logic
-rw-r--r--src/redshift-gtk/statusicon.py7
1 files changed, 4 insertions, 3 deletions
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: