From fe67907a5d500c3411de8fc2a80b0c4c8e34f456 Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Sun, 14 Oct 2007 03:55:53 +0000 Subject: [PATCH] add progress bars to files plugin - yobbobandana --- ChangeLog | 1 + plugins/TorrentFiles/__init__.py | 1 + plugins/TorrentFiles/tab_files.py | 21 +++++++++++---------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index b4bd60697..e09e38f6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,7 @@ Deluge 0.5.6 (xx October 2007) * Use SVG for internal logo usage (except on Win32) * Use theme for tray icon instead of hard-coded * Properly release port on shutdown + * TorrentFiles plugin now has progress bars * Removing torrent files no longer deletes files that werent part of the torrent * New max half-open connections setting to deal with cheap/broken routers * Inherit UPnP fixes from libtorrent diff --git a/plugins/TorrentFiles/__init__.py b/plugins/TorrentFiles/__init__.py index 48b4d1d68..99050d45a 100644 --- a/plugins/TorrentFiles/__init__.py +++ b/plugins/TorrentFiles/__init__.py @@ -60,6 +60,7 @@ class TorrentFiles: }) tree_view = gtk.TreeView() + tree_view.set_rules_hint(True) scrolled_window = gtk.ScrolledWindow() scrolled_window.add(tree_view) scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) diff --git a/plugins/TorrentFiles/tab_files.py b/plugins/TorrentFiles/tab_files.py index 4c9464fa8..eb7917fc5 100644 --- a/plugins/TorrentFiles/tab_files.py +++ b/plugins/TorrentFiles/tab_files.py @@ -41,7 +41,7 @@ from deluge import dgtk, dialogs class FilesTabManager(FilesBaseManager): def __init__(self, file_view, manager): file_store = gtk.ListStore(str, gobject.TYPE_UINT64, - gobject.TYPE_UINT, float) + gobject.TYPE_UINT, float, str) super(FilesTabManager, self).__init__(file_view, file_store) self.manager = manager @@ -56,12 +56,11 @@ class FilesTabManager(FilesBaseManager): def build_file_view(self): super(FilesTabManager, self).build_file_view() - def percent(column, cell, model, iter, data): - percent = float(model.get_value(iter, data)) - percent_str = "%.2f%%"%percent - cell.set_property("text", percent_str) - percent_col = dgtk.add_func_column(self.file_view, _("Progress"), \ - percent, 3, width=90) + percent_col = dgtk.add_progress_column(self.file_view, _("Progress"),\ + 3, 4, width=150) + expander_col = gtk.TreeViewColumn() + expander_col.set_expand(True) + self.file_view.append_column(expander_col) self.file_view.connect("row-activated", self.double_click_file) def set_unique_id(self, unique_id): @@ -114,7 +113,8 @@ an error trying to launch the file.")) file_priorities = self.manager.get_priorities(self.file_unique_id) for file, priority in izip(all_files, file_priorities): iter = self.file_store.append([file['path'], file['size'], - priority, round(file['progress'], 2)]) + priority, file['progress'], + "%.3g%%"%float(file['progress'])]) self.file_store_dict[file['path']] = iter # From core to UI @@ -122,8 +122,9 @@ an error trying to launch the file.")) new_file_info = self.manager.get_torrent_file_info(self.file_unique_id) for file in new_file_info: iter = self.file_store_dict[file['path']] - dgtk.update_store(self.file_store, iter, (3,), - (round(file['progress'], 2),)) + dgtk.update_store(self.file_store, iter, (3,4), + (file['progress'], + "%.3g%%"%float(file['progress']))) # From UI to core def update_priorities(self):