aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpux <pux@pux.dom>2020-05-24 11:09:26 +0200
committerpux <pux@pux.dom>2020-05-24 11:09:26 +0200
commit976e7234ae017018714d7548a84977d8968673ac (patch)
tree2d1efc7fb4ebd81ef6f111493eba9e044fca6252
parent943a95a9c7cb514c191c18b12f5d5ea8f6673c44 (diff)
downloadtimebomb-976e7234ae017018714d7548a84977d8968673ac.tar.gz
timebomb-976e7234ae017018714d7548a84977d8968673ac.tar.bz2
timebomb-976e7234ae017018714d7548a84977d8968673ac.zip
fix div/0 with -s 1 -m 0 and ignore dbus max notifications exceeded exceptionHEADmaster
-rw-r--r--timebomb.py14
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='')
in each repos: see "about"-tab (if existing) for more details / README.
mailto contact at omeckman dot net
all timestamps in UTC (German winter time: UTC+01:00, summer time: UTC+02:00)
dark theme is a modded version of: https://gist.github.com/Yoplitein/f4b671a2ec70c9e743fa