diff options
-rwxr-xr-x | client/ur_fuzzy_alarm_clock.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/client/ur_fuzzy_alarm_clock.py b/client/ur_fuzzy_alarm_clock.py index 5364e52..4fbe3e5 100755 --- a/client/ur_fuzzy_alarm_clock.py +++ b/client/ur_fuzzy_alarm_clock.py @@ -175,8 +175,8 @@ class UI: ],dividechars=1) self.main_body = urwid.ListBox([alarm_headers]+[al.widgets for al in self.alarms]) - footer = urwid.Text('a, b, c') - footer_map = urwid.AttrMap(footer,'footer') + self.footer = urwid.Text('') + footer_map = urwid.AttrMap(self.footer,'footer') header = urwid.Text( 'q: Quit ' + @@ -190,7 +190,7 @@ class UI: return ui def read_commands(self,cmd): - {'n': self.fac.set_time_to_now, + {'n': self.set_time_to_now, 'r': self.read_alarms, 's': self.set_alarms, '?': self.print_help, @@ -208,16 +208,27 @@ class UI: for i, al in enumerate(alarms): self.alarms[i].set_values(al) + self.footer.set_text('Alarms read from device') + def set_alarms(self): for i,alarm in enumerate(self.alarms): self.fac.set_alarm(i,alarm.get_values()) + self.footer.set_text('Alarms set on device') + + def set_time_to_now(self): + self.fac.set_time_to_now() + + self.footer.set_text('Time updated on device') + def save_alarms(self, fname='saved_alarms.json'): alarms = [a.get_values() for a in self.alarms] with open(fname,'w') as fp: json.dump(alarms, fp) + self.footer.set_text('Alarms saved to {fname}'.format(fname=fname)) + def load_alarms(self, fname='saved_alarms.json'): try: with open(fname) as fp: @@ -230,6 +241,8 @@ class UI: pass a.set_values(alarms[i]) + self.footer.set_text('Alarms loaded from {fname}'.format(fname=fname)) + def print_help(self): pass |