Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def items_to_display(self):
'''
Create a list of TodomanItems to display, based on the associated
Database and the current done_is_hidden setting.
(TodomanItemListPage) -> [TodomanItem]
'''
items = []
for t in self.database.todos():
todo = TodomanItem(t, self.database, self.generate_label)
if not self.done_is_hidden or not todo.is_completed:
items.append(todo)
items.sort(key=lambda item: item.label.lower())
return items
def new_item(self):
'''
Create a new TodomanItem and open a TodomanItemDetailsPage in which
the user can edit the new item.
(TodomanItemListPage) -> None
'''
item = TodomanItem(None, self.database, self.generate_label)
new_page = TodomanItemDetailsPage(self.parent, self.callback, item)
self.open_page(new_page)