Made current song info slightly larger
git-svn-id: file:///home/anna/Desktop/ocarina-legacy/mithos/ocarina@25 1daee41c-8060-4895-b1f0-2197c00d777a
This commit is contained in:
parent
a687c14a14
commit
6966d928b6
|
@ -26,6 +26,7 @@ class Library():
|
|||
|
||||
# Begin a scan on dir
|
||||
def scan(self,dir):
|
||||
print dir
|
||||
self.data = LibData()
|
||||
self.data.path = os.path.expanduser(dir)
|
||||
if os.path.exists(self.data.path) == False:
|
||||
|
@ -72,30 +73,35 @@ class Library():
|
|||
index = len(self.data.files)
|
||||
info = SongInfo()
|
||||
info.filename = os.path.join(self.data.path,file)
|
||||
f = tagpy.FileRef(info.filename)
|
||||
t = f.tag()
|
||||
info.title = t.title
|
||||
info.album = t.album
|
||||
info.artist = t.artist
|
||||
|
||||
#use later for length
|
||||
# a = f.audioProperties()
|
||||
# info.length = a.length
|
||||
|
||||
#print file
|
||||
#split = file.rsplit(os.sep)
|
||||
#max = 3
|
||||
#if len(split) < 3:
|
||||
# max = len(split)
|
||||
#for i in range(max):
|
||||
# if i==0:
|
||||
# info.title = split[len(split)-1]
|
||||
# elif i==1:
|
||||
# info.album = split[len(split)-2]
|
||||
# else:
|
||||
# info.artist = split[len(split)-3]
|
||||
split = file.rsplit(os.sep)
|
||||
max = 3
|
||||
if len(split) < 3:
|
||||
max = len(split)
|
||||
for i in range(max):
|
||||
if i==0:
|
||||
info.title = split[len(split)-1]
|
||||
elif i==1:
|
||||
info.album = split[len(split)-2]
|
||||
else:
|
||||
info.artist = split[len(split)-3]
|
||||
#print info.artist,",", info.title,",", info.album
|
||||
#print s1,s2,s3
|
||||
|
||||
f = tagpy.FileRef(info.filename)
|
||||
t = f.tag()
|
||||
if t.title != "":
|
||||
info.title = t.title
|
||||
if t.album != "":
|
||||
info.album = t.album
|
||||
if t.artist != "":
|
||||
info.artist = t.artist
|
||||
|
||||
self.data.files+=[info]
|
||||
print len(self.data.files)
|
||||
for word in words:
|
||||
|
|
|
@ -110,5 +110,12 @@ class Operations:
|
|||
self.plist.random = not self.plist.random
|
||||
|
||||
|
||||
def scanLib(self,dir):
|
||||
def scanLib(self,thread,dir):
|
||||
self.library.scan(dir)
|
||||
|
||||
|
||||
def click(self,widget,data,event,list,selection):
|
||||
if data.button == 3:
|
||||
(l,rows) = selection.get_selected_rows()
|
||||
iter = l.get_iter(rows[0])
|
||||
self.plist.queueSong(list[iter][0])
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import gobject
|
||||
import pango
|
||||
import pygtk
|
||||
pygtk.require('2.0')
|
||||
import gtk
|
||||
import thread
|
||||
|
||||
|
||||
class Window(gtk.Window):
|
||||
|
@ -34,9 +36,11 @@ class Window(gtk.Window):
|
|||
self.infoFrame = gtk.Frame("Current Song:")
|
||||
box = gtk.VBox(False,0)
|
||||
self.infoFrame.add(box)
|
||||
self.tagLabels["title"] = self.makeLabel("Title: ?",box)
|
||||
self.tagLabels["artist"] = self.makeLabel("Artist: ?",box)
|
||||
self.tagLabels["album"] = self.makeLabel("Album: ?",box)
|
||||
attr = pango.AttrList()
|
||||
attr.insert(pango.AttrSize(12000, 0, -1))
|
||||
self.tagLabels["title"] = self.makeLabel("Title: ?",box,attr)
|
||||
self.tagLabels["artist"] = self.makeLabel("Artist: ?",box,attr)
|
||||
self.tagLabels["album"] = self.makeLabel("Album: ?",box,attr)
|
||||
box.show()
|
||||
self.infoFrame.show()
|
||||
#self.mainLayout.add(self.infoFrame)
|
||||
|
@ -45,12 +49,13 @@ class Window(gtk.Window):
|
|||
|
||||
# Set up a new label, add to container
|
||||
# Goes into a HBox so that it is left justified
|
||||
def makeLabel(self,text,container):
|
||||
def makeLabel(self,text,container,attr):
|
||||
box = gtk.HBox(False,0)
|
||||
label = gtk.Label(text)
|
||||
s = label.get_style().copy()
|
||||
self.tooltip.set_tip(label,text,tip_private=None)
|
||||
#label.set_max_width_chars(35)
|
||||
label.set_attributes(attr)
|
||||
label.show()
|
||||
box.pack_start(label,False,False,0)
|
||||
box.show()
|
||||
|
@ -107,6 +112,7 @@ class Window(gtk.Window):
|
|||
col.set_sort_column_id(i)
|
||||
self.tree.append_column(col)
|
||||
self.tree.connect("row-activated",self.ops.plist.selectSong,"clicked",self.list)
|
||||
self.tree.connect("button_press_event",self.ops.click,"clicked",self.list,self.tree.get_selection())
|
||||
self.tree.set_grid_lines(True)
|
||||
scroll.add(self.tree)
|
||||
self.tree.columns_autosize()
|
||||
|
@ -116,8 +122,10 @@ class Window(gtk.Window):
|
|||
|
||||
|
||||
def gotoCurSong(self):
|
||||
print self.list[0][0]
|
||||
print len(self.list)
|
||||
if len(self.list) == 0:
|
||||
return
|
||||
#print self.list[0][0]
|
||||
#print len(self.list)
|
||||
selrow = 0
|
||||
row = 0
|
||||
for i in range(len(self.list)):
|
||||
|
@ -130,7 +138,7 @@ class Window(gtk.Window):
|
|||
#selrow = self.ops.plist.curSong - 10
|
||||
#if selrow < 0:
|
||||
# selrow = 0
|
||||
print selrow,row
|
||||
#print selrow,row
|
||||
self.tree.scroll_to_cell(selrow,None,True,0,0)
|
||||
treesel = self.tree.get_selection()
|
||||
treesel.select_path(row)
|
||||
|
@ -258,5 +266,5 @@ class Window(gtk.Window):
|
|||
#else:
|
||||
dirsel.hide()
|
||||
dirsel.destroy()
|
||||
#dirsel = None
|
||||
func(file)
|
||||
dirsel = None
|
||||
thread.start_new_thread(func,("name",file))
|
||||
|
|
Loading…
Reference in New Issue