dom0/qvm-run: fix tray notify
This commit is contained in:
parent
c0c64ecdc5
commit
4a6447f11b
@ -260,7 +260,7 @@ def run_in_vm(vm, command, verbose = True, autostart = False, notify_function =
|
|||||||
if verbose:
|
if verbose:
|
||||||
print >> sys.stderr, "Starting the VM '{0}'...".format(vm.name)
|
print >> sys.stderr, "Starting the VM '{0}'...".format(vm.name)
|
||||||
if notify_function is not None:
|
if notify_function is not None:
|
||||||
notify_function ("info", "Starting the '{0}' VM...".format(vm.name), label=vm.label)
|
notify_function ("info", "Starting the '{0}' VM...".format(vm.name))
|
||||||
xid = vm.start(verbose=verbose)
|
xid = vm.start(verbose=verbose)
|
||||||
|
|
||||||
except (IOError, OSError, QubesException) as err:
|
except (IOError, OSError, QubesException) as err:
|
||||||
|
@ -47,12 +47,6 @@ def tray_notify(str, label, timeout = 3000):
|
|||||||
def tray_notify_error(str, timeout = 3000):
|
def tray_notify_error(str, timeout = 3000):
|
||||||
notify_object.Notify("Qubes", 0, "dialog-error", "Qubes", str, [], [], timeout, dbus_interface="org.freedesktop.Notifications")
|
notify_object.Notify("Qubes", 0, "dialog-error", "Qubes", str, [], [], timeout, dbus_interface="org.freedesktop.Notifications")
|
||||||
|
|
||||||
def tray_notify_generic(level, str):
|
|
||||||
if level == "info":
|
|
||||||
tray_notify(str)
|
|
||||||
elif level == "error":
|
|
||||||
tray_notify_error(str)
|
|
||||||
|
|
||||||
def vm_run_cmd(vm, cmd, options):
|
def vm_run_cmd(vm, cmd, options):
|
||||||
if options.shutdown:
|
if options.shutdown:
|
||||||
if options.verbose:
|
if options.verbose:
|
||||||
@ -83,6 +77,12 @@ def vm_run_cmd(vm, cmd, options):
|
|||||||
print >> sys.stderr, "Running command on VM: '{0}'...".format(vm.name)
|
print >> sys.stderr, "Running command on VM: '{0}'...".format(vm.name)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
def tray_notify_generic(level, str):
|
||||||
|
if level == "info":
|
||||||
|
tray_notify(str, label=vm.label)
|
||||||
|
elif level == "error":
|
||||||
|
tray_notify_error(str)
|
||||||
|
|
||||||
return qubesutils.run_in_vm(vm, cmd, autostart = options.auto,
|
return qubesutils.run_in_vm(vm, cmd, autostart = options.auto,
|
||||||
verbose = options.verbose,
|
verbose = options.verbose,
|
||||||
notify_function = tray_notify_generic if options.tray else None,
|
notify_function = tray_notify_generic if options.tray else None,
|
||||||
|
Loading…
Reference in New Issue
Block a user