Support for natural find
svn: r1230
This commit is contained in:
parent
6c1cceed82
commit
42ab304330
Binary file not shown.
@ -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)
|
||||
|
@ -386,9 +386,12 @@ class HtmlDoc(TextDoc):
|
||||
self.f.write('</p>\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','<br>')
|
||||
if text != "":
|
||||
self.empty = 0
|
||||
text = string.replace(text,'\n','<br>')
|
||||
self.f.write(text)
|
||||
|
||||
Plugins.register_text_doc(_("HTML"),HtmlDoc,1,0,1)
|
||||
|
@ -77,7 +77,7 @@
|
||||
<signal name="activate" handler="on_revert_activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image70">
|
||||
<widget class="GtkImage" id="image96">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-revert-to-saved</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -113,7 +113,7 @@
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image71">
|
||||
<widget class="GtkImage" id="image97">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-convert</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -134,7 +134,7 @@
|
||||
<signal name="activate" handler="on_reload_plugins_activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image72">
|
||||
<widget class="GtkImage" id="image98">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-refresh</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -177,8 +177,21 @@
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="find">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock_item">GNOMEUIINFO_MENU_FIND_ITEM</property>
|
||||
<property name="label" translatable="yes">Find...</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="on_find_activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image99">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-find</property>
|
||||
<property name="icon_size">1</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
@ -190,7 +203,7 @@
|
||||
<signal name="activate" handler="on_merge_activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image73">
|
||||
<widget class="GtkImage" id="image100">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-convert</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -258,7 +271,7 @@
|
||||
<accelerator key="D" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image74">
|
||||
<widget class="GtkImage" id="image101">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-index</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -280,7 +293,7 @@
|
||||
<accelerator key="B" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image75">
|
||||
<widget class="GtkImage" id="image102">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gnome-stock-book-open</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -352,7 +365,7 @@
|
||||
<signal name="activate" handler="on_default_person_activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image76">
|
||||
<widget class="GtkImage" id="image103">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-home</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -386,7 +399,7 @@
|
||||
<signal name="activate" handler="on_contents_activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image77">
|
||||
<widget class="GtkImage" id="image104">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gnome-stock-book-red</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -407,7 +420,7 @@
|
||||
<signal name="activate" handler="on_writing_extensions_activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image78">
|
||||
<widget class="GtkImage" id="image105">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gnome-stock-book-blue</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -428,7 +441,7 @@
|
||||
<signal name="activate" handler="on_gramps_home_page_activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image79">
|
||||
<widget class="GtkImage" id="image106">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-jump-to</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -449,7 +462,7 @@
|
||||
<signal name="activate" handler="on_gramps_mailing_lists_activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image80">
|
||||
<widget class="GtkImage" id="image107">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gnome-stock-mail</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -68,6 +68,9 @@ class HtmlLinkDoc(HtmlDoc):
|
||||
def newline(self):
|
||||
self.f.write('<BR>\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("<SUP>%d</SUP>" % self.scnt)
|
||||
self.doc.write_raw('<SUP>')
|
||||
self.doc.write_text('%d' % self.scnt)
|
||||
self.doc.write_raw('</SUP>')
|
||||
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('<A NAME="s%d">%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('<table width="100%" border="0">')
|
||||
doc.write_text('<tr><td width="50%" valign="top">')
|
||||
doc.write_raw('<table width="100%" border="0">')
|
||||
doc.write_raw('<tr><td width="50%" valign="top">')
|
||||
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('</td></tr></table>')
|
||||
doc.write_raw('</td></tr></table>')
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user