Updated custom filter editor

svn: r895
This commit is contained in:
Don Allingham
2002-04-06 20:00:38 +00:00
parent 2e4cca7f7a
commit af52051f62
14 changed files with 1454 additions and 1722 deletions

View File

@@ -30,39 +30,17 @@ import sort
import Utils
import string
import ListColors
import Filter
import const
import GenericFilter
from TextDoc import *
from OpenSpreadSheet import *
import intl
_ = intl.gettext
import gtk
import gnome.ui
import libglade
import xml.parsers.expat
_ = intl.gettext
#-------------------------------------------------------------------------
#
# Unicode to latin conversion
#
#-------------------------------------------------------------------------
from latin_utf8 import utf8_to_latin
u2l = utf8_to_latin
#------------------------------------------------------------------------
#
#
#
#------------------------------------------------------------------------
FILTER = "filter"
FUNCTION = "function"
QUALIFIER= "qual"
NAME = "name"
#------------------------------------------------------------------------
#
#
@@ -141,196 +119,41 @@ class EventComparison:
self.glade_file = base + os.sep + "eventcmp.glade"
self.qual = 0
xml = os.path.expanduser("~/.gramps/eventcmp.xml")
self.interface = ComplexFilterFile(xml)
self.filterDialog = libglade.GladeXML(self.glade_file,"filters")
self.filterDialog.signal_autoconnect({
"on_add_clicked" : self.on_add_clicked,
"on_delete_clicked" : self.on_delete_clicked,
"on_filter_save_clicked" : self.on_filter_save_clicked,
"on_filter_load_clicked" : self.on_filter_load_clicked,
"on_apply_clicked" : self.on_apply_clicked,
"destroy_passed_object" : Utils.destroy_passed_object
})
top =self.filterDialog.get_widget("filters")
self.filter_menu = self.filterDialog.get_widget("filter_list")
self.filter_list_obj = self.filterDialog.get_widget("active_filters")
qualifier = self.filterDialog.get_widget("qualifier")
filters = self.filterDialog.get_widget("filter_list")
self.filter_list = []
myMenu = gtk.GtkMenu()
myMenu = Filter.build_filter_menu(self.on_filter_name_changed,qualifier)
self.filter_menu.set_menu(myMenu)
all = GenericFilter.GenericFilter()
all.set_name(_("Entire Database"))
all.add_rule(GenericFilter.Everyone([]))
flist = GenericFilter.GenericFilterList(const.custom_filters)
flist.load()
for f in [all] + flist.get_filters():
menuitem = gtk.GtkMenuItem(_(f.get_name()))
myMenu.append(menuitem)
menuitem.set_data("filter",f)
menuitem.show()
self.filter_menu = myMenu
filters.set_menu(myMenu)
top.show()
def on_apply_clicked(self,obj):
my_list = []
cfilter = self.filter_menu.get_active().get_data("filter")
for person in self.db.getPersonMap().values():
for filter in self.filter_list:
if not filter.compare(person):
break
else:
my_list.append(person)
plist = cfilter.apply(self.db.getPersonMap().values())
if len(my_list) == 0:
if len(plist) == 0:
gnome.ui.GnomeWarningDialog(_("No matches were found"))
else:
DisplayChart(my_list)
def on_delete_clicked(self,obj):
if len(self.filter_list_obj.selection) != 1:
return
row = self.filter_list_obj.selection[0]
self.filter_list_obj.remove(row)
self.filter_list_obj.unselect_all()
del self.filter_list[row]
def on_add_clicked(self,obj):
invert = self.filterDialog.get_widget("invert").get_active()
qwidget = self.filterDialog.get_widget("qualifier")
if self.qual:
qualifier = qwidget.get_text()
else:
qualifier = ""
menu = self.filter_menu.get_menu()
function = menu.get_active().get_data(FUNCTION)
name = menu.get_active().get_data(NAME)
myfilter = function(qualifier)
myfilter.set_invert(invert)
self.filter_list.append(myfilter)
if invert:
invert_text = "yes"
else:
invert_text = "no"
self.filter_list_obj.append([name,qualifier,invert_text])
def on_filter_save_clicked(self,obj):
self.load_dialog = libglade.GladeXML(self.glade_file,"filter_file")
self.filter_combo = self.load_dialog.get_widget("filter_combo")
self.load_dialog.get_widget("title").set_text("Save complex filter")
names = self.interface.get_filter_names()
if len(names) > 0:
self.filter_combo.set_popdown_strings(names)
self.load_dialog.signal_autoconnect({
"destroy_passed_object" : Utils.destroy_passed_object,
"combo_insert_text" : Utils.combo_insert_text,
"on_load_filter" : self.on_save_filter,
})
def on_filter_load_clicked(self,obj):
self.load_dialog = libglade.GladeXML(self.glade_file,"filter_file")
self.filter_combo = self.load_dialog.get_widget("filter_combo")
self.load_dialog.get_widget("title").set_text("Load complex filter")
names = self.interface.get_filter_names()
if len(names) > 0:
self.filter_combo.set_popdown_strings(names)
self.load_dialog.signal_autoconnect({
"destroy_passed_object" : Utils.destroy_passed_object,
"combo_insert_text" : Utils.combo_insert_text,
"on_load_filter" : self.on_load_filter,
})
def on_load_filter(self,obj):
name = self.load_dialog.get_widget("name").get_text()
self.filter_list = self.interface.get_filter(name)
self.filter_list_obj.freeze()
self.filter_list_obj.clear()
for f in self.filter_list:
if f.get_invert():
invert = "yes"
else:
invert = "no"
name = str(f.__class__)
name = Filter.get_filter_description(name)
self.filter_list_obj.append([name,f.get_text(),invert])
self.filter_list_obj.thaw()
Utils.destroy_passed_object(obj)
def on_save_filter(self,obj):
name = self.load_dialog.get_widget("name").get_text()
self.interface.save_filter(name,self.filter_list)
Utils.destroy_passed_object(obj)
def on_filter_name_changed(self,obj):
self.qual = obj.get_data(QUALIFIER)
obj.get_data(FILTER).set_sensitive(self.qual)
class ComplexFilterFile:
def __init__(self,name):
self.filters = {}
self.fname = name
try:
f = open(self.fname)
parser = ComplexFilterParser(self)
parser.parse(f)
f.close()
except IOError:
pass
def get_filter_names(self):
return self.filters.keys()
def get_filter(self,name):
if self.filters.has_key(name):
return self.filters[name]
else:
return []
def save_filter(self,name,filter_list):
self.filters[name] = filter_list
f = open(self.fname,"w")
f.write('<?xml version="1.0" encoding="iso-8859-1"?>\n')
f.write('<filterlist>\n')
for name in self.filters.keys():
f.write(' <complex_filter name="%s">\n' % name)
for filter in self.filters[name]:
val = (filter.get_name(),filter.get_text(),filter.get_invert())
f.write(' <filter name="%s" text="%s" invert="%d"/>\n' % val)
f.write(' </complex_filter>\n')
f.write('</filterlist>\n')
f.close()
class ComplexFilterParser:
def __init__(self,parent):
self.parent = parent
self.curfilter = []
self.curname = ""
def parse(self,f):
p = xml.parsers.expat.ParserCreate()
p.StartElementHandler = self.startElement
p.EndElementHandler = self.endElement
p.ParseFile(f)
def startElement(self,tag,attrs):
tag = u2l(tag)
if tag == "complex_filter":
self.curname = u2l(attrs['name'])
self.curfilter = []
elif tag == "filter":
name = u2l(attrs['name'])
qual = u2l(attrs['text'])
invert = int(attrs['invert'])
f = Filter.make_filter_from_name(name,qual,invert)
self.curfilter.append(f)
def endElement(self,tag):
if u2l(tag) == "complex_filter":
self.parent.filters[self.curname] = self.curfilter
DisplayChart(p_list)
#------------------------------------------------------------------------
#

