mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-06 08:33:56 +00:00
Fix move storage for remote hosts by adding a dialog for path entry.
This commit is contained in:
parent
2a510c8310
commit
8c49dd6e90
@ -372,8 +372,8 @@ class Core(
|
|||||||
if not self.torrents[torrent_id].pause():
|
if not self.torrents[torrent_id].pause():
|
||||||
log.warning("Error pausing torrent %s", torrent_id)
|
log.warning("Error pausing torrent %s", torrent_id)
|
||||||
|
|
||||||
def export_move_torrent(self, torrent_ids, dest):
|
def export_move_storage(self, torrent_ids, dest):
|
||||||
log.debug("Moving torrents %s to %s", torrent_ids, dest)
|
log.debug("Moving storage %s to %s", torrent_ids, dest)
|
||||||
for torrent_id in torrent_ids:
|
for torrent_id in torrent_ids:
|
||||||
if not self.torrents[torrent_id].move_storage(dest):
|
if not self.torrents[torrent_id].move_storage(dest):
|
||||||
log.warning("Error moving torrent %s to %s", torrent_id, dest)
|
log.warning("Error moving torrent %s to %s", torrent_id, dest)
|
||||||
|
@ -309,7 +309,7 @@ class TorrentManager(component.Component):
|
|||||||
|
|
||||||
log.debug("handle id: %s", str(handle.info_hash()))
|
log.debug("handle id: %s", str(handle.info_hash()))
|
||||||
# Create a Torrent object
|
# Create a Torrent object
|
||||||
torrent = Torrent(handle, options, state, filename=filename)
|
torrent = Torrent(handle, options, state, filename)
|
||||||
# Add the torrent object to the dictionary
|
# Add the torrent object to the dictionary
|
||||||
self.torrents[torrent.torrent_id] = torrent
|
self.torrents[torrent.torrent_id] = torrent
|
||||||
if self.config["queue_new_to_top"]:
|
if self.config["queue_new_to_top"]:
|
||||||
|
@ -95,7 +95,7 @@ class CoreProxy(gobject.GObject):
|
|||||||
callback(ret)
|
callback(ret)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
except (socket.error, xmlrpclib.ProtocolError), e:
|
except (socket.error, xmlrpclib.ProtocolError, deluge.xmlrpclib.Fault), e:
|
||||||
log.warning("Could not contact daemon: %s", e)
|
log.warning("Could not contact daemon: %s", e)
|
||||||
self.set_core_uri(None)
|
self.set_core_uri(None)
|
||||||
finally:
|
finally:
|
||||||
@ -160,7 +160,7 @@ class BaseClient(object):
|
|||||||
"set_torrent_max_connections", "set_torrent_max_upload_slots",
|
"set_torrent_max_connections", "set_torrent_max_upload_slots",
|
||||||
"set_torrent_max_upload_speed", "set_torrent_max_download_speed",
|
"set_torrent_max_upload_speed", "set_torrent_max_download_speed",
|
||||||
"set_torrent_private_flag", "set_torrent_file_priorities",
|
"set_torrent_private_flag", "set_torrent_file_priorities",
|
||||||
"block_ip_range", "remove_torrent", "pause_torrent", "move_torrent",
|
"block_ip_range", "remove_torrent", "pause_torrent", "move_storage",
|
||||||
"resume_torrent", "force_reannounce", "force_recheck",
|
"resume_torrent", "force_reannounce", "force_recheck",
|
||||||
"deregister_client", "register_client", "add_torrent_file",
|
"deregister_client", "register_client", "add_torrent_file",
|
||||||
"set_torrent_prioritize_first_last"]
|
"set_torrent_prioritize_first_last"]
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -274,6 +274,7 @@ class MenuBar(component.Component):
|
|||||||
|
|
||||||
def on_menuitem_move_activate(self, data=None):
|
def on_menuitem_move_activate(self, data=None):
|
||||||
log.debug("on_menuitem_move_activate")
|
log.debug("on_menuitem_move_activate")
|
||||||
|
if client.is_localhost():
|
||||||
from deluge.configmanager import ConfigManager
|
from deluge.configmanager import ConfigManager
|
||||||
config = ConfigManager("gtkui.conf")
|
config = ConfigManager("gtkui.conf")
|
||||||
chooser = gtk.FileChooserDialog(_("Choose a directory to move files to"\
|
chooser = gtk.FileChooserDialog(_("Choose a directory to move files to"\
|
||||||
@ -287,9 +288,29 @@ class MenuBar(component.Component):
|
|||||||
if chooser.run() == gtk.RESPONSE_OK:
|
if chooser.run() == gtk.RESPONSE_OK:
|
||||||
result = chooser.get_filename()
|
result = chooser.get_filename()
|
||||||
config["choose_directory_dialog_path"] = result
|
config["choose_directory_dialog_path"] = result
|
||||||
client.move_torrent(
|
client.move_storage(
|
||||||
component.get("TorrentView").get_selected_torrents(), result)
|
component.get("TorrentView").get_selected_torrents(), result)
|
||||||
chooser.destroy()
|
chooser.destroy()
|
||||||
|
else:
|
||||||
|
client.get_torrent_status(self.show_move_storage_dialog, component.get("TorrentView").get_selected_torrent(), ["save_path"])
|
||||||
|
client.force_call(False)
|
||||||
|
|
||||||
|
def show_move_storage_dialog(self, status):
|
||||||
|
log.debug("show_move_storage_dialog")
|
||||||
|
glade = gtk.glade.XML(
|
||||||
|
pkg_resources.resource_filename("deluge.ui.gtkui",
|
||||||
|
"glade/move_storage_dialog.glade"))
|
||||||
|
dialog = glade.get_widget("move_storage_dialog")
|
||||||
|
dialog.set_transient_for(self.window.window)
|
||||||
|
entry = glade.get_widget("entry_destination")
|
||||||
|
entry.set_text(status["save_path"])
|
||||||
|
def _on_response_event(widget, response_id):
|
||||||
|
log.debug("Moving torrents to %s", entry.get_text())
|
||||||
|
path = entry.get_text()
|
||||||
|
client.move_storage(component.get("TorrentView").get_selected_torrents(), path)
|
||||||
|
dialog.hide()
|
||||||
|
dialog.connect("response", _on_response_event)
|
||||||
|
dialog.show()
|
||||||
|
|
||||||
def on_menuitem_queue_top_activate(self, value):
|
def on_menuitem_queue_top_activate(self, value):
|
||||||
log.debug("on_menuitem_queue_top_activate")
|
log.debug("on_menuitem_queue_top_activate")
|
||||||
|
@ -114,12 +114,18 @@ class SignalReceiver(
|
|||||||
client.register_client(str(self.port))
|
client.register_client(str(self.port))
|
||||||
|
|
||||||
t = threading.Thread(target=self.handle_thread)
|
t = threading.Thread(target=self.handle_thread)
|
||||||
|
try:
|
||||||
t.start()
|
t.start()
|
||||||
|
except Exception, e:
|
||||||
|
log.debug("Thread: %s", e)
|
||||||
|
|
||||||
def handle_thread(self):
|
def handle_thread(self):
|
||||||
|
try:
|
||||||
while not self._shutdown:
|
while not self._shutdown:
|
||||||
self.handle_request()
|
self.handle_request()
|
||||||
self._shutdown = False
|
self._shutdown = False
|
||||||
|
except Exception, e:
|
||||||
|
log.debug("handle_thread: %s", e)
|
||||||
|
|
||||||
def emit_signal(self, signal, *data):
|
def emit_signal(self, signal, *data):
|
||||||
"""Exported method used by the core to emit a signal to the client"""
|
"""Exported method used by the core to emit a signal to the client"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user