Updated custom filter editor

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

View File

@ -455,9 +455,9 @@ class EditPerson:
def set_lds_seal(self,obj):
self.seal_stat = obj.get_data("val")
def ev_drag_data_received(self,widget,context,x,y,selection_data,info,time):
if selection_data and selection_data.data:
exec 'data = %s' % selection_data.data
def ev_drag_data_received(self,widget,context,x,y,sel_data,info,time):
if sel_data and sel_data.data:
exec 'data = %s' % sel_data.data
exec 'mytype = "%s"' % data[0]
exec 'person = "%s"' % data[1]
if person == self.person.getId() or mytype != 'pevent':
@ -474,17 +474,17 @@ class EditPerson:
self.lists_changed = 1
self.redraw_event_list()
def ev_drag_data_get(self,widget, context, selection_data, info, time):
def ev_drag_data_get(self,widget, context, sel_data, info, time):
ev = widget.get_row_data(widget.focus_row)
bits_per = 8; # we're going to pass a string
pickled = pickle.dumps(ev);
data = str(('pevent',self.person.getId(),pickled));
selection_data.set(selection_data.target, bits_per, data)
sel_data.set(sel_data.target, bits_per, data)
def url_drag_data_received(self,widget,context,x,y,selection_data,info,time):
if selection_data and selection_data.data:
exec 'data = %s' % selection_data.data
def url_drag_data_received(self,widget,context,x,y,sel_data,info,time):
if sel_data and sel_data.data:
exec 'data = %s' % sel_data.data
exec 'mytype = "%s"' % data[0]
exec 'person = "%s"' % data[1]
if person == self.person.getId() or mytype != 'url':
@ -494,17 +494,17 @@ class EditPerson:
self.lists_changed = 1
self.redraw_url_list()
def url_drag_data_get(self,widget, context, selection_data, info, time):
def url_drag_data_get(self,widget, context, sel_data, info, time):
ev = widget.get_row_data(widget.focus_row)
bits_per = 8; # we're going to pass a string
pickled = pickle.dumps(ev);
data = str(('url',self.person.getId(),pickled));
selection_data.set(selection_data.target, bits_per, data)
sel_data.set(sel_data.target, bits_per, data)
def at_drag_data_received(self,widget,context,x,y,selection_data,info,time):
if selection_data and selection_data.data:
exec 'data = %s' % selection_data.data
def at_drag_data_received(self,widget,context,x,y,sel_data,info,time):
if sel_data and sel_data.data:
exec 'data = %s' % sel_data.data
exec 'mytype = "%s"' % data[0]
exec 'person = "%s"' % data[1]
if person == self.person.getId() or mytype != 'pattr':
@ -518,17 +518,17 @@ class EditPerson:
self.lists_changed = 1
self.redraw_attr_list()
def at_drag_data_get(self,widget, context, selection_data, info, time):
def at_drag_data_get(self,widget, context, sel_data, info, time):
ev = widget.get_row_data(widget.focus_row)
bits_per = 8; # we're going to pass a string
pickled = pickle.dumps(ev);
data = str(('pattr',self.person.getId(),pickled));
selection_data.set(selection_data.target, bits_per, data)
sel_data.set(sel_data.target, bits_per, data)
def ad_drag_data_received(self,widget,context,x,y,selection_data,info,time):
if selection_data and selection_data.data:
exec 'data = %s' % selection_data.data
def ad_drag_data_received(self,widget,context,x,y,sel_data,info,time):
if sel_data and sel_data.data:
exec 'data = %s' % sel_data.data
exec 'mytype = "%s"' % data[0]
exec 'person = "%s"' % data[1]
if person == self.person.getId() or mytype != 'paddr':
@ -542,13 +542,13 @@ class EditPerson:
self.lists_changed = 1
self.redraw_addr_list()
def ad_drag_data_get(self,widget, context, selection_data, info, time):
def ad_drag_data_get(self,widget, context, sel_data, info, time):
ev = widget.get_row_data(widget.focus_row)
bits_per = 8; # we're going to pass a string
pickled = pickle.dumps(ev);
data = str(('paddr',self.person.getId(),pickled));
selection_data.set(selection_data.target, bits_per, data)
sel_data.set(sel_data.target, bits_per, data)
def menu_changed(self,obj):
self.ldsfam = obj.get_data("f")
@ -1012,8 +1012,8 @@ class EditPerson:
item = gtk.GtkTearoffMenuItem()
item.show()
menu.append(item)
Utils.add_menuitem(menu,_("Make the selected name the preferred name"),
None,self.change_name)
msg = _("Make the selected name the preferred name")
Utils.add_menuitem(menu,msg,None,self.change_name)
menu.popup(None,None,None,0,0)
def on_aka_update_clicked(self,obj):
@ -1029,7 +1029,8 @@ class EditPerson:
else:
try:
i = GdkImlib.Image(photo)
scale = float(const.picWidth)/float(max(i.rgb_height,i.rgb_width))
ratio = float(max(i.rgb_height,i.rgb_width))
scale = float(const.picWidth)/ratio
x = int(scale*(i.rgb_width))
y = int(scale*(i.rgb_height))
i = i.clone_scaled_image(x,y)
@ -1177,9 +1178,10 @@ class EditPerson:
Utils.modified()
if error == 1:
msg = _("Changing the gender caused problems with marriage information.")
msg2 = _("Please check the person's marriages.")
GnomeErrorDialog("%s\n%s" % (msg,msg2))
msg = _("Changing the gender caused problems "
"with marriage information.\nPlease check "
"the person's marriages.")
GnomeErrorDialog(msg)
text = self.notes_field.get_chars(0,-1)
if text != self.person.getNote():
@ -1195,7 +1197,8 @@ class EditPerson:
temple = ""
ord = self.person.getLdsBaptism()
place = self.get_place(self.ldsbapplace,1)
update_ord(self.person.setLdsBaptism,ord,date,temple,self.bap_stat,place)
update_ord(self.person.setLdsBaptism,ord,date,
temple,self.bap_stat,place)
date = self.ldsend_date.get_text()
temple = self.ldsend_temple.entry.get_text()
@ -1205,7 +1208,8 @@ class EditPerson:
temple = ""
ord = self.person.getLdsEndowment()
place = self.get_place(self.ldsendowplace,1)
update_ord(self.person.setLdsEndowment,ord,date,temple,self.end_stat,place)
update_ord(self.person.setLdsEndowment,ord,date,
temple,self.end_stat,place)
date = self.ldsseal_date.get_text()
temple = self.ldsseal_temple.entry.get_text()
@ -1359,7 +1363,8 @@ class EditPerson:
def write_primary_name(self):
# initial values
self.get_widget("activepersonTitle").set_text(GrampsCfg.nameof(self.person))
name = GrampsCfg.nameof(self.person)
self.get_widget("activepersonTitle").set_text(name)
self.suffix.set_text(self.pname.getSuffix())
self.surname_field.set_text(self.pname.getSurname())

