Move source column code to new file
This patch also moves the column into a new file. This is the beginning of my attempt to clean up the code used to display the song list.
This commit is contained in:
parent
2c1865d257
commit
74545558a7
|
@ -3,6 +3,7 @@
|
|||
import ocarina
|
||||
import menu
|
||||
from components import image
|
||||
from sources import column
|
||||
|
||||
libsaria = ocarina.libsaria
|
||||
from libsaria import sources
|
||||
|
@ -14,21 +15,6 @@ get_attrs = library.get_attrs
|
|||
event = ocarina.libsaria.event
|
||||
gtk = ocarina.gtk
|
||||
|
||||
cols = ["Id", "Title", "Length", "Artist", "Album", "Year"]
|
||||
colw = [ 2, 300, 60, 125, 125, 50]
|
||||
cell = gtk.CellRendererText()
|
||||
cell.set_fixed_height_from_font(1)
|
||||
|
||||
class Column(gtk.TreeViewColumn):
|
||||
def __init__(self, index, label):
|
||||
gtk.TreeViewColumn.__init__(self, label, cell)
|
||||
self.add_attribute(cell, 'text', index)
|
||||
self.set_resizable(True)
|
||||
self.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
|
||||
self.set_min_width(2)
|
||||
self.set_max_width(700)
|
||||
self.set_fixed_width(colw[index])
|
||||
|
||||
|
||||
class List(gtk.ListStore):
|
||||
def __init__(self):
|
||||
|
@ -41,8 +27,8 @@ class ListView(gtk.TreeView):
|
|||
self.list = List()
|
||||
event.invite("POSTLOAD", self.goto)
|
||||
|
||||
for index, label in enumerate(cols):
|
||||
col = Column(index, label)
|
||||
for index, label in enumerate(column.columns):
|
||||
col = column.Column(index, label)
|
||||
if index != 0 and index != 6:
|
||||
self.append_column(col)
|
||||
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
# Bryan Schumaker (2 / 12 / 2011)
|
||||
|
||||
import gtk
|
||||
|
||||
columns = ["Id", "Title", "Length", "Artist", "Album", "Year"]
|
||||
col_width = [ 2, 300, 60, 125, 125, 50]
|
||||
|
||||
cell = gtk.CellRendererText()
|
||||
cell.set_fixed_height_from_font(1)
|
||||
|
||||
class Column(gtk.TreeViewColumn):
|
||||
def __init__(self, index, label):
|
||||
gtk.TreeViewColumn.__init__(self, label, cell)
|
||||
self.add_attribute(cell, 'text', index)
|
||||
self.set_resizable(True)
|
||||
self.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
|
||||
self.set_min_width(2)
|
||||
self.set_max_width(700)
|
||||
self.set_fixed_width(col_width[index])
|
Loading…
Reference in New Issue