Skip to content

Commit

Permalink
Fallback to GLib DBus if Qt Dbus is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
fsantini authored and falkTX committed Mar 15, 2021
1 parent 64dc781 commit c146ff9
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/cadence.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,15 @@

try:
import dbus
from dbus.mainloop.pyqt5 import DBusQtMainLoop
from dbus.mainloop.pyqt5 import DBusQtMainLoop as DBusMainLoop
haveDBus = True
except:
haveDBus = False
try:
# Try falling back to GMainLoop
from dbus.mainloop.glib import DBusGMainLoop as DBusMainLoop
haveDBus = True
except:
haveDBus = False

# ------------------------------------------------------------------------------------------------------------
# Check for PulseAudio and Wine
Expand Down Expand Up @@ -2359,7 +2364,7 @@ def taskInMainThread():
app.setWindowIcon(QIcon(":/scalable/cadence.svg"))

if haveDBus:
gDBus.loop = DBusQtMainLoop(set_as_default=True)
gDBus.loop = DBusMainLoop(set_as_default=True)
gDBus.bus = dbus.SessionBus(mainloop=gDBus.loop)

initSystemChecks()
Expand Down

0 comments on commit c146ff9

Please sign in to comment.