diff --git a/deluge/ui/client.py b/deluge/ui/client.py index d7a517af2..1d33055f5 100644 --- a/deluge/ui/client.py +++ b/deluge/ui/client.py @@ -37,10 +37,6 @@ import socket import deluge.xmlrpclib as xmlrpclib -import pygtk -pygtk.require('2.0') -import gtk, gtk.glade - import deluge.common from deluge.log import LOG as log diff --git a/deluge/ui/gtkui/connectionmanager.py b/deluge/ui/gtkui/connectionmanager.py index 71cafdad1..3536c343b 100644 --- a/deluge/ui/gtkui/connectionmanager.py +++ b/deluge/ui/gtkui/connectionmanager.py @@ -68,7 +68,8 @@ class ConnectionManager(component.Component): self.config = ConfigManager("hostlist.conf", DEFAULT_CONFIG) self.connection_manager = self.glade.get_widget("connection_manager") self.hostlist = self.glade.get_widget("hostlist") - self.connection_manager.set_icon(deluge.common.get_logo(32)) + #self.connection_manager.set_icon(deluge.common.get_logo(32)) + self.glade.get_widget("image1").set_from_pixbuf( deluge.common.get_logo(32)) diff --git a/deluge/ui/gtkui/glade/main_window.glade b/deluge/ui/gtkui/glade/main_window.glade index 4b622bb18..55ea25228 100644 --- a/deluge/ui/gtkui/glade/main_window.glade +++ b/deluge/ui/gtkui/glade/main_window.glade @@ -122,7 +122,7 @@ - gtk-connect + gtk-network 1 @@ -299,6 +299,19 @@ False + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Connection Manager + Connection Manager + gtk-network + + + + False + + False @@ -315,6 +328,7 @@ True + False GTK_POLICY_AUTOMATIC GTK_POLICY_AUTOMATIC @@ -330,6 +344,7 @@ + True False @@ -361,6 +376,287 @@ 1 2 10 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 10 + 10 + 15 + 15 + + + True + 7 + 2 + 2 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + True + PANGO_WRAP_WORD_CHAR + + + 1 + 2 + 1 + 2 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + <b>Path:</b> + True + + + + + 1 + 2 + + + + + True + 0 + + + 1 + 2 + 6 + 7 + + + + + + True + 0 + + + 1 + 2 + 5 + 6 + + + + + + True + 0 + True + PANGO_WRAP_WORD_CHAR + + + 1 + 2 + 4 + 5 + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + + + True + 0 + 0 + 1 + <b>Name:</b> + True + + + + + GTK_FILL + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + + + True + 0 + 1 + <b>Next Announce:</b> + True + + + + + 6 + 7 + GTK_FILL + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + + + True + 0 + 1 + <b>Tracker Status:</b> + True + + + + + 5 + 6 + GTK_FILL + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + + + True + 0 + 1 + <b>Tracker:</b> + True + + + + + 4 + 5 + GTK_FILL + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + + + True + 0 + 1 + <b>Total Size:</b> + True + + + + + 2 + 3 + GTK_FILL + + + + + True + 0 + True + PANGO_WRAP_WORD_CHAR + + + 1 + 2 + + + + + + True + 0 + + + 1 + 2 + 2 + 3 + + + + + + True + 0 + + + 1 + 2 + 3 + 4 + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + + + True + 0 + 1 + <b># of files:</b> + True + + + + + 3 + 4 + GTK_FILL + + + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + <b>Torrent Info</b> + True + + + label_item + + + + + 1 + 2 + GTK_FILL + + True @@ -393,277 +689,18 @@ 4 5 - - True - 0 - - - 1 - 2 - - - - + True 0 + True + PANGO_WRAP_WORD_CHAR 3 4 - - - - - True - 0 - - - 1 - 2 - 1 - 2 - - - - - True - 0 - - - 3 - 4 - 1 - 2 - - - - - True - 0 - - - 1 - 2 - 2 - 3 - - - - - True - 0 - - - 3 - 4 - 2 - 3 - - - - - True - 0 - - - 1 - 2 - 3 - 4 - - - - - True - 0 - - - 3 - 4 - 3 - 4 - - - - - True - 5 - - - True - 0 - <b>Downloaded:</b> - True - - - - - - - True - 5 - - - True - 0 - <b>Uploaded:</b> - True - - - - - 1 - 2 - - - - - True - 5 - - - True - 0 - <b>Seeders:</b> - True - - - - - 2 - 3 - - - - - True - 5 - - - True - 0 - <b>Share Ratio:</b> - True - - - - - 3 - 4 - - - - - True - 15 - 5 - - - True - 0 - <b>Speed:</b> - True - - - - - 2 - 3 - - - - - True - 15 - 5 - - - True - 0 - <b>Speed:</b> - True - - - - - 2 - 3 - 1 - 2 - - - - - True - 15 - 5 - - - True - 0 - <b>Peers:</b> - True - - - - - 2 - 3 - 2 - 3 - - - - - True - 15 - 5 - - - True - 0 - <b>ETA:</b> - True - - - - - 2 - 3 - 3 - 4 - - - - - True - 0 - 1 - <b>Pieces:</b> - True - - - 4 - 5 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - - - True - 0 - - - - - 1 - 2 4 5 + @@ -690,18 +727,277 @@ - + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + + + True + 0 + + + + + 1 + 2 + 4 + 5 + + + + + True + 0 + 1 + <b>Pieces:</b> + True + + + 4 + 5 + + + + + True + 15 + 5 + + + True + 0 + <b>ETA:</b> + True + + + + + 2 + 3 + 3 + 4 + + + + + True + 15 + 5 + + + True + 0 + <b>Peers:</b> + True + + + + + 2 + 3 + 2 + 3 + + + + + True + 15 + 5 + + + True + 0 + <b>Speed:</b> + True + + + + + 2 + 3 + 1 + 2 + + + + + True + 15 + 5 + + + True + 0 + <b>Speed:</b> + True + + + + + 2 + 3 + + + + + True + 5 + + + True + 0 + <b>Share Ratio:</b> + True + + + + + 3 + 4 + + + + + True + 5 + + + True + 0 + <b>Seeders:</b> + True + + + + + 2 + 3 + + + + + True + 5 + + + True + 0 + <b>Uploaded:</b> + True + + + + + 1 + 2 + + + + + True + 5 + + + True + 0 + <b>Downloaded:</b> + True + + + + + + True 0 - True - PANGO_WRAP_WORD_CHAR 3 4 - 4 - 5 - + 3 + 4 + + + + + True + 0 + + + 1 + 2 + 3 + 4 + + + + + True + 0 + + + 3 + 4 + 2 + 3 + + + + + True + 0 + + + 1 + 2 + 2 + 3 + + + + + True + 0 + + + 3 + 4 + 1 + 2 + + + + + True + 0 + + + 1 + 2 + 1 + 2 + + + + + True + 0 + + + 3 + 4 + + + + + True + 0 + + + 1 + 2 @@ -731,287 +1027,6 @@ GTK_FILL - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 10 - 10 - 15 - 15 - - - True - 7 - 2 - 2 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - - - True - 0 - 1 - <b># of files:</b> - True - - - - - 3 - 4 - GTK_FILL - - - - - True - 0 - - - 1 - 2 - 3 - 4 - - - - - - True - 0 - - - 1 - 2 - 2 - 3 - - - - - - True - 0 - True - PANGO_WRAP_WORD_CHAR - - - 1 - 2 - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - - - True - 0 - 1 - <b>Total Size:</b> - True - - - - - 2 - 3 - GTK_FILL - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - - - True - 0 - 1 - <b>Tracker:</b> - True - - - - - 4 - 5 - GTK_FILL - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - - - True - 0 - 1 - <b>Tracker Status:</b> - True - - - - - 5 - 6 - GTK_FILL - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - - - True - 0 - 1 - <b>Next Announce:</b> - True - - - - - 6 - 7 - GTK_FILL - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - - - True - 0 - 0 - 1 - <b>Name:</b> - True - - - - - GTK_FILL - - - - - True - 0 - True - PANGO_WRAP_WORD_CHAR - - - 1 - 2 - 4 - 5 - - - - - - True - 0 - - - 1 - 2 - 5 - 6 - - - - - - True - 0 - - - 1 - 2 - 6 - 7 - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - <b>Path:</b> - True - - - - - 1 - 2 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - True - PANGO_WRAP_WORD_CHAR - - - 1 - 2 - 1 - 2 - - - - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - <b>Torrent Info</b> - True - - - label_item - - - - - 1 - 2 - GTK_FILL - - diff --git a/deluge/ui/gtkui/preferences.py b/deluge/ui/gtkui/preferences.py index cc39c8719..8d22ca26f 100644 --- a/deluge/ui/gtkui/preferences.py +++ b/deluge/ui/gtkui/preferences.py @@ -105,69 +105,106 @@ class Preferences(component.Component): self.liststore.append([index, name]) def show(self): - self.core_config = client.get_config() # Update the preferences dialog to reflect current config settings - + self.core_config = client.get_config() + + if self.core_config != {} and self.core_config != None: + core_widgets = { + "download_path_button": \ + ("filename", self.core_config["download_location"]), + "radio_compact_allocation": \ + ("active", self.core_config["compact_allocation"]), + "radio_full_allocation": \ + ("not_active", self.core_config["compact_allocation"]), + "chk_prioritize_first_last_pieces": \ + ("active", + self.core_config["prioritize_first_last_pieces"]), + "spin_port_min": ("value", self.core_config["listen_ports"][0]), + "spin_port_max": ("value", self.core_config["listen_ports"][1]), + "active_port_label": ("text", str(client.get_listen_port())), + "chk_random_port": ("active", self.core_config["random_port"]), + "chk_dht": ("active", self.core_config["dht"]), + "chk_upnp": ("active", self.core_config["upnp"]), + "chk_natpmp": ("active", self.core_config["natpmp"]), + "chk_utpex": ("active", self.core_config["utpex"]), + "combo_encin": ("active", self.core_config["enc_in_policy"]), + "combo_encout": ("active", self.core_config["enc_out_policy"]), + "combo_enclevel": ("active", self.core_config["enc_level"]), + "chk_pref_rc4": ("active", self.core_config["enc_prefer_rc4"]), + "spin_max_connections_global": \ + ("value", self.core_config["max_connections_global"]), + "spin_max_download": \ + ("value", self.core_config["max_download_speed"]), + "spin_max_upload": \ + ("value", self.core_config["max_upload_speed"]), + "spin_max_upload_slots_global": \ + ("value", self.core_config["max_upload_slots_global"]), + "spin_max_connections_per_torrent": \ + ("value", self.core_config["max_connections_per_torrent"]), + "spin_max_upload_slots_per_torrent": \ + ("value", self.core_config["max_upload_slots_per_torrent"]) + } + + # Update the widgets accordingly + for key in core_widgets.keys(): + modifier = core_widgets[key][0] + value = core_widgets[key][1] + widget = self.glade.get_widget(key) + if type(widget) == gtk.FileChooserButton: + for child in widget.get_children(): + child.set_sensitive(True) + widget.set_sensitive(True) + + if modifier == "filename": + widget.set_filename(value) + elif modifier == "active": + widget.set_active(value) + elif modifier == "not_active": + widget.set_active(not value) + elif modifier == "value": + widget.set_value(value) + elif modifier == "text": + widget.set_text(value) + else: + core_widget_list = [ + "download_path_button", + "radio_compact_allocation", + "radio_full_allocation", + "chk_prioritize_first_last_pieces", + "spin_port_min", + "spin_port_max", + "active_port_label", + "chk_random_port", + "chk_dht", + "chk_upnp", + "chk_natpmp", + "chk_utpex", + "combo_encin", + "combo_encout", + "combo_enclevel", + "chk_pref_rc4", + "spin_max_connections_global", + "spin_max_download", + "spin_max_upload", + "spin_max_upload_slots_global", + "spin_max_connections_per_torrent", + "spin_max_upload_slots_per_torrent" + ] + # We don't appear to be connected to a daemon + for key in core_widget_list: + widget = self.glade.get_widget(key) + if type(widget) == gtk.FileChooserButton: + for child in widget.get_children(): + child.set_sensitive(False) + widget.set_sensitive(False) + ## Downloads tab ## self.glade.get_widget("radio_ask_save").set_active( self.gtkui_config["interactive_add"]) self.glade.get_widget("radio_save_all_to").set_active( not self.gtkui_config["interactive_add"]) - - # This one will need to be re-evaluated if the core is running on a - # different machine.. We won't be able to use the local file browser to - # choose a download location.. It will be specific to the machine core - # is running on. - self.glade.get_widget("download_path_button").set_filename( - self.core_config["download_location"]) - self.glade.get_widget("radio_compact_allocation").set_active( - self.core_config["compact_allocation"]) - self.glade.get_widget("radio_full_allocation").set_active( - not self.core_config["compact_allocation"]) self.glade.get_widget("chk_enable_files_dialog").set_active( self.gtkui_config["enable_files_dialog"]) - self.glade.get_widget("chk_prioritize_first_last_pieces").set_active( - self.core_config["prioritize_first_last_pieces"]) - - ## Network tab ## - self.glade.get_widget("spin_port_min").set_value( - self.core_config["listen_ports"][0]) - self.glade.get_widget("spin_port_max").set_value( - self.core_config["listen_ports"][1]) - self.glade.get_widget("active_port_label").set_text( - str(client.get_listen_port())) - self.glade.get_widget("chk_random_port").set_active( - self.core_config["random_port"]) - self.glade.get_widget("chk_dht").set_active( - self.core_config["dht"]) - self.glade.get_widget("chk_upnp").set_active( - self.core_config["upnp"]) - self.glade.get_widget("chk_natpmp").set_active( - self.core_config["natpmp"]) - self.glade.get_widget("chk_utpex").set_active( - self.core_config["utpex"]) - self.glade.get_widget("combo_encin").set_active( - self.core_config["enc_in_policy"]) - self.glade.get_widget("combo_encout").set_active( - self.core_config["enc_out_policy"]) - self.glade.get_widget("combo_enclevel").set_active( - self.core_config["enc_level"]) - self.glade.get_widget("chk_pref_rc4").set_active( - self.core_config["enc_prefer_rc4"]) - - ## Bandwidth tab ## - self.glade.get_widget("spin_max_connections_global").set_value( - self.core_config["max_connections_global"]) - self.glade.get_widget("spin_max_download").set_value( - self.core_config["max_download_speed"]) - self.glade.get_widget("spin_max_upload").set_value( - self.core_config["max_upload_speed"]) - self.glade.get_widget("spin_max_upload_slots_global").set_value( - self.core_config["max_upload_slots_global"]) - self.glade.get_widget("spin_max_connections_per_torrent").set_value( - self.core_config["max_connections_per_torrent"]) - self.glade.get_widget("spin_max_upload_slots_per_torrent").set_value( - self.core_config["max_upload_slots_per_torrent"]) ## Other tab ## self.glade.get_widget("chk_use_tray").set_active(