Пример #1
0
    def __init__(self, playlist):
        self.store = Gtk.TreeStore(GObject.TYPE_PYOBJECT, str, str, str) # name, artist, album

        for track in playlist.tracks:
            self.store.append(None, [track, track.title, track.artist, track.album])

        self.ui = PlaylistView(self.store)
        self.ui.set_doubleclick_callback(self.on_track_clicked)

        self.click_listener = None
Пример #2
0
class PlaylistViewController():
    def __init__(self, playlist):
        self.store = Gtk.TreeStore(GObject.TYPE_PYOBJECT, str, str, str) # name, artist, album

        for track in playlist.tracks:
            self.store.append(None, [track, track.title, track.artist, track.album])

        self.ui = PlaylistView(self.store)
        self.ui.set_doubleclick_callback(self.on_track_clicked)

        self.click_listener = None

    def set_click_listener(self, callback):
        self.click_listener = callback

    def on_track_clicked(self, treeview, path, column):
        iter = self.store.get_iter(path)
        if iter is not None:
            sel = self.store[iter][0]
            self.click_listener(sel)