Commit 7805d35a authored by Bram Schoenmakers's avatar Bram Schoenmakers

Add group support to the column UI

parent 902ee572
......@@ -30,6 +30,7 @@ def columns(p_alt_layout_path=None):
column_dict['title'] = p_cp.get(p_column, 'title')
column_dict['filterexpr'] = p_cp.get(p_column, 'filterexpr')
column_dict['sortexpr'] = p_cp.get(p_column, 'sortexpr')
column_dict['groupexpr'] = p_cp.get(p_column, 'groupexpr')
column_dict['show_all'] = p_cp.getboolean(p_column, 'show_all')
return column_dict
......@@ -38,6 +39,7 @@ def columns(p_alt_layout_path=None):
'title': 'Yet another column',
'filterexpr': '',
'sortexpr': config().sort_string(),
'groupexpr': config().group_string(),
'show_all': '0',
}
......
......@@ -413,7 +413,7 @@ class UIApplication(CLIApplicationBase):
"""
Converts a dictionary describing a view to an actual UIView instance.
"""
sorter = Sorter(p_data['sortexpr'])
sorter = Sorter(p_data['sortexpr'], p_data['groupexpr'])
filters = []
if not p_data['show_all']:
......@@ -607,6 +607,7 @@ class UIApplication(CLIApplicationBase):
dummy = {
"title": "All tasks",
"sortexpr": "desc:prio",
"groupexpr": "",
"filterexpr": "",
"show_all": True,
}
......
......@@ -92,11 +92,17 @@ class TodoListWidget(urwid.LineBox):
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('-'))
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)
todowidget.number = self.view.todolist.number(todo)
self.todolist.append(todowidget)
self.todolist.append(urwid.Divider('-'))
if old_focus_position:
try:
......
......@@ -24,16 +24,18 @@ class ViewWidget(urwid.LineBox):
self.titleedit = urwid.Edit("Title: ", "")
self.sortedit = urwid.Edit("Sort expression: ", "")
self.groupedit = urwid.Edit("Group expression: ", "")
self.filteredit = urwid.Edit("Filter expression: ", "")
group = []
self.relevantradio = urwid.RadioButton(group, "Only show relevant todo items", True)
self.allradio = urwid.RadioButton(group, "Show all todo items")
radiogroup = []
self.relevantradio = urwid.RadioButton(radiogroup, "Only show relevant todo items", True)
self.allradio = urwid.RadioButton(radiogroup, "Show all todo items")
self.pile = urwid.Pile([
self.filteredit,
self.titleedit,
self.sortedit,
self.groupedit,
self.relevantradio,
self.allradio,
urwid.Button("Save", lambda _: urwid.emit_signal(self, 'save')),
......@@ -51,6 +53,7 @@ class ViewWidget(urwid.LineBox):
return {
'title': self.titleedit.edit_text or self.filteredit.edit_text,
'sortexpr': self.sortedit.edit_text or config().sort_string(),
'groupexpr': self.groupedit.edit_text or config().group_string(),
'filterexpr': self.filteredit.edit_text,
'show_all': self.allradio.state,
}
......@@ -59,6 +62,7 @@ class ViewWidget(urwid.LineBox):
def data(self, p_data):
self.titleedit.edit_text = p_data['title']
self.sortedit.edit_text = p_data['sortexpr']
self.groupedit.edit_text = p_data['groupexpr']
self.filteredit.edit_text = p_data['filterexpr']
self.relevantradio.set_state(not p_data['show_all'])
self.allradio.set_state(p_data['show_all'])
......
[all]
title = All tasks
filterexpr =
groupexpr = project
[today]
title = Due today
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment