* src/gramps_main.py: Added "Invert" checkbox for person filter; Fix "active-changed" signals to not cause Tracebacks.

* src/gramps.glade: Added "Invert" checkbox for person filter
* src/PeopleView.py (build_tree): Pass Invert state for Filter to PeopleModel
* src/PeopleModel.py: Enable invertation of filter result


svn: r4323
This commit is contained in:
Martin Hawlisch 2005-04-08 10:49:26 +00:00
parent 985d1f5dc7
commit 0b442d3721
5 changed files with 35 additions and 5 deletions

View File

@ -1,6 +1,12 @@
2005-04-08 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
2005-04-08 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/Utils.py (probably_alive): Added two more checks for birth and death year
* src/gramps_main.py: Added "Invert" checkbox for person filter;
Fix "active-changed" signals to not cause Tracebacks.
* src/gramps.glade: Added "Invert" checkbox for person filter
* src/PeopleView.py (build_tree): Pass Invert state for Filter to PeopleModel
* src/PeopleModel.py: Enable invertation of filter result
2005-04-08 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
* src/Utils.py (probably_alive): fix some bugs and added checking of ancestors.

View File

@ -69,12 +69,13 @@ _CHANGE_COL= 21
#-------------------------------------------------------------------------
class PeopleModel(gtk.GenericTreeModel):
def __init__(self,db,data_filter=None):
def __init__(self,db,data_filter=None,invert_result=False):
gtk.GenericTreeModel.__init__(self)
self.db = db
self.visible = {}
self.top_visible = {}
self.invert_result = invert_result
self.rebuild_data(data_filter)
def rebuild_data(self,data_filter=None,skip=None):
@ -96,6 +97,8 @@ class PeopleModel(gtk.GenericTreeModel):
if data_filter:
handle_list = self.db.get_person_handles(sort_handles=False)
keys = data_filter.apply(self.db,handle_list)
if self.invert_result:
keys = [k for k in handle_list if k not in keys]
del handle_list
else:
keys = self.db.get_person_handles(sort_handles=False)

View File

@ -169,7 +169,8 @@ class PeopleView:
def build_tree(self):
self.person_model = PeopleModel.PeopleModel(self.parent.db,
self.DataFilter)
self.DataFilter,
self.parent.filter_invert.get_active())
self.person_tree.set_model(self.person_model)
def blist(self, store, path, node, id_list):

View File

@ -1391,6 +1391,25 @@
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="filter_invert">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Invert</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="apply_filter">
<property name="visible">True</property>

View File

@ -110,7 +110,7 @@ class Gramps(GrampsDBCallback.GrampsDBCallback):
__signals__ = {
'database-changed' : (GrampsDbBase.GrampsDbBase,),
'active-changed' : (unicode,),
'active-changed' : (str,),
}
def __init__(self,args):
@ -291,6 +291,7 @@ class Gramps(GrampsDBCallback.GrampsDBCallback):
self.toolbardock = self.gtop.get_widget("dockitem2")
self.filter_text = self.gtop.get_widget('filter')
self.filter_label= self.gtop.get_widget('filter_label')
self.filter_invert= self.gtop.get_widget('filter_invert')
self.qual_label = self.gtop.get_widget("qual")
self.child_type = self.gtop.get_widget("childtype")
self.spouse_tab = self.gtop.get_widget("lab_or_list")
@ -1452,7 +1453,7 @@ class Gramps(GrampsDBCallback.GrampsDBCallback):
self.set_buttons(0)
self.active_person = None
self.modify_statusbar()
self.emit('active-changed',(None,))
self.emit('active-changed',('',))
elif (self.active_person == None or
person.get_handle() != self.active_person.get_handle()):
self.active_person = self.db.get_person_from_handle(person.get_handle())