2009-06-29 00:13:15 -04:00
|
|
|
import pango
|
|
|
|
import gtk
|
|
|
|
|
|
|
|
|
|
|
|
class InfoView(gtk.VBox):
|
|
|
|
def __init__(self,data):
|
|
|
|
gtk.VBox.__init__(self,False,0)
|
|
|
|
self.data = data
|
2009-06-29 09:42:01 -04:00
|
|
|
self.title = self.makeLabel("",13000,700)
|
|
|
|
self.album = self.makeLabel("",10000,400)
|
|
|
|
self.artist = self.makeLabel("",10000,400)
|
2009-06-29 00:13:15 -04:00
|
|
|
self.changeLabels()
|
|
|
|
self.show()
|
|
|
|
|
|
|
|
|
2009-07-04 16:18:53 -04:00
|
|
|
# Called when the song changes
|
2009-06-29 00:13:15 -04:00
|
|
|
def changeLabels(self):
|
|
|
|
title = ""
|
|
|
|
album = ""
|
|
|
|
artist = ""
|
2009-07-01 09:41:33 -04:00
|
|
|
if self.data.song:
|
2009-07-12 23:42:43 -04:00
|
|
|
title = self.data.song.info.title
|
|
|
|
album = "from "+self.data.song.info.album
|
|
|
|
artist = "by "+self.data.song.info.artist
|
2009-06-29 09:42:01 -04:00
|
|
|
self.title.set_text(title)
|
2009-06-29 23:23:01 -04:00
|
|
|
self.album.set_text(album)
|
|
|
|
self.artist.set_text(artist)
|
2009-06-29 00:13:15 -04:00
|
|
|
|
|
|
|
|
2009-07-04 16:18:53 -04:00
|
|
|
# Set the text, font, and weight of a label
|
2009-06-29 09:42:01 -04:00
|
|
|
def makeLabel(self,text,size,weight):
|
2009-06-29 00:13:15 -04:00
|
|
|
label = gtk.Label(text)
|
|
|
|
align = gtk.Alignment(0,1,0,0)
|
|
|
|
attr = pango.AttrList()
|
|
|
|
attr.insert(pango.AttrSize(size,0,-1))
|
2009-06-29 09:42:01 -04:00
|
|
|
attr.insert(pango.AttrWeight(weight,0,-1))
|
2009-06-29 00:13:15 -04:00
|
|
|
label.set_attributes(attr)
|
|
|
|
align.add(label)
|
|
|
|
self.pack_start(align,False,False,0)
|
|
|
|
label.show()
|
|
|
|
align.show()
|
|
|
|
return label
|