notify: allow displaying progress
This commit is contained in:
parent
362d43a7a1
commit
41fb08c059
|
@ -103,8 +103,10 @@ if available:
|
||||||
except Exception:
|
except Exception:
|
||||||
_log.exception('showing %s', n)
|
_log.exception('showing %s', n)
|
||||||
|
|
||||||
def show(dev, reason=None, icon=None):
|
def show(dev, reason=None, icon=None, progress=None):
|
||||||
"""Show a notification with title and text."""
|
"""Show a notification with title and text.
|
||||||
|
Optionally displays the `progress` integer value
|
||||||
|
in [0, 100] as a progress bar."""
|
||||||
if available and Notify.is_initted():
|
if available and Notify.is_initted():
|
||||||
summary = dev.name
|
summary = dev.name
|
||||||
|
|
||||||
|
@ -130,6 +132,8 @@ if available:
|
||||||
urgency = Notify.Urgency.LOW if dev.status else Notify.Urgency.NORMAL
|
urgency = Notify.Urgency.LOW if dev.status else Notify.Urgency.NORMAL
|
||||||
n.set_urgency(urgency)
|
n.set_urgency(urgency)
|
||||||
n.set_hint('desktop-entry', GLib.Variant('s', NAME.lower()))
|
n.set_hint('desktop-entry', GLib.Variant('s', NAME.lower()))
|
||||||
|
if progress:
|
||||||
|
n.set_hint('value', GLib.Variant('i', progress))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# if _log.isEnabledFor(_DEBUG):
|
# if _log.isEnabledFor(_DEBUG):
|
||||||
|
|
Loading…
Reference in New Issue