Handle dbus exceptions
This commit is contained in:
parent
d2e982469b
commit
84e6d58493
@ -299,15 +299,22 @@ def simple_backup():
|
|||||||
backup = Backup(inputs, output, exclude, keep, backup_options)
|
backup = Backup(inputs, output, exclude, keep, backup_options)
|
||||||
|
|
||||||
if backup.check_params():
|
if backup.check_params():
|
||||||
obj = dbus.SessionBus().get_object("org.freedesktop.Notifications", "/org/freedesktop/Notifications")
|
try:
|
||||||
obj = dbus.Interface(obj, "org.freedesktop.Notifications")
|
obj = dbus.SessionBus().get_object("org.freedesktop.Notifications", "/org/freedesktop/Notifications")
|
||||||
obj.Notify("simple_backup", 0, "", "Starting backup...", "", [], {"urgency": 1}, 10000)
|
obj = dbus.Interface(obj, "org.freedesktop.Notifications")
|
||||||
|
obj.Notify("simple_backup", 0, "", "Starting backup...", "", [], {"urgency": 1}, 10000)
|
||||||
|
except dbus.exceptions.DBusException:
|
||||||
|
pass
|
||||||
|
|
||||||
status = backup.run()
|
status = backup.run()
|
||||||
|
|
||||||
if status == 0:
|
try:
|
||||||
obj.Notify("simple_backup", 0, "", "Backup finished.", "", [], {"urgency": 1}, 10000)
|
if status == 0:
|
||||||
else:
|
obj.Notify("simple_backup", 0, "", "Backup finished.", "", [], {"urgency": 1}, 10000)
|
||||||
obj.Notify("simple_backup", 0, "", "Backup finished. Some errors occurred.", "", [], {"urgency": 1}, 10000)
|
else:
|
||||||
|
obj.Notify("simple_backup", 0, "", "Backup finished. Some errors occurred.", "", [], {"urgency": 1}, 10000)
|
||||||
|
except NameError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user