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
|
# Begin a scan on dir
|
||||||
def scan(self,dir):
|
def scan(self,dir):
|
||||||
|
print dir
|
||||||
self.data = LibData()
|
self.data = LibData()
|
||||||
self.data.path = os.path.expanduser(dir)
|
self.data.path = os.path.expanduser(dir)
|
||||||
if os.path.exists(self.data.path) == False:
|
if os.path.exists(self.data.path) == False:
|
||||||
|
@ -72,30 +73,35 @@ class Library():
|
||||||
index = len(self.data.files)
|
index = len(self.data.files)
|
||||||
info = SongInfo()
|
info = SongInfo()
|
||||||
info.filename = os.path.join(self.data.path,file)
|
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
|
#use later for length
|
||||||
# a = f.audioProperties()
|
# a = f.audioProperties()
|
||||||
# info.length = a.length
|
# info.length = a.length
|
||||||
|
|
||||||
#print file
|
#print file
|
||||||
#split = file.rsplit(os.sep)
|
split = file.rsplit(os.sep)
|
||||||
#max = 3
|
max = 3
|
||||||
#if len(split) < 3:
|
if len(split) < 3:
|
||||||
# max = len(split)
|
max = len(split)
|
||||||
#for i in range(max):
|
for i in range(max):
|
||||||
# if i==0:
|
if i==0:
|
||||||
# info.title = split[len(split)-1]
|
info.title = split[len(split)-1]
|
||||||
# elif i==1:
|
elif i==1:
|
||||||
# info.album = split[len(split)-2]
|
info.album = split[len(split)-2]
|
||||||
# else:
|
else:
|
||||||
# info.artist = split[len(split)-3]
|
info.artist = split[len(split)-3]
|
||||||
#print info.artist,",", info.title,",", info.album
|
#print info.artist,",", info.title,",", info.album
|
||||||
#print s1,s2,s3
|
#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]
|
self.data.files+=[info]
|
||||||
print len(self.data.files)
|
print len(self.data.files)
|
||||||
for word in words:
|
for word in words:
|
||||||
|
|
|
@ -110,5 +110,12 @@ class Operations:
|
||||||
self.plist.random = not self.plist.random
|
self.plist.random = not self.plist.random
|
||||||
|
|
||||||
|
|
||||||
def scanLib(self,dir):
|
def scanLib(self,thread,dir):
|
||||||
self.library.scan(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 gobject
|
||||||
|
import pango
|
||||||
import pygtk
|
import pygtk
|
||||||
pygtk.require('2.0')
|
pygtk.require('2.0')
|
||||||
import gtk
|
import gtk
|
||||||
|
import thread
|
||||||
|
|
||||||
|
|
||||||
class Window(gtk.Window):
|
class Window(gtk.Window):
|
||||||
|
@ -34,9 +36,11 @@ class Window(gtk.Window):
|
||||||
self.infoFrame = gtk.Frame("Current Song:")
|
self.infoFrame = gtk.Frame("Current Song:")
|
||||||
box = gtk.VBox(False,0)
|
box = gtk.VBox(False,0)
|
||||||
self.infoFrame.add(box)
|
self.infoFrame.add(box)
|
||||||
self.tagLabels["title"] = self.makeLabel("Title: ?",box)
|
attr = pango.AttrList()
|
||||||
self.tagLabels["artist"] = self.makeLabel("Artist: ?",box)
|
attr.insert(pango.AttrSize(12000, 0, -1))
|
||||||
self.tagLabels["album"] = self.makeLabel("Album: ?",box)
|
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()
|
box.show()
|
||||||
self.infoFrame.show()
|
self.infoFrame.show()
|
||||||
#self.mainLayout.add(self.infoFrame)
|
#self.mainLayout.add(self.infoFrame)
|
||||||
|
@ -45,12 +49,13 @@ class Window(gtk.Window):
|
||||||
|
|
||||||
# Set up a new label, add to container
|
# Set up a new label, add to container
|
||||||
# Goes into a HBox so that it is left justified
|
# 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)
|
box = gtk.HBox(False,0)
|
||||||
label = gtk.Label(text)
|
label = gtk.Label(text)
|
||||||
s = label.get_style().copy()
|
s = label.get_style().copy()
|
||||||
self.tooltip.set_tip(label,text,tip_private=None)
|
self.tooltip.set_tip(label,text,tip_private=None)
|
||||||
#label.set_max_width_chars(35)
|
#label.set_max_width_chars(35)
|
||||||
|
label.set_attributes(attr)
|
||||||
label.show()
|
label.show()
|
||||||
box.pack_start(label,False,False,0)
|
box.pack_start(label,False,False,0)
|
||||||
box.show()
|
box.show()
|
||||||
|
@ -107,6 +112,7 @@ class Window(gtk.Window):
|
||||||
col.set_sort_column_id(i)
|
col.set_sort_column_id(i)
|
||||||
self.tree.append_column(col)
|
self.tree.append_column(col)
|
||||||
self.tree.connect("row-activated",self.ops.plist.selectSong,"clicked",self.list)
|
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)
|
self.tree.set_grid_lines(True)
|
||||||
scroll.add(self.tree)
|
scroll.add(self.tree)
|
||||||
self.tree.columns_autosize()
|
self.tree.columns_autosize()
|
||||||
|
@ -116,8 +122,10 @@ class Window(gtk.Window):
|
||||||
|
|
||||||
|
|
||||||
def gotoCurSong(self):
|
def gotoCurSong(self):
|
||||||
print self.list[0][0]
|
if len(self.list) == 0:
|
||||||
print len(self.list)
|
return
|
||||||
|
#print self.list[0][0]
|
||||||
|
#print len(self.list)
|
||||||
selrow = 0
|
selrow = 0
|
||||||
row = 0
|
row = 0
|
||||||
for i in range(len(self.list)):
|
for i in range(len(self.list)):
|
||||||
|
@ -130,7 +138,7 @@ class Window(gtk.Window):
|
||||||
#selrow = self.ops.plist.curSong - 10
|
#selrow = self.ops.plist.curSong - 10
|
||||||
#if selrow < 0:
|
#if selrow < 0:
|
||||||
# selrow = 0
|
# selrow = 0
|
||||||
print selrow,row
|
#print selrow,row
|
||||||
self.tree.scroll_to_cell(selrow,None,True,0,0)
|
self.tree.scroll_to_cell(selrow,None,True,0,0)
|
||||||
treesel = self.tree.get_selection()
|
treesel = self.tree.get_selection()
|
||||||
treesel.select_path(row)
|
treesel.select_path(row)
|
||||||
|
@ -258,5 +266,5 @@ class Window(gtk.Window):
|
||||||
#else:
|
#else:
|
||||||
dirsel.hide()
|
dirsel.hide()
|
||||||
dirsel.destroy()
|
dirsel.destroy()
|
||||||
#dirsel = None
|
dirsel = None
|
||||||
func(file)
|
thread.start_new_thread(func,("name",file))
|
||||||
|
|
Loading…
Reference in New Issue