View File

@ -39,7 +39,7 @@ except:
#-------------------------------------------------------------------------
import types
import os
from string import find,join
from string import find,join,strip,replace
#-------------------------------------------------------------------------
#
@ -48,6 +48,8 @@ from string import find,join
#-------------------------------------------------------------------------
from RelLib import *
import Date
from intl import gettext
_ = gettext
#-------------------------------------------------------------------------
#
@ -82,6 +84,9 @@ class Rule:
def values(self):
return self.list
def trans_name(self):
return _(self.name())
def name(self):
return 'None'
@ -123,7 +128,7 @@ class Everyone(Rule):
class HasIdOf(Rule):
"""Rule that checks for a person with a specific GID"""
labels = [ 'ID' ]
labels = [ _('ID') ]
def name(self):
return 'Has the Id'
@ -156,7 +161,7 @@ class IsDescendantOf(Rule):
"""Rule that checks for a person that is a descendant
of a specified person"""
labels = ['ID']
labels = [ _('ID') ]
def name(self):
return 'Is a descendant of'
@ -182,7 +187,7 @@ class IsDescendantOf(Rule):
class IsAncestorOf(Rule):
"""Rule that checks for a person that is an ancestor of a specified person"""
labels = ['ID']
labels = [ _('ID') ]
def name(self):
return 'Is an ancestor of'
@ -225,7 +230,7 @@ class IsMale(Rule):
class HasEvent(Rule):
"""Rule that checks for a person with a particular value"""
labels = [ 'Event', 'Date', 'Place', 'Description' ]
labels = [ _('Personal Event'), _('Date'), _('Place'), _('Description') ]
def __init__(self,list):
Rule.__init__(self,list)
@ -236,19 +241,114 @@ class HasEvent(Rule):
self.date = None
def name(self):
return 'Has the event'
return 'Has the personal event'
def apply(self,p):
for event in p.getEventList():
val = 1
if self.list[0] and event.getName() != self.list[0]:
return 0
val = 0
if self.list[3] and find(event.getDescription(),self.list[3])==-1:
return 0
val = 0
if self.date:
return date_cmp(self.date,event.getDateObj())
if date_cmp(self.date,event.getDateObj()):
val = 0
if self.list[2] and find(p.getPlaceName(),self.list[2]) == -1:
val = 0
if val == 1:
return 1
return 0
#-------------------------------------------------------------------------
#
# HasFamilyEvent
#
#-------------------------------------------------------------------------
class HasFamilyEvent(Rule):
"""Rule that checks for a person who has a relationship event
with a particular value"""
labels = [ _('Family Event'), _('Date'), _('Place'), _('Description') ]
def __init__(self,list):
Rule.__init__(self,list)
if self.list[0]:
self.date = Date.Date()
self.date.set(self.list[0])
else:
self.date = None
def name(self):
return 'Has the family event'
def apply(self,p):
for f in p.getFamilyList():
for event in f.getEventList():
val = 1
if self.list[0] and event.getName() != self.list[0]:
val = 0
v = self.list[3]
if v and find(event.getDescription(),v)==-1:
val = 0
if self.date:
if date_cmp(self.date,event.getDateObj()):
val = 0
if self.list[2] and find(p.getPlaceName(),self.list[2]) == -1:
val = 0
if val == 1:
return 1
return 0
#-------------------------------------------------------------------------
#
# HasRelationship
#
#-------------------------------------------------------------------------
class HasRelationship(Rule):
"""Rule that checks for a person who has a particular relationship"""
labels = [ _('Number of Relationships'),
_('Relationship Type'),
_('Number of Children') ]
def name(self):
return 'Has the relationships'
def apply(self,p):
rel_type = 0
cnt = 0
num_rel = len(p.getFamilyList())
# count children and look for a relationship type match
for f in p.getFamilyList():
cnt = cnt + len(f.getChildList())
if self.list[1] and f.getRelationship() == self.list[1]:
rel_type = 1
rval = 0
# if number of relations specified
if self.list[0]:
try:
v = int(self.list[0])
except:
return 0
return 1
if v != num_rel:
return 0
# number of childred
if self.list[2]:
try:
v = int(self.list[2])
except:
return 0
if v != cnt:
return 0
# relation
if self.list[1]:
return rel_type == 1
else:
return 1
#-------------------------------------------------------------------------
#
@ -258,7 +358,7 @@ class HasEvent(Rule):
class HasBirth(Rule):
"""Rule that checks for a person with a birth of a particular value"""
labels = [ 'Date', 'Place', 'Description' ]
labels = [ _('Date'), _('Place'), _('Description') ]
def __init__(self,list):
Rule.__init__(self,list)
@ -276,7 +376,8 @@ class HasBirth(Rule):
if self.list[2] and find(event.getDescription(),self.list[2])==-1:
return 0
if self.date:
return date_cmp(self.date,event.getDateObj())
if date_cmp(self.date,event.getDateObj()) == 0:
return 0
if self.list[1] and find(p.getPlaceName(),self.list[1]) == -1:
return 0
return 1
@ -289,7 +390,7 @@ class HasBirth(Rule):
class HasDeath(Rule):
"""Rule that checks for a person with a death of a particular value"""
labels = [ 'Date', 'Place', 'Description' ]
labels = [ _('Date'), _('Place'), _('Description') ]
def __init__(self,list):
Rule.__init__(self,list)
@ -307,7 +408,8 @@ class HasDeath(Rule):
if self.list[2] and find(event.getDescription(),self.list[2])==-1:
return 0
if self.date:
date_cmp(self.date,event.getDateObj())
if date_cmp(self.date,event.getDateObj()) == 0:
return 0
if self.list[1] and find(p.getPlaceName(),self.list[1]) == -1:
return 0
return 1
@ -318,12 +420,12 @@ class HasDeath(Rule):
#
#-------------------------------------------------------------------------
class HasAttribute(Rule):
"""Rule that checks for a person with a particular attribute"""
"""Rule that checks for a person with a particular personal attribute"""
labels = [ 'Attribute', 'Value' ]
labels = [ _('Personal Attribute'), _('Value') ]
def name(self):
return 'Has the attribute'
return 'Has the personal attribute'
def apply(self,p):
for event in p.getAttributes():
@ -333,6 +435,31 @@ class HasAttribute(Rule):
return 0
return 1
#-------------------------------------------------------------------------
#
# HasFamilyAttribute
#
#-------------------------------------------------------------------------
class HasFamilyAttribute(Rule):
"""Rule that checks for a person with a particular family attribute"""
labels = [ _('Family Attribute'), _('Value') ]
def name(self):
return 'Has the family attribute'
def apply(self,p):
for f in p.getFamilyList():
for event in f.getAttributes():
val = 1
if self.list[0] and event.getType() != self.list[0]:
val = 0
if self.list[1] and find(event.getValue(),self.list[1])==-1:
val = 0
if val == 1:
return 1
return 0
#-------------------------------------------------------------------------
#
# HasNameOf
@ -341,7 +468,7 @@ class HasAttribute(Rule):
class HasNameOf(Rule):
"""Rule that checks for full or partial name matches"""
labels = ['Given Name','Surname','Suffix','Title']
labels = [_('Given Name'),_('Surname'),_('Suffix'),_('Title')]
def name(self):
return 'Has a name'
@ -352,15 +479,18 @@ class HasNameOf(Rule):
self.s = self.list[2]
self.t = self.list[3]
for name in [p.getPrimaryName()] + p.getAlternateNames():
val = 1
if self.f and find(name.getFirstName(),self.f) == -1:
return 0
val = 0
if self.l and find(name.getSurname(),self.l) == -1:
return 0
val = 0
if self.s and find(name.getSuffix(),self.s) == -1:
return 0
val = 0
if self.t and find(name.getTitle(),self.t) == -1:
return 0
return 1
val = 0
if val == 1:
return 1
return 0
#-------------------------------------------------------------------------
#
@ -417,17 +547,20 @@ class GenericFilter:
#
#-------------------------------------------------------------------------
tasks = {
"Everyone" : Everyone,
"Has the Id" : HasIdOf,
"Has a name" : HasNameOf,
"Has the death" : HasDeath,
"Has the birth" : HasBirth,
"Is the descendant of" : IsDescendantOf,
"Is an ancestor of" : IsAncestorOf,
"Is a female" : IsFemale,
"Is a male" : IsMale,
"Has the event" : HasEvent,
"Has the attribute" : HasAttribute,
_("Everyone") : Everyone,
_("Has the Id") : HasIdOf,
_("Has a name") : HasNameOf,
_("Has the relationships") : HasRelationship,
_("Has the death") : HasDeath,
_("Has the birth") : HasBirth,
_("Is the descendant of") : IsDescendantOf,
_("Is an ancestor of") : IsAncestorOf,
_("Is a female") : IsFemale,
_("Is a male") : IsMale,
_("Has the personal event") : HasEvent,
_("Has the family event") : HasFamilyEvent,
_("Has the personal attribute") : HasAttribute,
_("Has the family attribute") : HasFamilyAttribute,
}
#-------------------------------------------------------------------------
@ -457,6 +590,13 @@ class GenericFilterList:
except (IOError,OSError,SAXParseException):
pass
def fix(self,line):
l = strip(line)
l = replace(l,'&','&')
l = replace(l,'>','>')
l = replace(l,'<','&lt;')
return replace(l,'"','&quot;')
def save(self):
try:
f = open(self.file,'w')
@ -466,15 +606,15 @@ class GenericFilterList:
f.write("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n")
f.write('<filters>\n')
for i in self.filter_list:
f.write(' <filter name="%s"' % i.get_name())
f.write(' <filter name="%s"' % self.fix(i.get_name()))
comment = i.get_comment()
if comment:
f.write(' comment="%s"' % comment)
f.write(' comment="%s"' % self.fix(comment))
f.write('>\n')
for rule in i.get_rules():
f.write(' <rule class="%s">\n' % rule.name())
f.write(' <rule class="%s">\n' % self.fix(rule.name()))
for v in rule.values():
f.write(' <arg value="%s"/>\n' % v)
f.write(' <arg value="%s"/>\n' % self.fix(v))
f.write(' </rule>\n')
f.write(' </filter>\n')
f.write('</filters>\n')

