Ticket #265: remaining.diff

File remaining.diff, 2.2 KB (added by Anderen2, 12 years ago)

Patch to add a remaining data column

Line 
1diff -crB a/deluge/core/torrent.py b/deluge/core/torrent.py
2*** a/deluge/core/torrent.py 2013-01-03 10:28:39.852885233 +0100
3--- b/deluge/core/torrent.py 2013-01-03 10:25:44.000000000 +0100
4***************
5*** 522,527 ****
6--- 522,538 ----
7
8 return eta
9
10+ def get_remaining_data(self):
11+ """Returns the remaining data to download for this torrent"""
12+ if self.status == None:
13+ status = self.handle.status()
14+ else:
15+ status = self.status
16+
17+ remaining = status.total_wanted - status.total_wanted_done
18+
19+ return remaining
20+
21 def get_ratio(self):
22 """Returns the ratio for this torrent"""
23 if self.status == None:
24***************
25*** 794,800 ****
26 "ratio": self.get_ratio,
27 "total_size": ti_total_size,
28 "tracker_host": self.get_tracker_host,
29! "last_seen_complete": self.get_last_seen_complete
30 }
31
32 # Create the desired status dictionary and return it
33--- 805,812 ----
34 "ratio": self.get_ratio,
35 "total_size": ti_total_size,
36 "tracker_host": self.get_tracker_host,
37! "last_seen_complete": self.get_last_seen_complete,
38! "remaining": self.get_remaining_data
39 }
40
41 # Create the desired status dictionary and return it
42diff -crB a/deluge/ui/gtkui/torrentview.py b/deluge/ui/gtkui/torrentview.py
43*** a/deluge/ui/gtkui/torrentview.py 2013-01-03 10:28:34.652859447 +0100
44--- b/deluge/ui/gtkui/torrentview.py 2013-01-03 10:26:51.000000000 +0100
45***************
46*** 397,402 ****
47--- 397,405 ----
48 self.add_func_column(_("Last Seen Complete"),
49 listview.cell_data_date_or_never, [float],
50 status_field=["last_seen_complete"], default=False)
51+ self.add_func_column(_("Remaining"), listview.cell_data_size,
52+ [gobject.TYPE_UINT64],
53+ status_field=["remaining"], default=False)
54 self.add_texticon_column(_("Tracker"),
55 status_field=["tracker_host", "tracker_host"],
56 function=cell_data_trackericon, default=False)