Skip to content
This repository was archived by the owner on Aug 21, 2023. It is now read-only.

Commit c146ff9

Browse files
fsantinifalkTX
authored andcommitted
Fallback to GLib DBus if Qt Dbus is not available
1 parent 64dc781 commit c146ff9

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/cadence.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,15 @@
5252

5353
try:
5454
import dbus
55-
from dbus.mainloop.pyqt5 import DBusQtMainLoop
55+
from dbus.mainloop.pyqt5 import DBusQtMainLoop as DBusMainLoop
5656
haveDBus = True
5757
except:
58-
haveDBus = False
58+
try:
59+
# Try falling back to GMainLoop
60+
from dbus.mainloop.glib import DBusGMainLoop as DBusMainLoop
61+
haveDBus = True
62+
except:
63+
haveDBus = False
5964

6065
# ------------------------------------------------------------------------------------------------------------
6166
# Check for PulseAudio and Wine
@@ -2359,7 +2364,7 @@ def taskInMainThread():
23592364
app.setWindowIcon(QIcon(":/scalable/cadence.svg"))
23602365

23612366
if haveDBus:
2362-
gDBus.loop = DBusQtMainLoop(set_as_default=True)
2367+
gDBus.loop = DBusMainLoop(set_as_default=True)
23632368
gDBus.bus = dbus.SessionBus(mainloop=gDBus.loop)
23642369

23652370
initSystemChecks()

0 commit comments

Comments
 (0)