2006-06-02 Don Allingham <don@gramps-project.org>

* src/FilterEditor/_EditFilter.py: clean up
	* src/FilterEditor/_EditRule.py: clean up
	* src/glade/rule.glade: clean up
	* src/Filters/Rules/Person/_IsDescendantFamilyOf.py: make current with RelLib

	* src/Filters/Rules/Person/_HasFamilyEvent.py: make current with RelLib

	* src/Filters/Rules/Person/_IsParentOfFilterMatch.py: make current with RelLib

	* src/Filters/Rules/Person/_FamilyWithIncompleteEvent.py: make current with RelLib

	* src/Filters/Rules/Person/_IsBookmarked.py: make current with RelLib

	* src/Filters/Rules/Person/_IsLessThanNthGenerationAncestorOfBookmarked.py:
	make current with RelLib



svn: r6849
This commit is contained in:
Don Allingham 2006-06-02 22:18:57 +00:00
parent 6d06dfbbc3
commit 20aa297a21
10 changed files with 57 additions and 27 deletions

View File

@ -1,3 +1,20 @@
2006-06-02 Don Allingham <don@gramps-project.org>
* src/FilterEditor/_EditFilter.py: clean up
* src/FilterEditor/_EditRule.py: clean up
* src/glade/rule.glade: clean up
* src/Filters/Rules/Person/_IsDescendantFamilyOf.py: make current with RelLib
* src/Filters/Rules/Person/_HasFamilyEvent.py: make current with RelLib
* src/Filters/Rules/Person/_IsParentOfFilterMatch.py: make current with RelLib
* src/Filters/Rules/Person/_FamilyWithIncompleteEvent.py: make current with RelLib
* src/Filters/Rules/Person/_IsBookmarked.py: make current with RelLib
* src/Filters/Rules/Person/_IsLessThanNthGenerationAncestorOfBookmarked.py:
make current with RelLib
2006-06-01 Don Allingham <don@gramps-project.org>
* src/Filters/Rules/Person/_HaveAltFamilies.py: bring up to speed with
RelLib changes

View File

@ -102,15 +102,17 @@ class EditFilter(ManagedWindow.ManagedWindow):
self.ok = self.glade.get_widget('ok')
self.edit_btn = self.glade.get_widget('edit')
self.del_btn = self.glade.get_widget('delete')
self.glade.signal_autoconnect({
'on_ok_clicked' : self.on_ok_clicked,
'on_cancel_clicked' : self.close_window,
'on_filter_name_changed' : self.filter_name_changed,
'on_add_clicked' : self.on_add_clicked,
"on_help_filtdef_clicked" : self.on_help_clicked,
'on_edit_clicked' : self.on_edit_clicked,
})
self.add_btn = self.glade.get_widget('add')
self.ok.connect('clicked', self.on_ok_clicked)
self.edit_btn.connect('clicked', self.on_edit_clicked)
self.del_btn.connect('clicked', self.on_delete_clicked)
self.add_btn.connect('clicked', self.on_add_clicked)
self.glade.get_widget('help').('clicked', self.on_help_clicked)
self.glade.get_widget('cancel').('clicked', self.close_window)
self.fname.connect('changed', self.filter_name_changed)
if self.filter.get_logical_op() == 'or':
self.logical.set_active(1)
elif self.filter.get_logical_op() == 'one':
@ -178,11 +180,13 @@ class EditFilter(ManagedWindow.ManagedWindow):
self.filterdb, None, _('Add Rule'), self.update_rule)
def on_edit_clicked(self,obj):
store,node = self.rlist.get_selected()
print "ON EDIT"
store, node = self.rlist.get_selected()
if node:
from _EditRule import EditRule
d = self.rlist.get_object(node)
EditRule(self.space, self.dbstate, self.uistate, self.track,
self.filterdb, d, _('Edit Rule'), self.update_rule)

View File

