Store column widths, apply when changing tabs

git-svn-id: file:///home/anna/Desktop/ocarina-legacy/mithos/ocarina@51 1daee41c-8060-4895-b1f0-2197c00d777a
This commit is contained in:
bjschuma 2009-07-30 01:08:46 +00:00
parent b6a29ba2b0
commit d41b443a9d
4 changed files with 38 additions and 5 deletions

View File

@ -25,6 +25,7 @@ class Data:
self.save(self.library,"library")
self.library.libview = libview
self.save([self.curList,self.curQ,self.curSong],"playlist")
print self.colSizes
self.save([self.size,self.divider,self.colSizes,self.sortedCol,self.random],"preferences")
self.save([self.lfm,self.lfmuser,self.lfmpass],"last.fm")
@ -59,7 +60,7 @@ class Data:
if prefs == None:
self.size = (800,600)
self.divider = 150
self.colSizes = [200,110,110,110,110]
self.colSizes = [0,0,0,0,0]
self.sortedCol = 3
self.random = False
else:

View File

@ -55,7 +55,6 @@ class List(gtk.ScrolledWindow):
col.set_sort_indicator(False)
if cols[i] != "Id":
self.tree.append_column(col)
col.set_fixed_width(self.data.colSizes[i-1])
self.tree.set_rules_hint(True)
self.tree.connect("row-activated",self.selectSong,"clicked",list)
@ -63,6 +62,8 @@ class List(gtk.ScrolledWindow):
self.sel = self.tree.get_selection()
self.sel.set_mode(gtk.SELECTION_MULTIPLE)
self.list.set_sort_column_id(self.data.sortedCol,gtk.SORT_ASCENDING)
self.cols = self.tree.get_columns()
self.loadCols()
#self.tree.show()
self.add(self.tree)
@ -157,7 +158,6 @@ class List(gtk.ScrolledWindow):
if self.hideRows(None,file,string) == True:
self.count+=1
self.seconds+=file.duration
print self.count
self.makeLabel()
@ -220,8 +220,28 @@ class List(gtk.ScrolledWindow):
def visible(self,func):
if func=="show":
self.loadCols()
self.align.show()
self.tree.show()
else:
self.storeCols()
self.align.hide()
self.tree.hide()
def storeCols(self):
#cols = self.tree.get_columns()
for i in range(len(self.cols)):
self.data.colSizes[i] = self.cols[i].get_width()
def loadCols(self):
#cols = self.tree.get_columns()
for i in range(len(self.cols)):
width = self.data.colSizes[i]
if width <= 0:
if i==0:
width = 200
else:
width = 110
self.cols[i].set_fixed_width(width)

View File

@ -32,6 +32,7 @@ class main:
#print self.window.get_size()
self.data.size = self.window.get_size()
self.data.divider = self.window.contentPane.divider.get_position()
self.window.contentPane.right.storeCols()
#self.window.contentPane.plistview.saveCols()
#self.data.clearSong()
self.data.dump()

View File

@ -55,7 +55,7 @@ class RightPane(gtk.VBox):
self.pack_start(hbox,False,False,0)
hbox.show()
self.changedTab(None,None,0)
#self.changedTab(None,None,0)
self.status = ""
@ -79,6 +79,7 @@ class RightPane(gtk.VBox):
self.queue = Queue(self.data,self.next,self.setLabels,self.plause)
self.playlist = Playlist(self.data,self.queue,self.next,self.setLabels,self.plause)
self.playlist.visible("show")
self.library = LibList(self.data,self.playlist,self.queue,self.next,self.setLabels,self.plause)
self.data.library.libview = self.library
@ -86,7 +87,7 @@ class RightPane(gtk.VBox):
self.tabs.append_page(self.queue,self.queue.label)
self.tabs.append_page(self.library,self.library.label)
self.curTab = -1
self.curTab = 0
self.tabs.connect("switch-page",self.changedTab)
#self.filter("")
@ -241,3 +242,13 @@ class RightPane(gtk.VBox):
self.status = "pafter"
else:
print status
def storeCols(self):
print self.curTab
if self.curTab == 0:
self.playlist.storeCols()
elif self.curTab == 1:
self.queue.storeCols()
else:
self.library.storeCols()