* src/ChooseParents.py: use new cursor for interation
* src/DbPrompter.py: reformat * src/GenericFilter.py: add disconnected rule * src/GrampsBSDDB.py: provide cursor access for iteration * src/GrampsDbBase.py: provide cursor access for iteration * src/GrampsInMemDB.py: provide cursor access for iteration * src/Makefile.am: add gramps.desktop to install list * src/PeopleModel.py: use new cursor for faster iteration * src/PeopleView.py: reimplement filtering * src/ReadGedcom.py: removed used source counting * src/gedcomimport.glade: remove source field * src/gramps.glade: fixed spacing in message * src/gramps_main.py: add disconnected filter svn: r3779
This commit is contained in:
parent
e25236f85a
commit
bd783405bf
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
||||
2004-12-04 Don Allingham <dallingham@users.sourceforge.net>
|
||||
* src/ChooseParents.py: use new cursor for interation
|
||||
* src/DbPrompter.py: reformat
|
||||
* src/GenericFilter.py: add disconnected rule
|
||||
* src/GrampsBSDDB.py: provide cursor access for iteration
|
||||
* src/GrampsDbBase.py: provide cursor access for iteration
|
||||
* src/GrampsInMemDB.py: provide cursor access for iteration
|
||||
* src/Makefile.am: add gramps.desktop to install list
|
||||
* src/PeopleModel.py: use new cursor for faster iteration
|
||||
* src/PeopleView.py: reimplement filtering
|
||||
* src/ReadGedcom.py: removed used source counting
|
||||
* src/gedcomimport.glade: remove source field
|
||||
* src/gramps.glade: fixed spacing in message
|
||||
* src/gramps_main.py: add disconnected filter
|
||||
|
||||
2004-12-02 Don Allingham <dallingham@users.sourceforge.net>
|
||||
* src/EditPerson.py: hide window while closing updating info
|
||||
* src/FamilyView.py: Fix deleting of spouses and children
|
||||
|
@ -313,16 +313,19 @@ class ChooseParents:
|
||||
|
||||
def redrawf(self):
|
||||
"""Redraws the potential father list"""
|
||||
self.father_nsort = PeopleModel.PeopleModel(self.db)
|
||||
self.father_nsort.rebuild_data()
|
||||
self.father_nsort.reset_visible()
|
||||
self.build_exclude_list()
|
||||
self.father_nsort = PeopleModel.PeopleModel(self.db)
|
||||
|
||||
for pid in self.db.get_person_handles(sort_handles=False):
|
||||
person = self.db.get_person_from_handle(pid)
|
||||
cursor = self.db.get_person_cursor()
|
||||
data = cursor.first()
|
||||
while data:
|
||||
person = RelLib.Person()
|
||||
person.unserialize(data[1])
|
||||
visible = self.father_filter(person)
|
||||
if visible:
|
||||
self.father_nsort.set_visible(pid,visible)
|
||||
self.father_nsort.set_visible(data[0],visible)
|
||||
data = cursor.next()
|
||||
cursor.close()
|
||||
|
||||
self.father_model = gtk.TreeModelSort(self.father_nsort).filter_new()
|
||||
self.father_model.set_visible_column(PeopleModel.COLUMN_VIEW)
|
||||
@ -337,15 +340,18 @@ class ChooseParents:
|
||||
def redrawm(self):
|
||||
"""Redraws the potential mother list"""
|
||||
self.mother_nsort = PeopleModel.PeopleModel(self.db)
|
||||
self.mother_nsort.rebuild_data()
|
||||
self.mother_nsort.reset_visible()
|
||||
self.build_exclude_list()
|
||||
|
||||
for pid in self.db.get_person_handles(sort_handles=False):
|
||||
person = self.db.get_person_from_handle(pid)
|
||||
cursor = self.db.get_person_cursor()
|
||||
data = cursor.first()
|
||||
while data:
|
||||
person = RelLib.Person()
|
||||
person.unserialize(data[1])
|
||||
visible = self.mother_filter(person)
|
||||
if visible:
|
||||
self.mother_nsort.set_visible(pid,visible)
|
||||
self.mother_nsort.set_visible(data[0],visible)
|
||||
data = cursor.next()
|
||||
cursor.close()
|
||||
|
||||
self.mother_model = gtk.TreeModelSort(self.mother_nsort).filter_new()
|
||||
self.mother_model.set_visible_column(PeopleModel.COLUMN_VIEW)
|
||||
|
@ -185,12 +185,13 @@ class ExistingDbPrompter:
|
||||
# and create an empty native database to import data in
|
||||
for (importData,mime_filter,mime_type,native_format) in Plugins._imports:
|
||||
if filetype == mime_type or the_file == mime_type:
|
||||
QuestionDialog.OkDialog( _("Opening non-native format"),
|
||||
_("New gramps database has to be set up "
|
||||
"when opening non-native formats. The "
|
||||
"following dialog will let you select "
|
||||
"the new database."),
|
||||
self.parent_window)
|
||||
QuestionDialog.OkDialog(
|
||||
_("Opening non-native format"),
|
||||
_("New gramps database has to be set up "
|
||||
"when opening non-native formats. The "
|
||||
"following dialog will let you select "
|
||||
"the new database."),
|
||||
self.parent_window)
|
||||
prompter = NewNativeDbPrompter(self.parent,self.parent_window)
|
||||
if prompter.chooser():
|
||||
importData(self.parent.db,filename)
|
||||
@ -198,8 +199,9 @@ class ExistingDbPrompter:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
QuestionDialog.ErrorDialog( _("Could not open file: %s") % filename,
|
||||
_('The type "%s" is not in the list of known file types') % filetype )
|
||||
QuestionDialog.ErrorDialog(
|
||||
_("Could not open file: %s") % filename,
|
||||
_('The type "%s" is not in the list of known file types') % filetype )
|
||||
#choose.destroy()
|
||||
return False
|
||||
|
||||
@ -283,8 +285,9 @@ class ImportDbPrompter:
|
||||
importData(self.parent.db,filename)
|
||||
self.parent.import_tool_callback()
|
||||
return True
|
||||
QuestionDialog.ErrorDialog( _("Could not open file: %s") % filename,
|
||||
_('The type "%s" is not in the list of known file types') % filetype )
|
||||
QuestionDialog.ErrorDialog(
|
||||
_("Could not open file: %s") % filename,
|
||||
_('The type "%s" is not in the list of known file types') % filetype )
|
||||
choose.destroy()
|
||||
return False
|
||||
|
||||
|
@ -844,11 +844,9 @@ class FamilyView:
|
||||
|
||||
for id in [father_id, mother_id]:
|
||||
if id:
|
||||
print p.get_family_handle_list()
|
||||
p = self.db.find_person_from_handle(id)
|
||||
p.remove_family_handle(self.family.get_handle())
|
||||
self.parent.db.commit_person(p,trans)
|
||||
print p.get_family_handle_list()
|
||||
|
||||
if len(self.person.get_family_handle_list()) > 0:
|
||||
handle = self.person.get_family_handle_list()[0]
|
||||
|
@ -139,6 +139,30 @@ class Everyone(Rule):
|
||||
def apply(self,db,p_id):
|
||||
return 1
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Disconnected
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Disconnected(Rule):
|
||||
"""Matches disconnected individuals"""
|
||||
|
||||
labels = []
|
||||
|
||||
def name(self):
|
||||
return 'Disconnected individuals'
|
||||
|
||||
def category(self):
|
||||
return _('General filters')
|
||||
|
||||
def description(self):
|
||||
return _('Matches individuals that have no relationships')
|
||||
|
||||
def apply(self,db,p_id):
|
||||
person = db.get_person_from_handle(p_id)
|
||||
return (not person.get_main_parents_family_handle() and
|
||||
not len(person.get_family_handle_list()))
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# RelationshipPathBetween
|
||||
|
@ -60,6 +60,9 @@ class GrampsBSDDB(GrampsDbBase):
|
||||
dbmap.open(name, dbname, db.DB_HASH, db.DB_CREATE, 0666)
|
||||
return dbmap
|
||||
|
||||
def get_person_cursor(self):
|
||||
return self.person_map.cursor()
|
||||
|
||||
def load(self,name,callback):
|
||||
if self.person_map:
|
||||
self.close()
|
||||
|
@ -114,6 +114,9 @@ class GrampsDbBase:
|
||||
self.place2title = {}
|
||||
self.name_groups = {}
|
||||
|
||||
def get_person_cursor(self):
|
||||
assert False, "Needs to be overridden in the derived class"
|
||||
|
||||
def load(self,name,callback):
|
||||
"""
|
||||
Opens the specified database. The method needs to be overridden
|
||||
|
@ -27,6 +27,27 @@ import os
|
||||
import md5
|
||||
import gtk
|
||||
|
||||
|
||||
class GrampsCursor:
|
||||
|
||||
def __init__(self,src_map):
|
||||
self.src_map = src_map
|
||||
self.current = iter(src_map)
|
||||
|
||||
def first(self):
|
||||
self.current = iter(self.src_map)
|
||||
return self.next()
|
||||
|
||||
def next(self):
|
||||
try:
|
||||
index = self.current.next()
|
||||
return (index,self.src_map[index])
|
||||
except StopIteration:
|
||||
return None
|
||||
|
||||
def close(self):
|
||||
pass
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GrampsInMemDB
|
||||
@ -59,6 +80,9 @@ class GrampsInMemDB(GrampsDbBase):
|
||||
def load(self,name,callback):
|
||||
pass
|
||||
|
||||
def get_person_cursor(self):
|
||||
return GrampsCursor(self.person_map)
|
||||
|
||||
def close(self):
|
||||
pass
|
||||
|
||||
@ -73,7 +97,7 @@ class GrampsInMemDB(GrampsDbBase):
|
||||
|
||||
def get_surname_list(self):
|
||||
a = {}
|
||||
for person_id in self.get_person_handles(sort_handles=False):
|
||||
for person_id in iter(self.person_map):
|
||||
p = self.get_person_from_handle(person_id)
|
||||
a[p.get_primary_name().get_group_as()] = 1
|
||||
vals = a.keys()
|
||||
|
@ -129,6 +129,7 @@ GRAPHICS = \
|
||||
home.png\
|
||||
logo.png\
|
||||
gramps.png \
|
||||
gramps.desktop \
|
||||
media.png\
|
||||
people48.png\
|
||||
place.png\
|
||||
|
@ -93,9 +93,13 @@ class PeopleModel(gtk.GenericTreeModel):
|
||||
if not self.db.is_open():
|
||||
return
|
||||
|
||||
for person_handle in self.db.get_person_handles(sort_handles=False):
|
||||
cursor = self.db.get_person_cursor()
|
||||
|
||||
person = self.db.get_person_from_handle(person_handle)
|
||||
data = cursor.first()
|
||||
while data:
|
||||
person = Person()
|
||||
person_handle = data[0]
|
||||
person.unserialize(data[1])
|
||||
grp_as = person.get_primary_name().get_group_as()
|
||||
sn = person.get_primary_name().get_surname()
|
||||
if grp_as:
|
||||
@ -108,6 +112,9 @@ class PeopleModel(gtk.GenericTreeModel):
|
||||
else:
|
||||
self.sname_sub[surname] = [person_handle]
|
||||
|
||||
data = cursor.next()
|
||||
cursor.close()
|
||||
|
||||
self.top_path2iter = self.sname_sub.keys()
|
||||
self.top_path2iter.sort(locale.strcoll)
|
||||
for name in self.top_path2iter:
|
||||
|
@ -116,13 +116,15 @@ class PeopleView:
|
||||
|
||||
def build_tree(self):
|
||||
self.person_model = PeopleModel.PeopleModel(self.parent.db)
|
||||
#self.sort_model = self.person_model.filter_new()
|
||||
self.sort_model = self.person_model
|
||||
#self.sort_model = self.person_model
|
||||
self.sort_model = self.person_model.filter_new()
|
||||
self.sort_model.set_visible_column(PeopleModel.COLUMN_VIEW)
|
||||
self.person_tree.set_model(self.sort_model)
|
||||
|
||||
def blist(self, store, path, node, id_list):
|
||||
id_list.append(self.sort_model.get_value(node,
|
||||
PeopleModel.COLUMN_INT_ID))
|
||||
id_list.append(self.sort_model.get_value(
|
||||
node,
|
||||
PeopleModel.COLUMN_INT_ID))
|
||||
|
||||
def get_selected_objects(self):
|
||||
mlist = []
|
||||
@ -146,8 +148,10 @@ class PeopleView:
|
||||
def change_db(self,db):
|
||||
self.build_columns()
|
||||
self.person_model = PeopleModel.PeopleModel(db)
|
||||
#self.sort_model = self.person_model.filter_new()
|
||||
self.sort_model = self.person_model
|
||||
#self.sort_model = self.person_model
|
||||
self.sort_model = self.person_model.filter_new()
|
||||
self.sort_model.set_visible_column(PeopleModel.COLUMN_VIEW)
|
||||
self.apply_filter()
|
||||
self.person_tree.set_model(self.sort_model)
|
||||
|
||||
def remove_from_person_list(self,person):
|
||||
@ -203,14 +207,18 @@ class PeopleView:
|
||||
def apply_filter(self,current_model=None):
|
||||
self.person_model.rebuild_data()
|
||||
self.parent.status_text(_('Updating display...'))
|
||||
keys = self.DataFilter.apply(self.parent.db,
|
||||
self.parent.db.get_person_handles(sort_handles=False))
|
||||
keys = self.DataFilter.apply(
|
||||
self.parent.db,
|
||||
self.parent.db.get_person_handles(sort_handles=False))
|
||||
self.person_model.reset_visible()
|
||||
for person_handle in keys:
|
||||
self.person_model.set_visible(person_handle,1)
|
||||
self.person_model.set_visible(person_handle,True)
|
||||
|
||||
#self.sort_model.refilter()
|
||||
print "Applying filter"
|
||||
self.sort_model.refilter()
|
||||
print "Done"
|
||||
self.parent.modify_statusbar()
|
||||
print "exit"
|
||||
|
||||
def on_plist_button_press(self,obj,event):
|
||||
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
|
||||
|
@ -293,7 +293,6 @@ class GedcomParser:
|
||||
self.version_obj = window.get_widget("version")
|
||||
self.families_obj = window.get_widget("families")
|
||||
self.people_obj = window.get_widget("people")
|
||||
self.source_obj = window.get_widget("sources")
|
||||
self.errors_obj = window.get_widget("errors")
|
||||
self.close_done = window.get_widget('close_done')
|
||||
self.error_text_obj = window.get_widget("error_text")
|
||||
@ -607,8 +606,6 @@ class GedcomParser:
|
||||
elif matches[1] in ["SUBM","SUBN","OBJE","_EVENT_DEFN"]:
|
||||
self.ignore_sub_junk(1)
|
||||
elif matches[2] == "SOUR":
|
||||
if self.source_count % UPDATE == 0 and self.window:
|
||||
self.update(self.source_obj,str(self.source_count))
|
||||
self.parse_source(matches[1],1)
|
||||
elif matches[2][0:4] == "NOTE":
|
||||
if self.nmap.has_key(matches[1]):
|
||||
|
@ -50,7 +50,7 @@
|
||||
<widget class="GtkTable" id="table1">
|
||||
<property name="border_width">12</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">11</property>
|
||||
<property name="n_rows">10</property>
|
||||
<property name="n_columns">5</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="row_spacing">6</property>
|
||||
@ -161,7 +161,7 @@
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="invisible_char" translatable="yes">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
@ -204,8 +204,8 @@
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">5</property>
|
||||
<property name="top_attach">7</property>
|
||||
<property name="bottom_attach">8</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="bottom_attach">7</property>
|
||||
<property name="x_options">fill</property>
|
||||
</packing>
|
||||
</child>
|
||||
@ -227,8 +227,8 @@
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">5</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="bottom_attach">7</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@ -251,8 +251,8 @@
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">5</property>
|
||||
<property name="top_attach">9</property>
|
||||
<property name="bottom_attach">10</property>
|
||||
<property name="top_attach">8</property>
|
||||
<property name="bottom_attach">9</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
@ -290,8 +290,8 @@
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">5</property>
|
||||
<property name="top_attach">10</property>
|
||||
<property name="bottom_attach">11</property>
|
||||
<property name="top_attach">9</property>
|
||||
<property name="bottom_attach">10</property>
|
||||
<property name="x_options">fill</property>
|
||||
</packing>
|
||||
</child>
|
||||
@ -305,7 +305,7 @@
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="invisible_char" translatable="yes">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
@ -350,7 +350,7 @@
|
||||
<property name="max_length">10</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="invisible_char" translatable="yes">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
@ -371,7 +371,7 @@
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="invisible_char" translatable="yes">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
@ -392,7 +392,7 @@
|
||||
<property name="max_length">10</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="invisible_char" translatable="yes">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
@ -437,7 +437,7 @@
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="invisible_char" translatable="yes">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
@ -472,51 +472,6 @@
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label20">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Sources:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkEntry" id="sources">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">False</property>
|
||||
<property name="visibility">True</property>
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
|
@ -31792,7 +31792,7 @@ Family name Given name
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label402">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">GRAMPS is loading the database you selected. Please wait.</property>
|
||||
<property name="label" translatable="yes">GRAMPS is loading the database you selected. Please wait.</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
|
@ -846,6 +846,11 @@ class Gramps:
|
||||
all.add_rule(GenericFilter.IsMale([]))
|
||||
filter_list.append(all)
|
||||
|
||||
all = GenericFilter.GenericFilter()
|
||||
all.set_name(_("Disconnected individuals"))
|
||||
all.add_rule(GenericFilter.Disconnected([]))
|
||||
filter_list.append(all)
|
||||
|
||||
all = GenericFilter.ParamFilter()
|
||||
all.set_name(_("Name contains..."))
|
||||
all.add_rule(GenericFilter.SearchName([]))
|
||||
|
Loading…
Reference in New Issue
Block a user