Pass a tuple of functions to playlist,queue,liblist instead of individual functions
git-svn-id: file:///home/anna/Desktop/ocarina-legacy/mithos/ocarina@56 1daee41c-8060-4895-b1f0-2197c00d777a
This commit is contained in:
parent
c338c740a8
commit
bb0dbd0c27
|
@ -1,5 +1,3 @@
|
||||||
# Eventually this and rightPane should probably be merged...
|
|
||||||
|
|
||||||
import gtk
|
import gtk
|
||||||
import gobject
|
import gobject
|
||||||
|
|
||||||
|
@ -10,13 +8,11 @@ from liblist import LibList
|
||||||
from image import Image
|
from image import Image
|
||||||
from check import CheckButton
|
from check import CheckButton
|
||||||
from button import Button
|
from button import Button
|
||||||
#from libView import LibView
|
|
||||||
from scrobbler import Scrobbler
|
from scrobbler import Scrobbler
|
||||||
#from plistView import PlistView
|
|
||||||
from controlPanel import ControlPanel
|
from controlPanel import ControlPanel
|
||||||
|
|
||||||
#from rightPane import RightPane
|
|
||||||
|
|
||||||
|
# This is the main content area
|
||||||
class ContentPane(gtk.HBox):
|
class ContentPane(gtk.HBox):
|
||||||
def __init__(self,data):
|
def __init__(self,data):
|
||||||
gtk.HBox.__init__(self,False,0)
|
gtk.HBox.__init__(self,False,0)
|
||||||
|
@ -32,43 +28,19 @@ class ContentPane(gtk.HBox):
|
||||||
|
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
|
# Left side is scrobbler, album art, maybe others at some point?
|
||||||
def makeLeftSide(self):
|
def makeLeftSide(self):
|
||||||
self.data.scrobbler = Scrobbler(self.data)
|
self.data.scrobbler = Scrobbler(self.data)
|
||||||
self.divider.add1(self.data.scrobbler)
|
self.divider.add1(self.data.scrobbler)
|
||||||
|
|
||||||
|
|
||||||
|
# Right side has tabs, current song info, controls, and more
|
||||||
def makeRightSide(self):
|
def makeRightSide(self):
|
||||||
vbox = gtk.VBox(False,0)
|
vbox = gtk.VBox(False,0)
|
||||||
vbox.show()
|
vbox.show()
|
||||||
#self.right = RightPane(self.data)
|
|
||||||
self.divider.add2(vbox)
|
self.divider.add2(vbox)
|
||||||
|
|
||||||
self.title = Label("",13000,700)
|
|
||||||
self.album = Label("",10000,400)
|
|
||||||
self.artist = Label("",10000,400)
|
|
||||||
self.setLabels()
|
|
||||||
|
|
||||||
infobox = gtk.HBox(False,0)
|
|
||||||
infobox.show()
|
|
||||||
infolabels = gtk.VBox(False,0)
|
|
||||||
infolabels.show()
|
|
||||||
infobox.pack_start(infolabels,False,False,0)
|
|
||||||
|
|
||||||
infolabels.pack_start(self.title,False,False,0)
|
|
||||||
infolabels.pack_start(self.album,False,False,0)
|
|
||||||
infolabels.pack_start(self.artist,False,False,0)
|
|
||||||
|
|
||||||
self.searchBar = gtk.Entry()
|
|
||||||
self.searchBar.show()
|
|
||||||
self.searchBar.connect("changed",self.textTyped)
|
|
||||||
searchalign = gtk.Alignment(1,1,0,0)
|
|
||||||
searchalign.show()
|
|
||||||
searchalign.add(self.searchBar)
|
|
||||||
infobox.pack_end(searchalign,False,False,0)
|
|
||||||
|
|
||||||
vbox.pack_start(infobox,False,False,0)
|
|
||||||
|
|
||||||
|
self.makeInfoArea(vbox)
|
||||||
self.makeTabs(vbox)
|
self.makeTabs(vbox)
|
||||||
self.makeControls(vbox)
|
self.makeControls(vbox)
|
||||||
|
|
||||||
|
@ -100,15 +72,52 @@ class ContentPane(gtk.HBox):
|
||||||
self.artist.set_text(artist)
|
self.artist.set_text(artist)
|
||||||
|
|
||||||
|
|
||||||
|
# This is the upper end of the right side of the divider
|
||||||
|
# Current song labels, and the filter entry
|
||||||
|
def makeInfoArea(self,box):
|
||||||
|
# Make the labels
|
||||||
|
self.title = Label("",13000,700)
|
||||||
|
self.album = Label("",10000,400)
|
||||||
|
self.artist = Label("",10000,400)
|
||||||
|
self.setLabels()
|
||||||
|
|
||||||
|
infobox = gtk.HBox(False,0)
|
||||||
|
infobox.show()
|
||||||
|
infolabels = gtk.VBox(False,0)
|
||||||
|
infolabels.show()
|
||||||
|
infobox.pack_start(infolabels,False,False,0)
|
||||||
|
|
||||||
|
# Pack the labels into a vbox
|
||||||
|
infolabels.pack_start(self.title,False,False,0)
|
||||||
|
infolabels.pack_start(self.album,False,False,0)
|
||||||
|
infolabels.pack_start(self.artist,False,False,0)
|
||||||
|
|
||||||
|
# Make the filter bar
|
||||||
|
self.searchBar = gtk.Entry()
|
||||||
|
self.searchBar.show()
|
||||||
|
self.searchBar.connect("changed",self.textTyped)
|
||||||
|
searchalign = gtk.Alignment(1,1,0,0)
|
||||||
|
searchalign.show()
|
||||||
|
searchalign.add(self.searchBar)
|
||||||
|
infobox.pack_end(searchalign,False,False,0)
|
||||||
|
|
||||||
|
# Pack it all in
|
||||||
|
box.pack_start(infobox,False,False,0)
|
||||||
|
|
||||||
|
|
||||||
|
# Makes the playlist/queue/library tabs
|
||||||
def makeTabs(self,box):
|
def makeTabs(self,box):
|
||||||
self.tabs = gtk.Notebook()
|
self.tabs = gtk.Notebook()
|
||||||
box.add(self.tabs)
|
box.add(self.tabs)
|
||||||
self.tabs.show()
|
self.tabs.show()
|
||||||
|
|
||||||
self.queue = Queue(self.data,self.next,self.setLabels,self.plause)
|
# Ann array of function pointers that gets passed to List
|
||||||
self.playlist = Playlist(self.data,self.queue,self.next,self.setLabels,self.plause)
|
funcs = [self.next,self.setLabels,self.plause]
|
||||||
|
|
||||||
|
self.queue = Queue(self.data,funcs)
|
||||||
|
self.playlist = Playlist(self.data,self.queue,funcs)
|
||||||
self.playlist.visible("show")
|
self.playlist.visible("show")
|
||||||
self.library = LibList(self.data,self.playlist,self.queue,self.next,self.setLabels,self.plause)
|
self.library = LibList(self.data,self.playlist,self.queue,funcs)
|
||||||
self.data.library.libview = self.library
|
self.data.library.libview = self.library
|
||||||
|
|
||||||
self.tabs.append_page(self.playlist,self.playlist.label)
|
self.tabs.append_page(self.playlist,self.playlist.label)
|
||||||
|
@ -120,6 +129,7 @@ class ContentPane(gtk.HBox):
|
||||||
#self.filter("")
|
#self.filter("")
|
||||||
|
|
||||||
|
|
||||||
|
# Makes buttons and progress bar
|
||||||
def makeControls(self,vbox):
|
def makeControls(self,vbox):
|
||||||
box = gtk.HBox(False,0)
|
box = gtk.HBox(False,0)
|
||||||
box.show()
|
box.show()
|
||||||
|
|
|
@ -5,8 +5,8 @@ from list import List
|
||||||
from menuItem import MenuItem
|
from menuItem import MenuItem
|
||||||
|
|
||||||
class LibList(List):
|
class LibList(List):
|
||||||
def __init__(self,data,playlist,queue,nextFunc,labelFunc,plause):
|
def __init__(self,data,playlist,queue,funcs):
|
||||||
List.__init__(self,data,"Library",nextFunc,labelFunc,plause)
|
List.__init__(self,data,"Library",funcs)
|
||||||
self.plist = playlist
|
self.plist = playlist
|
||||||
self.queue = queue
|
self.queue = queue
|
||||||
self.pbar = gtk.ProgressBar()
|
self.pbar = gtk.ProgressBar()
|
||||||
|
|
|
@ -5,7 +5,7 @@ from menuItem import MenuItem
|
||||||
from song import Song
|
from song import Song
|
||||||
|
|
||||||
class List(gtk.ScrolledWindow):
|
class List(gtk.ScrolledWindow):
|
||||||
def __init__(self,data,text,nextFunc,labelFunc,plauseFunc):
|
def __init__(self,data,text,(nextFunc,labelFunc,plauseFunc)):
|
||||||
gtk.ScrolledWindow.__init__(self)
|
gtk.ScrolledWindow.__init__(self)
|
||||||
self.show()
|
self.show()
|
||||||
self.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
|
self.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
|
||||||
|
@ -150,10 +150,6 @@ class List(gtk.ScrolledWindow):
|
||||||
self.seconds = 0
|
self.seconds = 0
|
||||||
self.count = 0
|
self.count = 0
|
||||||
self.filter.refilter()
|
self.filter.refilter()
|
||||||
#for row in self.filter:
|
|
||||||
#file = self.data.library.files[row[0]]
|
|
||||||
# self.seconds+=self.data.library.files[row[0]].duration
|
|
||||||
# self.count+=1
|
|
||||||
self.count = len(self.filter)
|
self.count = len(self.filter)
|
||||||
for i in range(self.count):
|
for i in range(self.count):
|
||||||
self.seconds+=self.data.library.files[self.filter[i][0]].duration
|
self.seconds+=self.data.library.files[self.filter[i][0]].duration
|
||||||
|
|
|
@ -29,14 +29,12 @@ class main:
|
||||||
def quit(self,widgit,data):
|
def quit(self,widgit,data):
|
||||||
if self.options.verbose == True:
|
if self.options.verbose == True:
|
||||||
print "Quitting..."
|
print "Quitting..."
|
||||||
#print self.window.get_size()
|
if self.data.song:
|
||||||
|
self.data.song.close()
|
||||||
self.data.size = self.window.get_size()
|
self.data.size = self.window.get_size()
|
||||||
self.data.divider = self.window.contentPane.divider.get_position()
|
self.data.divider = self.window.contentPane.divider.get_position()
|
||||||
self.window.contentPane.storeCols()
|
self.window.contentPane.storeCols()
|
||||||
#self.window.contentPane.plistview.saveCols()
|
|
||||||
#self.data.clearSong()
|
|
||||||
self.data.dump()
|
self.data.dump()
|
||||||
#self.library.dump()
|
|
||||||
gtk.main_quit()
|
gtk.main_quit()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@ import random
|
||||||
from menuItem import MenuItem
|
from menuItem import MenuItem
|
||||||
|
|
||||||
class Playlist(List):
|
class Playlist(List):
|
||||||
def __init__(self,data,queue,nextFunc,labelFunc,plause):
|
def __init__(self,data,queue,funcs):
|
||||||
List.__init__(self,data,"Playlist",nextFunc,labelFunc,plause)
|
List.__init__(self,data,"Playlist",funcs)
|
||||||
self.queue = queue
|
self.queue = queue
|
||||||
#for file in self.data.curList:
|
#for file in self.data.curList:
|
||||||
# List.insert(self,file)
|
# List.insert(self,file)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
from list import List
|
from list import List
|
||||||
|
|
||||||
class Queue(List):
|
class Queue(List):
|
||||||
def __init__(self,data,nextFunc,labelFunc,plause):
|
def __init__(self,data,funcs):
|
||||||
List.__init__(self,data,"Queue",nextFunc,labelFunc,plause)
|
List.__init__(self,data,"Queue",funcs)
|
||||||
self.data = data
|
self.data = data
|
||||||
self.populated = False
|
self.populated = False
|
||||||
self.count = len(self.data.curQ)
|
self.count = len(self.data.curQ)
|
||||||
|
|
|
@ -94,6 +94,7 @@ class Window(gtk.Window):
|
||||||
thread.start_new_thread(func,(data,file))
|
thread.start_new_thread(func,(data,file))
|
||||||
|
|
||||||
|
|
||||||
|
# This is the "main area" where all info is shown
|
||||||
def makeContentPane(self):
|
def makeContentPane(self):
|
||||||
self.contentPane = ContentPane(self.data)
|
self.contentPane = ContentPane(self.data)
|
||||||
self.mainLayout.add(self.contentPane)
|
self.mainLayout.add(self.contentPane)
|
||||||
|
|
Loading…
Reference in New Issue