diff --git a/glade/dgtkpopups.glade b/glade/dgtkpopups.glade index 78809ec2c..642cddddb 100644 --- a/glade/dgtkpopups.glade +++ b/glade/dgtkpopups.glade @@ -1,6 +1,6 @@ - + True @@ -309,4 +309,98 @@ + + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + GTK_WIN_POS_MOUSE + True + GDK_WINDOW_TYPE_HINT_DIALOG + True + False + False + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 2 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 10 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Rate: + + + False + + + + + True + True + True + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + 1 + 0 -1 10000 1 10 10 + True + + + False + False + 1 + + + + + False + 1 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_BUTTONBOX_END + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-cancel + True + 0 + + + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-ok + True + 1 + + + 1 + + + + + False + GTK_PACK_END + + + + + diff --git a/glade/preferences_dialog.glade b/glade/preferences_dialog.glade index c0fafa741..a0d3917ea 100644 --- a/glade/preferences_dialog.glade +++ b/glade/preferences_dialog.glade @@ -317,40 +317,86 @@ 4 2 - + True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 10 - - - True - 0 - Maximum Upload Rate (KiB/s): - - + True + The maximum upload rate for all torrents. Set -1 for unlimited. + 1 + -1 -1 9000 1 10 10 + 1 + 1 + 2 3 4 GTK_FILL - + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + The maximum download rate for all torrents. Set -1 for unlimited. + 1 + -1 -1 9000 1 10 10 + 1 + + + 1 + 2 + 2 + 3 + GTK_FILL + + + + + True + True + The maximum number of upload slots. Set -1 for unlimited. + 1 + -1 -1 1000 1 10 10 + 1 + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + True + True + The maximum number of connections allowed. Set -1 for unlimited. + 1 + -1 -1 1000 1 10 10 + 1 + + + 1 + 2 + GTK_FILL + + + + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 10 - + True 0 - Maximum Download Rate (KiB/s): + Maximum Connections: - 2 - 3 GTK_FILL @@ -374,84 +420,38 @@ - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 10 - + True 0 - Maximum Connections: + Maximum Download Rate (KiB/s): - GTK_FILL - - - - - True - True - The maximum number of connections allowed. Set -1 for unlimited. - 1 - -1 -1 1000 1 10 10 - 1 - - - 1 - 2 - GTK_FILL - - - - - True - True - The maximum number of upload slots. Set -1 for unlimited. - 1 - -1 -1 1000 1 10 10 - 1 - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - The maximum download rate for all torrents. Set -1 for unlimited. - 1 - -1 -1 9000 1 10 10 - 1 - - - 1 - 2 2 3 GTK_FILL - + True - True - The maximum upload rate for all torrents. Set -1 for unlimited. - 1 - -1 -1 9000 1 10 10 - 1 + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 10 + + + True + 0 + Maximum Upload Rate (KiB/s): + + - 1 - 2 3 4 GTK_FILL @@ -974,55 +974,54 @@ Full Stream - + True - True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 8080 0 10000 1 10 10 + Proxy Type: + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Username: - 3 - 4 1 2 - + True - True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Password: - 3 - 4 + 2 + 3 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - None -Socksv4 -Socksv5 -Socksv5 w/ Auth -HTTP -HTTP w/ Auth + Server: - 1 - 2 + 2 + 3 - + True - True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Port: - 1 - 2 + 2 + 3 1 2 @@ -1042,58 +1041,59 @@ HTTP w/ Auth - + True + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Port: - 2 - 3 + 1 + 2 1 2 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Server: + None +Socksv4 +Socksv5 +Socksv5 w/ Auth +HTTP +HTTP w/ Auth - 2 - 3 + 1 + 2 - + True + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Password: - 2 - 3 + 3 + 4 - + True + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Username: + 8080 0 10000 1 10 10 + 3 + 4 1 2 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Proxy Type: - - @@ -1255,97 +1255,6 @@ HTTP w/ Auth 2 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 3 - 20 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 10 - 5 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - Download speed limits: - - - - - False - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 1 - - - - - - - 3 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 20 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 10 - 21 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - Upload speed limits: - - - - - False - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - 1 - - - - - - - 4 - - diff --git a/glade/tray_menu.glade b/glade/tray_menu.glade index 55cc37117..01bd5e4e2 100644 --- a/glade/tray_menu.glade +++ b/glade/tray_menu.glade @@ -6,19 +6,33 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK Download Limit True + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-missing-image + + - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK Upload Limit True + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-missing-image + + diff --git a/pixmaps/downloading22.png b/pixmaps/downloading22.png new file mode 100644 index 000000000..77e61965a Binary files /dev/null and b/pixmaps/downloading22.png differ diff --git a/pixmaps/downloading24.png b/pixmaps/downloading24.png deleted file mode 100644 index 6f9a9d456..000000000 Binary files a/pixmaps/downloading24.png and /dev/null differ diff --git a/pixmaps/inactive22.png b/pixmaps/inactive22.png new file mode 100644 index 000000000..685d9f327 Binary files /dev/null and b/pixmaps/inactive22.png differ diff --git a/pixmaps/inactive24.png b/pixmaps/inactive24.png deleted file mode 100644 index a2b5a023b..000000000 Binary files a/pixmaps/inactive24.png and /dev/null differ diff --git a/pixmaps/seeding22.png b/pixmaps/seeding22.png new file mode 100644 index 000000000..816e5e075 Binary files /dev/null and b/pixmaps/seeding22.png differ diff --git a/pixmaps/seeding24.png b/pixmaps/seeding24.png deleted file mode 100644 index 31a41957d..000000000 Binary files a/pixmaps/seeding24.png and /dev/null differ diff --git a/src/dialogs.py b/src/dialogs.py index 9414b2b48..c3d96464e 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -85,9 +85,6 @@ class PreferencesDlg: self.glade.get_widget("ratio_spinner").set_value(self.preferences.get("auto_seed_ratio")) self.glade.get_widget("chk_dht").set_active(self.preferences.get("enable_dht", bool, default=True)) self.glade.get_widget("spin_gui").set_value(self.preferences.get("gui_update_interval", float, default=1.0)) - - self.glade.get_widget("txt_tray_downladspeed").set_text(self.preferences.get("tray_downloadspeedlist", default="")) - self.glade.get_widget("txt_tray_uploadspeed").set_text(self.preferences.get("tray_uploadspeedlist", default="")) except KeyError: pass @@ -128,9 +125,6 @@ class PreferencesDlg: self.preferences.set("enable_dht", self.glade.get_widget("chk_dht").get_active()) self.preferences.set("gui_update_interval", self.glade.get_widget("spin_gui").get_value()) - self.preferences.set("tray_downloadspeedlist", self.glade.get_widget("txt_tray_downladspeed").get_text()) - self.preferences.set("tray_uploadspeedlist", self.glade.get_widget("txt_tray_uploadspeed").get_text()) - def TestPort(self, widget): activep = str(self.parent.manager.get_state()['port']) common.open_url_in_browser(self.dialog,'http://www.deluge-torrent.org/test-port.php?port=%s' %activep) diff --git a/src/interface.py b/src/interface.py index 93296f33d..f745b9776 100644 --- a/src/interface.py +++ b/src/interface.py @@ -170,8 +170,8 @@ class DelugeGTK: "show_hide_window": self.force_show_hide, }) - self.item_bwdownset = self.tray_glade.get_widget("download_limit") - self.item_bwupset = self.tray_glade.get_widget("upload_limit") + self.tray_glade.get_widget("download-limit-image").set_from_file(common.get_pixmap('downloading22.png')) + self.tray_glade.get_widget("upload-limit-image").set_from_file(common.get_pixmap('seeding22.png')) self.build_tray_bwsetsubmenu() self.tray_icon.connect("activate", self.tray_clicked) @@ -181,37 +181,54 @@ class DelugeGTK: self.tray_menu.popup(None, None, gtk.status_icon_position_menu, button, activate_time, status_icon) - def update_tray_bwsetsubmenu(self): - self.submenu_bwdownset.destroy() - self.submenu_bwupset.destroy() - - self.build_tray_bwsetsubmenu() - def build_tray_bwsetsubmenu(self): self.submenu_bwdownset = gtk.Menu() self.submenu_bwupset = gtk.Menu() + + group = None + for value in sorted(self.config.get("tray_downloadspeedlist")): + subitem = gtk.RadioMenuItem(group, str(value) + " " + _("KiB/s")) + group = subitem + self.submenu_bwdownset.append(subitem) + if value == self.config.get("max_download_rate"): + subitem.set_active(True) + subitem.connect("toggled", self.tray_setbwdown) - subitem_downtmp = gtk.MenuItem(_("Unlimited")) - self.submenu_bwdownset.append(subitem_downtmp) - self.submenu_bwdownset.append(gtk.SeparatorMenuItem()) - subitem_downtmp.connect("activate", self.tray_setbwdown) + subitem = gtk.RadioMenuItem(group, _("Unlimited")) + self.submenu_bwdownset.append(subitem) + if self.config.get("max_download_rate") < 0: + subitem.set_active(True) + subitem.connect("toggled", self.tray_setbwdown) - subitem_uptmp = gtk.MenuItem(_("Unlimited")) - self.submenu_bwupset.append(subitem_uptmp) - self.submenu_bwupset.append(gtk.SeparatorMenuItem()) - subitem_uptmp.connect("activate", self.tray_setbwup) + subitem = gtk.SeparatorMenuItem() + self.submenu_bwdownset.append(subitem) + subitem = gtk.MenuItem(_("Other...")) + subitem.connect("activate", self.tray_setbwdown) + self.submenu_bwdownset.append(subitem) - for i in self.config.get("tray_downloadspeedlist").split(","): - subitem_downtmp = gtk.MenuItem(i+" "+_("KiB/s")) - self.submenu_bwdownset.append(subitem_downtmp) - subitem_downtmp.connect("activate", self.tray_setbwdown) - for i in self.config.get("tray_uploadspeedlist").split(","): - subitem_uptmp = gtk.MenuItem(i+" "+_("KiB/s")) - self.submenu_bwupset.append(subitem_uptmp) - subitem_uptmp.connect("activate", self.tray_setbwup) + group = None + for value in self.config.get("tray_uploadspeedlist"): + subitem = gtk.RadioMenuItem(group, str(value) + " " + _("KiB/s")) + group = subitem + if value == self.config.get("max_upload_rate"): + subitem.set_active(True) + self.submenu_bwupset.append(subitem) + subitem.connect("toggled", self.tray_setbwup) - self.item_bwdownset.set_submenu(self.submenu_bwdownset) - self.item_bwupset.set_submenu(self.submenu_bwupset) + subitem = gtk.RadioMenuItem(group, _("Unlimited")) + self.submenu_bwupset.append(subitem) + if self.config.get("max_upload_rate") < 0: + subitem.set_active(True) + subitem.connect("toggled", self.tray_setbwup) + + subitem = gtk.SeparatorMenuItem() + self.submenu_bwupset.append(subitem) + subitem = gtk.MenuItem(_("Other...")) + subitem.connect("activate", self.tray_setbwup) + self.submenu_bwupset.append(subitem) + + self.tray_glade.get_widget("download_limit").set_submenu(self.submenu_bwdownset) + self.tray_glade.get_widget("upload_limit").set_submenu(self.submenu_bwupset) self.submenu_bwdownset.show_all() self.submenu_bwupset.show_all() @@ -219,17 +236,45 @@ class DelugeGTK: def tray_setbwdown(self, widget, data=None): str_bwdown = widget.get_children()[0].get_text().rstrip(" "+_("KiB/s")) if str_bwdown == _("Unlimited"): - str_bwdown = "-1" + str_bwdown = -1 - self.config.set("max_download_rate", str_bwdown) + if str_bwdown == _("Other..."): + dialog_glade = gtk.glade.XML(common.get_glade_file("dgtkpopups.glade")) + rate_dialog = dialog_glade.get_widget("rate_dialog") + spin_rate = dialog_glade.get_widget("spin_rate") + spin_rate.set_value(self.config.get("max_download_rate")) + spin_rate.select_region(0, -1) + response = rate_dialog.run() + if response == 1: # OK Response + str_bwdown = spin_rate.get_value() + else: + rate_dialog.destroy() + return + rate_dialog.destroy() + + self.config.set("max_download_rate", float(str_bwdown)) self.apply_prefs() def tray_setbwup(self, widget, data=None): str_bwup = widget.get_children()[0].get_text().rstrip(" "+_("KiB/s")) if str_bwup == _("Unlimited"): - str_bwup = "-1" + str_bwup = -1 - self.config.set("max_upload_rate", str_bwup) + if str_bwup == _("Other..."): + dialog_glade = gtk.glade.XML(common.get_glade_file("dgtkpopups.glade")) + rate_dialog = dialog_glade.get_widget("rate_dialog") + spin_rate = dialog_glade.get_widget("spin_rate") + spin_rate.set_value(self.config.get("max_upload_rate")) + spin_rate.select_region(0, -1) + response = rate_dialog.run() + if response == 1: # OK Response + str_bwup = spin_rate.get_value() + else: + rate_dialog.destroy() + return + rate_dialog.destroy() + + self.config.set("max_upload_rate", float(str_bwup)) self.apply_prefs() def unlock_tray(self,comingnext): @@ -643,17 +688,31 @@ class DelugeGTK: def apply_prefs(self): # Show tray icon if necessary - self.tray_icon.set_visible(self.config.get("enable_system_tray", bool, default=True)) + self.tray_icon.set_visible(self.config.get("enable_system_tray")) # Update the max_*_rate_bps prefs - ulrate = self.config.get("max_upload_rate", int, default=-1) * 1024 - dlrate = self.config.get("max_download_rate", int, default=-1) * 1024 + ulrate = self.config.get("max_upload_rate") * 1024 + dlrate = self.config.get("max_download_rate") * 1024 if not (ulrate < 0): self.config.set("max_upload_rate_bps", ulrate) if not (dlrate < 0): self.config.set("max_download_rate_bps", dlrate) - self.update_tray_bwsetsubmenu() + # Update the tray download speed limits + if self.config.get("max_download_rate") not in self.config.get("tray_downloadspeedlist") and self.config.get("max_download_rate") >= 0: + # We need to prepend this value and remove the last value in the list + self.config.get("tray_downloadspeedlist").insert(0, self.config.get("max_download_rate")) + self.config.get("tray_downloadspeedlist").pop() + # Re-build the sub-menu to display new option + self.build_tray_bwsetsubmenu() + # Do the same for the upload speed limits + if self.config.get("max_upload_rate") not in self.config.get("tray_uploadspeedlist") and self.config.get("max_upload_rate") >= 0: + # We need to prepend this value and remove the last value in the list + self.config.get("tray_uploadspeedlist").insert(0, self.config.get("max_upload_rate")) + self.config.get("tray_uploadspeedlist").pop() + # Re-build the sub-menu to display new option + self.build_tray_bwsetsubmenu() + # Apply the preferences in the core self.manager.apply_prefs() @@ -699,11 +758,11 @@ class DelugeGTK: # Set the appropriate status icon if state["is_paused"]: - status_icon = gtk.gdk.pixbuf_new_from_file(common.get_pixmap("inactive24.png")) + status_icon = gtk.gdk.pixbuf_new_from_file(common.get_pixmap("inactive22.png")) elif state["is_seed"]: - status_icon = gtk.gdk.pixbuf_new_from_file(common.get_pixmap("seeding24.png")) + status_icon = gtk.gdk.pixbuf_new_from_file(common.get_pixmap("seeding22.png")) else: - status_icon = gtk.gdk.pixbuf_new_from_file(common.get_pixmap("downloading24.png")) + status_icon = gtk.gdk.pixbuf_new_from_file(common.get_pixmap("downloading22.png")) rlist = [int(unique_id), int(queue), status_icon, str(name), long(size), float(progress), str(message), int(seeds), int(seeds_t), int(peers), int(peers_t), int(dlrate), int(ulrate), int(eta), float(share)] diff --git a/src/pref.py b/src/pref.py index 2efd678e2..649ca0191 100644 --- a/src/pref.py +++ b/src/pref.py @@ -77,7 +77,9 @@ DEFAULT_PREFS = { "show_status" : True, "show_toolbar" : True, "show_ul" : True, + "tray_downloadspeedlist" : [5.0, 10.0, 30.0, 80.0, 300.0], "tray_passwd" : "", + "tray_uploadspeedlist" : [5.0, 10.0, 30.0, 80.0, 300.0] "use_compact_storage" : False, "use_default_dir" : False, "use_natpmp" : False, @@ -89,8 +91,6 @@ DEFAULT_PREFS = { "window_width" : 640, "window_x_pos" : 0, "window_y_pos" : 0, - "tray_downloadspeedlist" : "10,20,30,40,50,100,200,300,400,500,1000", - "tray_uploadspeedlist" : "10,20,30,40,50,100,200,300,400,500,1000" } class Preferences: def __init__(self, filename=None, global_defaults=True, defaults=None):