Show paused state correctly in TorrentView.
This commit is contained in:
parent
f7b537ad81
commit
007f8c8dc3
|
@ -47,7 +47,8 @@ TORRENT_STATE = [
|
|||
"Downloading",
|
||||
"Finished",
|
||||
"Seeding",
|
||||
"Allocating"
|
||||
"Allocating",
|
||||
"Paused"
|
||||
]
|
||||
|
||||
def get_version():
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
|
||||
"""Internal Torrent class"""
|
||||
|
||||
import deluge.common
|
||||
|
||||
class Torrent:
|
||||
"""Torrent holds information about torrents added to the libtorrent session.
|
||||
"""
|
||||
|
@ -102,6 +104,11 @@ class Torrent:
|
|||
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(),
|
||||
"total_size": self.handle.torrent_info().total_size(),
|
||||
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue