diff options
author | pux <pux@pux.dom> | 2020-05-24 11:09:26 +0200 |
---|---|---|
committer | pux <pux@pux.dom> | 2020-05-24 11:09:26 +0200 |
commit | 976e7234ae017018714d7548a84977d8968673ac (patch) | |
tree | 2d1efc7fb4ebd81ef6f111493eba9e044fca6252 | |
parent | 943a95a9c7cb514c191c18b12f5d5ea8f6673c44 (diff) | |
download | timebomb-master.tar.gz timebomb-master.tar.bz2 timebomb-master.zip |
-rw-r--r-- | timebomb.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/timebomb.py b/timebomb.py index c8679bb..695f11a 100644 --- a/timebomb.py +++ b/timebomb.py @@ -23,7 +23,13 @@ def message(m, s): msg = 'ALARM, Timer ran ' + str(m) + 'm and ' + str(s) + ' s' notify_msg = notify2.Notification('ALARM', msg) - notify_msg.show() + try: + notify_msg.show() + except: + # ignore + # dbus.exceptions.DBusException: org.freedesktop.Notifications.Max + # NotificationsExceeded: Exceeded maximum number of notifications + pass if screen_width <= 0: screen_width = 1024 @@ -88,7 +94,11 @@ def sleep(m, s): if pbar_len < 20: pbar_len = 20 - progress = int(x/(time_sum_s-1) * pbar_len) + n = time_sum_s-1 + if n == 0: + progress = pbar_len + else: + progress = int(x/n * pbar_len) print(left, end='') print('#' * progress + '_' * int(pbar_len-progress), end='') |