View File

@ -872,7 +872,6 @@ class Url:
if self.desc != other.desc:
return 0
return 1
class Person:
"""Represents an individual person in the gramps database"""

View File

@ -25,8 +25,10 @@ import const
import os
import string
import Utils
import intl
import Plugins
import GenericFilter
import intl
_ = intl.gettext
@ -258,11 +260,11 @@ class ReportDialog:
is the name of menu item to pre-select."""
return (None, None)
def get_report_filter_strings(self):
def get_report_filters(self):
"""Return the data used to fill out the 'filter' combo box in
the report options box. The return value is the list of
strings to be inserted into the pulldown."""
return None
return []
def get_report_generations(self):
"""Return the default number of generations to start the
@ -624,12 +626,14 @@ class ReportDialog:
self.template_combo.entry.set_editable(0)
self.template_combo.entry.connect('changed',self.html_file_enable)
table.attach(self.template_combo,1,2,0,1,FILL|EXPAND,FILL|EXPAND,pad,pad)
table.attach(GtkLabel(_("User Template")),0,1,1,2,FILL,FILL,pad,pad)
table.attach(self.template_combo,1,2,0,1,
FILL|EXPAND,FILL|EXPAND,pad,pad)
table.attach(GtkLabel(_("User Template")),0,1,1,2,
FILL,FILL,pad,pad)
self.html_fileentry = GnomeFileEntry(_("HTML Template"),_("Choose File"))
self.html_fileentry.set_sensitive(0)
table.attach(self.html_fileentry,1,2,1,2,FILL|EXPAND,FILL|EXPAND,pad,pad)
table.attach(self.html_fileentry,1,2,1,2,
FILL|EXPAND,FILL|EXPAND,pad,pad)
def setup_report_options_frame(self):
"""Set up the report options frame of the dialog. This
@ -640,7 +644,7 @@ class ReportDialog:
(but not all) dialog boxes."""
(use_gen, use_break) = self.get_report_generations()
filter_strings = self.get_report_filter_strings()
local_filter = self.get_report_filters()
(em_label, extra_map, preset, em_tip) = self.get_report_extra_menu_info()
(et_label, string, et_tip) = self.get_report_extra_textbox_info()
@ -650,7 +654,7 @@ class ReportDialog:
max_rows = max_rows + 1
if use_break:
max_rows = max_rows + 1
if filter_strings:
if len(local_filter):
max_rows = max_rows + 1
if extra_map:
max_rows = max_rows + 1
@ -669,14 +673,24 @@ class ReportDialog:
frame.add(table)
pad = ReportDialog.border_pad
if filter_strings:
self.filter_combo = GtkCombo()
if len(local_filter):
myMenu = GtkMenu()
self.filter_combo = GtkOptionMenu()
l = GtkLabel(_("Filter"))
l.set_alignment(1.0,0.5)
table.attach(l,0,1,row,row+1,FILL,FILL,pad,pad)
table.attach(self.filter_combo,1,2,row,row+1,xpadding=pad,ypadding=pad)
filter_strings.sort()
self.filter_combo.set_popdown_strings(filter_strings)
table.attach(self.filter_combo,1,2,row,row+1,
xpadding=pad,ypadding=pad)
flist = GenericFilter.GenericFilterList(const.custom_filters)
flist.load()
for f in local_filter + flist.get_filters():
menuitem = gtk.GtkMenuItem(_(f.get_name()))
myMenu.append(menuitem)
menuitem.set_data("filter",f)
menuitem.show()
self.filter_combo.set_menu(myMenu)
self.filter_menu = myMenu
row = row + 1
# Set up the generations spin and page break checkbox
@ -689,12 +703,15 @@ class ReportDialog:
l = GtkLabel(_("Generations"))
l.set_alignment(1.0,0.5)
table.attach(l,0,1,row,row+1,FILL,FILL,pad,pad)
table.attach(self.generations_spinbox,1,2,row,row+1,xpadding=pad,ypadding=pad)
table.attach(self.generations_spinbox,1,2,row,row+1,
xpadding=pad,ypadding=pad)
row = row + 1
if use_break:
self.pagebreak_checkbox = GtkCheckButton(_("Page break between generations"))
table.attach(self.pagebreak_checkbox,1,2,row,row+1,xpadding=pad,ypadding=pad)
msg = _("Page break between generations")
self.pagebreak_checkbox = GtkCheckButton(msg)
table.attach(self.pagebreak_checkbox,1,2,row,row+1,
xpadding=pad,ypadding=pad)
row = row + 1
# Now the "extra" option menu
@ -706,8 +723,10 @@ class ReportDialog:
self.extra_menu.set_menu(myMenu)
self.extra_menu.set_sensitive(len(extra_map) > 1)
self.add_tooltip(self.extra_menu,em_tip)
table.attach(self.extra_menu_label,0,1,row,row+1,FILL,FILL,pad,pad)
table.attach(self.extra_menu,1,2,row,row+1,xpadding=pad,ypadding=pad)
table.attach(self.extra_menu_label,0,1,row,row+1,
FILL,FILL,pad,pad)
table.attach(self.extra_menu,1,2,row,row+1,
xpadding=pad,ypadding=pad)
row = row + 1
# Now the "extra" text box
@ -746,12 +765,14 @@ class ReportDialog:
row = 0
for (text,widget) in list:
if text == None:
table.attach(widget,0,2,row,row+1,xpadding=pad,ypadding=pad)
table.attach(widget,0,2,row,row+1,
xpadding=pad,ypadding=pad)
else:
text_widget = GtkLabel(text)
text_widget.set_alignment(1.0,0)
table.attach(text_widget,0,1,row,row+1,FILL,FILL,pad,pad)
table.attach(widget,1,2,row,row+1,xpadding=pad,ypadding=pad)
table.attach(widget,1,2,row,row+1,
xpadding=pad,ypadding=pad)
row = row + 1
#------------------------------------------------------------------------
@ -832,9 +853,9 @@ class ReportDialog:
self.pg_brk = 0
if self.filter_combo:
self.filter = self.filter_combo.entry.get_text()
self.filter = self.filter_menu.get_active().get_data("filter")
else:
self.filter = ""
self.filter = None
if self.extra_menu:
self.report_menu = self.extra_menu.get_menu().get_active().get_data("d")

