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():
|
||||
log.warning("Error pausing torrent %s", torrent_id)
|
||||
|
||||
def export_move_torrent(self, torrent_ids, dest):
|
||||
log.debug("Moving torrents %s to %s", torrent_ids, dest)
|
||||
def export_move_storage(self, torrent_ids, dest):
|
||||
log.debug("Moving storage %s to %s", torrent_ids, dest)
|
||||
for torrent_id in torrent_ids:
|
||||
if not self.torrents[torrent_id].move_storage(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()))
|
||||
# Create a Torrent object
|
||||
torrent = Torrent(handle, options, state, filename=filename)
|
||||
torrent = Torrent(handle, options, state, filename)
|
||||
# Add the torrent object to the dictionary
|
||||
self.torrents[torrent.torrent_id] = torrent
|
||||
if self.config["queue_new_to_top"]:
|
||||
|
|
|
@ -95,7 +95,7 @@ class CoreProxy(gobject.GObject):
|
|||
callback(ret)
|
||||
except:
|
||||
pass
|
||||
except (socket.error, xmlrpclib.ProtocolError), e:
|
||||
except (socket.error, xmlrpclib.ProtocolError, deluge.xmlrpclib.Fault), e:
|
||||
log.warning("Could not contact daemon: %s", e)
|
||||
self.set_core_uri(None)
|
||||
finally:
|
||||
|
@ -160,7 +160,7 @@ class BaseClient(object):
|
|||
"set_torrent_max_connections", "set_torrent_max_upload_slots",
|
||||
"set_torrent_max_upload_speed", "set_torrent_max_download_speed",
|
||||
"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",
|
||||
"deregister_client", "register_client", "add_torrent_file",
|
||||
"set_torrent_prioritize_first_last"]
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -274,23 +274,44 @@ class MenuBar(component.Component):
|
|||
|
||||
def on_menuitem_move_activate(self, data=None):
|
||||
log.debug("on_menuitem_move_activate")
|
||||
from deluge.configmanager import ConfigManager
|
||||
config = ConfigManager("gtkui.conf")
|
||||
chooser = gtk.FileChooserDialog(_("Choose a directory to move files to"\
|
||||
) , component.get("MainWindow").window, \
|
||||
gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER, buttons=(gtk.STOCK_CANCEL, \
|
||||
gtk.RESPONSE_CANCEL, gtk.STOCK_OK, gtk.RESPONSE_OK))
|
||||
if not common.windows_check():
|
||||
chooser.set_icon(common.get_logo(18))
|
||||
chooser.set_property("skip-taskbar-hint", True)
|
||||
chooser.set_current_folder(config["choose_directory_dialog_path"])
|
||||
if chooser.run() == gtk.RESPONSE_OK:
|
||||
result = chooser.get_filename()
|
||||
config["choose_directory_dialog_path"] = result
|
||||
client.move_torrent(
|
||||
component.get("TorrentView").get_selected_torrents(), result)
|
||||
chooser.destroy()
|
||||
|
||||
if client.is_localhost():
|
||||
from deluge.configmanager import ConfigManager
|
||||
config = ConfigManager("gtkui.conf")
|
||||
chooser = gtk.FileChooserDialog(_("Choose a directory to move files to"\
|
||||
) , component.get("MainWindow").window, \
|
||||
gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER, buttons=(gtk.STOCK_CANCEL, \
|
||||
gtk.RESPONSE_CANCEL, gtk.STOCK_OK, gtk.RESPONSE_OK))
|
||||
if not common.windows_check():
|
||||
chooser.set_icon(common.get_logo(18))
|
||||
chooser.set_property("skip-taskbar-hint", True)
|
||||
chooser.set_current_folder(config["choose_directory_dialog_path"])
|
||||
if chooser.run() == gtk.RESPONSE_OK:
|
||||
result = chooser.get_filename()
|
||||
config["choose_directory_dialog_path"] = result
|
||||
client.move_storage(
|
||||
component.get("TorrentView").get_selected_torrents(), result)
|
||||
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):
|
||||
log.debug("on_menuitem_queue_top_activate")
|
||||
client.queue_top(None, component.get("TorrentView").get_selected_torrents())
|
||||
|
|
|
@ -114,12 +114,18 @@ class SignalReceiver(
|
|||
client.register_client(str(self.port))
|
||||
|
||||
t = threading.Thread(target=self.handle_thread)
|
||||
t.start()
|
||||
try:
|
||||
t.start()
|
||||
except Exception, e:
|
||||
log.debug("Thread: %s", e)
|
||||
|
||||
def handle_thread(self):
|
||||
while not self._shutdown:
|
||||
self.handle_request()
|
||||
self._shutdown = False
|
||||
try:
|
||||
while not self._shutdown:
|
||||
self.handle_request()
|
||||
self._shutdown = False
|
||||
except Exception, e:
|
||||
log.debug("handle_thread: %s", e)
|
||||
|
||||
def emit_signal(self, signal, *data):
|
||||
"""Exported method used by the core to emit a signal to the client"""
|
||||
|
|
Loading…
Reference in New Issue