def update(self): """ Updates the todo list according to the todos in the view associated with this list. """ old_focus_position = self.todolist.focus id_length = max_id_length(self.view.todolist.count()) del self.todolist[:] for group, todos in self.view.groups.items(): if len(self.view.groups) > 1: grouplabel = ", ".join(group) self.todolist.append(urwid.Text(grouplabel)) self.todolist.append(urwid.Divider('-')) for todo in todos: todowidget = TodoWidget.create(todo, id_length) todowidget.number = self.view.todolist.number(todo) self.todolist.append(todowidget) self.todolist.append(urwid.Divider('-')) if old_focus_position: try: self.todolist.set_focus(old_focus_position) except IndexError: # scroll to the bottom if the last item disappeared from column # -2 for the same reason as in self._scroll_to_bottom() self.todolist.set_focus(len(self.todolist) - 2)
def update(self): """ Updates the todo list according to the todos in the view associated with this list. """ old_focus_position = self.todolist.focus del self.todolist[:] for todo in self.view.todos: todowidget = TodoWidget.create(todo) todowidget.number = self.view.todolist.number(todo) self.todolist.append(todowidget) self.todolist.append(urwid.Divider("-")) if old_focus_position: try: self.todolist.set_focus(old_focus_position) except IndexError: # scroll to the bottom if the last item disappeared from column # -2 for the same reason as in self._scroll_to_bottom() self.todolist.set_focus(len(self.todolist) - 2)
def callback(p_loop, p_data): TodoWidget.wipe_cache() self._update_all_columns() self._set_alarm_for_next_midnight_update()