mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-05 07:58:38 +00:00
deal with stupid gutsy sometimes not being able to connect to dbus
This commit is contained in:
parent
4b7d40ed49
commit
bb03e2ff6a
1 changed files with 26 additions and 19 deletions
|
@ -113,24 +113,31 @@ def start_deluge():
|
||||||
interface = deluge.interface.DelugeGTK()
|
interface = deluge.interface.DelugeGTK()
|
||||||
interface.start(get_cmd_line_torrents())
|
interface.start(get_cmd_line_torrents())
|
||||||
|
|
||||||
bus = dbus.SessionBus()
|
try:
|
||||||
dbus_objects = dbus.Interface(bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus'), 'org.freedesktop.DBus').ListNames()
|
bus = dbus.SessionBus()
|
||||||
|
except:
|
||||||
if not "org.deluge_torrent.Deluge" in dbus_objects:
|
if not deluge.common.windows_check():
|
||||||
print "no existing Deluge session"
|
pid = os.fork()
|
||||||
if not os.path.exists(os.path.join(deluge.common.CONFIG_DIR, 'firstrun')):
|
if not pid:
|
||||||
import deluge.wizard
|
os.popen('dbus-launch deluge')
|
||||||
deluge.wizard.WizardGTK()
|
|
||||||
|
|
||||||
start_deluge()
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
## This connects to the deluge interface
|
dbus_objects = dbus.Interface(bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus'), 'org.freedesktop.DBus').ListNames()
|
||||||
print "create proxy object"
|
|
||||||
proxy = bus.get_object('org.deluge_torrent.Deluge', '/org/deluge_torrent/DelugeObject')
|
|
||||||
print "create iface"
|
|
||||||
deluge_iface = dbus.Interface(proxy, 'org.deluge_torrent.Deluge')
|
|
||||||
print "send to iface"
|
|
||||||
|
|
||||||
for filename in get_cmd_line_torrents():
|
if not "org.deluge_torrent.Deluge" in dbus_objects:
|
||||||
deluge_iface.interactive_add_torrent(filename)
|
print "no existing Deluge session"
|
||||||
|
if not os.path.exists(os.path.join(deluge.common.CONFIG_DIR, 'firstrun')):
|
||||||
|
import deluge.wizard
|
||||||
|
deluge.wizard.WizardGTK()
|
||||||
|
|
||||||
|
start_deluge()
|
||||||
|
|
||||||
|
else:
|
||||||
|
## This connects to the deluge interface
|
||||||
|
print "create proxy object"
|
||||||
|
proxy = bus.get_object('org.deluge_torrent.Deluge', '/org/deluge_torrent/DelugeObject')
|
||||||
|
print "create iface"
|
||||||
|
deluge_iface = dbus.Interface(proxy, 'org.deluge_torrent.Deluge')
|
||||||
|
print "send to iface"
|
||||||
|
|
||||||
|
for filename in get_cmd_line_torrents():
|
||||||
|
deluge_iface.interactive_add_torrent(filename)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue