From 42ab304330f3f9fe6d8f21cadc6b3549ce8b99a8 Mon Sep 17 00:00:00 2001
From: Don Allingham
Date: Tue, 24 Dec 2002 22:36:46 +0000
Subject: [PATCH] Support for natural find
svn: r1230
---
example/gramps/data.gramps | Bin 3770 -> 3773 bytes
src/ListModel.py | 2 ++
src/docgen/HtmlDoc.py | 5 ++++-
src/gramps.glade | 37 +++++++++++++++++++++-----------
src/gramps_main.py | 11 +++++++++-
src/plugins/Desbrowser.py | 42 ++++++++++++++++++++++---------------
src/plugins/WebPage.py | 25 ++++++++++++++--------
7 files changed, 82 insertions(+), 40 deletions(-)
diff --git a/example/gramps/data.gramps b/example/gramps/data.gramps
index 10666b1b7ede4c94287662e894183a9ee58be042..3f2d5ce4b1f2702220f9dddeb27989302cd8d6b4 100644
GIT binary patch
delta 3657
zcmV-P4z}^S9lae0ABzYGuiFSdkqA0PU2SjMI1>KeU%~T-!yORYqFyWsmu4?BpQ^Q)c^j5lw`|kC^ItS!(xlAERr+iGsEG`kdcKsf2!6sPTnDO
zJf|e0Ts*>$DW{~Mk)T1}_iPt^I3FY1vh3c5p*08xR)4{%-$M(^775gJM?EwnX`I9~
zhb}=$&X#;Cez;I8A@b37d&7zmr#U5jIxaH=mlfsfMm?I6I61jz
z_ql-JpE*nE6QD!~87*XsvO^yn`X2$due+3x$t-gS@({IcUf8#A-wxCZkfm$o936pRa{{^iMv|29!-&HXFgf^*
z#Sw(A^as2yd^$+OHYbg1Fnn=#5Mel0ALBj_l_2foGi}>(n1>rXZmGqBu^!7a0@gQA
zcMh(_BXo5&z*5`Qrpe71gbHV$Za&_f-d=uvSIQARe~}y|aW3L0c)F($fgpk|mw8IE
zBlI`+l$CGhYza{sRACE<7oc{*;O&g?^zR7B6mwct;dIJ)1odXxD>XJ0-FG0k4*
z%r0lMfB47AgoCD4&junkTh7mx1=BVoMKA=GFAPCd|DMhmr)su(TtB60+``lfq^GV{
z9jvLN<2e`BLs*F&U_w;tcQJNb?j=_Fowm~NY;ila)=tl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rxb+B(gN7{o<@_(
o<6&b}9N#ncT`azOjnu!N1-Qqi_@%
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 @@
@@ -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)