View File

@@ -35,8 +35,17 @@ import GenericFilter
import intl
_ = intl.gettext
_name2list = {
_('Personal Event') : const.personalEvents,
_('Family Event') : const.marriageEvents,
_('Personal Attribute') : const.personalAttributes,
_('Family Attribute') : const.familyAttributes,
_('Relationship Type') : const.familyRelations,
}
class FilterEditor:
def __init__(self,filterdb):
def __init__(self,filterdb,db):
self.db = db
self.filterdb = GenericFilter.GenericFilterList(filterdb)
self.filterdb.load()
@@ -47,6 +56,7 @@ class FilterEditor:
self.editor.signal_autoconnect({
'on_add_clicked' : self.add_new_filter,
'on_edit_clicked' : self.edit_filter,
'on_test_clicked' : self.test_clicked,
'on_close_clicked' : self.close_filter_editor,
'on_delete_clicked' : self.delete_filter,
})
@@ -75,6 +85,14 @@ class FilterEditor:
filter = self.filter_list.get_row_data(sel[0])
self.filter_editor(GenericFilter.GenericFilter(filter))
def test_clicked(self,obj):
sel = self.filter_list.selection
if len(sel) != 1:
return
filt = self.filter_list.get_row_data(sel[0])
list = filt.apply(self.db.getPersonMap().values())
ShowResults(list)
def delete_filter(self,obj):
sel = self.filter_list.selection
if len(sel) != 1:
@@ -106,7 +124,7 @@ class FilterEditor:
self.rule_list.clear()
row = 0
for r in self.filter.get_rules():
self.rule_list.append([r.name(),r.display_values()])
self.rule_list.append([r.trans_name(),r.display_values()])
self.rule_list.set_row_data(row,r)
row = row + 1
@@ -173,18 +191,12 @@ class FilterEditor:
list.append(c)
map[name] = c
for v in arglist:
l = gtk.GtkLabel(v)
l = gtk.GtkLabel(_(v))
l.set_alignment(1,0.5)
l.show()
if v == 'Event':
if _name2list.has_key(_(v)):
t = gtk.GtkCombo()
t.set_popdown_strings(const.personalEvents)
t.set_value_in_list(1,0)
t.entry.set_editable(0)
tlist.append(t.entry)
elif v == 'Attribute':
t = gtk.GtkCombo()
t.set_popdown_strings(const.personalAttributes)
t.set_popdown_strings(_name2list[_(v)])
t.set_value_in_list(1,0)
t.entry.set_editable(0)
tlist.append(t.entry)
@@ -203,7 +215,7 @@ class FilterEditor:
self.rname.list.clear_items(0,-1)
self.rname.list.append_items(list)
for v in map.keys():
self.rname.set_item_string(map[v],v)
self.rname.set_item_string(map[_(v)],_(v))
if self.active_rule:
page = self.name2page[self.active_rule.name()]
@@ -249,13 +261,29 @@ class FilterEditor:
def rule_cancel(self,obj):
self.rule_top.destroy()
class ShowResults:
def __init__(self,plist):
self.glade = libglade.GladeXML(const.filterFile,'test')
self.top = self.glade.get_widget('test')
text = self.glade.get_widget('text')
self.glade.signal_autoconnect({
'on_close_clicked' : self.close,
})
for p in plist:
n = "%s [%s]\n" % (p.getPrimaryName().getName(),p.getId())
text.insert_defaults(n)
def close(self,obj):
self.top.destroy()
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def runTool(database,person,callback):
FilterEditor(const.custom_filters)
FilterEditor(const.custom_filters,database)
#-------------------------------------------------------------------------
#
@@ -268,5 +296,7 @@ register_tool(
runTool,
_("Custom Filter Editor"),
category=_("Utilities"),
description=_("The Custom Filter Editor builds custom filters that can be used to select people included reports, exports, and other utilities.")
description=_("The Custom Filter Editor builds custom "
"filters that can be used to select people "
"included reports, exports, and other utilities.")
)

