summaryrefslogtreecommitdiff
path: root/plugins/reminder.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2018-08-15 13:13:17 +0200
committermathieui <mathieui@mathieui.net>2018-08-15 13:13:17 +0200
commit6e13b8b73572f9c0ac9b5c683b98a475afbeab38 (patch)
tree7dae86588339a8cf144b2d98c9280f28646341a9 /plugins/reminder.py
parentd1b624753bb5371cf287cc9d86bb685593a99315 (diff)
downloadpoezio-6e13b8b73572f9c0ac9b5c683b98a475afbeab38.tar.gz
poezio-6e13b8b73572f9c0ac9b5c683b98a475afbeab38.tar.bz2
poezio-6e13b8b73572f9c0ac9b5c683b98a475afbeab38.tar.xz
poezio-6e13b8b73572f9c0ac9b5c683b98a475afbeab38.zip
yapf -rip on plugins
Diffstat (limited to 'plugins/reminder.py')
-rw-r--r--plugins/reminder.py61
1 files changed, 38 insertions, 23 deletions
diff --git a/plugins/reminder.py b/plugins/reminder.py
index e3ba64cb..e5ed96c0 100644
--- a/plugins/reminder.py
+++ b/plugins/reminder.py
@@ -53,23 +53,29 @@ from poezio import timed_events
from poezio import common
import curses
-class Plugin(BasePlugin):
+class Plugin(BasePlugin):
def init(self):
- self.api.add_command('remind', self.command_remind,
- usage='<seconds> <todo>',
- help='Remind you of <todo> every <time> seconds.',
- short='Remind you of a task',
- completion=self.completion_remind)
- self.api.add_command('done', self.command_done,
- usage='<id>',
- help='Stop reminding you do the task identified by <id>.',
- short='Remove a task',
- completion=self.completion_done)
- self.api.add_command('tasks', self.command_tasks,
- usage='',
- help='List all the current tasks and their ids.',
- short='List current tasks')
+ self.api.add_command(
+ 'remind',
+ self.command_remind,
+ usage='<seconds> <todo>',
+ help='Remind you of <todo> every <time> seconds.',
+ short='Remind you of a task',
+ completion=self.completion_remind)
+ self.api.add_command(
+ 'done',
+ self.command_done,
+ usage='<id>',
+ help='Stop reminding you do the task identified by <id>.',
+ short='Remove a task',
+ completion=self.completion_done)
+ self.api.add_command(
+ 'tasks',
+ self.command_tasks,
+ usage='',
+ help='List all the current tasks and their ids.',
+ short='List current tasks')
self.tasks = {}
self.count = 0
@@ -97,8 +103,10 @@ class Plugin(BasePlugin):
self.tasks[self.count] = (time, args[1])
timed_event = timed_events.DelayedEvent(time, self.remind, self.count)
self.api.add_timed_event(timed_event)
- self.api.information('Task %s added: %s every %s.' % (self.count, args[1],
- common.parse_secs_to_str(time)), 'Info')
+ self.api.information(
+ 'Task %s added: %s every %s.' % (self.count, args[1],
+ common.parse_secs_to_str(time)),
+ 'Info')
self.count += 1
def completion_remind(self, the_input):
@@ -108,10 +116,13 @@ class Plugin(BasePlugin):
if txt.endswith(' '):
n += 1
if n == 2:
- return Completion(the_input.auto_completion, ["60", "5m", "15m", "30m", "1h", "10h", "1d"], '')
+ return Completion(the_input.auto_completion,
+ ["60", "5m", "15m", "30m", "1h", "10h", "1d"],
+ '')
def completion_done(self, the_input):
- return Completion(the_input.auto_completion, ["%s" % key for key in self.tasks], '')
+ return Completion(the_input.auto_completion,
+ ["%s" % key for key in self.tasks], '')
def command_done(self, arg="0"):
try:
@@ -121,7 +132,8 @@ class Plugin(BasePlugin):
if id_ not in self.tasks:
return
- self.api.information('Task %s: %s [DONE]' % (id_, self.tasks[id_][1]), 'Info')
+ self.api.information('Task %s: %s [DONE]' % (id_, self.tasks[id_][1]),
+ 'Info')
del self.tasks[id_]
def command_tasks(self, arg, nocommand=None):
@@ -131,7 +143,8 @@ class Plugin(BasePlugin):
s = 'The following tasks are active:\n'
for key in self.tasks:
s += 'Task %s: %s every %s.\n' % (key, repr(self.tasks[key][1]),
- common.parse_secs_to_str(self.tasks[key][0]))
+ common.parse_secs_to_str(
+ self.tasks[key][0]))
if s:
self.api.information(s, 'Info')
@@ -141,7 +154,8 @@ class Plugin(BasePlugin):
self.api.information('Task %s: %s' % (id_, self.tasks[id_][1]), 'Info')
if self.config.get('beep', '') == 'true':
curses.beep()
- timed_event = timed_events.DelayedEvent(self.tasks[id_][0], self.remind, id_)
+ timed_event = timed_events.DelayedEvent(self.tasks[id_][0],
+ self.remind, id_)
self.api.add_timed_event(timed_event)
def cleanup(self):
@@ -149,5 +163,6 @@ class Plugin(BasePlugin):
self.config.remove_section(self.__module__)
self.config.add_section(self.__module__)
for task in self.tasks:
- self.config.set('%s,%s' % (task, self.tasks[task][0]), self.tasks[task][1])
+ self.config.set('%s,%s' % (task, self.tasks[task][0]),
+ self.tasks[task][1])
self.config.write()