View File

@ -91,10 +91,12 @@ startup = 1
#
#-------------------------------------------------------------------------
progName = "gramps"
version = "0.7.3-snap20020330"
version = "0.7.3-snap20020406"
copyright = "© 2001 Donald N. Allingham"
authors = ["Donald N. Allingham", "David Hampton","Donald A. Peterson"]
comments = _("GRAMPS (Genealogical Research and Analysis Management Programming System) is a personal genealogy program.")
comments = _("GRAMPS (Genealogical Research and Analysis "
"Management Programming System) is a personal "
"genealogy program.")
#-------------------------------------------------------------------------
#

View File

@ -45,7 +45,7 @@ _top = [
' <TITLE>\n',
' </TITLE>\n',
' <STYLE type="text/css">\n',
' <!--\n',
' <!--\n',
' BODY { background-color: #ffffff }\n',
' .parent_name { font-family: Arial; font-style: bold }\n',
' .child_name { font-family: Arial; font-style: bold }\n',
@ -174,10 +174,10 @@ class HtmlDoc(TextDoc):
left = 'thin solid #000000'
if style.get_right_border():
right = 'thin solid #000000'
text.append('.%s {\n' \
'\tpadding: %s %s %s %s;\n' \
'\tborder-top:%s; border-bottom:%s;\n' \
'\tborder-left:%s; border-right:%s;\n}' \
text.append('.%s {\n'
'\tpadding: %s %s %s %s;\n'
'\tborder-top:%s; border-bottom:%s;\n'
'\tborder-left:%s; border-right:%s;\n}'
% (key, pad, pad, pad, pad, top, bottom, left, right))
for key in self.style_list.keys():
@ -210,13 +210,13 @@ class HtmlDoc(TextDoc):
else:
family = '"Times New Roman","Times","serif"'
text.append('.%s {\n' \
'\tfont-size: %dpt; color: %s;\n' \
'\ttext-align: %s; text-indent: %scm;\n' \
'\tmargin-right: %scm; margin-left: %scm;\n' \
'\tborder-top:%s; border-bottom:%s;\n' \
'\tborder-left:%s; border-right:%s;\n' \
'\t%s%sfont-family:%s;\n}' \
text.append('.%s {\n'
'\tfont-size: %dpt; color: %s;\n'
'\ttext-align: %s; text-indent: %scm;\n'
'\tmargin-right: %scm; margin-left: %scm;\n'
'\tborder-top:%s; border-bottom:%s;\n'
'\tborder-left:%s; border-right:%s;\n'
'\t%s%sfont-family:%s;\n}'
% (key, font_size, font_color,
align, text_indent,
right_margin, left_margin,
@ -233,9 +233,7 @@ class HtmlDoc(TextDoc):
def add_photo(self,name,pos,x,y):
self.empty = 0
size = int(max(x,y) * float(150.0/2.54))
refname = "is%s" % os.path.basename(name)
if self.image_dir:

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>

File diff suppressed because it is too large Load Diff

View File

@ -504,7 +504,7 @@
<widget>
<class>GtkFrame</class>
<name>values</name>
<width>300</width>
<width>425</width>
<height>200</height>
<label>Values</label>
<label_xalign>0</label_xalign>
@ -726,6 +726,102 @@
<label>Delete</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
<widget>
<class>GtkButton</class>
<name>button7</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_test_clicked</handler>
<last_modification_time>Sat, 06 Apr 2002 18:34:08 GMT</last_modification_time>
</signal>
<label>Test</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
</widget>
</widget>
</widget>
</widget>
<widget>
<class>GnomeDialog</class>
<name>test</name>
<title>Test 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>button9</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_close_clicked</handler>
<last_modification_time>Sat, 06 Apr 2002 19:05:56 GMT</last_modification_time>
</signal>
<stock_button>GNOME_STOCK_BUTTON_CLOSE</stock_button>
</widget>
</widget>
<widget>
<class>GtkScrolledWindow</class>
<name>scrolledwindow3</name>
<hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkText</class>
<name>text</name>
<width>350</width>
<height>250</height>
<can_focus>True</can_focus>
<editable>False</editable>
<text></text>
</widget>
</widget>
</widget>