From a5eb6d18973d7bf924e947b052e94e86b26baf19 Mon Sep 17 00:00:00 2001 From: Arnas Udovicius Date: Tue, 13 Mar 2018 22:49:47 +0200 Subject: [PATCH] toggle active in config menu --- config.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/config.py b/config.py index 0f51926..c16c449 100644 --- a/config.py +++ b/config.py @@ -15,6 +15,12 @@ class Config: def manage(self): print(bcolors.HEADER + 'Managing configs' + bcolors.ENDC) + active = 'off' + if self.params.get('active'): + active = 'on' + + print(bcolors.WARNING + 'Show current tasks: [' + active + ']' + bcolors.ENDC) + done = 'off' if self.params.get('done'): done = 'on' @@ -33,6 +39,10 @@ class Config: self.manage_about() self.manage_menu() + elif menu == '!': + self.toggle_active() + self.manage() + elif menu == 'v': self.toggle_done() self.manage() @@ -61,6 +71,11 @@ t - manage time slots q - exit ''' + bcolors.ENDC) + def toggle_active(self): + active = self.params.get('active') + self.params.update('active', not active) + print(bcolors.OKBLUE + '[parameter "active" has been toggled]' + bcolors.ENDC) + def toggle_done(self): done = self.params.get('done') self.params.update('done', not done)