From 2ee7b98f186abd0e07e5c460b78543c3b3d497e0 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Mon, 8 Dec 2003 02:23:53 +0000 Subject: [PATCH] * src/filters/Complete.py: Add filter matching people with the complete flag. * src/GenericFilter.py (HasCompleteRecord): Add rule matching people with the complete records. * src/RelLib.py (Source.setAbbrev, Source.getAbbrev): Add functions. * src/WriteXML.py (write_xml_data): Save abbreviation info for sources. * src/GrampsParser.py (GrampsParser.stop_sabbrev): Parse abbreviation. * src/gramps.glade (sourceEditor): Add widgets for Call Number and Abbreviation. * src/EditSource.py: Support Call Number and Abbreviation. * src/plugins/ReadGedcom.py (parse_source): Parse abbreviation. * src/plugins/WriteGedcom.py (write_sources): Export abbreviation. * NEWS: Update. svn: r2463 --- gramps2/ChangeLog | 15 +++ gramps2/NEWS | 4 + gramps2/src/EditSource.py | 14 +++ gramps2/src/GenericFilter.py | 26 +++++ gramps2/src/GrampsParser.py | 4 + gramps2/src/RelLib.py | 9 ++ gramps2/src/WriteXML.py | 1 + gramps2/src/filters/Complete.py | 42 +++++++++ gramps2/src/gramps.glade | 147 +++++++++++++++++++++++------ gramps2/src/plugins/ReadGedcom.py | 6 +- gramps2/src/plugins/WriteGedcom.py | 4 +- 11 files changed, 236 insertions(+), 36 deletions(-) create mode 100644 gramps2/src/filters/Complete.py diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 9d093078d..b48995be0 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,18 @@ +2003-12-07 Alex Roitman + * src/filters/Complete.py: Add filter matching people with the + complete flag. + * src/GenericFilter.py (HasCompleteRecord): Add rule matching people + with the complete records. + * src/RelLib.py (Source.setAbbrev, Source.getAbbrev): Add functions. + * src/WriteXML.py (write_xml_data): Save abbreviation info for sources. + * src/GrampsParser.py (GrampsParser.stop_sabbrev): Parse abbreviation. + * src/gramps.glade (sourceEditor): Add widgets for Call Number and + Abbreviation. + * src/EditSource.py: Support Call Number and Abbreviation. + * src/plugins/ReadGedcom.py (parse_source): Parse abbreviation. + * src/plugins/WriteGedcom.py (write_sources): Export abbreviation. + * NEWS: Update. + 2003-12-07 Don Allingham * Version 0.98.0: the "Round me off" release. diff --git a/gramps2/NEWS b/gramps2/NEWS index fbbd6c3f0..730cbef07 100644 --- a/gramps2/NEWS +++ b/gramps2/NEWS @@ -1,3 +1,7 @@ +Version 0.99.0 -- the "Stable as a tombstone" release +* New filter and custom filter rule based on the personal completeness flag. +* Improved GEDCOM support. + Version 0.98.0 -- the "Round me off" release * More compliance with GNOME HIG. * New BookReport dialog layout. diff --git a/gramps2/src/EditSource.py b/gramps2/src/EditSource.py index 3fd684119..8545a0878 100644 --- a/gramps2/src/EditSource.py +++ b/gramps2/src/EditSource.py @@ -67,6 +67,8 @@ class EditSource: self.gallery = ImageSelect.Gallery(source, self.path, plwidget, db, self, self.top) self.author = self.top_window.get_widget("author") self.pubinfo = self.top_window.get_widget("pubinfo") + self.callno = self.top_window.get_widget("callno") + self.abbrev = self.top_window.get_widget("abbrev") self.note = self.top_window.get_widget("source_note") self.notes_buffer = self.note.get_buffer() self.gallery_label = self.top_window.get_widget("gallerySourceEditor") @@ -79,6 +81,8 @@ class EditSource: self.title.set_text(source.getTitle()) self.author.set_text(source.getAuthor()) self.pubinfo.set_text(source.getPubInfo()) + self.callno.set_text(source.getCallNumber()) + self.abbrev.set_text(source.getAbbrev()) if source.getNote(): self.notes_buffer.set_text(source.getNote()) @@ -225,6 +229,8 @@ class EditSource: title = self.title.get_text() author = self.author.get_text() pubinfo = self.pubinfo.get_text() + callno = self.callno.get_text() + abbrev = self.abbrev.get_text() note = self.notes_buffer.get_text(self.notes_buffer.get_start_iter(), self.notes_buffer.get_end_iter(),gtk.FALSE) @@ -240,6 +246,14 @@ class EditSource: self.source.setPubInfo(pubinfo) Utils.modified() + if callno != self.source.getCallNumber(): + self.source.setCallNumber(callno) + Utils.modified() + + if abbrev != self.source.getAbbrev(): + self.source.setAbbrev(abbrev) + Utils.modified() + if note != self.source.getNote(): self.source.setNote(note) Utils.modified() diff --git a/gramps2/src/GenericFilter.py b/gramps2/src/GenericFilter.py index e4dbe8369..1c76eec83 100644 --- a/gramps2/src/GenericFilter.py +++ b/gramps2/src/GenericFilter.py @@ -18,6 +18,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# $Id$ + """Generic Filtering Routines""" __author__ = "Don Allingham" @@ -266,6 +268,29 @@ class HasIdOf(Rule): def apply(self,db,p): return p.getId() == self.list[0] +#------------------------------------------------------------------------- +# +# HasCompleteRecord +# +#------------------------------------------------------------------------- +class HasCompleteRecord(Rule): + """Rule that checks for a person whose record is complete""" + + labels = [] + + def name(self): + return 'Has complete record' + + def category(self): + return _('General filters') + + def description(self): + return _('Matches all people whose records are complete') + + def apply(self,db,p): + return p.getComplete() == 1 + + #------------------------------------------------------------------------- # # IsFemale @@ -1419,6 +1444,7 @@ tasks = { : HasCommonAncestorWithFilterMatch, _("Is a female") : IsFemale, _("Is a male") : IsMale, + _("Has complete record") : HasCompleteRecord, _("Has the personal event") : HasEvent, _("Has the family event") : HasFamilyEvent, _("Has the personal attribute") : HasAttribute, diff --git a/gramps2/src/GrampsParser.py b/gramps2/src/GrampsParser.py index 45999fe65..5a767e661 100644 --- a/gramps2/src/GrampsParser.py +++ b/gramps2/src/GrampsParser.py @@ -171,6 +171,7 @@ class GrampsParser: "resemail" : (None, self.stop_resemail), "sauthor" : (None, self.stop_sauthor), "scallno" : (None, self.stop_scallno), + "sabbrev" : (None, self.stop_sabbrev), "scomments" : (None, self.stop_scomments), "sdate" : (None,self.stop_sdate), "source" : (self.start_source, self.stop_source), @@ -763,6 +764,9 @@ class GrampsParser: def stop_scallno(self,tag): self.source.setCallNumber(tag) + def stop_sabbrev(self,tag): + self.source.setAbbrev(tag) + def stop_stext(self,tag): if self.use_p: self.use_p = 0 diff --git a/gramps2/src/RelLib.py b/gramps2/src/RelLib.py index a3a9e04e8..2655b9734 100644 --- a/gramps2/src/RelLib.py +++ b/gramps2/src/RelLib.py @@ -1832,6 +1832,7 @@ class Source: self.note = Note() self.photoList = [] self.id = "" + self.abbrev = "" def getDisplayInfo(self): return [self.title,self.id,self.author,upper(self.title), @@ -1911,6 +1912,14 @@ class Source: of the Source""" return self.callno + def setAbbrev(self,abbrev): + """sets the title abbreviation of the Source""" + self.abbrev = abbrev + + def getAbbrev(self): + """returns the title abbreviation of the Source""" + return self.abbrev + class SourceRef: """Source reference, containing detailed information about how a referenced source relates to it""" diff --git a/gramps2/src/WriteXML.py b/gramps2/src/WriteXML.py index d47fd7af0..586f962fe 100644 --- a/gramps2/src/WriteXML.py +++ b/gramps2/src/WriteXML.py @@ -333,6 +333,7 @@ class XmlWriter: self.write_line("sauthor",source.getAuthor(),3) self.write_line("spubinfo",source.getPubInfo(),3) self.write_line("scallno",source.getCallNumber(),3) + self.write_line("sabbrev",source.getAbbrev(),3) if source.getNote() != "": self.write_note("note",source.getNote(),3) self.write_photo_list(source.getPhotoList()) diff --git a/gramps2/src/filters/Complete.py b/gramps2/src/filters/Complete.py new file mode 100644 index 000000000..eedc681c4 --- /dev/null +++ b/gramps2/src/filters/Complete.py @@ -0,0 +1,42 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2003 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +# $Id$ + +"People with complete information" + +import Filter +from gettext import gettext as _ + +class IsComplete(Filter.Filter): + "People with complete information" + + def match(self,person): + return person.getComplete() == 1 + +#------------------------------------------------------------------------ +# +# +# +#------------------------------------------------------------------------ +Filter.register_filter(IsComplete, + description=_("People with complete information"), + qualifier=0) + diff --git a/gramps2/src/gramps.glade b/gramps2/src/gramps.glade index 8b2c606d8..4b2d6ae70 100644 --- a/gramps2/src/gramps.glade +++ b/gramps2/src/gramps.glade @@ -5641,7 +5641,7 @@ 12 True - 3 + 5 2 False 6 @@ -5703,34 +5703,6 @@ - - - True - _Publication information: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - pubinfo - - - - - - 0 - 1 - 2 - 3 - fill - - - - True @@ -5774,6 +5746,31 @@ + + + True + _Publication information: + True + False + GTK_JUSTIFY_CENTER + False + False + 1 + 0.5 + 0 + 0 + pubinfo + + + 0 + 1 + 3 + 4 + fill + + + + True @@ -5786,6 +5783,73 @@ * False + + 1 + 2 + 3 + 4 + + + + + + + True + Call _Number: + True + False + GTK_JUSTIFY_CENTER + False + False + 1 + 0.5 + 0 + 0 + callno + + + 0 + 1 + 4 + 5 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 4 + 5 + + + + + + + True + True + True + True + 0 + + True + * + False + 1 2 @@ -5794,6 +5858,31 @@ + + + + True + A_bbreviation: + True + False + GTK_JUSTIFY_CENTER + False + False + 1 + 0.5 + 0 + 0 + abbrev + + + 0 + 1 + 2 + 3 + fill + + + False diff --git a/gramps2/src/plugins/ReadGedcom.py b/gramps2/src/plugins/ReadGedcom.py index 56ef19868..bf1fdf938 100644 --- a/gramps2/src/plugins/ReadGedcom.py +++ b/gramps2/src/plugins/ReadGedcom.py @@ -470,11 +470,7 @@ class GedcomParser: else: note = "%s %s%s" % (matches[1],matches[2],d) elif matches[1] == "ABBR": - d = self.parse_continue_data(level+1) - if note: - note = "%s\n%s %s%s" % (note,matches[1],matches[2],d) - else: - note = "%s %s%s" % (matches[1],matches[2],d) + self.source.setAbbrev(matches[2] + self.parse_continue_data(level+1)) else: if note: note = "%s\n%s %s" % (note,matches[1],matches[2]) diff --git a/gramps2/src/plugins/WriteGedcom.py b/gramps2/src/plugins/WriteGedcom.py index e0c78367d..ab48abf16 100644 --- a/gramps2/src/plugins/WriteGedcom.py +++ b/gramps2/src/plugins/WriteGedcom.py @@ -775,8 +775,8 @@ class GedcomWriter: self.writeln("1 AUTH %s" % self.cnvtxt(source.getAuthor())) if source.getPubInfo(): self.writeln("1 PUBL %s" % self.cnvtxt(source.getPubInfo())) - if source.getTitle(): - self.writeln("1 ABBR %s" % self.cnvtxt(source.getTitle())) + if source.getAbbrev(): + self.writeln("1 ABBR %s" % self.cnvtxt(source.getAbbrev())) if source.getCallNumber(): self.writeln("1 CALN %s" % self.cnvtxt(source.getCallNumber())) if source.getNote():