diff --git a/ChangeLog b/ChangeLog index 00e09558c..55e95c219 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,8 @@ * src/PeopleModel.py: handle sorting of columns * src/ChooseParents.py: handle sorting of columns * src/SelectPerson.py: use PersonModel + * src/SelectChild.py: use PersonModel + * src/plugins/FilterEditor.py: use new SelectPerson 2004-03-22 Alex Roitman * src/docgen/LPRDoc.py: Fix colliding name. diff --git a/src/ChooseParents.py b/src/ChooseParents.py index 80aad52b4..c9ec1de0d 100644 --- a/src/ChooseParents.py +++ b/src/ChooseParents.py @@ -181,12 +181,14 @@ class ChooseParents: def add_columns(self,tree): column = gtk.TreeViewColumn(_('Name'), self.renderer,text=0) column.set_resizable(gtk.TRUE) - #column.set_clickable(gtk.TRUE) + column.set_clickable(gtk.TRUE) + column.set_sort_column_id(0) column.set_min_width(225) tree.append_column(column) column = gtk.TreeViewColumn(_('ID'), self.renderer,text=1) column.set_resizable(gtk.TRUE) - #column.set_clickable(gtk.TRUE) + column.set_clickable(gtk.TRUE) + column.set_sort_column_id(1) column.set_min_width(75) tree.append_column(column) column = gtk.TreeViewColumn(_('Birth date'), self.renderer,text=3) @@ -291,7 +293,7 @@ class ChooseParents: def redrawf(self): """Redraws the potential father list""" - self.father_model = PeopleModel.PeopleModel(self.db, self.father_filter) + self.father_model = gtk.TreeModelSort(PeopleModel.PeopleModel(self.db, self.father_filter)) self.father_list.set_model(self.father_model) if self.type == "Partners": self.flabel.set_label("%s" % _("Par_ent")) @@ -300,7 +302,7 @@ class ChooseParents: def redrawm(self): """Redraws the potential mother list""" - self.mother_model = PeopleModel.PeopleModel(self.db, self.mother_filter) + self.mother_model = gtk.TreeModelSort(PeopleModel.PeopleModel(self.db, self.mother_filter)) self.mother_list.set_model(self.mother_model) if self.type == "Partners": self.mlabel.set_label("%s" % _("Pa_rent")) diff --git a/src/DisplayModels.py b/src/DisplayModels.py index fd075487d..9d50c2366 100644 --- a/src/DisplayModels.py +++ b/src/DisplayModels.py @@ -62,8 +62,8 @@ class BaseModel(gtk.GenericTreeModel): def on_row_deleted(self,obj,path): self.rebuild_data() - def find_path(self,iter): - return self.iter2path.get(iter) +# def find_path(self,iter): +# return self.iter2path.get(iter) def on_get_flags(self): '''returns the GtkTreeModelFlags for this particular type of model''' diff --git a/src/FamilyView.py b/src/FamilyView.py index 715db237e..d4cb29dc9 100644 --- a/src/FamilyView.py +++ b/src/FamilyView.py @@ -718,7 +718,7 @@ class FamilyView: child = self.parent.db.get_person(id) self.family.remove_child_id(child.get_id()) - child.remove_parent_family_id(self.family) + child.remove_parent_family_id(self.family.get_id()) if len(self.family.get_child_id_list()) == 0: if self.family.get_father_id() == None: diff --git a/src/GrampsParser.py b/src/GrampsParser.py index e236e65e1..587f4ad4f 100644 --- a/src/GrampsParser.py +++ b/src/GrampsParser.py @@ -200,7 +200,7 @@ class GrampsParser: if self.tempDefault != None: id = self.tempDefault if self.db.has_person_id(id) and self.db.get_default_person() == None: - self.db.set_default_person(id) + self.db.set_default_person_id(id) for key in self.func_map.keys(): del self.func_map[key] @@ -550,8 +550,8 @@ class GrampsParser: if attrs.has_key("cformat"): d.set_calendar(Calendar.find_calendar(attrs['calendar'])) - d.get_start_date().setIsoDate(attrs['start']) - d.get_stop_date().setIsoDate(attrs['stop']) + d.get_start_date().set_iso_date(attrs['start']) + d.get_stop_date().set_iso_date(attrs['stop']) d.range = 1 def start_dateval(self,attrs): @@ -570,12 +570,12 @@ class GrampsParser: if attrs.has_key("cformat"): d.set_calendar(Calendar.find_calendar(attrs['cformat'])) - d.get_start_date().setIsoDate(attrs['val']) + d.get_start_date().set_iso_date(attrs['val']) if attrs.has_key("type"): - d.get_start_date().setMode(attrs['type']) + d.get_start_date().set_mode(attrs['type']) else: - d.get_start_date().setMode(None) + d.get_start_date().set_mode(None) def start_datestr(self,attrs): if self.source_ref: diff --git a/src/MediaView.py b/src/MediaView.py index 8a2b49c96..86eff00a2 100644 --- a/src/MediaView.py +++ b/src/MediaView.py @@ -85,7 +85,7 @@ class MediaView: self.preview = glade.get_widget("preview") self.renderer = gtk.CellRendererText() - self.model = DisplayModels.MediaModel(self.db) + self.model = gtk.TreeModelSort(DisplayModels.MediaModel(self.db)) self.selection = self.list.get_selection() self.list.set_model(self.model) @@ -125,9 +125,9 @@ class MediaView: column = gtk.TreeViewColumn(_('Title'), self.renderer,text=0) column.set_resizable(gtk.TRUE) - #column.set_clickable(gtk.TRUE) + column.set_clickable(gtk.TRUE) column.set_min_width(225) - #column.set_sort_column_id(0) + column.set_sort_column_id(0) self.list.append_column(column) self.columns = [column] @@ -140,7 +140,7 @@ class MediaView: column.set_resizable(gtk.TRUE) column.set_clickable(gtk.TRUE) column.set_min_width(75) - column.set_sort_column_id(0) + column.set_sort_column_id(index) self.columns.append(column) self.list.append_column(column) index += 1 @@ -160,13 +160,9 @@ class MediaView: def build_tree(self): self.list.set_model(None) - self.model = DisplayModels.MediaModel(self.parent.db) - + self.model = gtk.TreeModelSort(DisplayModels.MediaModel(self.parent.db)) self.list.set_model(self.model) self.selection = self.list.get_selection() - #self.selection.connect('changed',self.row_changed) - #self.list.connect('row_activated', self.alpha_event) - #self.model.connect('button-press-event',self.on_plist_button_press) def on_select_row(self,obj): fexists = 1 diff --git a/src/PeopleModel.py b/src/PeopleModel.py index 48ce4dd68..639d613ff 100644 --- a/src/PeopleModel.py +++ b/src/PeopleModel.py @@ -24,6 +24,9 @@ import gtk.glade import gnome import gnome.ui +COLUMN_NAME = 0 +COLUMN_NAME_SORT = 7 + from RelLib import * class PeopleModel(gtk.GenericTreeModel): @@ -47,6 +50,7 @@ class PeopleModel(gtk.GenericTreeModel): self.column_birth_place, self.column_death_day, self.column_death_place, + self.sort_name, ] def rebuild_data(self): @@ -68,23 +72,30 @@ class PeopleModel(gtk.GenericTreeModel): surname = unicode(person.get_primary_name().get_surname()) if self.sname_sub.has_key(surname): - val = len(self.sname_sub[surname]) self.sname_sub[surname].append(person_id) else: self.sname_sub[surname] = [person_id] - val = 0 - tpl = (surname,val) - self.iter2path[person_id] = tpl - self.path2iter[tpl] = person_id - - val = 0 + sval = 0 name_list = self.db.get_surnames() for name in name_list: if self.sname_sub.has_key(name): - self.top_iter2path[unicode(name)] = (val,) - self.top_path2iter[val] = unicode(name) - val += 1 + self.top_iter2path[name] = (sval,) + self.top_path2iter[sval] = name + val = 0 + entries = self.sname_sub[name] + entries.sort(self.byname) + for person_id in entries: + tpl = (name,val) + self.iter2path[person_id] = tpl + self.path2iter[tpl] = person_id + val += 1 + sval += 1 + + def byname(self,f,s): + n1 = self.db.person_map.get(str(f))[2].get_sort_name() + n2 = self.db.person_map.get(str(s))[2].get_sort_name() + return cmp(n1,n2) def on_row_inserted(self,obj,path,iter): self.rebuild_data() @@ -92,29 +103,16 @@ class PeopleModel(gtk.GenericTreeModel): def on_row_deleted(self,obj,path): self.rebuild_data() - def find_path(self,iter): - if self.top_iter2path.has_key(iter): - return self.top_iter2path[iter] - else: - path = self.iter2path.get(iter) - if path: - return (self.top_iter2path[path[0]][0],path[1]); - else: - return None - def on_get_flags(self): '''returns the GtkTreeModelFlags for this particular type of model''' - #print "on_get_flags" return 1 def on_get_n_columns(self): - #print "on_get_columns" - return 5 + return 8 def on_get_path(self, node): '''returns the tree path (a tuple of indices at the various levels) for a particular node.''' - #print "on_get_path" if self.top_iter2path.has_key(node): return self.top_iter2path[node] else: @@ -125,7 +123,6 @@ class PeopleModel(gtk.GenericTreeModel): return gobject.TYPE_STRING def on_get_iter(self, path): - #print "on_get_iter" try: if len(path)==1: return self.top_path2iter[path[0]] @@ -136,10 +133,11 @@ class PeopleModel(gtk.GenericTreeModel): return None def on_get_value(self,iter,col): - #print "on_get_value", iter, col if self.top_iter2path.has_key(iter): if col == 0: return iter + elif col == COLUMN_NAME_SORT: + return iter.upper() else: return u'' else: @@ -147,7 +145,6 @@ class PeopleModel(gtk.GenericTreeModel): def on_iter_next(self, node): '''returns the next node at this level of the tree''' - #print "on_iter_next" if self.top_iter2path.has_key(node): path = self.top_iter2path[node] return self.top_path2iter.get(path[0]+1) @@ -157,14 +154,12 @@ class PeopleModel(gtk.GenericTreeModel): def on_iter_children(self,node): """Return the first child of the node""" - #print "on_iter_children" if node == None: return self.top_path2iter[0] return self.path2iter.get((node,0)) def on_iter_has_child(self, node): '''returns true if this node has children''' - #print "on_iter_has_child" if node == None: return len(top_iter2path) > 0 if self.sname_sub.has_key(node) and len(self.sname_sub[node]) > 0: @@ -172,7 +167,6 @@ class PeopleModel(gtk.GenericTreeModel): return 0 def on_iter_n_children(self,node): - #print "on_iter_n_children",node if node == None: return len(self.top_iter2path) if self.top_iter2path.has_key(node): @@ -180,7 +174,6 @@ class PeopleModel(gtk.GenericTreeModel): return 0 def on_iter_nth_child(self,node,n): - #print "on_iter_nth_child" path = self.top_iter2path.get(node) if path: return self.path2iter.get((node,n)) @@ -189,17 +182,19 @@ class PeopleModel(gtk.GenericTreeModel): def on_iter_parent(self, node): '''returns the parent of this node''' - #print "on_iter_parent" path = self.iter2path.get(node) if path: return path[0] return None + def sort_name(self,data): + return data[2].get_sort_name() + def column_name(self,data): - return unicode(data[2].get_name()) + return data[2].get_name() def column_id(self,data): - return unicode(data[0]) + return data[0] def column_gender(self,data): return _GENDER[data[1]] diff --git a/src/PeopleView.py b/src/PeopleView.py index 43fe0edc4..f2a01bb27 100644 --- a/src/PeopleView.py +++ b/src/PeopleView.py @@ -86,7 +86,7 @@ class PeopleView: column.set_resizable(gtk.TRUE) column.set_clickable(gtk.TRUE) column.set_min_width(225) - column.set_sort_column_id(0) + column.set_sort_column_id(PeopleModel.COLUMN_NAME_SORT) self.person_tree.append_column(column) self.columns = [column] @@ -99,7 +99,7 @@ class PeopleView: column.set_resizable(gtk.TRUE) #column.set_clickable(gtk.TRUE) column.set_min_width(60) - column.set_sort_column_id(0) + column.set_sort_column_id(index) self.columns.append(column) self.person_tree.append_column(column) index += 1 @@ -108,10 +108,10 @@ class PeopleView: self.person_tree.set_model(None) self.person_model = PeopleModel.PeopleModel(self.parent.db) - #self.sort_model = gtk.TreeModelSort(self.person_model) - #self.person_tree.set_model(self.sort_model) + self.sort_model = gtk.TreeModelSort(self.person_model) + self.person_tree.set_model(self.sort_model) - self.person_tree.set_model(self.person_model) + #self.person_tree.set_model(self.person_model) self.person_selection = self.person_tree.get_selection() self.person_selection.connect('changed',self.row_changed) @@ -119,7 +119,8 @@ class PeopleView: self.person_tree.connect('button-press-event',self.on_plist_button_press) def blist(self,store,path,iter,id_list): - id_list.append(self.person_model.get_value(iter,1)) + #id_list.append(self.person_model.get_value(iter,1)) + id_list.append(self.sort_model.get_value(iter,1)) def get_selected_objects(self): mlist = [] @@ -151,7 +152,7 @@ class PeopleView: """Remove the selected person from the list. A person object is expected, not an ID""" if old_id == None or person.get_id() == old_id: - path = self.person_model.find_path(person.get_id()) + path = self.person_model.on_get_path(person.get_id()) self.person_model.row_deleted(path) else: self.person_model.rebuild_data() @@ -194,8 +195,8 @@ class PeopleView: return p = self.parent.active_person id = p.get_id() - path = self.person_model.find_path(id) - top_path = self.person_model.find_path(p.get_primary_name().get_surname()) + path = self.person_model.on_get_path(id) + top_path = self.person_model.on_get_path(p.get_primary_name().get_surname()) self.person_tree.expand_row(top_path,0) self.person_selection.select_path(path) self.person_tree.scroll_to_cell(path,None,1,0.5,0) diff --git a/src/PlaceView.py b/src/PlaceView.py index 5ed1d5648..1fed562aa 100644 --- a/src/PlaceView.py +++ b/src/PlaceView.py @@ -77,7 +77,7 @@ class PlaceView: self.active = None - self.model = DisplayModels.PlaceModel(self.db) + self.model = gtk.TreeModelSort(DisplayModels.PlaceModel(self.db)) self.list.set_model(self.model) self.selection = self.list.get_selection() self.selection.set_mode(gtk.SELECTION_MULTIPLE) @@ -94,9 +94,9 @@ class PlaceView: column = gtk.TreeViewColumn(_('Place Name'), self.renderer,text=0) column.set_resizable(gtk.TRUE) - #column.set_clickable(gtk.TRUE) + column.set_clickable(gtk.TRUE) column.set_min_width(225) - #column.set_sort_column_id(0) + column.set_sort_column_id(0) self.list.append_column(column) self.columns = [column] @@ -109,7 +109,7 @@ class PlaceView: column.set_resizable(gtk.TRUE) column.set_clickable(gtk.TRUE) column.set_min_width(75) - column.set_sort_column_id(0) + column.set_sort_column_id(index) self.columns.append(column) self.list.append_column(column) index += 1 @@ -123,14 +123,9 @@ class PlaceView: def build_tree(self): self.list.set_model(None) - self.model = DisplayModels.PlaceModel(self.parent.db) - + self.model = gtk.TreeModelSort(DisplayModels.PlaceModel(self.parent.db)) self.list.set_model(self.model) - self.selection = self.list.get_selection() - #self.selection.connect('changed',self.row_changed) - #self.list.connect('row_activated', self.alpha_event) - #self.model.connect('button-press-event',self.on_plist_button_press) def load_places(self,id=None): """Rebuilds the entire place view. This can be very time consuming diff --git a/src/RelLib.py b/src/RelLib.py index 0ef8f337e..848d33b57 100644 --- a/src/RelLib.py +++ b/src/RelLib.py @@ -2567,15 +2567,20 @@ class GrampsDB: self.metadata['default'] = str(person.get_id()) # if person: # self.default.set_ancestor(1) - + + def set_default_person_id(self,id): + """sets the default Person to the passed instance""" + assert(type(id) == types.StringType or type(id) == types.UnicodeType) + self.metadata['default'] = id + def get_default_person(self): """returns the default Person of the database""" - if self.metadata: - if self.metadata.has_key('default'): - person = Person() - data = self.person_map.get(self.metadata['default']) - person.unserialize(data) - return person + if self.metadata and self.metadata.has_key('default'): + person = Person() + id = self.metadata['default'] + data = self.person_map.get(str(id)) + person.unserialize(data) + return person return None def get_person(self,id): diff --git a/src/SelectChild.py b/src/SelectChild.py index 18bc3bb89..f44513927 100644 --- a/src/SelectChild.py +++ b/src/SelectChild.py @@ -44,7 +44,7 @@ import gnome import RelLib import const import Utils -import ListModel +import PeopleModel import GrampsCfg from RelLib import Person @@ -62,6 +62,7 @@ class SelectChild: self.family = family self.redraw = redraw self.add_person = add_person + self.renderer = gtk.CellRendererText() self.xml = gtk.glade.XML(const.gladeFile,"select_child","gramps") if person: @@ -119,14 +120,29 @@ class SelectChild: self.frel.set_text(_("Birth")) - titles = [(_('Name'),3,150),(_('ID'),1,50), (_('Birth date'),4,100), - ('',-1,0),('',-1,0)] - - self.refmodel = ListModel.ListModel(self.add_child,titles) + self.refmodel = PeopleModel.PeopleModel(self.db) + self.add_child.set_model(self.refmodel) self.redraw_child_list(2) self.add_itself_to_menu() + self.add_columns(self.add_child) self.top.show() + def add_columns(self,tree): + column = gtk.TreeViewColumn(_('Name'), self.renderer,text=0) + column.set_resizable(gtk.TRUE) + #column.set_clickable(gtk.TRUE) + column.set_min_width(225) + tree.append_column(column) + column = gtk.TreeViewColumn(_('ID'), self.renderer,text=1) + column.set_resizable(gtk.TRUE) + #column.set_clickable(gtk.TRUE) + column.set_min_width(75) + tree.append_column(column) + column = gtk.TreeViewColumn(_('Birth date'), self.renderer,text=3) + #column.set_resizable(gtk.TRUE) + column.set_clickable(gtk.TRUE) + tree.append_column(column) + def on_delete_event(self,obj,b): self.remove_itself_from_menu() @@ -153,8 +169,8 @@ class SelectChild: gnome.help_display('gramps-manual','gramps-edit-quick') def redraw_child_list(self,filter): - self.refmodel.clear() - self.refmodel.new_model() + return + birth = self.db.find_event_from_id(self.person.get_birth_id()) death = self.db.find_event_from_id(self.person.get_death_id()) if birth: @@ -243,14 +259,22 @@ class SelectChild: col = self.add_child.get_column(0) self.add_child.scroll_to_cell(path,col,1,0.5,0.0) + def select_function(self,store,path,iter,id_list): + id_list.append(self.refmodel.get_value(iter,1)) + + def get_selected_ids(self): + mlist = [] + self.add_child.get_selection().selected_foreach(self.select_function,mlist) + return mlist def on_save_child_clicked(self,obj): - store,iter = self.refmodel.selection.get_selected() - if not iter: + idlist = self.get_selected_ids() + + if not idlist or not idlist[0]: return - id = self.refmodel.model.get_value(iter,1) + id = idlist[0] select_child = self.db.get_person(id) if self.family == None: self.family = self.db.new_family() diff --git a/src/SelectPerson.py b/src/SelectPerson.py index bbdd55499..ce7a8d01b 100644 --- a/src/SelectPerson.py +++ b/src/SelectPerson.py @@ -42,7 +42,7 @@ import gtk.glade import RelLib import const import Utils -import ListModel +import PeopleModel #------------------------------------------------------------------------- # @@ -53,6 +53,7 @@ class SelectPerson: def __init__(self,db,title,flabel="",filter=None,parent_window=None): + self.renderer = gtk.CellRendererText() self.db = db self.filter = filter gladefile = "%s/choose.glade" % const.rootDir @@ -60,9 +61,7 @@ class SelectPerson: self.top = self.glade.get_widget('select') title_label = self.glade.get_widget('title') self.filter_select = self.glade.get_widget('filter') - self.female = self.glade.get_widget('female') - self.male = self.glade.get_widget('male') - self.unknown = self.glade.get_widget('unknown') + self.plist = self.glade.get_widget('plist') self.notebook = self.glade.get_widget('notebook') if filter: self.use_filter = 1 @@ -71,12 +70,7 @@ class SelectPerson: Utils.set_titles(self.top,title_label,title) - titles = [(_('Name'),3,150),(_('ID'),1,50), (_('Birth date'),4,100), - ('',0,0),('',0,0)] - - self.fmodel = ListModel.ListModel(self.female,titles) - self.mmodel = ListModel.ListModel(self.male,titles) - self.umodel = ListModel.ListModel(self.unknown,titles) + self.model = PeopleModel.PeopleModel(self.db) if filter: self.filter_select.set_label(flabel) @@ -86,7 +80,9 @@ class SelectPerson: else: self.filter_select.hide() + self.add_columns(self.plist) self.redraw() + self.plist.set_model(self.model) self.top.show() if parent_window: @@ -95,18 +91,29 @@ class SelectPerson: def redraw_cb(self,obj): self.use_filter = self.filter_select.get_active() self.redraw() + + def add_columns(self,tree): + column = gtk.TreeViewColumn(_('Name'), self.renderer,text=0) + column.set_resizable(gtk.TRUE) + column.set_clickable(gtk.TRUE) + column.set_sort_column_id(0) + column.set_min_width(225) + tree.append_column(column) + column = gtk.TreeViewColumn(_('ID'), self.renderer,text=1) + column.set_resizable(gtk.TRUE) + column.set_clickable(gtk.TRUE) + column.set_sort_column_id(1) + column.set_min_width(75) + tree.append_column(column) + column = gtk.TreeViewColumn(_('Birth date'), self.renderer,text=3) + #column.set_resizable(gtk.TRUE) + column.set_clickable(gtk.TRUE) + tree.append_column(column) def redraw(self): - - self.fmodel.clear() - self.fmodel.new_model() - - self.mmodel.clear() - self.mmodel.new_model() - - self.umodel.clear() - self.umodel.new_model() + return + for key in self.db.sort_person_keys(): person = self.db.get_person(key) if self.use_filter and not self.filter(person): @@ -114,33 +121,28 @@ class SelectPerson: data = self.db.get_person_display(key) gender = person.get_gender() - if gender == RelLib.Person.male: + if gender == RelLib.Person.plist: self.mmodel.add([data[0],data[1],data[3],data[5],data[6]],key) - elif gender == RelLib.Person.female: + elif gender == RelLib.Person.feplist: self.fmodel.add([data[0],data[1],data[3],data[5],data[6]],key) else: self.umodel.add([data[0],data[1],data[3],data[5],data[6]],key) - self.fmodel.connect_model() - self.mmodel.connect_model() - self.umodel.connect_model() - + def select_function(self,store,path,iter,id_list): + id_list.append(self.model.get_value(iter,1)) + + def get_selected_ids(self): + mlist = [] + self.plist.get_selection().selected_foreach(self.select_function,mlist) + return mlist + def run(self): val = self.top.run() - page = self.notebook.get_current_page() - if val == gtk.RESPONSE_OK: - if page == 0: - lmodel = self.fmodel - elif page == 1: - lmodel = self.mmodel - else: - lmodel = self.umodel - model,iter = lmodel.get_selected() - if iter: - id = lmodel.get_object(iter) - return_value = self.db.get_person(id) + idlist = self.get_selected_ids() + if idlist and idlist[0]: + return_value = self.db.get_person(idlist[0]) else: return_value = None self.top.destroy() diff --git a/src/SourceView.py b/src/SourceView.py index 70adb9a36..80f591fbc 100644 --- a/src/SourceView.py +++ b/src/SourceView.py @@ -73,7 +73,7 @@ class SourceView: self.renderer = gtk.CellRendererText() - self.model = DisplayModels.SourceModel(self.db) + self.model = gtk.TreeModelSort(DisplayModels.SourceModel(self.db)) self.list.set_model(self.model) self.topWindow = self.glade.get_widget("gramps") @@ -92,9 +92,9 @@ class SourceView: column = gtk.TreeViewColumn(_('Title'), self.renderer,text=0) column.set_resizable(gtk.TRUE) - #column.set_clickable(gtk.TRUE) + column.set_clickable(gtk.TRUE) column.set_min_width(225) - #column.set_sort_column_id(0) + column.set_sort_column_id(0) self.list.append_column(column) self.columns = [column] @@ -107,7 +107,7 @@ class SourceView: column.set_resizable(gtk.TRUE) column.set_clickable(gtk.TRUE) column.set_min_width(75) - column.set_sort_column_id(0) + column.set_sort_column_id(index) self.columns.append(column) self.list.append_column(column) index += 1 @@ -125,21 +125,20 @@ class SourceView: def build_tree(self): self.list.set_model(None) - self.model = DisplayModels.SourceModel(self.parent.db) + self.model = gtk.TreeModelSort(DisplayModels.SourceModel(self.parent.db)) self.list.set_model(self.model) self.selection = self.list.get_selection() - #self.selection.connect('changed',self.row_changed) - #self.list.connect('row_activated', self.alpha_event) - #self.model.connect('button-press-event',self.on_plist_button_press) + self.list.connect('button-press-event',self.button_press) def button_press(self,obj,event): if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: store,iter = self.selection.get_selected() id = store.get_value(iter,1) source = self.db.get_source(id) - EditSource.EditSource(source,self.db,self.parent,self.topWindow,self.update_display) + EditSource.EditSource(source,self.db,self.parent, + self.topWindow,self.update_display) return 1 elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: self.build_context_menu(event) @@ -179,7 +178,8 @@ class SourceView: menu.popup(None,None,None,event.button,event.time) def on_add_clicked(self,obj): - EditSource.EditSource(RelLib.Source(),self.db,self.parent,self.topWindow,self.new_after_edit) + EditSource.EditSource(RelLib.Source(),self.db,self.parent, + self.topWindow,self.new_after_edit) def on_delete_clicked(self,obj): @@ -253,7 +253,8 @@ class SourceView: if iter: id = list_store.get_value(iter,1) source = self.db.get_source(id) - EditSource.EditSource(source, self.db, self.parent, self.topWindow, self.update_display) + EditSource.EditSource(source, self.db, self.parent, + self.topWindow, self.update_display) def new_after_edit(self,source): self.db.add_source(source) diff --git a/src/choose.glade b/src/choose.glade index 51772cc6b..9f7462cd2 100644 --- a/src/choose.glade +++ b/src/choose.glade @@ -87,148 +87,23 @@ - + True True - True - True - GTK_POS_BOTTOM - False - False + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT - + True True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - True - False - True - - + True + True + False + True - - False - True - - - - - - True - female - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - tab - - - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - True - False - True - - - - - False - True - - - - - - True - male - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - tab - - - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - False - True - - - - - False - True - - - - - - True - unknown - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - tab - diff --git a/src/gramps.glade b/src/gramps.glade index 52c07c717..2018b17c7 100644 --- a/src/gramps.glade +++ b/src/gramps.glade @@ -51,7 +51,7 @@ - + True gtk-new 1 @@ -73,7 +73,7 @@ - + True gtk-open 1 @@ -107,7 +107,7 @@ True - + True gtk-convert 1 @@ -120,27 +120,6 @@ - - - True - Re_load plugins - True - - - - - True - gtk-refresh - 1 - 0.5 - 0.5 - 0 - 0 - - - - - True @@ -156,7 +135,7 @@ - + True gtk-quit 1 @@ -192,7 +171,7 @@ - + True gtk-add 1 @@ -215,7 +194,7 @@ - + True gtk-remove 1 @@ -253,7 +232,7 @@ - + True gtk-find 1 @@ -275,7 +254,7 @@ - + True gtk-convert 1 @@ -302,7 +281,7 @@ - + True gtk-preferences 1 @@ -316,11 +295,23 @@ - + True - _Column order + _Column Editor... True + + + + True + gtk-properties + 1 + 0.5 + 0.5 + 0 + 0 + + @@ -332,7 +323,7 @@ - + True gtk-home 1 @@ -418,7 +409,7 @@ - + True gtk-index 1 @@ -440,7 +431,7 @@ - + True gnome-stock-book-open 1 @@ -513,7 +504,7 @@ - + True gtk-help 1 @@ -534,7 +525,7 @@ - + True gnome-stock-book-open 1 @@ -561,7 +552,7 @@ - + True gtk-jump-to 1 @@ -582,7 +573,7 @@ - + True gnome-stock-mail 1 @@ -636,7 +627,7 @@ - + True gnome-stock-about 1 @@ -4805,7 +4796,7 @@ GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False - 500 + 550 400 True False diff --git a/src/gramps_main.py b/src/gramps_main.py index 2d3fff76d..391a65458 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -121,9 +121,6 @@ class Gramps: "is rarely a wise idea, and can open up potential " "security risks.")) - # This will never contain data - It will be replaced by either - # a GrampsXML - self.history = [] self.mhistory = [] self.hindex = -1 @@ -244,9 +241,12 @@ class Gramps: self.change_active_person, self.load_person ) - self.place_view = PlaceView.PlaceView(self,self.db,self.gtop,self.update_display) - self.source_view = SourceView.SourceView(self,self.db,self.gtop,self.update_display) - self.media_view = MediaView.MediaView(self,self.db,self.gtop,self.update_display) + self.place_view = PlaceView.PlaceView(self,self.db,self.gtop, + self.update_display) + self.source_view = SourceView.SourceView(self,self.db,self.gtop, + self.update_display) + self.media_view = MediaView.MediaView(self,self.db,self.gtop, + self.update_display) self.add_button = self.gtop.get_widget('addbtn') self.add_item = self.gtop.get_widget('add_item') @@ -312,7 +312,6 @@ class Gramps: "on_filter1_activate" : self.on_filter_activate, "on_places_activate" : self.on_places_activate, "on_preferences1_activate" : self.on_preferences_activate, - "on_reload_plugins_activate" : Plugins.reload_plugins, "on_reports_clicked" : self.on_reports_clicked, "on_revert_activate" : self.on_revert_activate, "on_show_plugin_status" : self.on_show_plugin_status, @@ -919,7 +918,10 @@ class Gramps: def full_update(self): """Brute force display update, updating all the pages""" - self.update_display(1) + self.place_view.change_db(self.db) + self.people_view.change_db(self.db) + self.source_view.change_db(self.db) + self.media_view.change_db(self.db) self.toolbar.set_style(GrampsCfg.toolbar) def update_display(self,changed): @@ -1300,7 +1302,6 @@ class Gramps: self.people_view.remove_from_history(self.active_person) self.db.remove_person_id(self.active_person.get_id()) self.people_view.remove_from_person_list(self.active_person) - #self.people_view.person_model.sort_column_changed() if self.hindex >= 0: self.active_person = self.db.get_person(self.history[self.hindex]) @@ -1535,13 +1536,11 @@ class Gramps: def update_after_edit(self,epo,change=1): if epo: if change: - print "change" self.people_view.redisplay_person_list(epo.person) else: - print "no change" iter = self.people_view.person_model.get_iter((0,)) id = epo.person.get_id() - path = self.people_view.person_model.find_path(id) + path = self.people_view.person_model.on_get_path(id) self.people_view.person_model.row_changed(path,iter) self.update_display(0) diff --git a/src/plugins/FilterEditor.py b/src/plugins/FilterEditor.py index 265248d25..5a8384945 100644 --- a/src/plugins/FilterEditor.py +++ b/src/plugins/FilterEditor.py @@ -465,8 +465,7 @@ class FilterEditor: t = MyFilters(self.filterdb.get_filters()) elif _name2list.has_key(v1): data =_name2list[v1] - print data, data.get_values() - t = MySelect(data.get_values(),data) + t = MySelect(data) elif v == _('Inclusive:'): t = MyBoolean(_('Include original person')) else: