qvm-toos: import dbus only when needed

Void import errors when 'dbus' module not really needed.
This commit is contained in:
Marek Marczykowski-Górecki 2013-09-20 04:03:09 +02:00
parent d88da1e66b
commit 4300d778a5

View File

@ -20,7 +20,6 @@
#
#
import dbus
import sys
system_bus = None
@ -29,6 +28,7 @@ session_bus = None
notify_object = None
def tray_notify_init():
import dbus
global notify_object
try:
notify_object = dbus.SessionBus().get_object("org.freedesktop.Notifications", "/org/freedesktop/Notifications")
@ -51,6 +51,7 @@ def tray_notify_error(msg, timeout = 3000):
def notify_error_qubes_manager(name, message):
global system_bus
if system_bus is None:
import dbus
system_bus = dbus.SystemBus()
try:
@ -64,6 +65,7 @@ def notify_error_qubes_manager(name, message):
def clear_error_qubes_manager(name, message):
global system_bus
if system_bus is None:
import dbus
system_bus = dbus.SystemBus()
try: