* 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
This commit is contained in:
Alex Roitman 2003-12-08 02:23:53 +00:00
parent 325efe438e
commit 5907d97571
11 changed files with 236 additions and 36 deletions

View File

@ -1,3 +1,18 @@
2003-12-07 Alex Roitman <shura@alex.neuro.umn.edu>
* 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 <dallingham@users.sourceforge.net> 2003-12-07 Don Allingham <dallingham@users.sourceforge.net>
* Version 0.98.0: the "Round me off" release. * Version 0.98.0: the "Round me off" release.

4
NEWS
View File

@ -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 Version 0.98.0 -- the "Round me off" release
* More compliance with GNOME HIG. * More compliance with GNOME HIG.
* New BookReport dialog layout. * New BookReport dialog layout.

View File

@ -67,6 +67,8 @@ class EditSource:
self.gallery = ImageSelect.Gallery(source, self.path, plwidget, db, self, self.top) self.gallery = ImageSelect.Gallery(source, self.path, plwidget, db, self, self.top)
self.author = self.top_window.get_widget("author") self.author = self.top_window.get_widget("author")
self.pubinfo = self.top_window.get_widget("pubinfo") 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.note = self.top_window.get_widget("source_note")
self.notes_buffer = self.note.get_buffer() self.notes_buffer = self.note.get_buffer()
self.gallery_label = self.top_window.get_widget("gallerySourceEditor") self.gallery_label = self.top_window.get_widget("gallerySourceEditor")
@ -79,6 +81,8 @@ class EditSource:
self.title.set_text(source.getTitle()) self.title.set_text(source.getTitle())
self.author.set_text(source.getAuthor()) self.author.set_text(source.getAuthor())
self.pubinfo.set_text(source.getPubInfo()) self.pubinfo.set_text(source.getPubInfo())
self.callno.set_text(source.getCallNumber())
self.abbrev.set_text(source.getAbbrev())
if source.getNote(): if source.getNote():
self.notes_buffer.set_text(source.getNote()) self.notes_buffer.set_text(source.getNote())
@ -225,6 +229,8 @@ class EditSource:
title = self.title.get_text() title = self.title.get_text()
author = self.author.get_text() author = self.author.get_text()
pubinfo = self.pubinfo.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(), note = self.notes_buffer.get_text(self.notes_buffer.get_start_iter(),
self.notes_buffer.get_end_iter(),gtk.FALSE) self.notes_buffer.get_end_iter(),gtk.FALSE)
@ -240,6 +246,14 @@ class EditSource:
self.source.setPubInfo(pubinfo) self.source.setPubInfo(pubinfo)
Utils.modified() 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(): if note != self.source.getNote():
self.source.setNote(note) self.source.setNote(note)
Utils.modified() Utils.modified()

View File

@ -18,6 +18,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# #
# $Id$
"""Generic Filtering Routines""" """Generic Filtering Routines"""
__author__ = "Don Allingham" __author__ = "Don Allingham"
@ -266,6 +268,29 @@ class HasIdOf(Rule):
def apply(self,db,p): def apply(self,db,p):
return p.getId() == self.list[0] 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 # IsFemale
@ -1419,6 +1444,7 @@ tasks = {
: HasCommonAncestorWithFilterMatch, : HasCommonAncestorWithFilterMatch,
_("Is a female") : IsFemale, _("Is a female") : IsFemale,
_("Is a male") : IsMale, _("Is a male") : IsMale,
_("Has complete record") : HasCompleteRecord,
_("Has the personal event") : HasEvent, _("Has the personal event") : HasEvent,
_("Has the family event") : HasFamilyEvent, _("Has the family event") : HasFamilyEvent,
_("Has the personal attribute") : HasAttribute, _("Has the personal attribute") : HasAttribute,

View File

@ -171,6 +171,7 @@ class GrampsParser:
"resemail" : (None, self.stop_resemail), "resemail" : (None, self.stop_resemail),
"sauthor" : (None, self.stop_sauthor), "sauthor" : (None, self.stop_sauthor),
"scallno" : (None, self.stop_scallno), "scallno" : (None, self.stop_scallno),
"sabbrev" : (None, self.stop_sabbrev),
"scomments" : (None, self.stop_scomments), "scomments" : (None, self.stop_scomments),
"sdate" : (None,self.stop_sdate), "sdate" : (None,self.stop_sdate),
"source" : (self.start_source, self.stop_source), "source" : (self.start_source, self.stop_source),
@ -763,6 +764,9 @@ class GrampsParser:
def stop_scallno(self,tag): def stop_scallno(self,tag):
self.source.setCallNumber(tag) self.source.setCallNumber(tag)
def stop_sabbrev(self,tag):
self.source.setAbbrev(tag)
def stop_stext(self,tag): def stop_stext(self,tag):
if self.use_p: if self.use_p:
self.use_p = 0 self.use_p = 0

View File

@ -1832,6 +1832,7 @@ class Source:
self.note = Note() self.note = Note()
self.photoList = [] self.photoList = []
self.id = "" self.id = ""
self.abbrev = ""
def getDisplayInfo(self): def getDisplayInfo(self):
return [self.title,self.id,self.author,upper(self.title), return [self.title,self.id,self.author,upper(self.title),
@ -1911,6 +1912,14 @@ class Source:
of the Source""" of the Source"""
return self.callno 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: class SourceRef:
"""Source reference, containing detailed information about how a """Source reference, containing detailed information about how a
referenced source relates to it""" referenced source relates to it"""

View File

@ -333,6 +333,7 @@ class XmlWriter:
self.write_line("sauthor",source.getAuthor(),3) self.write_line("sauthor",source.getAuthor(),3)
self.write_line("spubinfo",source.getPubInfo(),3) self.write_line("spubinfo",source.getPubInfo(),3)
self.write_line("scallno",source.getCallNumber(),3) self.write_line("scallno",source.getCallNumber(),3)
self.write_line("sabbrev",source.getAbbrev(),3)
if source.getNote() != "": if source.getNote() != "":
self.write_note("note",source.getNote(),3) self.write_note("note",source.getNote(),3)
self.write_photo_list(source.getPhotoList()) self.write_photo_list(source.getPhotoList())

42
src/filters/Complete.py Normal file
View File

@ -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)

View File

@ -5641,7 +5641,7 @@
<widget class="GtkTable" id="table17"> <widget class="GtkTable" id="table17">
<property name="border_width">12</property> <property name="border_width">12</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="n_rows">3</property> <property name="n_rows">5</property>
<property name="n_columns">2</property> <property name="n_columns">2</property>
<property name="homogeneous">False</property> <property name="homogeneous">False</property>
<property name="row_spacing">6</property> <property name="row_spacing">6</property>
@ -5703,34 +5703,6 @@
</packing> </packing>
</child> </child>
<child>
<widget class="GtkLabel" id="label167">
<property name="visible">True</property>
<property name="label" translatable="yes">_Publication information:</property>
<property name="use_underline">True</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">1</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">pubinfo</property>
<accessibility>
<atkrelation target="pubinfo" type="label-for"/>
</accessibility>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child> <child>
<widget class="GtkEntry" id="source_title"> <widget class="GtkEntry" id="source_title">
<property name="visible">True</property> <property name="visible">True</property>
@ -5774,6 +5746,31 @@
</packing> </packing>
</child> </child>
<child>
<widget class="GtkLabel" id="label167">
<property name="visible">True</property>
<property name="label" translatable="yes">_Publication information:</property>
<property name="use_underline">True</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">1</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">pubinfo</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child> <child>
<widget class="GtkEntry" id="pubinfo"> <widget class="GtkEntry" id="pubinfo">
<property name="visible">True</property> <property name="visible">True</property>
@ -5786,6 +5783,73 @@
<property name="invisible_char" translatable="yes">*</property> <property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property> <property name="activates_default">False</property>
</widget> </widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label391">
<property name="visible">True</property>
<property name="label" translatable="yes">Call _Number:</property>
<property name="use_underline">True</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">1</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">callno</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</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="callno">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</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" translatable="yes">*</property>
<property name="activates_default">False</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="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="abbrev">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</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" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="right_attach">2</property> <property name="right_attach">2</property>
@ -5794,6 +5858,31 @@
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkLabel" id="label392">
<property name="visible">True</property>
<property name="label" translatable="yes">A_bbreviation:</property>
<property name="use_underline">True</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">1</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">abbrev</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget> </widget>
<packing> <packing>
<property name="tab_expand">False</property> <property name="tab_expand">False</property>

View File

@ -470,11 +470,7 @@ class GedcomParser:
else: else:
note = "%s %s%s" % (matches[1],matches[2],d) note = "%s %s%s" % (matches[1],matches[2],d)
elif matches[1] == "ABBR": elif matches[1] == "ABBR":
d = self.parse_continue_data(level+1) self.source.setAbbrev(matches[2] + 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)
else: else:
if note: if note:
note = "%s\n%s %s" % (note,matches[1],matches[2]) note = "%s\n%s %s" % (note,matches[1],matches[2])

View File

@ -775,8 +775,8 @@ class GedcomWriter:
self.writeln("1 AUTH %s" % self.cnvtxt(source.getAuthor())) self.writeln("1 AUTH %s" % self.cnvtxt(source.getAuthor()))
if source.getPubInfo(): if source.getPubInfo():
self.writeln("1 PUBL %s" % self.cnvtxt(source.getPubInfo())) self.writeln("1 PUBL %s" % self.cnvtxt(source.getPubInfo()))
if source.getTitle(): if source.getAbbrev():
self.writeln("1 ABBR %s" % self.cnvtxt(source.getTitle())) self.writeln("1 ABBR %s" % self.cnvtxt(source.getAbbrev()))
if source.getCallNumber(): if source.getCallNumber():
self.writeln("1 CALN %s" % self.cnvtxt(source.getCallNumber())) self.writeln("1 CALN %s" % self.cnvtxt(source.getCallNumber()))
if source.getNote(): if source.getNote():