* src/ColumnOrder.py: preserved column width

svn: r6423
This commit is contained in:
Don Allingham 2006-04-23 21:58:17 +00:00
parent 4dfb3d1608
commit af404006c9
3 changed files with 24 additions and 16 deletions

View File

@ -1,4 +1,5 @@
2006-04-23 Don Allingham <don@gramps-project.org> 2006-04-23 Don Allingham <don@gramps-project.org>
* src/ColumnOrder.py: preserved column width
* src/GrampsCfg.py: remove familyview stuff * src/GrampsCfg.py: remove familyview stuff
* src/plugins/TestcaseGenerator.py: fix BIRTH, DEATH constants * src/plugins/TestcaseGenerator.py: fix BIRTH, DEATH constants

View File

@ -26,8 +26,6 @@
import gobject import gobject
import gtk.glade import gtk.glade
import gc
import const import const
from gettext import gettext as _ from gettext import gettext as _
@ -50,9 +48,7 @@ class ColumnOrder:
self.top.set_title("%s - GRAMPS" % _('Select Columns')) self.top.set_title("%s - GRAMPS" % _('Select Columns'))
self.model = gtk.ListStore(gobject.TYPE_BOOLEAN, self.model = gtk.ListStore( bool , str , int , object )
gobject.TYPE_STRING,
gobject.TYPE_INT)
self.tree.set_model(self.model) self.tree.set_model(self.model)
@ -68,26 +64,33 @@ class ColumnOrder:
column_n.set_min_width(225) column_n.set_min_width(225)
self.tree.append_column(column_n) self.tree.append_column(column_n)
self.glade.get_widget('okbutton').connect('clicked',self.ok_clicked) self.glade.get_widget('okbutton').connect('clicked',
self.glade.get_widget('cancelbutton').connect('clicked',self.cancel_clicked) self.ok_clicked)
self.glade.get_widget('cancelbutton').connect('clicked',
self.cancel_clicked)
for item in self.arglist: for item in self.arglist:
node = self.model.append() node = self.model.append()
self.model.set(node,0,item[0],1,column_names[item[1]],2,item[1]) self.model.set(node,
0, item[0],
1, column_names[item[1]],
2, item[1],
3, item)
def ok_clicked(self,obj): def ok_clicked(self,obj):
newlist = [] newlist = []
for i in range(0,len(self.arglist)): for i in range(0,len(self.arglist)):
node = self.model.get_iter((int(i),)) node = self.model.get_iter((int(i),))
newlist.append((self.model.get_value(node,0), enable = self.model.get_value(node, 0)
self.model.get_value(node,2))) index = self.model.get_value(node, 2)
value = self.model.get_value(node,3)
newlist.append((enable, index, value[2]))
self.callback(newlist) self.callback(newlist)
self.top.destroy() self.top.destroy()
gc.collect()
def cancel_clicked(self,obj): def cancel_clicked(self,obj):
self.top.destroy() self.top.destroy()
gc.collect()
def toggled(self, cell, path, model): def toggled(self, cell, path, model):
node = model.get_iter((int(path),)) node = model.get_iter((int(path),))

View File

@ -128,8 +128,8 @@ class PersonView(PageView.PersonNavView):
ColumnOrder.ColumnOrder(self.dbstate.db.get_person_column_order(), ColumnOrder.ColumnOrder(self.dbstate.db.get_person_column_order(),
column_names, self.set_column_order) column_names, self.set_column_order)
def set_column_order(self,list): def set_column_order(self, column_list):
self.dbstate.db.set_person_column_order(list) self.dbstate.db.set_person_column_order(column_list)
self.build_columns() self.build_columns()
def get_stock(self): def get_stock(self):
@ -460,10 +460,14 @@ class PersonView(PageView.PersonNavView):
for column in self.columns: for column in self.columns:
self.tree.remove_column(column) self.tree.remove_column(column)
try: try:
column = gtk.TreeViewColumn(_('Name'), self.renderer,text=0, column = gtk.TreeViewColumn(
background=self.model.marker_color_column) _('Name'),
self.renderer,text=0,
background=self.model.marker_color_column)
except AttributeError: except AttributeError:
column = gtk.TreeViewColumn(_('Name'), self.renderer,text=0) column = gtk.TreeViewColumn(_('Name'), self.renderer,text=0)
column.set_resizable(True) column.set_resizable(True)
#column.set_clickable(True) #column.set_clickable(True)
#column.connect('clicked',self.sort_clicked) #column.connect('clicked',self.sort_clicked)