Changeset 169b9b
- Timestamp:
- 01/17/2014 07:17:18 PM (12 years ago)
- Branches:
- 2.0.x, develop, master
- Children:
- 2b64d7
- Parents:
- 0da6739
- git-author:
- Calum Lind <calumlind+deluge@gmail.com> (11/20/2013 11:55:22 PM)
- git-committer:
- Calum Lind <calumlind+deluge@gmail.com> (01/17/2014 07:17:18 PM)
- Location:
- deluge
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
deluge/core/torrent.py
r0da6739 r169b9b 55 55 log = logging.getLogger(__name__) 56 56 57 57 58 def sanitize_filepath(filepath, folder=False): 58 59 """ … … 79 80 else: 80 81 return newfilepath 82 81 83 82 84 class TorrentOptions(dict): … … 106 108 self["mapped_files"] = {} 107 109 110 108 111 class Torrent(object): 109 112 """Torrent holds information about torrents added to the libtorrent session. … … 382 385 def set_trackers(self, trackers): 383 386 """Sets trackers""" 384 if trackers ==None:387 if trackers is None: 385 388 trackers = [] 386 389 for value in self.handle.trackers(): … … 575 578 file_progress = self.handle.file_progress() 576 579 ret = [] 577 for i, f in enumerate(self.get_files()):580 for i, f in enumerate(self.get_files()): 578 581 try: 579 582 ret.append(float(file_progress[i]) / float(f["size"])) … … 681 684 "all_time_download": lambda: self.status.all_time_download, 682 685 "compact": lambda: self.options["compact_allocation"], 683 "distributed_copies": lambda: 0.0 if self.status.distributed_copies < 0 else \684 self.status.distributed_copies,# Adjust status.distributed_copies to return a non-negative value686 "distributed_copies": lambda: 0.0 if self.status.distributed_copies < 0 else 687 self.status.distributed_copies, # Adjust status.distributed_copies to return a non-negative value 685 688 "download_payload_rate": lambda: self.status.download_payload_rate, 686 689 "file_priorities": lambda: self.options["file_priorities"], … … 709 712 "save_path": lambda: self.options["download_location"], 710 713 "seeding_time": lambda: self.status.seeding_time, 711 "seeds_peers_ratio": lambda: -1.0 if self.status.num_incomplete == 0 else \712 self.status.num_complete / float(self.status.num_incomplete),# Use -1.0 to signify infinity714 "seeds_peers_ratio": lambda: -1.0 if self.status.num_incomplete == 0 else 715 self.status.num_complete / float(self.status.num_incomplete), # Use -1.0 to signify infinity 713 716 "seed_rank": lambda: self.status.seed_rank, 714 717 "state": lambda: self.state, … … 735 738 "total_size": lambda: self.torrent_info.total_size() if self.has_metadata else 0, 736 739 "eta": self.get_eta, 737 "file_progress": self.get_file_progress, # Adjust progress to be 0-100 value740 "file_progress": self.get_file_progress, # Adjust progress to be 0-100 value 738 741 "files": self.get_files, 739 742 "is_seed": lambda: self.status.is_seeding, … … 742 745 "ratio": self.get_ratio, 743 746 "tracker_host": self.get_tracker_host, 747 "completed_time": lambda: self.status.completed_time, 744 748 "last_seen_complete": lambda: self.status.last_seen_complete, 745 749 "name": self.get_name, 746 750 "pieces": self._get_pieces_info, 747 748 } 751 } 749 752 750 753 def get_name(self): -
deluge/ui/gtkui/torrentview.py
r0da6739 r169b9b 54 54 55 55 log = logging.getLogger(__name__) 56 56 57 57 58 def queue_peer_seed_sort_function(v1, v2): … … 66 67 if v2 > v1: 67 68 return -1 69 68 70 69 71 def queue_column_sort(model, iter1, iter2, data): … … 87 89 return -1 88 90 91 89 92 def seed_peer_column_sort(model, iter1, iter2, data): 90 93 v1 = model[iter1][data] # num seeds/peers … … 96 99 return queue_peer_seed_sort_function(v1, v3) 97 100 101 98 102 class SearchBox(object): 99 103 def __init__(self, torrentview): … … 183 187 self.prefiltered.pop(self.prefiltered.index(torrent_id)) 184 188 row[filter_column] = not row[filter_column] 185 186 189 187 190 if not row[filter_column]: … … 295 298 self.add_func_column(_("Added"), funcs.cell_data_date, [float], 296 299 status_field=["time_added"], default=False) 300 self.add_func_column(_("Completed"), 301 funcs.cell_data_date_or_never, [float], 302 status_field=["completed_time"], default=False) 297 303 self.add_func_column(_("Last Seen Complete"), 298 304 funcs.cell_data_date_or_never, [float], … … 394 400 self.treeview.get_selection().unselect_all() 395 401 search_filter = self.filter and self.filter.get('name', None) or None 396 self.filter = dict(filter_dict) #copied version of filter_dict.402 self.filter = dict(filter_dict) # Copied version of filter_dict. 397 403 if search_filter and 'name' not in filter_dict: 398 404 self.filter['name'] = search_filter … … 412 418 # If not, we can ignore it. 413 419 if self.columns[column].column.get_visible() is True \ 414 and self.columns[column].hidden is False \415 and self.columns[column].status_field is not None:420 and self.columns[column].hidden is False \ 421 and self.columns[column].status_field is not None: 416 422 for field in self.columns[column].status_field: 417 423 status_keys.append(field) … … 479 485 # The status dict is the same, so do nothing to update for this torrent 480 486 continue 481 except KeyError , e:487 except KeyError: 482 488 pass 483 489 … … 540 546 break 541 547 542 def mark_dirty(self, torrent_id =None):548 def mark_dirty(self, torrent_id=None): 543 549 for row in self.liststore: 544 550 if not torrent_id or row[self.columns["torrent_id"].column_indices[0]] == torrent_id: 545 551 #log.debug("marking %s dirty", torrent_id) 546 552 row[self.columns["dirty"].column_indices[0]] = True 547 if torrent_id: break 553 if torrent_id: 554 break 548 555 549 556 def get_selected_torrent(self): … … 611 618 612 619 if self.get_selected_torrents(): 613 if self.model_filter.get_value(row, self.columns["torrent_id"].column_indices[0]) not in self.get_selected_torrents(): 620 if self.model_filter.get_value(row, self.columns["torrent_id"].column_indices[0]) \ 621 not in self.get_selected_torrents(): 614 622 self.treeview.get_selection().unselect_all() 615 623 self.treeview.get_selection().select_iter(row)
Note:
See TracChangeset
for help on using the changeset viewer.