View File

@@ -31,78 +31,6 @@ _ = intl.gettext
import libglade
from Report import *
ind_list = []
#------------------------------------------------------------------------
#
#
#
#------------------------------------------------------------------------
def ancestor_filter(database,person,list,generations):
if person == None:
return
if person not in list:
list.append(person)
if generations <= 1:
return
family = person.getMainParents()
if family != None:
ancestor_filter(database,family.getFather(),list,generations-1)
ancestor_filter(database,family.getMother(),list,generations-1)
#------------------------------------------------------------------------
#
#
#
#------------------------------------------------------------------------
def descendant_filter(database,person,list,generations):
if person == None:
return
if person not in list:
list.append(person)
if generations <= 1:
return
for family in person.getFamilyList():
for child in family.getChildList():
descendant_filter(database,child,list,generations-1)
#------------------------------------------------------------------------
#
#
#
#------------------------------------------------------------------------
def an_des_filter(database,person,list,generations):
descendant_filter(database,person,list,generations)
ancestor_filter(database,person,list,generations)
#------------------------------------------------------------------------
#
#
#
#------------------------------------------------------------------------
def entire_db_filter(database,person,list,generations):
for entry in database.getPersonMap().values():
list.append(entry)
#------------------------------------------------------------------------
#
#
#
#------------------------------------------------------------------------
filter_map = {
_("Ancestors") : ancestor_filter,
_("Descendants") : descendant_filter,
_("Ancestors and Descendants") : an_des_filter,
_("Entire Database") : entire_db_filter
}
_scaled = 0
_single = 1
_multiple = 2
@@ -129,7 +57,8 @@ class GraphVizDialog(ReportDialog):
#------------------------------------------------------------------------
def get_title(self):
"""The window title for this dialog"""
return "%s - %s - GRAMPS" % (_("Relationship Graph"),_("Graphical Reports"))
return "%s - %s - GRAMPS" % (_("Relationship Graph"),
_("Graphical Reports"))
def get_target_browser_title(self):
"""The title of the window created when the 'browse' button is
@@ -144,9 +73,24 @@ class GraphVizDialog(ReportDialog):
"""Default to 10 generations, no page breaks."""
return (10, 0)
def get_report_filter_strings(self):
def get_report_filters(self):
"""Set up the list of possible content filters."""
return filter_map.keys()
name = self.person.getPrimaryName().getName()
all = GenericFilter.GenericFilter()
all.set_name(_("Entire Database"))
all.add_rule(GenericFilter.Everyone([]))
des = GenericFilter.GenericFilter()
des.set_name(_("Descendants of %s") % name)
des.add_rule(GenericFilter.IsDescendantOf([self.person.getId()]))
ans = GenericFilter.GenericFilter()
ans.set_name(_("Ancestors of %s") % name)
ans.add_rule(GenericFilter.IsAncestorOf([self.person.getId()]))
return [all,des,ans]
def add_user_options(self):
@@ -171,26 +115,41 @@ class GraphVizDialog(ReportDialog):
menu.set_active(0)
self.arrowhead_optionmenu.set_menu(menu)
self.add_frame_option(_("GraphViz Options"), _("Arrowhead Options"),
self.arrowhead_optionmenu,_("Choose the direction that the arrows point."))
self.includedates_checkbutton = GtkCheckButton(_("Include Birth and Death Dates"))
self.arrowhead_optionmenu,
_("Choose the direction that the arrows point."))
msg = _("Include Birth and Death Dates")
self.includedates_checkbutton = GtkCheckButton(msg)
self.includedates_checkbutton.set_active(1)
self.add_frame_option(_("GraphViz Options"), '', self.includedates_checkbutton,
_("Include the years that the individual was born and/or died in the graph node labels."))
self.add_frame_option(_("GraphViz Options"), '',
self.includedates_checkbutton,
_("Include the years that the individual "
"was born and/or died in the graph node "
"labels."))
self.includeurl_checkbutton = GtkCheckButton(_("Include URLs"))
self.includeurl_checkbutton.set_active(1)
self.add_frame_option(_("GraphViz Options"), '', self.includeurl_checkbutton,
_("Include a URL in each graph node so that PDF and imagemap files can be generated that contain active links to the files generated by the 'Generate Web Site' report."))
self.add_frame_option(_("GraphViz Options"), '',
self.includeurl_checkbutton,
_("Include a URL in each graph node so "
"that PDF and imagemap files can be "
"generated that contain active links "
"to the files generated by the 'Generate "
"Web Site' report."))
self.tb_margin_adjustment = GtkAdjustment(value=0.5, lower=0.25, upper=100.0, step_incr=0.25)
self.lr_margin_adjustment = GtkAdjustment(value=0.5, lower=0.25, upper=100.0, step_incr=0.25)
tb_margin_adj = GtkAdjustment(value=0.5, lower=0.25,
upper=100.0, step_incr=0.25)
lr_margin_adj = GtkAdjustment(value=0.5, lower=0.25,
upper=100.0, step_incr=0.25)
self.tb_margin_spinbutton = GtkSpinButton(adj=self.tb_margin_adjustment, digits=2)
self.lr_margin_spinbutton = GtkSpinButton(adj=self.lr_margin_adjustment, digits=2)
self.tb_margin_sb = GtkSpinButton(adj=tb_margin_adj, digits=2)
self.lr_margin_sb = GtkSpinButton(adj=lr_margin_adj, digits=2)
self.add_frame_option(_("GraphViz Options"), _("Top & Bottom Margins"), self.tb_margin_spinbutton)
self.add_frame_option(_("GraphViz Options"), _("Left & Right Margins"), self.lr_margin_spinbutton)
self.add_frame_option(_("GraphViz Options"),
_("Top & Bottom Margins"),
self.tb_margin_sb)
self.add_frame_option(_("GraphViz Options"),
_("Left & Right Margins"),
self.lr_margin_sb)
#------------------------------------------------------------------------
#
@@ -228,11 +187,12 @@ class GraphVizDialog(ReportDialog):
pass
def parse_other_frames(self):
self.arrowhead_option = self.arrowhead_optionmenu.get_menu().get_active().get_data('i')
menu = self.arrowhead_optionmenu.get_menu()
self.arrowhead_option = menu.get_active().get_data('i')
self.includedates = self.includedates_checkbutton.get_active()
self.includeurl = self.includeurl_checkbutton.get_active()
self.tb_margin = self.tb_margin_spinbutton.get_value_as_float()
self.lr_margin = self.lr_margin_spinbutton.get_value_as_float()
self.tb_margin = self.tb_margin_sb.get_value_as_float()
self.lr_margin = self.lr_margin_sb.get_value_as_float()
#------------------------------------------------------------------------
#
@@ -246,10 +206,7 @@ class GraphVizDialog(ReportDialog):
file = open(self.target_path,"w")
filter = filter_map[self.filter]
ind_list = []
filter(self.db,self.person,ind_list,self.max_gen)
ind_list = self.filter.apply(self.db.getPersonMap().values())
file.write("digraph g {\n")
file.write("bgcolor=white;\n")
@@ -258,8 +215,8 @@ class GraphVizDialog(ReportDialog):
if self.pagecount == _scaled:
file.write("ratio=compress;\n")
file.write("size=\"%3.1f,%3.1f\";\n" % (width-(self.lr_margin * 2),
height-(self.tb_margin * 2)))
file.write('size="%3.1f' % (width-(self.lr_margin*2)))
file.write(',%3.1f";\n' % (height-(self.tb_margin*2)))
else:
file.write("ratio=auto;\n")
@@ -333,11 +290,11 @@ def dump_index(person_list,file,includedates,includeurl):
#
#------------------------------------------------------------------------
def get_description():
return _("Generates relationship graphs, currently only in GraphViz format.") + \
" " + \
_("GraphViz (dot) can transform the graph into postscript, jpeg, png, vrml, svg, and many other formats.") + \
" " + \
_("For more information or to get a copy of GraphViz, goto http://www.graphviz.org")
return _("Generates relationship graphs, currently only in GraphViz"
"format. GraphViz (dot) can transform the graph into "
"postscript, jpeg, png, vrml, svg, and many other formats. "
"For more information or to get a copy of GraphViz, "
"goto http://www.graphviz.org")
#------------------------------------------------------------------------
#

View File

@@ -4,7 +4,7 @@
# Copyright (C) 2000 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# it under the terms of the GNU General Pubilc License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
@@ -25,6 +25,7 @@ from HtmlDoc import *
import const
import GrampsCfg
import GenericFilter
import intl
_ = intl.gettext
@@ -633,21 +634,6 @@ def an_des_of_gparents_filter(database,person,list,generations):
descendant_filter(database,person,list,generations)
ancestor_filter(database,person,list,generations)
#------------------------------------------------------------------------
#
# Mams menu items to filter functions
#
#------------------------------------------------------------------------
filter_map = {
_("Individual") : individual_filter,
_("Ancestors") : ancestor_filter,
_("Descendants") : descendant_filter,
_("Ancestors and descendants") : an_des_filter,
_("Grandparent's ancestors and descendants") : an_des_of_gparents_filter,
_("Entire database") : entire_db_filter
}
#------------------------------------------------------------------------
#
#
@@ -738,9 +724,7 @@ class WebReport(Report):
image_dir_name)
return
filter = filter_map[self.filter]
ind_list = []
filter(self.db,self.person,ind_list,self.max_gen)
ind_list = self.filter.apply(self.db.getPersonMap().values())
self.progress_bar_setup(float(len(ind_list)))
doc = HtmlLinkDoc(self.selected_style,None,self.template_name,None)
@@ -765,8 +749,8 @@ class WebReport(Report):
mainiteration()
if len(ind_list) > 1:
self.dump_index(ind_list,self.selected_style,self.template_name,dir_name)
self.dump_index(ind_list,self.selected_style,
self.template_name,dir_name)
self.progress_bar_done()
def add_styles(self,doc):
@@ -854,9 +838,24 @@ class WebReportDialog(ReportDialog):
"""Default to ten generations, no page break box."""
return (10, 0)
def get_report_filter_strings(self):
def get_report_filters(self):
"""Set up the list of possible content filters."""
return filter_map.keys()
name = self.person.getPrimaryName().getName()
all = GenericFilter.GenericFilter()
all.set_name(_("Entire Database"))
all.add_rule(GenericFilter.Everyone([]))
des = GenericFilter.GenericFilter()
des.set_name(_("Descendants of %s") % name)
des.add_rule(GenericFilter.IsDescendantOf([self.person.getId()]))
ans = GenericFilter.GenericFilter()
ans.set_name(_("Ancestors of %s") % name)
ans.add_rule(GenericFilter.IsAncestorOf([self.person.getId()]))
return [all,des,ans]
#------------------------------------------------------------------------
#

View File

@@ -21,6 +21,7 @@
"Export to GEDCOM"
from RelLib import *
import GenericFilter
import os
import string
import time
@@ -62,113 +63,6 @@ _calmap = {
Date.JULIAN : (_month, '@#JULIAN@'),
}
#-------------------------------------------------------------------------
#
# Filters
#
#-------------------------------------------------------------------------
def entire_database(database,person,private):
plist = database.getPersonMap().values()
flist = database.getFamilyMap().values()
slist = database.getSourceMap().values()
return (plist,flist,slist)
def active_person_descendants(database,person,private):
plist = []
flist = []
slist = []
descend(person,plist,flist,slist,private)
return (plist,flist,slist)
def active_person_ancestors_and_descendants(database,person,private):
plist = []
flist = []
slist = []
descend(person,plist,flist,slist,private)
ancestors(person,plist,flist,slist,private)
return (plist,flist,slist)
def active_person_ancestors(database,person,private):
plist = []
flist = []
slist = []
ancestors(person,plist,flist,slist,private)
return (plist,flist,slist)
def interconnected(database,person,private):
plist = []
flist = []
slist = []
walk(person,plist,flist,slist,private)
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def descend(person,plist,flist,slist,private):
if person == None or person in plist:
return
plist.append(person)
add_persons_sources(person,slist,private)
for family in person.getFamilyList():
add_familys_sources(family,slist,private)
flist.append(family)
father = family.getFather()
mother = family.getMother()
if father != None and father not in plist:
plist.append(father)
add_persons_sources(father,slist,private)
if mother != None and mother not in plist:
plist.append(mother)
add_persons_sources(mother,slist,private)
for child in family.getChildList():
descend(child,plist,flist,slist,private)
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def ancestors(person,plist,flist,slist,private):
if person == None or person in plist:
return
plist.append(person)
add_persons_sources(person,slist,private)
family = person.getMainParents()
if family == None or family in flist:
return
add_familys_sources(family,slist,private)
flist.append(family)
ancestors(family.getMother(),plist,flist,slist,private)
ancestors(family.getFather(),plist,flist,slist,private)
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def walk(person,plist,flist,slist,private):
if person == None or person in plist:
return
plist.append(person)
add_persons_sources(person,slist,private)
families = person.getFamilyList()
families.append(person.getMainParents())
for f in person.getParentList():
families.append(f[0])
for family in families:
if family == None or family in flist:
continue
add_familys_sources(family,slist,private)
flist.append(family)
walk(family.getFather(),plist,flist,slist,private)
walk(family.getMother(),plist,flist,slist,private)
for child in family.getChildList():
walk(child,plist,flist,slist,private)
#-------------------------------------------------------------------------
#
#
@@ -417,8 +311,6 @@ class GedcomWriter:
filter_obj = self.topDialog.get_widget("filter")
myMenu = gtk.GtkMenu()
import GenericFilter
all = GenericFilter.GenericFilter()
all.set_name(_("Entire Database"))
all.add_rule(GenericFilter.Everyone([]))
@@ -475,7 +367,6 @@ class GedcomWriter:
self.obje = self.target_ged.get_obje()
self.resi = self.target_ged.get_resi()
if self.topDialog.get_widget("ansel").get_active():
self.cnvtxt = latin_to_ansel
else:

View File

@@ -414,161 +414,16 @@
</widget>
</widget>
<widget>
<class>GnomeDialog</class>
<name>filter_file</name>
<title>Complex Filter - GRAMPS</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position>
<modal>False</modal>
<allow_shrink>False</allow_shrink>
<allow_grow>True</allow_grow>
<auto_shrink>False</auto_shrink>
<auto_close>False</auto_close>
<hide_on_close>False</hide_on_close>
<widget>
<class>GtkVBox</class>
<child_name>GnomeDialog:vbox</child_name>
<name>dialog-vbox4</name>
<homogeneous>False</homogeneous>
<spacing>8</spacing>
<child>
<padding>4</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkHButtonBox</class>
<child_name>GnomeDialog:action_area</child_name>
<name>dialog-action_area4</name>
<layout_style>GTK_BUTTONBOX_END</layout_style>
<spacing>8</spacing>
<child_min_width>85</child_min_width>
<child_min_height>27</child_min_height>
<child_ipad_x>7</child_ipad_x>
<child_ipad_y>0</child_ipad_y>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
<pack>GTK_PACK_END</pack>
</child>
<widget>
<class>GtkButton</class>
<name>button22</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_load_filter</handler>
<object>filter_file</object>
<last_modification_time>Sun, 28 Oct 2001 22:46:35 GMT</last_modification_time>
</signal>
<stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
</widget>
<widget>
<class>GtkButton</class>
<name>button24</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>destroy_passed_object</handler>
<object>filter_file</object>
<last_modification_time>Sun, 28 Oct 2001 22:46:21 GMT</last_modification_time>
</signal>
<stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
</widget>
</widget>
<widget>
<class>GtkVBox</class>
<name>vbox6</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>title</name>
<label>Save complex filter as:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>5</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkHSeparator</class>
<name>hseparator2</name>
<child>
<padding>5</padding>
<expand>True</expand>
<fill>True</fill>
</child>
</widget>
<widget>
<class>GtkCombo</class>
<name>filter_combo</name>
<width>350</width>
<value_in_list>False</value_in_list>
<ok_if_empty>True</ok_if_empty>
<case_sensitive>False</case_sensitive>
<use_arrows>True</use_arrows>
<use_arrows_always>False</use_arrows_always>
<items></items>
<child>
<padding>15</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<widget>
<class>GtkEntry</class>
<child_name>GtkCombo:entry</child_name>
<name>name</name>
<can_focus>True</can_focus>
<signal>
<name>insert_text</name>
<handler>combo_insert_text</handler>
<object>filter_combo</object>
<last_modification_time>Sun, 28 Oct 2001 21:27:05 GMT</last_modification_time>
</signal>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
</widget>
</widget>
</widget>
</widget>
</widget>
<widget>
<class>GnomeDialog</class>
<name>filters</name>
<width>350</width>
<title>Event Comparison - GRAMPS</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position>
<modal>False</modal>
<allow_shrink>False</allow_shrink>
<allow_grow>True</allow_grow>
<allow_grow>False</allow_grow>
<auto_shrink>False</auto_shrink>
<auto_close>False</auto_close>
<hide_on_close>False</hide_on_close>
@@ -638,14 +493,14 @@
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<expand>False</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>title</name>
<label>Event Comparison - Create a complex filter</label>
<label>Event Comparison</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
@@ -664,294 +519,52 @@
<name>hseparator3</name>
<child>
<padding>5</padding>
<expand>True</expand>
<expand>False</expand>
<fill>True</fill>
</child>
</widget>
</widget>
<widget>
<class>GtkHBox</class>
<name>hbox2</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>label8</name>
<label>Filter</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>5</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkTable</class>
<name>table1</name>
<rows>3</rows>
<columns>2</columns>
<homogeneous>False</homogeneous>
<row_spacing>0</row_spacing>
<column_spacing>0</column_spacing>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>label8</name>
<label>Filter</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>5</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>10</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkOptionMenu</class>
<name>filter_list</name>
<can_focus>True</can_focus>
<items>
<class>GtkOptionMenu</class>
<name>filter_list</name>
<can_focus>True</can_focus>
<items>
</items>
<initial_choice>0</initial_choice>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>4</xpad>
<ypad>4</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>qualifier</name>
<width>480</width>
<sensitive>False</sensitive>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>4</xpad>
<ypad>4</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label9</name>
<label>Qualifier</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>5</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>4</xpad>
<ypad>10</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>False</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkCheckButton</class>
<name>invert</name>
<can_focus>True</can_focus>
<label>Invert</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
</widget>
<widget>
<class>GtkScrolledWindow</class>
<name>scrolledwindow2</name>
<hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<initial_choice>0</initial_choice>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkCList</class>
<name>active_filters</name>
<width>450</width>
<height>150</height>
<can_focus>True</can_focus>
<signal>
<name>select_row</name>
<handler>on_select_row</handler>
<last_modification_time>Mon, 12 Mar 2001 02:11:13 GMT</last_modification_time>
</signal>
<columns>3</columns>
<column_widths>280,132,80</column_widths>
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
<show_titles>True</show_titles>
<shadow_type>GTK_SHADOW_IN</shadow_type>
<widget>
<class>GtkLabel</class>
<child_name>CList:title</child_name>
<name>label5</name>
<label>Filter</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>CList:title</child_name>
<name>label6</name>
<label>Qualifier</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>CList:title</child_name>
<name>label7</name>
<label>Invert</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
</widget>
</widget>
<widget>
<class>GtkHButtonBox</class>
<name>hbuttonbox3</name>
<layout_style>GTK_BUTTONBOX_SPREAD</layout_style>
<spacing>30</spacing>
<child_min_width>85</child_min_width>
<child_min_height>27</child_min_height>
<child_ipad_x>7</child_ipad_x>
<child_ipad_y>0</child_ipad_y>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkButton</class>
<name>button8</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_add_clicked</handler>
<object>filters</object>
<last_modification_time>Wed, 07 Mar 2001 02:55:00 GMT</last_modification_time>
</signal>
<label>Add Filter</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
<widget>
<class>GtkButton</class>
<name>button9</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_delete_clicked</handler>
<object>filters</object>
<last_modification_time>Wed, 07 Mar 2001 02:55:12 GMT</last_modification_time>
</signal>
<label>Delete Filter</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
<widget>
<class>GtkButton</class>
<name>button17</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_filter_load_clicked</handler>
<last_modification_time>Sun, 28 Oct 2001 21:28:30 GMT</last_modification_time>
</signal>
<label>Load Filters</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
<widget>
<class>GtkButton</class>
<name>button18</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_filter_save_clicked</handler>
<object>filters</object>
<last_modification_time>Sun, 18 Mar 2001 13:52:32 GMT</last_modification_time>
</signal>
<label>Save Filters</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
</widget>
</widget>
</widget>