summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2011-11-14 20:57:54 +0100
committermathieui <mathieui@mathieui.net>2011-11-14 20:57:54 +0100
commitcfa5520cfe9a73f70338eca6a17cd9a1f6f779c3 (patch)
treea86eba667755e8baa71424d48face30533b29d51 /plugins
parent07d7189ab6eb7795ddfa4864ed2d00c34c64486c (diff)
downloadpoezio-cfa5520cfe9a73f70338eca6a17cd9a1f6f779c3.tar.gz
poezio-cfa5520cfe9a73f70338eca6a17cd9a1f6f779c3.tar.bz2
poezio-cfa5520cfe9a73f70338eca6a17cd9a1f6f779c3.tar.xz
poezio-cfa5520cfe9a73f70338eca6a17cd9a1f6f779c3.zip
Make it possible to use 'm', 'h', and 'd' in the time for the
reminder plugin.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/reminder.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/plugins/reminder.py b/plugins/reminder.py
index 8426dcfe..ed45985c 100644
--- a/plugins/reminder.py
+++ b/plugins/reminder.py
@@ -29,11 +29,29 @@ class Plugin(BasePlugin):
args = common.shell_split(arg)
if len(args) < 2:
return
+ if args[0].endswith('d'):
+ modifier = 'd'
+ elif args[0].endswith('h'):
+ modifier = 'h'
+ elif args[0].endswith('m'):
+ modifier = 'm'
+ else:
+ modifier = None
try:
- time = int(args[0])
+ if modifier:
+ time = int(args[0][:-1])
+ else:
+ time = int(args[0])
except:
return
+ if modifier == 'd':
+ time = time * 86400
+ elif modifier == 'h':
+ time = time * 3600
+ elif modifier == 'm':
+ time = time * 60
+
self.tasks[self.count] = (time, args[1])
timed_event = timed_events.DelayedEvent(time, self.remind, self.count)
self.core.add_timed_event(timed_event)
@@ -47,7 +65,7 @@ class Plugin(BasePlugin):
if txt.endswith(' '):
n += 1
if n == 2:
- return the_input.auto_completion(["60", "300", "600", "900", "3600", "36000", "86400"], '')
+ return the_input.auto_completion(["60", "5m", "15m", "30m", "1h", "10h", "1d"], '')
def completion_done(self, the_input):
return the_input.auto_completion(["%s" % key for key in self.tasks], '')