46 lines
1.0 KiB
Python
46 lines
1.0 KiB
Python
import pango
|
|
import gobject
|
|
import pygtk
|
|
pygtk.require('2.0')
|
|
import gtk
|
|
|
|
|
|
class InfoView(gtk.VBox):
|
|
def __init__(self,data):
|
|
gtk.VBox.__init__(self,False,0)
|
|
self.data = data
|
|
self.title = self.makeLabel("",13000,700)
|
|
self.album = self.makeLabel("",10000,400)
|
|
self.artist = self.makeLabel("",10000,400)
|
|
self.changeLabels()
|
|
gobject.timeout_add(1000,self.changeLabels)
|
|
self.show()
|
|
|
|
|
|
def changeLabels(self):
|
|
title = ""
|
|
album = ""
|
|
artist = ""
|
|
if self.data.song.info:
|
|
title = self.data.song.info.title
|
|
album = "from "+self.data.song.info.album
|
|
artist = "by "+self.data.song.info.artist
|
|
self.title.set_text(title)
|
|
self.album.set_text(album)
|
|
self.artist.set_text(artist)
|
|
return True
|
|
|
|
|
|
def makeLabel(self,text,size,weight):
|
|
label = gtk.Label(text)
|
|
align = gtk.Alignment(0,1,0,0)
|
|
attr = pango.AttrList()
|
|
attr.insert(pango.AttrSize(size,0,-1))
|
|
attr.insert(pango.AttrWeight(weight,0,-1))
|
|
label.set_attributes(attr)
|
|
align.add(label)
|
|
self.pack_start(align,False,False,0)
|
|
label.show()
|
|
align.show()
|
|
return label
|