From 86d8ea3f5b37089c76267768cef55a0b2ea38eb9 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Mon, 17 Mar 2008 08:11:21 +0000 Subject: [PATCH] Fix add torrent dialog displaying the wrong download path when connected to a remote daemon. --- deluge/ui/gtkui/addtorrentdialog.py | 34 +++- .../ui/gtkui/glade/add_torrent_dialog.glade | 155 ++++++++++-------- 2 files changed, 112 insertions(+), 77 deletions(-) diff --git a/deluge/ui/gtkui/addtorrentdialog.py b/deluge/ui/gtkui/addtorrentdialog.py index e416619ae..1e83c456c 100644 --- a/deluge/ui/gtkui/addtorrentdialog.py +++ b/deluge/ui/gtkui/addtorrentdialog.py @@ -132,6 +132,13 @@ class AddTorrentDialog: def show(self): self.dialog.show_all() + if client.is_localhost(): + self.glade.get_widget("button_location").show() + self.glade.get_widget("entry_download_path").hide() + else: + self.glade.get_widget("button_location").hide() + self.glade.get_widget("entry_download_path").show() + return None def hide(self): @@ -212,8 +219,13 @@ class AddTorrentDialog: options = self.options[torrent_id] - self.glade.get_widget("button_location").set_current_folder( - options["download_location"]) + if client.is_localhost(): + self.glade.get_widget("button_location").set_current_folder( + options["download_location"]) + else: + self.glade.get_widget("entry_download_path").set_text( + options["download_location"]) + self.glade.get_widget("radio_compact").set_active( options["compact_allocation"]) self.glade.get_widget("spin_maxdown").set_value( @@ -242,8 +254,12 @@ class AddTorrentDialog: torrent_id = self.torrent_liststore.get_value(row, 0) options = {} - options["download_location"] = \ - self.glade.get_widget("button_location").get_current_folder() + if client.is_localhost(): + options["download_location"] = \ + self.glade.get_widget("button_location").get_current_folder() + else: + options["download_location"] = \ + self.glade.get_widget("entry_download_path").get_text() options["compact_allocation"] = \ self.glade.get_widget("radio_compact").get_active() options["max_download_speed_per_torrent"] = \ @@ -275,9 +291,13 @@ class AddTorrentDialog: file_dict["download"] = files_priorities[i] def set_default_options(self): - # FIXME: does not account for remote core - self.glade.get_widget("button_location").set_current_folder( - self.core_config["download_location"]) + if client.is_localhost(): + self.glade.get_widget("button_location").set_current_folder( + self.core_config["download_location"]) + else: + self.glade.get_widget("entry_download_path").set_text( + self.core_config["download_location"]) + self.glade.get_widget("radio_compact").set_active( self.core_config["compact_allocation"]) self.glade.get_widget("spin_maxdown").set_value( diff --git a/deluge/ui/gtkui/glade/add_torrent_dialog.glade b/deluge/ui/gtkui/glade/add_torrent_dialog.glade index 857efb6f3..8ed456fb6 100644 --- a/deluge/ui/gtkui/glade/add_torrent_dialog.glade +++ b/deluge/ui/gtkui/glade/add_torrent_dialog.glade @@ -1,6 +1,6 @@ - + 560 @@ -395,13 +395,28 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 5 - 12 + 5 + 5 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER - Select A Folder + + + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER + Select A Folder + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + 1 + + @@ -517,7 +532,7 @@ 2 10 - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -527,26 +542,61 @@ 1 2 - 3 - 4 - + True - True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 1 - -1 -1 9999 1 10 10 + 0 + Max Down Speed: + + + GTK_FILL + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Max Up Speed: + + + 1 + 2 + GTK_FILL + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Max Connections: - 1 - 2 2 3 - + GTK_FILL + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Max Upload Slots: + + + 3 + 4 + GTK_FILL @@ -569,61 +619,7 @@ - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - Max Upload Slots: - - - 3 - 4 - GTK_FILL - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - Max Connections: - - - 2 - 3 - GTK_FILL - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - Max Up Speed: - - - 1 - 2 - GTK_FILL - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - Max Down Speed: - - - GTK_FILL - - - - - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -633,6 +629,25 @@ 1 2 + 2 + 3 + + + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 1 + -1 -1 9999 1 10 10 + + + 1 + 2 + 3 + 4