print shit in the console for now. also default -t value to 10 minutes

This commit is contained in:
Von Random 2016-05-10 13:39:01 +03:00
parent 5b4451161f
commit d27d1dabcc

View file

@ -2,7 +2,7 @@
from argparse import ArgumentParser from argparse import ArgumentParser
from random import randint from random import randint
from sys import argv from sys import argv
from time import sleep from time import sleep, strftime
import gi import gi
gi.require_version('Notify', '0.7') gi.require_version('Notify', '0.7')
from gi.repository import Notify from gi.repository import Notify
@ -23,7 +23,7 @@ def parse_args(sys_args):
p.add_argument( p.add_argument(
'-t', '-t',
'--timer', '--timer',
default='300', default='600',
help='run in foreground, showing notification every TIMER seconds (this is default, with TIMER = 300)' help='run in foreground, showing notification every TIMER seconds (this is default, with TIMER = 300)'
) )
p.add_argument( p.add_argument(
@ -47,6 +47,7 @@ def get_random_message(message_list):
def show_notification(notification, icon): def show_notification(notification, icon):
text = get_random_message(MESSAGES) text = get_random_message(MESSAGES)
print('[' + strftime('%H:%M:%S') + '] ' + text)
if icon is not None: if icon is not None:
notification.update(TITLE, text, icon) notification.update(TITLE, text, icon)
else: else:
@ -63,7 +64,7 @@ if __name__ == '__main__':
show_notification(notification, args.icon) show_notification(notification, args.icon)
else: else:
while True: while True:
show_notification(notification, args.icon)
sleep(int(args.timer)) sleep(int(args.timer))
show_notification(notification, args.icon)
Notify.uninit() Notify.uninit()