From a17466f6b9eabe36f32727dbc068df1d179b3bbe Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Wed, 20 Jun 2007 23:34:53 +0000 Subject: [PATCH] Changed status icons size. Changed the way the download/upload speed limit is done in the system tray. --- glade/dgtkpopups.glade | 96 +++++++++- glade/preferences_dialog.glade | 325 ++++++++++++--------------------- glade/tray_menu.glade | 18 +- pixmaps/downloading22.png | Bin 0 -> 977 bytes pixmaps/downloading24.png | Bin 1083 -> 0 bytes pixmaps/inactive22.png | Bin 0 -> 884 bytes pixmaps/inactive24.png | Bin 961 -> 0 bytes pixmaps/seeding22.png | Bin 0 -> 827 bytes pixmaps/seeding24.png | Bin 935 -> 0 bytes src/dialogs.py | 6 - src/interface.py | 133 ++++++++++---- src/pref.py | 4 +- 12 files changed, 326 insertions(+), 256 deletions(-) create mode 100644 pixmaps/downloading22.png delete mode 100644 pixmaps/downloading24.png create mode 100644 pixmaps/inactive22.png delete mode 100644 pixmaps/inactive24.png create mode 100644 pixmaps/seeding22.png delete mode 100644 pixmaps/seeding24.png 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 0000000000000000000000000000000000000000..77e61965a142c8d1f870354c72dc4dd26637287c GIT binary patch literal 977 zcmV;?11|iDP)0B6N@Tl{df8o7PZ@u-}e|d~CAY%*$Rl~2pFk+AYl$kVaMr#vO zwduuyMgZ&)fPy2vuTm3BB61z+eb?~o_WyziroM1x`NVd#fxp95xN^9rSnkWmhBW;8 z`HEG2dn;V&Yn#CmDt7hF&*v|^GYIm~Od5Xucu9@i(k3l6qjfOi;3PmG*t~$Eti+q) z^69DC^v!{ghF@ob)Q=X=Pu|)41(`{E78FDYMO8uB8UsL+xZH`A9G^ zxv)2P00006opcBHf<ZH2>fE;&GvBpqV$1tRxfTxb) zh&>L;EHtAvYzB8RY*#;M`1R)jfW1Ha($kI{svb-uFN%i~Ai@#*NpKR_j@FRqh&$4| z-tg;!aS~TKNn|Dg0B{meJU1vw5HWbxF@#wc+tCIb;XMoBRp!d_nReRh8x-C?Wx5NN(NgSGAgy6G-{ZGMkdw1HH|002fD75g}v(fS;K zYh;YU#o06G%hu=(BH~-YT^RH>n;@A&qN6_El@**QPGC3Qx}E6g>{M-frN70O=3air z5#Ed|%U)(ubkZFpI!2-+aN;P467r&iM2BdnJAWvaJ9lN`+ZEtn|H;(PlR`23oXrdG zN^ZYMAXo199%T3TGM(JCg?s7psjq)KIP`x2FOr&suiihh00000NkvXXu0mjf2&ujW literal 0 HcmV?d00001 diff --git a/pixmaps/downloading24.png b/pixmaps/downloading24.png deleted file mode 100644 index 6f9a9d456ed6752b9518f830b3b2fd60c0c11ed9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1083 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 diff --git a/pixmaps/seeding22.png b/pixmaps/seeding22.png new file mode 100644 index 0000000000000000000000000000000000000000..816e5e075a76cc7bfd18924790656f31735d1cfd GIT binary patch literal 827 zcmV-B1H}A^P)j4>uIOuV4}1Kn76x*<(mxG{0B31Uc0ydg$VK#*H$ij|hm%yBVXth9<> zau)NRH&4FzJ7*43N=mKX2lDcn`?BY69w{Y?l#*fg6JxDx0&pnO2K#%Dgzw!>D=EkBpT;*B+U7*$qj9E4(h_3 z>wQ417^Gk((KwMEWxTN*$|o1WBR~_NC=l>MRgjgjc{&m?hKfR>afGJw!qjOW9D}^Q zY5+neY!5(97=X!{G|h<^>%FeW$=lr01?>Z)8-V5roY)Vk41Ah(WBGMzg9iQ4I7$Je z=N>0Lf~zC5U_0(cYaMj#fdkdh)#z&DNq9d6JIm?RJX|k;{K)apvQbh$UGZo=v^Q*I z-ctpqn!!+EViCS9KqSnyXq;96H^vtN&^6@%b>dnGCBB`f(nx+pj+J*;CM3QnqH2<@U%P7rd@@AnI#zc z?jCnd$ki+xyeemfPb0iG3jn#gHkEXBM}n@pQaTHMoeq)BC@?@J}voHY5U002ovPDHLk FV1iB1V}Sqw literal 0 HcmV?d00001 diff --git a/pixmaps/seeding24.png b/pixmaps/seeding24.png deleted file mode 100644 index 31a41957d4d54809cbd062383e93fe267eee83b6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 935 zcmV;Y16cftP)B^CmOz zV{*H=Hfb`M*c^Dgci;V=AOCaj;UJ}Cx98-9{P^UAeD(iyQc5%_CEcP>;>Z(yO!@&U z3pK{dMP|B+0kI3{k$j3D!Zspp)046JxlqF1GptZTvlD#ZmnMIE3I46Xz8qtg!Ni_n z8l2nT%WF3)YP~KMaDSfD?|#ku-C!MORw(h}P>$c5A$qm3RqVOoImFXdUMUy(b5~fQ zgqN}TE9WviH3Q8M3>^|Wc#irW%0UoQsnj`KE^?=9nHqd+>I_d_hlLu{THpuJ2;iSZ z^>1bgJcqut%}<3A=8mxAUvb7UIePUrwEr{fB;eSyaBLKk7Ton=x(YWIU?|7)rp|ar znQx9WrVFmDuOp_bYQwb@$aB@Y8Nn~tV6hH%0uBwr=d!9#zh|MM8&{o>V3J0oUpw zl&}`Uk5^&12c8~){_Ivz+=i(c(14T;K?FezmI1(fMn1{D#kvv)v3f@_w0CeNAJD)C zgk}V;$s0mKGTN5;V8X*h+y-5c7rI8YeX}0y4W?-TxWW&Z%Q{;(YfT9E;4W!_A8<{q zHkrz~or1~Bc@P3jL-p8BL;0~Dm|dm;jB8R# zp8J$vM+SNQ`W?3zAMkjqX~DMi_H5>o7j~A(yv1zXv-BQX$7d+wuSa002ov JPDHLkV1j7IplJXA 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):