diff --git a/example/gramps/data.gramps b/example/gramps/data.gramps index 10666b1b7..3f2d5ce4b 100644 Binary files a/example/gramps/data.gramps and b/example/gramps/data.gramps differ diff --git a/src/ListModel.py b/src/ListModel.py index b0e45552b..2f734dd26 100644 --- a/src/ListModel.py +++ b/src/ListModel.py @@ -28,6 +28,8 @@ class ListModel: self.mylist = [TYPE_STRING]*l + [TYPE_PYOBJECT] self.tree.set_rules_hint(gtk.TRUE) + self.tree.set_enable_search(gtk.TRUE) + self.tree.set_search_column(gtk.TRUE) self.new_model() self.selection = self.tree.get_selection() self.selection.set_mode(mode) diff --git a/src/docgen/HtmlDoc.py b/src/docgen/HtmlDoc.py index 55dd9e185..8c5b0c94b 100644 --- a/src/docgen/HtmlDoc.py +++ b/src/docgen/HtmlDoc.py @@ -386,9 +386,12 @@ class HtmlDoc(TextDoc): self.f.write('

\n') def write_text(self,text): + text = string.replace(text,'&','&'); # Must be first + text = string.replace(text,'<','<'); + text = string.replace(text,'>','>'); + text = string.replace(text,'\n','
') if text != "": self.empty = 0 - text = string.replace(text,'\n','
') self.f.write(text) Plugins.register_text_doc(_("HTML"),HtmlDoc,1,0,1) diff --git a/src/gramps.glade b/src/gramps.glade index 575838c3a..8158a9d76 100644 --- a/src/gramps.glade +++ b/src/gramps.glade @@ -77,7 +77,7 @@ - + True gtk-revert-to-saved 1 @@ -113,7 +113,7 @@ True - + True gtk-convert 1 @@ -134,7 +134,7 @@ - + True gtk-refresh 1 @@ -177,8 +177,21 @@ True - GNOMEUIINFO_MENU_FIND_ITEM + Find... + True + + + + True + gtk-find + 1 + 0.5 + 0.5 + 0 + 0 + + @@ -190,7 +203,7 @@ - + True gtk-convert 1 @@ -258,7 +271,7 @@ - + True gtk-index 1 @@ -280,7 +293,7 @@ - + True gnome-stock-book-open 1 @@ -352,7 +365,7 @@ - + True gtk-home 1 @@ -386,7 +399,7 @@ - + True gnome-stock-book-red 1 @@ -407,7 +420,7 @@ - + True gnome-stock-book-blue 1 @@ -428,7 +441,7 @@ - + True gtk-jump-to 1 @@ -449,7 +462,7 @@ - + True gnome-stock-mail 1 diff --git a/src/gramps_main.py b/src/gramps_main.py index 3bce4ebb0..c1bebe614 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -1358,10 +1358,19 @@ class Gramps: self.status_text("") def complete_rebuild(self): - self.status_text(_("Updating display...")) + import time + t = time.time() keys = self.alpha_page.keys() + + for key in keys: + self.alpha_page[key].new_model() + self.id2col = {} self.apply_filter() + for key in keys: + self.alpha_page[key].connect_model() + self.modify_statusbar() + self.status_text(_("Updating display... %d") % (time.time()-t)) def apply_filter(self): datacomp = self.DataFilter.compare diff --git a/src/plugins/Desbrowser.py b/src/plugins/Desbrowser.py index 51ddc7862..d4b7733df 100644 --- a/src/plugins/Desbrowser.py +++ b/src/plugins/Desbrowser.py @@ -42,6 +42,7 @@ import GrampsCfg # GTK/GNOME modules # #------------------------------------------------------------------------ +import gobject import gtk import gtk.glade @@ -71,31 +72,38 @@ class DesBrowse: "destroy_passed_object" : Utils.destroy_passed_object, }) top = self.glade.get_widget("top") - tree= self.glade.get_widget("tree1") + self.tree= self.glade.get_widget("tree1") + col = gtk.TreeViewColumn('',gtk.CellRendererText(),text=0) + self.tree.append_column(col) + self.model = gtk.TreeStore(gobject.TYPE_STRING,gobject.TYPE_PYOBJECT) + self.tree.set_model(self.model) + self.tree.set_rules_hint(gtk.TRUE) + self.tree.set_headers_visible(gtk.FALSE) - self.add_to_tree(tree,self.active) + self.add_to_tree(None,None,self.active) + self.tree.expand_all() + self.tree.connect('event',self.button_press_event) + top.show() - def add_to_tree(self,tree,person): - item = gtk.TreeItem(GrampsCfg.nameof(person)) - item.show() - item.connect('button-press-event',self.button_press_event) - item.set_data('d',person) - tree.append(item) - subtree = None + def add_to_tree(self,parent,sib,person): + item = self.model.insert_after(parent,sib) + self.model.set(item,0,GrampsCfg.nameof(person)) + self.model.set(item,1,person) + prev = None for family in person.getFamilyList(): for child in family.getChildList(): - if subtree == None: - subtree = gtk.Tree() - subtree.show() - item.set_subtree(subtree) - self.add_to_tree(subtree,child) - + prev = self.add_to_tree(item,prev,child) + return item + def button_press_event(self,obj,event): import EditPerson + if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: - person = obj.get_data('d') - EditPerson.EditPerson(person,self.db,self.callback) + store,iter = self.tree.get_selection().get_selected() + if iter: + person = store.get_value(iter,1) + EditPerson.EditPerson(person,self.db,self.callback) #------------------------------------------------------------------------ # diff --git a/src/plugins/WebPage.py b/src/plugins/WebPage.py index 04e51cb23..853cba352 100644 --- a/src/plugins/WebPage.py +++ b/src/plugins/WebPage.py @@ -68,6 +68,9 @@ class HtmlLinkDoc(HtmlDoc): def newline(self): self.f.write('
\n') + def write_raw(self,text): + self.f.write(text) + #------------------------------------------------------------------------ # # @@ -114,7 +117,9 @@ class IndividualPage: if sreflist: for sref in sreflist: self.doc.start_link("#s%d" % self.scnt) - self.doc.write_text("%d" % self.scnt) + self.doc.write_raw('') + self.doc.write_text('%d' % self.scnt) + self.doc.write_raw('') self.doc.end_link() self.scnt = self.scnt + 1 self.slist.append(sref) @@ -160,7 +165,7 @@ class IndividualPage: self.doc.start_cell("NormalCell") self.doc.start_paragraph("Data") if person: - if self.list.has_key(person): + if self.list.has_key(person.getId()): self.doc.start_link("%s.%s" % (person.getId(),self.ext)) self.doc.write_text(person.getPrimaryName().getRegularName()) self.doc.end_link() @@ -179,7 +184,9 @@ class IndividualPage: index = 1 for sref in self.slist: self.doc.start_paragraph("SourceParagraph") - self.doc.write_text('%d. ' % (index,index)) + self.doc.start_link("s%d" % index) + self.doc.write_text('%d. ' % index) + self.doc.end_link() index = index + 1 self.write_info(sref.getBase().getTitle()) self.write_info(sref.getBase().getAuthor()) @@ -510,7 +517,7 @@ class IndividualPage: self.doc.start_cell("NormalCell",2) self.doc.start_paragraph("Spouse") if spouse: - if self.list.has_key(spouse): + if self.list.has_key(spouse.getId()): self.doc.start_link("%s.%s" % (spouse.getId(),self.ext)) self.doc.write_text(spouse.getPrimaryName().getRegularName()) self.doc.end_link() @@ -547,7 +554,7 @@ class IndividualPage: first = 0 else: self.doc.write_text('\n') - if self.list.has_key(child): + if self.list.has_key(child.getId()): self.doc.start_link("%s.%s" % (child.getId(),self.ext)) self.doc.write_text(name) self.doc.end_link() @@ -695,8 +702,8 @@ class WebReport(Report): col_len = len(person_list) + len(a.keys()) col_len = col_len/2 - doc.write_text('') - doc.write_text('
') + doc.write_raw('') + doc.write_raw('
') last = '' end_col = 0 for person in person_list: @@ -719,7 +726,7 @@ class WebReport(Report): else: doc.newline() col_len = col_len - 1 - doc.write_text('
') + doc.write_raw('
') doc.close() doc.write_support_files() @@ -773,7 +780,7 @@ class WebReport(Report): my_map = {} for l in ind_list: - my_map[l] = 1 + my_map[l.getId()] = l for person in ind_list: tdoc = HtmlLinkDoc(self.selected_style,None,None,None,doc) tdoc.set_extension(self.ext)