From af404006c938b4ad3aca5d0d7b0375e0d869c4e4 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sun, 23 Apr 2006 21:58:17 +0000 Subject: [PATCH] * src/ColumnOrder.py: preserved column width svn: r6423 --- gramps2/ChangeLog | 1 + gramps2/src/ColumnOrder.py | 27 +++++++++++++++------------ gramps2/src/DataViews/_PersonView.py | 12 ++++++++---- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index d6c277599..99ee7b927 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,5 @@ 2006-04-23 Don Allingham + * src/ColumnOrder.py: preserved column width * src/GrampsCfg.py: remove familyview stuff * src/plugins/TestcaseGenerator.py: fix BIRTH, DEATH constants diff --git a/gramps2/src/ColumnOrder.py b/gramps2/src/ColumnOrder.py index a168d148d..a68ffd968 100644 --- a/gramps2/src/ColumnOrder.py +++ b/gramps2/src/ColumnOrder.py @@ -26,8 +26,6 @@ import gobject import gtk.glade -import gc - import const from gettext import gettext as _ @@ -50,9 +48,7 @@ class ColumnOrder: self.top.set_title("%s - GRAMPS" % _('Select Columns')) - self.model = gtk.ListStore(gobject.TYPE_BOOLEAN, - gobject.TYPE_STRING, - gobject.TYPE_INT) + self.model = gtk.ListStore( bool , str , int , object ) self.tree.set_model(self.model) @@ -68,26 +64,33 @@ class ColumnOrder: column_n.set_min_width(225) self.tree.append_column(column_n) - self.glade.get_widget('okbutton').connect('clicked',self.ok_clicked) - self.glade.get_widget('cancelbutton').connect('clicked',self.cancel_clicked) + self.glade.get_widget('okbutton').connect('clicked', + self.ok_clicked) + self.glade.get_widget('cancelbutton').connect('clicked', + self.cancel_clicked) for item in self.arglist: 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): newlist = [] for i in range(0,len(self.arglist)): node = self.model.get_iter((int(i),)) - newlist.append((self.model.get_value(node,0), - self.model.get_value(node,2))) + enable = self.model.get_value(node, 0) + index = self.model.get_value(node, 2) + value = self.model.get_value(node,3) + newlist.append((enable, index, value[2])) + self.callback(newlist) self.top.destroy() - gc.collect() def cancel_clicked(self,obj): self.top.destroy() - gc.collect() def toggled(self, cell, path, model): node = model.get_iter((int(path),)) diff --git a/gramps2/src/DataViews/_PersonView.py b/gramps2/src/DataViews/_PersonView.py index 27e737361..88899f269 100644 --- a/gramps2/src/DataViews/_PersonView.py +++ b/gramps2/src/DataViews/_PersonView.py @@ -128,8 +128,8 @@ class PersonView(PageView.PersonNavView): ColumnOrder.ColumnOrder(self.dbstate.db.get_person_column_order(), column_names, self.set_column_order) - def set_column_order(self,list): - self.dbstate.db.set_person_column_order(list) + def set_column_order(self, column_list): + self.dbstate.db.set_person_column_order(column_list) self.build_columns() def get_stock(self): @@ -460,10 +460,14 @@ class PersonView(PageView.PersonNavView): for column in self.columns: self.tree.remove_column(column) try: - column = gtk.TreeViewColumn(_('Name'), self.renderer,text=0, - background=self.model.marker_color_column) + column = gtk.TreeViewColumn( + _('Name'), + self.renderer,text=0, + background=self.model.marker_color_column) + except AttributeError: column = gtk.TreeViewColumn(_('Name'), self.renderer,text=0) + column.set_resizable(True) #column.set_clickable(True) #column.connect('clicked',self.sort_clicked)