From b4af52cdceee40d16d59e15f69db331ce67eb572 Mon Sep 17 00:00:00 2001 From: Bryan Schumaker Date: Sun, 7 Nov 2010 17:01:01 -0500 Subject: [PATCH] Collection Treeview / List cleanup This removes the on_mouse_motion notifications that I was using for setting the tooltip. --- ocarina/collection.py | 31 ++----------------------------- ocarina/list.py | 3 +-- 2 files changed, 3 insertions(+), 31 deletions(-) diff --git a/ocarina/collection.py b/ocarina/collection.py index e5662cf4..9f02b777 100644 --- a/ocarina/collection.py +++ b/ocarina/collection.py @@ -15,7 +15,6 @@ gtk = ocarina.gtk class Actions: def __init__(self): - self.mouse_motion = None self.selected_row = None self.refilter = None self.show_rc_menu = None @@ -26,9 +25,6 @@ class Collection(gtk.ScrolledWindow): gtk.ScrolledWindow.__init__(self) self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.list = list.List(actions) - - self.list.connect("motion-notify-event", self.on_mouse_motion) - self.mouse_motion = actions.mouse_motion self.selected_row = actions.selected_row self.add(self.list) @@ -43,7 +39,7 @@ class Collection(gtk.ScrolledWindow): ins_next = 0 for track in func(): insert(ins_next, [track[3], track[2], - track[5], track[0], track[1], track[4], ""]) + track[5], track[0], track[1], track[4]]) ins_next += 1 self.list.thaw() @@ -58,23 +54,10 @@ class Collection(gtk.ScrolledWindow): artist = getattr(id, "artist") album = getattr(id, "album") year = getattr(id, "year") - insert(ins_next, [id, title, length, artist, album, year, ""]) + insert(ins_next, [id, title, length, artist, album, year]) ins_next += 1 self.list.thaw() - def on_mouse_motion(self, widget, pos): - list = self.list - x,y = list.convert_bin_window_to_widget_coords(int(pos.x), int(pos.y)) - row = list.get_dest_row_at_pos(x,y) - list = list.list - if row is not None: - row = row[0] - list_iter = list.get_iter(row) - list_row = list[list_iter] - items = self.mouse_motion(list_row) - list.set_value(list_iter, len(list_row)-1, - "Played: %s Score: %s" % items) - def add_selected_to_playlist(self, *args): self.list.for_each_selected(playlist.add_id) playlist.save() @@ -84,7 +67,6 @@ class Collection(gtk.ScrolledWindow): class Library(Collection): def __init__(self): actions = Actions() - actions.mouse_motion = self.mouse_motion actions.selected_row = self.select_row actions.refilter = self.refilter actions.show_rc_menu = menu.make_lib_menu @@ -110,10 +92,6 @@ class Library(Collection): collection.reset() self.clear() - def mouse_motion(self, row): - return (collection.get_attr(row[0], "playcount"), - collection.get_attr(row[0], "score")) - def select_row(self, row): collection.change_score() collection.play_id(row[0]) @@ -130,7 +108,6 @@ class Library(Collection): class Playlist(Collection): def __init__(self): actions = Actions() - actions.mouse_motion = self.mouse_motion actions.selected_row = self.select_row actions.refilter = self.refilter actions.show_rc_menu = menu.make_plist_menu @@ -156,10 +133,6 @@ class Playlist(Collection): #after = datetime.datetime.now() #print "Populating took: %s" % (after - before) - def mouse_motion(self, row): - return (collection.get_attr(row[0], "playcount"), - collection.get_attr(row[0], "score")) - def select_row(self, row): collection.change_score() collection.play_id(row[0]) diff --git a/ocarina/list.py b/ocarina/list.py index e55142ab..9de4467f 100644 --- a/ocarina/list.py +++ b/ocarina/list.py @@ -15,7 +15,7 @@ class List(gtk.TreeView): def __init__(self, actions): gtk.TreeView.__init__(self) self.actions = actions - self.list = gtk.ListStore(int, str, str, str, str, int, str) + self.list = gtk.ListStore(int, str, str, str, str, int) self.append = self.list.append @@ -36,7 +36,6 @@ class List(gtk.TreeView): self.append_column(col) self.set_rules_hint(True) - self.set_tooltip_column(len(cols)-1) self.set_has_tooltip(True) self.filter_model = self.list.filter_new()