Fix #1162 problem with the queued torrents dialog from not properly adding to the add torrent dialog if set to auto add

This commit is contained in:
Andrew Resch 2010-02-28 16:58:19 -08:00
parent cfeae2baf4
commit e5c734fb05
2 changed files with 16 additions and 9 deletions

View File

@ -148,7 +148,7 @@ class AddTorrentDialog(component.Component):
self.update_core_config()
def show(self, focus=False):
self.update_core_config(True, focus)
return self.update_core_config(True, focus)
def _show(self, focus=False):
if client.is_localhost():
@ -184,7 +184,7 @@ class AddTorrentDialog(component.Component):
self._show(focus)
# Send requests to the core for these config values
client.core.get_config_values(self.core_keys).addCallback(_on_config_values)
return client.core.get_config_values(self.core_keys).addCallback(_on_config_values)
def add_from_files(self, filenames):
import os.path

View File

@ -49,7 +49,7 @@ import common
class QueuedTorrents(component.Component):
def __init__(self):
component.Component.__init__(self, "QueuedTorrents", depend=["StatusBar"])
component.Component.__init__(self, "QueuedTorrents", depend=["StatusBar", "AddTorrentDialog"])
self.queue = []
self.status_item = None
@ -174,20 +174,27 @@ class QueuedTorrents(component.Component):
torrent_path = model.get_value(iter, 1)
if deluge.common.is_url(torrent_path):
if self.config["interactive_add"]:
component.get("AddTorrentDialog").add_from_url(torrent_path)
component.get("AddTorrentDialog").show(self.config["focus_add_dialog"])
def on_show(result):
component.get("AddTorrentDialog").add_from_url(torrent_path)
d = component.get("AddTorrentDialog").show(self.config["focus_add_dialog"])
d.addCallback(on_show)
else:
client.core.add_torrent_url(torrent_path, None)
elif deluge.common.is_magnet(torrent_path):
if self.config["interactive_add"]:
component.get("AddTorrentDialog").add_from_magnets([torrent_path])
component.get("AddTorrentDialog").show(self.config["focus_add_dialog"])
def on_show(result):
component.get("AddTorrentDialog").add_from_magnets([torrent_path])
d = component.get("AddTorrentDialog").show(self.config["focus_add_dialog"])
d.addCallback(on_show)
else:
client.core.add_magnet_uris([torrent_path], [])
else:
if self.config["interactive_add"]:
component.get("AddTorrentDialog").add_from_files([torrent_path])
component.get("AddTorrentDialog").show(self.config["focus_add_dialog"])
def on_show(result):
component.get("AddTorrentDialog").add_from_files([torrent_path])
d = component.get("AddTorrentDialog").show(self.config["focus_add_dialog"])
d.addCallback(on_show)
else:
client.core.add_torrent_file(
os.path.split(torrent_path)[-1],