diff --git a/src/gtimelog/main.py b/src/gtimelog/main.py index dd66897c..bec697d2 100644 --- a/src/gtimelog/main.py +++ b/src/gtimelog/main.py @@ -1342,12 +1342,12 @@ def on_tasks_file_changed(self, monitor, file, other_file, event_type): GLib.timeout_add_seconds(1, self.check_reload_tasks) def check_reload(self): - if self.timelog.check_reload(): + if self.timelog and self.timelog.check_reload(): self.notify('timelog') self.tick(True) def check_reload_tasks(self): - if self.tasks.check_reload(): + if self.tasks and self.tasks.check_reload(): self.notify('tasks') def enable_add_entry(self): diff --git a/src/gtimelog/timelog.py b/src/gtimelog/timelog.py index 85d2c3b4..a5340cd4 100644 --- a/src/gtimelog/timelog.py +++ b/src/gtimelog/timelog.py @@ -250,6 +250,11 @@ def split_category(entry): """ if ': ' in entry: cat, tsk = entry.split(': ', 1) + t, _, c = cat.partition('@') + if c and t: + # if category string can be further partitioned into non empty strings by '@' + # use 1st as task and 2nd as category + cat, tsk = c, t return cat.strip(), tsk.strip() elif entry.endswith(':'): return entry.partition(':')[0].strip(), '' @@ -284,6 +289,10 @@ def grouped_entries(self, skip_first=True): work = {} slack = {} for start, stop, duration, tags, entry in self.all_entries(): + cat, task = self.split_category(entry) + entry = task if task is not None else '' + if cat: + entry = cat + ': ' + entry if skip_first: # XXX: in case of for multi-day windows, this should skip # the 1st entry of each day