From cc72814b839ad60e51fb3c87baa2d66744dcbd22 Mon Sep 17 00:00:00 2001 From: Pierre Dorbais Date: Tue, 30 Jan 2018 16:58:09 +0100 Subject: [PATCH 1/2] [modules] add taskwarrior module --- bumblebee/modules/taskwarrior.py | 39 +++++++++++++++++++++++++++++++ screenshots/taskwarrior.png | Bin 0 -> 702 bytes themes/icons/awesome-fonts.json | 3 +++ 3 files changed, 42 insertions(+) create mode 100644 bumblebee/modules/taskwarrior.py create mode 100644 screenshots/taskwarrior.png diff --git a/bumblebee/modules/taskwarrior.py b/bumblebee/modules/taskwarrior.py new file mode 100644 index 0000000..a7ba92d --- /dev/null +++ b/bumblebee/modules/taskwarrior.py @@ -0,0 +1,39 @@ +"""Displays the number of pending tasks in TaskWarrior. + +Requires the following library: + * taskw + +Parameters: + * taskwarrior.taskrc : path to the taskrc file (defaults to ~/.taskrc) +""" + +import bumblebee.input +import bumblebee.output +import bumblebee.engine + +from taskw import TaskWarrior + + +class Module(bumblebee.engine.Module): + """TaskWarrior module.""" + + def __init__(self, engine, config): + """Initialize taskwarrior module.""" + super(Module, self).__init__(engine, config, + bumblebee.output.Widget( + full_text=self.output)) + self._pending_tasks_count = "0" + + def update(self, widgets): + """Return a string with the number of pending tasks from TaskWarrior.""" + try: + taskrc = self.parameter("taskrc", "~/.taskrc") + w = TaskWarrior(config_filename=taskrc) + pending_tasks = w.filter_tasks({'status': 'pending'}) + self._pending_tasks_count = str(len(pending_tasks)) + except: + self._pending_tasks_count = 'Error' + + def output(self, _): + """Format the task counter to ouptut in bumblebee.""" + return "{}".format(self._pending_tasks_count) diff --git a/screenshots/taskwarrior.png b/screenshots/taskwarrior.png new file mode 100644 index 0000000000000000000000000000000000000000..6f2014795671f80caad91907b38ec4e1318dcfd9 GIT binary patch literal 702 zcmV;v0zv(WP)G}TS7bgeykaM@xbu!fg zYGh$$K6c?YE)yKVYKR9=$Nl@qdjDbY&!0kgbQbq5!y`*jN=%T~)=+Kbu9JC@ZUhxW z6o4G}|3A~i$Nt~HOXAl>XXU%n{fQUMo7PII>& zy_m3M2c{NWX$}~npT2&-eEYGYv?!)7Tp}RHadABVz(6=PAg4KH8S&ntC`?1Kra2J- z9$=zupSKxPJ$?~r_4VSF?d#VTaHXuQpYh}j{3c?`nrJB{`rH2b_YWuqj9(UDS@8Go zitWdbU%G>-7$^d-zMvUGLhSJ0-`wv$=wek35hOd!UAgnPY1RgaAu?h@$$|EhmhF7@ z`U4)jAX12;L`rJspTC@+KC9r;gSDJHcH!2NZO7nRu%@{mzkdIC`w^ms3tSkze*YPm zNN`yM7e_dbk@3Hr%;tL!L%)5K!Kw{wIcKJ)VyK~jFb;1yht*g-g6K`Ae}CEUJc#`F zmxGFF4v+O%rEoTxn3#Vm%B^8z{e)E;odvNpnOIrB$jWY{vpcX_hsAL~b*wC3v8txC kAa=*m*%7#`8`O>i06)gu*!nCHy#N3J07*qoM6N<$f&yGt0{{R3 literal 0 HcmV?d00001 diff --git a/themes/icons/awesome-fonts.json b/themes/icons/awesome-fonts.json index d5f1c97..b9491da 100644 --- a/themes/icons/awesome-fonts.json +++ b/themes/icons/awesome-fonts.json @@ -132,5 +132,8 @@ "snow": { "prefix": "" }, "clear": { "prefix": "" }, "thunder": { "prefix": "" } + }, + "taskwarrior": { + "prefix": "  " } } From 5328a151f4f4d396815ce0f838f206299622d32c Mon Sep 17 00:00:00 2001 From: Pierre Dorbais Date: Tue, 30 Jan 2018 17:08:17 +0100 Subject: [PATCH 2/2] [modules] taskwarrior - added taskw python dependency for Travis CI --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 08c3046..e33e3fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ install: - pip install pyyaml - pip install -U coverage==4.3 - pip install codeclimate-test-reporter + - pip install taskw script: - nosetests -v --with-coverage --cover-erase tests/ - CODECLIMATE_REPO_TOKEN=40cb00907f7a10e04868e856570bb997ab9c42fd3b63d980f2b2269433195fdf codeclimate-test-reporter