|
|
@ -14,7 +14,6 @@ import json |
|
|
|
import notmuch |
|
|
|
import mpd |
|
|
|
import random |
|
|
|
import taskw |
|
|
|
import math |
|
|
|
|
|
|
|
coloredlogs.install(level='DEBUG', fmt='%(levelname)s %(message)s') |
|
|
@ -526,39 +525,6 @@ class NotmuchUnreadProvider(ColorCountsSection, InotifyUpdater): |
|
|
|
self.addPath(os.path.join(self.dir, '.notmuch', 'xapian')) |
|
|
|
|
|
|
|
|
|
|
|
class TaskWarriorProvider(StatefulSection, InotifyUpdater): |
|
|
|
ICON = '' |
|
|
|
NUMBER_STATES = 2 |
|
|
|
DEFAULT_STATE = 1 |
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, theme=None): |
|
|
|
InotifyUpdater.__init__(self) |
|
|
|
StatefulSection.__init__(self, theme=theme) |
|
|
|
self.taskw = taskw.TaskWarrior() |
|
|
|
self.addPath(os.path.expanduser(self.taskw.config['data']['location'])) |
|
|
|
|
|
|
|
def fetcher(self): |
|
|
|
maxi = -math.inf |
|
|
|
total = 0 |
|
|
|
for task in self.taskw.load_tasks('pending')['pending']: |
|
|
|
urgency = task['urgency'] |
|
|
|
if urgency > maxi: |
|
|
|
maxi = urgency |
|
|
|
if urgency > 0: |
|
|
|
total += urgency |
|
|
|
t = Text() |
|
|
|
t.append(f"{maxi:.1f}") |
|
|
|
|
|
|
|
if self.showTotal: |
|
|
|
t.append(f" | {total:.1f}") |
|
|
|
|
|
|
|
return t |
|
|
|
|
|
|
|
def onChangeState(self, state): |
|
|
|
self.showTotal = state >= 1 |
|
|
|
|
|
|
|
|
|
|
|
class TodoProvider(ColorCountsSection, InotifyUpdater): |
|
|
|
# TODO OPT/UX Maybe we could get more data from the todoman python module |
|
|
|
# TODO OPT Specific callback for specific directory |
|
|
|