Some performance tweaks. Still the main issue is in Tree View to display data

and more tweaks to come.
This commit is contained in:
Alex Dedul 2007-07-20 11:58:55 +00:00
parent 76184c1be8
commit 938c1fed43
1 changed files with 17 additions and 4 deletions

View File

@ -102,6 +102,7 @@ class DelugeGTK:
self.build_summary_tab() self.build_summary_tab()
self.build_file_tab() self.build_file_tab()
self.build_peer_tab() self.build_peer_tab()
self.load_status_icons()
# Set the Torrent menu bar sub-menu to the same as the right-click Torrent pop-up menu # Set the Torrent menu bar sub-menu to the same as the right-click Torrent pop-up menu
self.wtree.get_widget("menu_torrent").set_submenu(self.torrent_menu) self.wtree.get_widget("menu_torrent").set_submenu(self.torrent_menu)
@ -360,6 +361,15 @@ class DelugeGTK:
tray_lock.destroy() tray_lock.destroy()
return True return True
def load_status_icons(self):
self.status_icons = \
{'paused': gtk.gdk.pixbuf_new_from_file(
common.get_pixmap("inactive16.png")),
'seeding': gtk.gdk.pixbuf_new_from_file(
common.get_pixmap("seeding16.png")),
'downloading' : gtk.gdk.pixbuf_new_from_file(
common.get_pixmap("downloading16.png"))}
def list_of_trackers(self,obj=None): def list_of_trackers(self,obj=None):
torrent = self.get_selected_torrent() torrent = self.get_selected_torrent()
if torrent is not None: if torrent is not None:
@ -750,11 +760,11 @@ class DelugeGTK:
# Set the appropriate status icon # Set the appropriate status icon
if state["is_paused"]: if state["is_paused"]:
status_icon = gtk.gdk.pixbuf_new_from_file(common.get_pixmap("inactive16.png")) status_icon = self.status_icons['paused']
elif state["is_seed"]: elif state["is_seed"]:
status_icon = gtk.gdk.pixbuf_new_from_file(common.get_pixmap("seeding16.png")) status_icon = self.status_icons['seeding']
else: else:
status_icon = gtk.gdk.pixbuf_new_from_file(common.get_pixmap("downloading16.png")) status_icon = self.status_icons['downloading']
rlist = [int(unique_id), queue, status_icon, name, size, progress, rlist = [int(unique_id), queue, status_icon, name, size, progress,
message, seeds, seeds_t, peers, peers_t, dl_speed, ul_speed, message, seeds, seeds_t, peers, peers_t, dl_speed, ul_speed,
@ -868,7 +878,10 @@ class DelugeGTK:
tlist = self.get_list_from_unique_id(uid) tlist = self.get_list_from_unique_id(uid)
for i in xrange(len(tlist)): for i in xrange(len(tlist)):
try: try:
self.torrent_model.set_value(itr, i, tlist[i]) if self.torrent_model.get_value(itr, i) != \
tlist[i]:
self.torrent_model.set_value(itr, i,
tlist[i])
except: except:
print "ERR", i, type(tlist[i]), tlist[i] print "ERR", i, type(tlist[i]), tlist[i]
itr = self.torrent_model.iter_next(itr) itr = self.torrent_model.iter_next(itr)