add progress bars to files plugin - yobbobandana
This commit is contained in:
parent
7fa861f83a
commit
fe67907a5d
|
@ -14,6 +14,7 @@ Deluge 0.5.6 (xx October 2007)
|
||||||
* Use SVG for internal logo usage (except on Win32)
|
* Use SVG for internal logo usage (except on Win32)
|
||||||
* Use theme for tray icon instead of hard-coded
|
* Use theme for tray icon instead of hard-coded
|
||||||
* Properly release port on shutdown
|
* Properly release port on shutdown
|
||||||
|
* TorrentFiles plugin now has progress bars
|
||||||
* Removing torrent files no longer deletes files that werent part of the torrent
|
* 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
|
* New max half-open connections setting to deal with cheap/broken routers
|
||||||
* Inherit UPnP fixes from libtorrent
|
* Inherit UPnP fixes from libtorrent
|
||||||
|
|
|
@ -60,6 +60,7 @@ class TorrentFiles:
|
||||||
})
|
})
|
||||||
|
|
||||||
tree_view = gtk.TreeView()
|
tree_view = gtk.TreeView()
|
||||||
|
tree_view.set_rules_hint(True)
|
||||||
scrolled_window = gtk.ScrolledWindow()
|
scrolled_window = gtk.ScrolledWindow()
|
||||||
scrolled_window.add(tree_view)
|
scrolled_window.add(tree_view)
|
||||||
scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
||||||
|
|
|
@ -41,7 +41,7 @@ from deluge import dgtk, dialogs
|
||||||
class FilesTabManager(FilesBaseManager):
|
class FilesTabManager(FilesBaseManager):
|
||||||
def __init__(self, file_view, manager):
|
def __init__(self, file_view, manager):
|
||||||
file_store = gtk.ListStore(str, gobject.TYPE_UINT64,
|
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)
|
super(FilesTabManager, self).__init__(file_view, file_store)
|
||||||
self.manager = manager
|
self.manager = manager
|
||||||
|
@ -56,12 +56,11 @@ class FilesTabManager(FilesBaseManager):
|
||||||
def build_file_view(self):
|
def build_file_view(self):
|
||||||
super(FilesTabManager, self).build_file_view()
|
super(FilesTabManager, self).build_file_view()
|
||||||
|
|
||||||
def percent(column, cell, model, iter, data):
|
percent_col = dgtk.add_progress_column(self.file_view, _("Progress"),\
|
||||||
percent = float(model.get_value(iter, data))
|
3, 4, width=150)
|
||||||
percent_str = "%.2f%%"%percent
|
expander_col = gtk.TreeViewColumn()
|
||||||
cell.set_property("text", percent_str)
|
expander_col.set_expand(True)
|
||||||
percent_col = dgtk.add_func_column(self.file_view, _("Progress"), \
|
self.file_view.append_column(expander_col)
|
||||||
percent, 3, width=90)
|
|
||||||
self.file_view.connect("row-activated", self.double_click_file)
|
self.file_view.connect("row-activated", self.double_click_file)
|
||||||
|
|
||||||
def set_unique_id(self, unique_id):
|
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)
|
file_priorities = self.manager.get_priorities(self.file_unique_id)
|
||||||
for file, priority in izip(all_files, file_priorities):
|
for file, priority in izip(all_files, file_priorities):
|
||||||
iter = self.file_store.append([file['path'], file['size'],
|
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
|
self.file_store_dict[file['path']] = iter
|
||||||
|
|
||||||
# From core to UI
|
# 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)
|
new_file_info = self.manager.get_torrent_file_info(self.file_unique_id)
|
||||||
for file in new_file_info:
|
for file in new_file_info:
|
||||||
iter = self.file_store_dict[file['path']]
|
iter = self.file_store_dict[file['path']]
|
||||||
dgtk.update_store(self.file_store, iter, (3,),
|
dgtk.update_store(self.file_store, iter, (3,4),
|
||||||
(round(file['progress'], 2),))
|
(file['progress'],
|
||||||
|
"%.3g%%"%float(file['progress'])))
|
||||||
|
|
||||||
# From UI to core
|
# From UI to core
|
||||||
def update_priorities(self):
|
def update_priorities(self):
|
||||||
|
|
Loading…
Reference in New Issue