def display(self, title=None): if not title: title = self.name self.items = [ActionItem("..", Menu.back)] + self.unevaluated() self.position = min(len(self.items) - 1, self.position) text = "" for i, item in enumerate(self.items): if i == self.position: text += "> {}\n".format(item.name) else: text += " {}\n".format(item.name) print(title, "\n", text) Screen.menu_screen(title, text)
def display(self, title="Edit Time"): Screen.multi_line_text([ Screen.TextLine(title, 1), Screen.TextLine( "Unit change: {}".format( TimeMenu.units_stages[self.units_stage]), 0), Screen.TextLine(self.time.strftime("%H:%M"), 2, align="c"), Screen.TextLine(TimeMenu.menu_stages[self.menu_stage], 1, align="c") ])
def display(self): now = datetime.datetime.now() Screen.home_screen(self.name, now.strftime("%H:%M"), now.strftime("%a %d %b"))
def display(self): Screen.text_screen(self.name + "\n" + "-" * len(self.name))
def display(self): if self.delayed_for > 0: Screen.multi_line_text([ Screen.TextLine(self.name, 1), Screen.TextLine("Delaying until:", 0, uniform_y=True), Screen.TextLine(self.task.get_task_time().strftime("%H:%M"), 1), Screen.TextLine(" ", 0), Screen.TextLine("Delayed for", 0), Screen.TextLine(str(self.delayed_for * self.delay_period), 0) ]) else: Screen.multi_line_text([ Screen.TextLine(self.name, 1), Screen.TextLine("Alert time:", 0, uniform_y=True), Screen.TextLine(self.task.get_task_time().strftime("%H:%M"), 1) ])
def handle_button_press(self, button): if button == "x": Menu.menu_stack.pop() Screen.toggle_backlight()
def display(self): Screen.off()
def exit_program(): saving_data() Screen.off() exit()
def power_off(): saving_data() Screen.off() time.sleep(0.5) os.system("sudo shutdown now") exit()