diff options
| author | Mattias Andrée <maandree@operamail.com> | 2014-05-16 19:47:19 +0200 | 
|---|---|---|
| committer | Mattias Andrée <maandree@operamail.com> | 2014-05-16 19:47:19 +0200 | 
| commit | 25e581bb690b85d4e6a073169ef25f3c32d6b021 (patch) | |
| tree | f0cce1c3711bf490e2e25d10ebf23d3e0916d77f /src | |
| parent | broadcast freeze and thaw (diff) | |
| download | nightshift-25e581bb690b85d4e6a073169ef25f3c32d6b021.tar.gz nightshift-25e581bb690b85d4e6a073169ef25f3c32d6b021.tar.bz2 nightshift-25e581bb690b85d4e6a073169ef25f3c32d6b021.tar.xz  | |
typo
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src')
| -rwxr-xr-x | src/__main__.py | 28 | ||||
| -rw-r--r-- | src/interface.py | 18 | 
2 files changed, 23 insertions, 23 deletions
diff --git a/src/__main__.py b/src/__main__.py index 6c41b3f..e0230c5 100755 --- a/src/__main__.py +++ b/src/__main__.py @@ -106,7 +106,7 @@ set_status = None  set_freeze = None  ''' -:bool?  `True` if redshift should be froozen, `False` for thawed, otherwise `None` +:bool?  `True` if redshift should be frozen, `False` for thawed, otherwise `None`  '''  status = False @@ -277,7 +277,7 @@ The pathname of the interprocess communication socket for nightshift  red_brightness, red_temperature = 1, 6500  red_brightnesses, red_temperatures = (1, 1), (5500, 3500)  red_period, red_location = 1, (0, 0) -red_status, red_running, red_dying, red_froozen = True, True, False, False +red_status, red_running, red_dying, red_frozen = True, True, False, False  red_condition, broadcast_condition = None, None @@ -302,7 +302,7 @@ def read_status(proc, sock):      while True:          got = proc.stdout.readline()          if (got is None) or (len(got) == 0): -            if red_froozen: +            if red_frozen:                  proc.wait()                  continue              break @@ -395,7 +395,7 @@ def generate_status_message():      message += 'Enabled: %s\n'             % ('yes' if red_status  else 'no')      message += 'Running: %s\n'             % ('yes' if red_running else 'no')      message += 'Dying: %s\n'               % ('yes' if red_dying   else 'no') -    message += 'Froozen: %s\n'             % ('yes' if red_froozen else 'no') +    message += 'Frozen: %s\n'              % ('yes' if red_frozen  else 'no')      return message @@ -406,7 +406,7 @@ def use_client(sock, proc):      @param  sock:socket  The socket connected to the client      @param  proc:Popen   The redshift process      ''' -    global red_dying, red_froozen +    global red_dying, red_frozen      buf = ''      closed = False      while not closed: @@ -428,21 +428,21 @@ def use_client(sock, proc):                  finally:                      red_condition.release()              elif message == 'toggle': -                if (not red_dying) and (not red_froozen): +                if (not red_dying) and (not red_frozen):                      proc.send_signal(signal.SIGUSR1)              elif message == 'disable': -                if (not red_dying) and (not red_froozen): +                if (not red_dying) and (not red_frozen):                      if red_status:                          proc.send_signal(signal.SIGUSR1)              elif message == 'enable': -                if (not red_dying) and (not red_froozen): +                if (not red_dying) and (not red_frozen):                      if not red_status:                          proc.send_signal(signal.SIGUSR1)              elif message == 'freeze':                  broadcast_condition.acquire()                  try: -                    if not red_froozen: -                        red_froozen = True +                    if not red_frozen: +                        red_frozen = True                          proc.send_signal(signal.SIGTSTP)                      broadcast_condition.notify_all()                  finally: @@ -450,15 +450,15 @@ def use_client(sock, proc):              elif message == 'thaw':                  broadcast_condition.acquire()                  try: -                    if red_froozen: -                        red_froozen = False +                    if red_frozen: +                        red_frozen = False                          proc.send_signal(signal.SIGCONT)                      broadcast_condition.notify_all()                  finally:                      broadcast_condition.release()              elif message == 'kill': -                if red_froozen: -                    red_froozen = False +                if red_frozen: +                    red_frozen = False                      proc.send_signal(signal.SIGCONT)                  red_dying = True                  proc.terminate() diff --git a/src/interface.py b/src/interface.py index b041d6b..99d38ed 100644 --- a/src/interface.py +++ b/src/interface.py @@ -69,7 +69,7 @@ def ui_print():          print('\033[2K' + ('Dying' if red_dying else ('Enabled' if red_status else 'Disabled')))          print('\033[2K\n\033[2K', end = '')          if not red_dying: -            if red_froozen: +            if red_frozen:                  print(_button(0, 1) % 'Thaw', end = '  ')                  print(_button(2) % 'Kill', end = '  ')                  print(_button(3) % 'Close') @@ -90,7 +90,7 @@ def ui_print():  def ui_read(): -    global red_dying, red_froozen +    global red_dying, red_frozen      inbuf = sys.stdin.buffer      while True:          c = inbuf.read(1) @@ -100,10 +100,10 @@ def ui_read():              red_condition.acquire()              try:                  if red_running and not red_dying: -                    if red_froozen and (ui_state['focus'] == 0): +                    if red_frozen and (ui_state['focus'] == 0):                          ui_state['focus'] = 1                      ui_state['focus'] = (ui_state['focus'] + 1) % 4 -                    if red_froozen and (ui_state['focus'] == 0): +                    if red_frozen and (ui_state['focus'] == 0):                          ui_state['focus'] = 1                  elif ui_state['focus'] == 3:                      ui_state['focus'] = 0 @@ -121,15 +121,15 @@ def ui_read():                      if red_dying or (ui_state['focus'] == 2):                          sock.sendall('kill\n'.encode('utf-8'))                          red_dying = True -                    elif red_froozen: +                    elif red_frozen:                          sock.sendall('thaw\n'.encode('utf-8')) -                        red_froozen = False +                        red_frozen = False                      else:                          if ui_state['focus'] == 0:                              sock.sendall('toggle\n'.encode('utf-8'))                          elif ui_state['focus'] == 1:                              sock.sendall('freeze\n'.encode('utf-8')) -                            red_froozen = True +                            red_frozen = True                      red_condition.notify()                  else:                      respawn_daemon() @@ -184,7 +184,7 @@ def ui_status():  def ui_status_callback(status):      global red_brightness, red_temperature, red_brightnesses, red_temperatures -    global red_period, red_location, red_status, red_running, red_dying, red_froozen +    global red_period, red_location, red_status, red_running, red_dying, red_frozen      if status is not None:          brightness  = [float(status['%s brightness' % k])  for k in ('Current', 'Daytime', 'Night')]          temperature = [float(status['%s temperature' % k]) for k in ('Current', 'Daytime', 'Night')] @@ -197,7 +197,7 @@ def ui_status_callback(status):              red_status   = status['Enabled'] == 'yes'              red_running  = status['Running'] == 'yes'              red_dying    = status['Dying']   == 'yes' -            red_froozen  = status['Froozen'] == 'yes' +            red_frozen  = status['Frozen'] == 'yes'              red_condition.notify()          finally:              red_condition.release()  | 