@ -470,11 +470,9 @@ class EditRule(ManagedWindow.ManagedWindow):
tlist[i].set_text(r[i])
self.selection.connect('changed', self.on_node_selected)
self.rule.signal_autoconnect({
'rule_ok_clicked' : self.rule_ok,
"on_help_rule_clicked" : self.on_help_clicked,
'rule_cancel_clicked' : self.close_window,
})
self.rule.get_widget('ok').connect('clicked',self.rule_ok)
self.rule.get_widget('cancel').connect('clicked', self.close_window)
self.rule.get_widget('help').connect('clicked',self.on_help_clicked)
self.show()

View File

@ -48,9 +48,9 @@ class FamilyWithIncompleteEvent(Rule):
def apply(self,db,person):
for family_handle in person.get_family_handle_list():
family = db.get_family_from_handle(family_handle)
for event_handle in family.get_event_list():
event = db.get_event_from_handle(event_handle)
if event:
for event_ref in family.get_event_ref_list():
if event_ref:
event = db.get_event_from_handle(event_ref.ref)
if not event.get_place_handle():
return True
if not event.get_date_object():

View File

@ -64,9 +64,10 @@ class HasFamilyEvent(Rule):
def apply(self,db,person):
for f_id in person.get_family_handle_list():
f = db.get_family_from_handle(f_id)
for event_handle in f.get_event_list():
if not event_handle:
for event_ref in f.get_event_ref_list():
if not event_ref:
continue
event_handle = event_ref.ref
event = db.get_event_from_handle(event_handle)
val = 1
if self.list[0] and event.get_name() != self.list[0]:

View File

@ -27,6 +27,11 @@
#-------------------------------------------------------------------------
from gettext import gettext as _
try:
set()
except:
from sets import Set as set
#-------------------------------------------------------------------------
#
# GRAMPS modules
@ -51,7 +56,7 @@ class IsBookmarked(Rule):
if len(bookmarks) == 0:
self.apply = lambda db,p : False
else:
self.bookmarks = sets.Set(bookmarks)
self.bookmarks = set(bookmarks)
self.apply = self.apply_real
def apply_real(self,db,person):

View File

@ -64,8 +64,8 @@ class IsDescendantFamilyOf(Rule):
return False
p = self.db.get_person_from_handle(handle)
for (f,r1,r2) in p.get_parent_family_handle_list():
family = self.db.get_family_from_handle(f)
for fhandle in p.get_parent_family_handle_list():
family = self.db.get_family_from_handle(fhandle)
for person_handle in [family.get_mother_handle(),family.get_father_handle()]:
if person_handle:
if self.search(person_handle,0):

View File

@ -27,6 +27,11 @@
#-------------------------------------------------------------------------
from gettext import gettext as _
try:
set()
except:
from sets import Set as set
#-------------------------------------------------------------------------
#
# GRAMPS modules
@ -58,7 +63,7 @@ class IsLessThanNthGenerationAncestorOfBookmarked(Rule):
self.apply = lambda db,p : False
else:
self.map = {}
self.bookmarks = sets.Set(bookmarks)
self.bookmarks = set(bookmarks)
self.apply = self.apply_real
for self.bookmarkhandle in self.bookmarks:
self.init_ancestor_list(self.bookmarkhandle, 1)

View File

@ -67,7 +67,7 @@ class IsParentOfFilterMatch(Rule):
return self.map.has_key(person.handle)
def init_list(self,person):
for fam_id,frel,mrel in person.get_parent_family_handle_list():
for fam_id in person.get_parent_family_handle_list():
fam = self.db.get_family_from_handle(fam_id)
for parent_id in [fam.get_father_handle (), fam.get_mother_handle ()]:
if parent_id:

View File

@ -34,7 +34,7 @@
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="button6">
<widget class="GtkButton" id="cancel">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
@ -63,7 +63,7 @@
</child>
<child>
<widget class="GtkButton" id="button11">
<widget class="GtkButton" id="help">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
@ -992,7 +992,7 @@ Exactly one rule must apply</property>
</child>
<child>
<widget class="GtkButton" id="button12">
<widget class="GtkButton" id="help">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>