#! /usr/bin/python # To change this template, choose Tools | Templates # and open the template in the editor. __author__="bjschuma" __date__ ="$Jan 16, 2010 12:47:28 PM$" import gtk from guiGTK import * from bt.message import * from tools import database def library(): select = "track.name, artist.name, album.name" frm = "track,artist,album" where = "track.artist=artist.id AND track.album=album.id" return database.select(select,frm,where).fetchall() class ListPage(box.VBox): def __init__(self,name): box.VBox.__init__(self) self.labelText = name self.label = label.Label(self.labelText) self.label.rotate(90) self.list = list.List(gtk.ListStore(str,str,str), ["Title", "Artist", "Album"]) self.list.rules(True) self.pack(self.list,True,True) if name == "Library": self.fromLibrary() self.setLabel() def fromLibrary(self): for track in library(): self.list.insert(track) def setLabel(self): text = self.labelText + " (" text += str( self.list.count() ) text += ")" self.label.change(text)