diff --git a/deluge/common.py b/deluge/common.py index 1be89d5f9..0f432dab1 100644 --- a/deluge/common.py +++ b/deluge/common.py @@ -47,7 +47,8 @@ TORRENT_STATE = [ "Downloading", "Finished", "Seeding", - "Allocating" + "Allocating", + "Paused" ] def get_version(): diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index 0058c1285..b582e6e03 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -33,6 +33,8 @@ """Internal Torrent class""" +import deluge.common + class Torrent: """Torrent holds information about torrents added to the libtorrent session. """ @@ -101,6 +103,11 @@ class Torrent: 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: + state = deluge.common.TORRENT_STATE.index("Paused") full_status = { "name": self.handle.torrent_info().name(), @@ -111,7 +118,7 @@ class Torrent: "distributed_copies": status.distributed_copies, "total_done": status.total_done, "total_uploaded": self.total_uploaded + status.total_payload_upload, - "state": int(status.state), + "state": int(state), "paused": status.paused, "progress": progress, "next_announce": status.next_announce.seconds, diff --git a/deluge/ui/gtkui/torrentview.py b/deluge/ui/gtkui/torrentview.py index 9337fc9fe..fe30b532a 100644 --- a/deluge/ui/gtkui/torrentview.py +++ b/deluge/ui/gtkui/torrentview.py @@ -54,6 +54,8 @@ def cell_data_statusicon(column, cell, model, row, data): fname = "downloading16.png" if state == deluge.common.TORRENT_STATE.index("Queued"): fname = "inactive16.png" + if state == deluge.common.TORRENT_STATE.index("Paused"): + fname = "inactive16.png" if state == deluge.common.TORRENT_STATE.index("Checking"): fname = "downloading16.png" if state == deluge.common.TORRENT_STATE.index("Allocating"): @@ -72,11 +74,12 @@ def cell_data_progress(column, cell, model, row, data): value = model.get_value(row, column1) text = model.get_value(row, column2) cell.set_property("value", value) - textstr = "%s" % _(deluge.common.TORRENT_STATE[text]) + textstr = "%s" % deluge.common.TORRENT_STATE[text] if deluge.common.TORRENT_STATE[text] == "Downloading" or\ deluge.common.TORRENT_STATE[text] == "Downloading Metadata" or\ deluge.common.TORRENT_STATE[text] == "Checking" or\ - deluge.common.TORRENT_STATE[text] == "Allocating": + deluge.common.TORRENT_STATE[text] == "Allocating" or\ + (deluge.common.TORRENT_STATE[text] == "Paused" and value < 100): textstr = textstr + " %.2f%%" % value cell.set_property("text", textstr)