diff --git a/deluge/common.py b/deluge/common.py index a558fef52..e437cf298 100644 --- a/deluge/common.py +++ b/deluge/common.py @@ -127,7 +127,10 @@ def fspeed(bps): def fpeer(num_peers, total_peers): """Returns a formatted string num_peers (total_peers)""" - return str(str(num_peers) + " (" + str(total_peers) + ")") + if total_peers > -1: + return str(str(num_peers) + " (" + str(total_peers) + ")") + else: + return str(num_peers) def ftime(seconds): """Returns a formatted time string""" diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index 18139ede7..92728ce5d 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -128,17 +128,6 @@ class Torrent: # Adjust progress to be 0-100 value progress = status.progress*100 - # Get the total number of seeds and peers - if status.num_complete == -1: - total_seeds = status.num_seeds - else: - total_seeds = status.num_complete - - if status.num_incomplete == -1: - total_peers = status.num_peers - status.num_seeds - else: - total_peers = status.num_incomplete - # Set the state to 'Paused' if the torrent is paused. state = status.state if status.paused: @@ -168,8 +157,8 @@ class Torrent: "upload_payload_rate": status.upload_payload_rate, "num_peers": status.num_peers - status.num_seeds, "num_seeds": status.num_seeds, - "total_peers": total_peers, - "total_seeds": total_seeds, + "total_peers": status.num_incomplete, + "total_seeds": status.num_complete, "total_wanted": status.total_wanted, "eta": self.get_eta(), "ratio": self.get_ratio(), diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index 33d76f503..a1d4476f1 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -531,7 +531,8 @@ class TorrentManager: torrent_id = str(alert.handle.info_hash()) # Set the tracker status for the torrent try: - self.torrents[torrent_id].set_tracker_status(_("Announce OK")) + if alert.msg != "Got peers from DHT": + self.torrents[torrent_id].set_tracker_status(_("Announce OK")) except KeyError: log.debug("torrent_id doesn't exist.") @@ -555,10 +556,8 @@ class TorrentManager: log.debug("on_alert_tracker") # Get the torrent_id torrent_id = str(alert.handle.info_hash()) - tracker_status = "%s: %s (%s=%s, %s=%s)" % \ - (_("Alert"), str(alert.msg()), - _("HTTP code"), alert.status_code, - _("times in a row"), alert.times_in_row) + tracker_status = "%s: %s" % \ + (_("Alert"), str(alert.msg()).strip('"')[8:]) # Set the tracker status for the torrent try: self.torrents[torrent_id].set_tracker_status(tracker_status) diff --git a/deluge/ui/gtkui/glade/main_window.glade b/deluge/ui/gtkui/glade/main_window.glade index c274d425d..e6fa3cf18 100644 --- a/deluge/ui/gtkui/glade/main_window.glade +++ b/deluge/ui/gtkui/glade/main_window.glade @@ -904,6 +904,7 @@ True 0 + True 1 @@ -917,6 +918,7 @@ True 0 + True 1 @@ -931,7 +933,8 @@ True 0 True - PANGO_WRAP_WORD_CHAR + PANGO_WRAP_CHAR + True 1 @@ -1048,7 +1051,8 @@ True 0 True - PANGO_WRAP_WORD_CHAR + PANGO_WRAP_CHAR + True 1 @@ -1062,6 +1066,9 @@ True 0 + True + PANGO_WRAP_CHAR + True 1 @@ -1075,6 +1082,8 @@ True 0 + True + True 1 @@ -1111,7 +1120,8 @@ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 0 True - PANGO_WRAP_WORD_CHAR + PANGO_WRAP_CHAR + True 1 diff --git a/deluge/ui/gtkui/glade/preferences_dialog.glade b/deluge/ui/gtkui/glade/preferences_dialog.glade index 204f8141a..2acc7d4d0 100644 --- a/deluge/ui/gtkui/glade/preferences_dialog.glade +++ b/deluge/ui/gtkui/glade/preferences_dialog.glade @@ -1,6 +1,6 @@ - + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -263,7 +263,7 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK Automatically add torrent files that are placed in this folder. - Client Auto Add: + Client Folder: 0 True @@ -296,7 +296,7 @@ True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Daemon Auto Add: + Daemon Folder: 0 True @@ -568,6 +568,7 @@ True True + False 5 1 0 0 65535 1 10 10 @@ -597,6 +598,7 @@ True True + False 5 1 0 0 65535 1 10 10 @@ -1078,71 +1080,40 @@ Either 2 15 - + True - The maximum upload speed for all torrents. Set -1 for unlimited. - 0 - Maximum Upload Speed (KiB/s): - - - 2 - 3 - GTK_FILL - - - - - True - The maximum number of connections allowed. Set -1 for unlimited. - 0 - Maximum Connections: - - - GTK_FILL - - - - - True - The maximum upload speed for all torrents. Set -1 for unlimited. - 0 - Maximum Upload Slots: + True + The maximum upload slots for all torrents. Set -1 for unlimited. + 1 + -1 -1 9000 1 10 10 + 1 + True + True + 1 + 2 3 4 GTK_FILL - + True True - The maximum number of connections allowed. Set -1 for unlimited. - 4 + The maximum upload speed for all torrents. Set -1 for unlimited. 1 -1 -1 9000 1 10 10 1 - True + 1 True - GTK_UPDATE_IF_VALID 1 2 - GTK_FILL - - - - - True - The maximum download speed for all torrents. Set -1 for unlimited. - 0 - Maximum Download Speed (KiB/s): - - - 1 - 2 + 2 + 3 GTK_FILL @@ -1167,43 +1138,74 @@ Either - + True - True - The maximum upload speed for all torrents. Set -1 for unlimited. - 1 - -1 -1 9000 1 10 10 - 1 - 1 - True + The maximum download speed for all torrents. Set -1 for unlimited. + 0 + Maximum Download Speed (KiB/s): - 1 - 2 - 2 - 3 + 1 + 2 GTK_FILL - + True True - The maximum upload slots for all torrents. Set -1 for unlimited. + The maximum number of connections allowed. Set -1 for unlimited. + 4 1 -1 -1 9000 1 10 10 1 True True + GTK_UPDATE_IF_VALID 1 2 + GTK_FILL + + + + + True + The maximum upload speed for all torrents. Set -1 for unlimited. + 0 + Maximum Upload Slots: + + 3 4 GTK_FILL + + + True + The maximum number of connections allowed. Set -1 for unlimited. + 0 + Maximum Connections: + + + GTK_FILL + + + + + True + The maximum upload speed for all torrents. Set -1 for unlimited. + 0 + Maximum Upload Speed (KiB/s): + + + 2 + 3 + GTK_FILL + + @@ -1247,29 +1249,24 @@ Either 2 15 - + True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - Maximum Upload Slots: + True + The maximum upload slots per torrent. Set -1 for unlimited. + 1 + -1 -1 9000 1 10 10 + 1 + True + True + 1 + 2 1 2 GTK_FILL - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - Maximum Connections: - - - GTK_FILL - - True @@ -1287,19 +1284,24 @@ Either - + True - True - The maximum upload slots per torrent. Set -1 for unlimited. - 1 - -1 -1 9000 1 10 10 - 1 - True - True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Maximum Connections: + + + GTK_FILL + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Maximum Upload Slots: - 1 - 2 1 2 GTK_FILL @@ -1550,15 +1552,33 @@ Either 2 10 - + True - False True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Open folder with: + 0 + True + True + + + + GTK_FILL + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Custom: + 0 + True + True + radio_open_folder_stock + - 1 - 2 1 2 GTK_FILL @@ -1588,38 +1608,20 @@ Thunar - + True + False True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Custom: - 0 - True - True - radio_open_folder_stock - + 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 - Open folder with: - 0 - True - True - - - - GTK_FILL - - diff --git a/deluge/ui/gtkui/listview.py b/deluge/ui/gtkui/listview.py index 7a32d054c..c432793ed 100644 --- a/deluge/ui/gtkui/listview.py +++ b/deluge/ui/gtkui/listview.py @@ -43,7 +43,10 @@ from deluge.log import LOG as log def cell_data_speed(column, cell, model, row, data): """Display value as a speed, eg. 2 KiB/s""" speed = int(model.get_value(row, data)) - speed_str = deluge.common.fspeed(speed) + speed_str = "" + if speed > 0: + speed_str = deluge.common.fspeed(speed) + cell.set_property('text', speed_str) def cell_data_size(column, cell, model, row, data): @@ -57,7 +60,11 @@ def cell_data_peer(column, cell, model, row, data): column1, column2 = data first = int(model.get_value(row, column1)) second = int(model.get_value(row, column2)) - cell.set_property('text', '%d (%d)' % (first, second)) + # Only display a (total) if second is greater than -1 + if second > -1: + cell.set_property('text', '%d (%d)' % (first, second)) + else: + cell.set_property('text', '%d' % first) def cell_data_time(column, cell, model, row, data): """Display value as time, eg 1m10s""" diff --git a/deluge/ui/gtkui/preferences.py b/deluge/ui/gtkui/preferences.py index 742684a6c..44d5e581c 100644 --- a/deluge/ui/gtkui/preferences.py +++ b/deluge/ui/gtkui/preferences.py @@ -465,6 +465,7 @@ class Preferences(component.Component): # Disable the port spinners if random ports is selected. if widget == self.glade.get_widget("chk_random_port"): + log.debug("chk_random_port set to: %s", value) self.glade.get_widget("spin_port_min").set_sensitive(not value) self.glade.get_widget("spin_port_max").set_sensitive(not value) diff --git a/deluge/ui/gtkui/torrentview.py b/deluge/ui/gtkui/torrentview.py index 5c5d9525a..593378140 100644 --- a/deluge/ui/gtkui/torrentview.py +++ b/deluge/ui/gtkui/torrentview.py @@ -45,30 +45,40 @@ import deluge.ui.client as client from deluge.log import LOG as log import deluge.ui.gtkui.listview as listview +# Status icons.. Create them from file only once to avoid constantly +# re-creating them. +icon_downloading = gtk.gdk.pixbuf_new_from_file( + deluge.common.get_pixmap("downloading16.png")) +icon_seeding = gtk.gdk.pixbuf_new_from_file( + deluge.common.get_pixmap("seeding16.png")) +icon_inactive = gtk.gdk.pixbuf_new_from_file( + deluge.common.get_pixmap("inactive16.png")) + def cell_data_statusicon(column, cell, model, row, data): """Display text with an icon""" state = model.get_value(row, data) + icon = None if state == deluge.common.TORRENT_STATE.index("Connecting"): - fname = "downloading16.png" + icon = icon_downloading if state == deluge.common.TORRENT_STATE.index("Downloading"): - fname = "downloading16.png" + icon = icon_downloading if state == deluge.common.TORRENT_STATE.index("Downloading Metadata"): - fname = "downloading16.png" + icon = icon_downloading if state == deluge.common.TORRENT_STATE.index("Queued"): - fname = "inactive16.png" + icon = icon_inactive if state == deluge.common.TORRENT_STATE.index("Paused"): - fname = "inactive16.png" + icon = icon_inactive if state == deluge.common.TORRENT_STATE.index("Checking"): - fname = "downloading16.png" + icon = icon_downloading if state == deluge.common.TORRENT_STATE.index("Allocating"): - fname = "downloading16.png" + icon = icon_downloading if state == deluge.common.TORRENT_STATE.index("Finished"): - fname = "seeding16.png" + icon = icon_seeding if state == deluge.common.TORRENT_STATE.index("Seeding"): - fname = "seeding16.png" - - icon = gtk.gdk.pixbuf_new_from_file(deluge.common.get_pixmap(fname)) - cell.set_property("pixbuf", icon) + icon = icon_seeding + + if icon != None: + cell.set_property("pixbuf", icon) def cell_data_progress(column, cell, model, row, data): """Display progress bar with text"""