GEPS 011: Tagging - Extended to Family, Note and Media objects

svn: r16025
This commit is contained in:
Nick Hall 2010-10-22 23:22:33 +00:00
parent e25cec5186
commit c3e527b4fb
76 changed files with 1294 additions and 1312 deletions

View File

@ -3,8 +3,9 @@
<!-- <!--
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2001 Graham J. Williams # Copyright (C) 2001 Graham J. Williams
# Copyright (C) 2000-2007 Donald N. Allingham # Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -171,8 +172,8 @@ FAMILY
<!ELEMENT families (family)*> <!ELEMENT families (family)*>
<!ELEMENT family (rel?, father?, mother?, eventref*, lds_ord*, <!ELEMENT family (rel?, father?, mother?, eventref*, lds_ord*, objref*,
objref*, childref*, attribute*, noteref*, sourceref*)> childref*, attribute*, noteref*, sourceref*, tagref*)>
<!ATTLIST family <!ATTLIST family
id CDATA #REQUIRED id CDATA #REQUIRED
handle ID #REQUIRED handle ID #REQUIRED
@ -277,7 +278,7 @@ OBJECTS
<!ELEMENT objects (object)*> <!ELEMENT objects (object)*>
<!ELEMENT object (file, attribute*, noteref*, <!ELEMENT object (file, attribute*, noteref*,
(daterange|datespan|dateval|datestr)?, sourceref*)> (daterange|datespan|dateval|datestr)?, sourceref*, tagref*)>
<!ATTLIST object <!ATTLIST object
id CDATA #REQUIRED id CDATA #REQUIRED
handle ID #REQUIRED handle ID #REQUIRED
@ -316,7 +317,7 @@ NOTES
<!ELEMENT notes (note)*> <!ELEMENT notes (note)*>
<!ELEMENT note (text, style*)> <!ELEMENT note (text, style*, tagref*)>
<!ATTLIST note <!ATTLIST note
id CDATA #REQUIRED id CDATA #REQUIRED
handle ID #REQUIRED handle ID #REQUIRED

View File

@ -4,6 +4,7 @@
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2005-2007 Donald N. Allingham # Copyright (C) 2005-2007 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -364,6 +365,9 @@
<zeroOrMore><element name="sourceref"> <zeroOrMore><element name="sourceref">
<ref name="sourceref-content"/> <ref name="sourceref-content"/>
</element></zeroOrMore> </element></zeroOrMore>
<zeroOrMore><element name="tagref">
<ref name="tagref-content"/>
</element></zeroOrMore>
</define> </define>
<define name="event-content"> <define name="event-content">
@ -457,6 +461,9 @@
<zeroOrMore><element name="sourceref"> <zeroOrMore><element name="sourceref">
<ref name="sourceref-content"/> <ref name="sourceref-content"/>
</element></zeroOrMore> </element></zeroOrMore>
<zeroOrMore><element name="tagref">
<ref name="tagref-content"/>
</element></zeroOrMore>
</define> </define>
<define name="repository-content"> <define name="repository-content">
@ -513,6 +520,9 @@
</choice></attribute></optional> </choice></attribute></optional>
<attribute name="type"><text/></attribute> <attribute name="type"><text/></attribute>
<ref name="styledtext"/> <ref name="styledtext"/>
<zeroOrMore><element name="tagref">
<ref name="tagref-content"/>
</element></zeroOrMore>
</define> </define>
<define name="styledtext"> <define name="styledtext">

View File

@ -12,9 +12,8 @@ pkgdata_PYTHON = \
_HasData.py\ _HasData.py\
_HasGallery.py \ _HasGallery.py \
_HasIdOf.py\ _HasIdOf.py\
_HasMarkerOf.py\
_HasNote.py \ _HasNote.py \
_HasSource.py \ _HasSource.py \
_HasType.py\ _HasType.py\
_HasNoteMatchingSubstringOf.py\ _HasNoteMatchingSubstringOf.py\
_HasReferenceCountOf.py\ _HasReferenceCountOf.py\

View File

@ -28,7 +28,6 @@ Package providing filter rules for GRAMPS.
from Filters.Rules._HasEventBase import HasEventBase as HasEvent from Filters.Rules._HasEventBase import HasEventBase as HasEvent
from _HasType import HasType from _HasType import HasType
from _HasMarkerOf import HasMarkerOf
from _AllEvents import AllEvents from _AllEvents import AllEvents
from _HasGallery import HasGallery from _HasGallery import HasGallery
from _HasIdOf import HasIdOf from _HasIdOf import HasIdOf
@ -51,8 +50,6 @@ editor_rule_list = [
HasType, HasType,
HasIdOf, HasIdOf,
HasGallery, HasGallery,
# TODO: At the time of this writing, the GRAMPS UI does not allow setting markers for events. 1197 bug-report
# HasMarkerOf,
RegExpIdOf, RegExpIdOf,
HasNote, HasNote,
HasNoteRegexp, HasNoteRegexp,

View File

@ -17,6 +17,7 @@ pkgdata_PYTHON = \
_HasReferenceCountOf.py\ _HasReferenceCountOf.py\
_HasRelType.py\ _HasRelType.py\
_HasSource.py \ _HasSource.py \
_HasTag.py \
__init__.py\ __init__.py\
_IsBookmarked.py\ _IsBookmarked.py\
_RegExpIdOf.py\ _RegExpIdOf.py\
@ -33,8 +34,7 @@ pkgdata_PYTHON = \
_RegExpFatherName.py\ _RegExpFatherName.py\
_RegExpMotherName.py\ _RegExpMotherName.py\
_RegExpChildName.py\ _RegExpChildName.py\
_MemberBase.py\ _MemberBase.py
_HasMarkerOf.py
pkgpyexecdir = @pkgpyexecdir@/Filters/Rules/Family pkgpyexecdir = @pkgpyexecdir@/Filters/Rules/Family

View File

@ -1,7 +1,7 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2002-2006 Donald N. Allingham # Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -17,8 +17,10 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# 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$ # $Id$
"""
Rule that checks for a family with a particular tag.
"""
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -32,15 +34,17 @@ from gen.ggettext import gettext as _
# GRAMPS modules # GRAMPS modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from Filters.Rules._HasMarkerBase import HasMarkerBase from Filters.Rules._HasTagBase import HasTagBase
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# HasEvent # HasTag
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class HasMarkerOf(HasMarkerBase): class HasTag(HasTagBase):
"""Rule that checks for a family with a particular marker""" """
Rule that checks for a family with a particular tag.
name = _('Families with <marker>') """
description = _("Matches Families with a marker of a particular value") labels = [ _('Tag:') ]
name = _('Families with the <tag>')
description = _("Matches families with the particular tag")

View File

@ -46,7 +46,6 @@ from _HasReferenceCountOf import HasReferenceCountOf
from _FamilyPrivate import FamilyPrivate from _FamilyPrivate import FamilyPrivate
from _HasAttribute import HasAttribute from _HasAttribute import HasAttribute
from _HasEvent import HasEvent from _HasEvent import HasEvent
from _HasMarkerOf import HasMarkerOf
from _IsBookmarked import IsBookmarked from _IsBookmarked import IsBookmarked
from _MatchesFilter import MatchesFilter from _MatchesFilter import MatchesFilter
from _FatherHasNameOf import FatherHasNameOf from _FatherHasNameOf import FatherHasNameOf
@ -56,6 +55,7 @@ from _MotherHasIdOf import MotherHasIdOf
from _ChildHasNameOf import ChildHasNameOf from _ChildHasNameOf import ChildHasNameOf
from _ChildHasIdOf import ChildHasIdOf from _ChildHasIdOf import ChildHasIdOf
from _ChangedSince import ChangedSince from _ChangedSince import ChangedSince
from _HasTag import HasTag
editor_rule_list = [ editor_rule_list = [
AllFamilies, AllFamilies,
@ -72,7 +72,6 @@ editor_rule_list = [
FamilyPrivate, FamilyPrivate,
HasEvent, HasEvent,
HasAttribute, HasAttribute,
HasMarkerOf,
IsBookmarked, IsBookmarked,
MatchesFilter, MatchesFilter,
FatherHasNameOf, FatherHasNameOf,
@ -82,4 +81,5 @@ editor_rule_list = [
ChildHasNameOf, ChildHasNameOf,
ChildHasIdOf, ChildHasIdOf,
ChangedSince, ChangedSince,
HasTag,
] ]

View File

@ -10,6 +10,7 @@ pkgdata_PYTHON = \
_HasNoteMatchingSubstringOf.py\ _HasNoteMatchingSubstringOf.py\
_HasNoteRegexp.py\ _HasNoteRegexp.py\
_HasReferenceCountOf.py\ _HasReferenceCountOf.py\
_HasTag.py\
_MatchesFilter.py\ _MatchesFilter.py\
_MediaPrivate.py\ _MediaPrivate.py\
_HasAttribute.py\ _HasAttribute.py\

View File

@ -1,7 +1,7 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2007 Brian G. Matherly # Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -17,8 +17,10 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# 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$ # $Id$
"""
Rule that checks for a media object with a particular tag.
"""
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -32,15 +34,17 @@ from gen.ggettext import gettext as _
# GRAMPS modules # GRAMPS modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from Filters.Rules._HasMarkerBase import HasMarkerBase from Filters.Rules._HasTagBase import HasTagBase
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# HasEvent # HasTag
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class HasMarkerOf(HasMarkerBase): class HasTag(HasTagBase):
"""Rule that checks for a note with a particular marker""" """
Rule that checks for a media object with a particular tag.
name = _('Notes with <marker>') """
description = _("Matches Notes with a marker of a particular value") labels = [ _('Tag:') ]
name = _('Media objects with the <tag>')
description = _("Matches media objects with the particular tag")

View File

@ -35,6 +35,7 @@ from _MatchesFilter import MatchesFilter
from _HasMedia import HasMedia from _HasMedia import HasMedia
from _HasAttribute import HasAttribute from _HasAttribute import HasAttribute
from _ChangedSince import ChangedSince from _ChangedSince import ChangedSince
from _HasTag import HasTag
editor_rule_list = [ editor_rule_list = [
AllMedia, AllMedia,
@ -47,4 +48,5 @@ editor_rule_list = [
MatchesFilter, MatchesFilter,
HasAttribute, HasAttribute,
ChangedSince, ChangedSince,
HasTag,
] ]

View File

@ -11,6 +11,7 @@ pkgdata_PYTHON = \
_MatchesRegexpOf.py\ _MatchesRegexpOf.py\
_HasNote.py\ _HasNote.py\
_HasReferenceCountOf.py\ _HasReferenceCountOf.py\
_HasTag.py\
_MatchesFilter.py\ _MatchesFilter.py\
_RegExpIdOf.py\ _RegExpIdOf.py\
_NotePrivate.py\ _NotePrivate.py\

View File

@ -1,7 +1,7 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2007 Brian G. Matherly # Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -17,8 +17,10 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# 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$ # $Id$
"""
Rule that checks for a note with a particular tag.
"""
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -32,15 +34,17 @@ from gen.ggettext import gettext as _
# GRAMPS modules # GRAMPS modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from Filters.Rules._HasMarkerBase import HasMarkerBase from Filters.Rules._HasTagBase import HasTagBase
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# HasEvent # HasTag
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class HasMarkerOf(HasMarkerBase): class HasTag(HasTagBase):
"""Rule that checks for an event with a particular marker""" """
Rule that checks for a note with a particular tag.
name = _('Events with <marker>') """
description = _("Matches Events with a marker of a particular value") labels = [ _('Tag:') ]
name = _('Notes with the <tag>')
description = _("Matches notes with the particular tag")

View File

@ -36,6 +36,7 @@ from _NotePrivate import NotePrivate
from _MatchesFilter import MatchesFilter from _MatchesFilter import MatchesFilter
from _HasNote import HasNote from _HasNote import HasNote
from _ChangedSince import ChangedSince from _ChangedSince import ChangedSince
from _HasTag import HasTag
editor_rule_list = [ editor_rule_list = [
AllNotes, AllNotes,
@ -49,4 +50,5 @@ editor_rule_list = [
NotePrivate, NotePrivate,
MatchesFilter, MatchesFilter,
ChangedSince, ChangedSince,
HasTag,
] ]

View File

@ -71,7 +71,6 @@ pkgdata_PYTHON = \
_MatchIdOf.py \ _MatchIdOf.py \
_HasNoteRegexp.py \ _HasNoteRegexp.py \
_RegExpName.py \ _RegExpName.py \
_HasMarkerOf.py \
__init__.py __init__.py
pkgpyexecdir = @pkgpyexecdir@/Filters/Rules/Person pkgpyexecdir = @pkgpyexecdir@/Filters/Rules/Person

View File

@ -1,51 +0,0 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 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$
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gen.ggettext import gettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
from Filters.Rules._Rule import Rule
from gen.lib import MarkerType
#-------------------------------------------------------------------------
#
# HasCompleteRecord
#
#-------------------------------------------------------------------------
class HasCompleteRecord(Rule):
"""Rule that checks for a person whose record is complete"""
name = _('People with complete records')
category = _('General filters')
description = _('Matches all people whose records are complete')
def apply(self,db,person):
return person.get_marker() == MarkerType.COMPLETE

View File

@ -1,46 +0,0 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 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$
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gen.ggettext import gettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
from Filters.Rules._HasMarkerBase import HasMarkerBase
#-------------------------------------------------------------------------
#
# HasEvent
#
#-------------------------------------------------------------------------
class HasMarkerOf(HasMarkerBase):
"""Rule that checks for a person with a particular marker"""
name = _('People with <marker>')
description = _("Matches people with a marker of a particular value")

View File

@ -53,7 +53,6 @@ from _HasTag import HasTag
from _HasTextMatchingRegexpOf import HasTextMatchingRegexpOf from _HasTextMatchingRegexpOf import HasTextMatchingRegexpOf
from _HasTextMatchingSubstringOf import HasTextMatchingSubstringOf from _HasTextMatchingSubstringOf import HasTextMatchingSubstringOf
from _HasUnknownGender import HasUnknownGender from _HasUnknownGender import HasUnknownGender
from _HasMarkerOf import HasMarkerOf
from _HaveAltFamilies import HaveAltFamilies from _HaveAltFamilies import HaveAltFamilies
from _HaveChildren import HaveChildren from _HaveChildren import HaveChildren
from _IncompleteNames import IncompleteNames from _IncompleteNames import IncompleteNames
@ -130,7 +129,6 @@ editor_rule_list = [
HasTag, HasTag,
HasSource, HasSource,
HasSourceOf, HasSourceOf,
HasMarkerOf,
HaveAltFamilies, HaveAltFamilies,
HavePhotos, HavePhotos,
HaveChildren, HaveChildren,

View File

@ -1,55 +0,0 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 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$
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from gen.ggettext import gettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
from gen.lib import MarkerType
from Filters.Rules import Rule
#-------------------------------------------------------------------------
#
# HasEvent
#
#-------------------------------------------------------------------------
class HasMarkerBase(Rule):
"""Rule that checks for a person with a particular value."""
labels = [ _('Marker type:')]
name = _('Has marker of')
description = _("Matches markers of a particular type")
category = _('General filters')
def apply(self, db, obj):
specified_type = MarkerType()
specified_type.set_from_xml_str(self.list[0])
return obj.get_marker() == specified_type

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2002-2006 Donald N. Allingham # Copyright (C) 2002-2006 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -48,7 +49,7 @@ from Filters.Rules.Family import (RegExpIdOf, HasIdOf, RegExpFatherName,
SearchFatherName, RegExpMotherName, SearchFatherName, RegExpMotherName,
SearchMotherName, RegExpChildName, SearchMotherName, RegExpChildName,
SearchChildName, HasEvent, HasRelType, SearchChildName, HasEvent, HasRelType,
HasMarkerOf, HasNoteRegexp, HasTag, HasNoteRegexp,
HasNoteMatchingSubstringOf, MatchesFilter) HasNoteMatchingSubstringOf, MatchesFilter)
GenericFamilyFilter = GenericFilterFactory('Family') GenericFamilyFilter = GenericFilterFactory('Family')
@ -84,18 +85,11 @@ class FamilySidebarFilter(SidebarFilter):
self.family_stub.set_relationship, self.family_stub.set_relationship,
self.family_stub.get_relationship) self.family_stub.get_relationship)
self.filter_marker = gen.lib.Family()
self.filter_marker.set_marker((gen.lib.MarkerType.CUSTOM, u''))
self.mtype = gtk.ComboBoxEntry()
self.marker_menu = widgets.MonitoredDataType(
self.mtype,
self.filter_marker.set_marker,
self.filter_marker.get_marker)
self.filter_note = gtk.Entry() self.filter_note = gtk.Entry()
self.filter_regex = gtk.CheckButton(_('Use regular expressions')) self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
self.tag = gtk.ComboBox()
self.generic = gtk.ComboBox() self.generic = gtk.ComboBox()
SidebarFilter.__init__(self, dbstate, uistate, "Family") SidebarFilter.__init__(self, dbstate, uistate, "Family")
@ -108,14 +102,20 @@ class FamilySidebarFilter(SidebarFilter):
self.generic.add_attribute(cell, 'text', 0) self.generic.add_attribute(cell, 'text', 0)
self.on_filters_changed('Family') self.on_filters_changed('Family')
cell = gtk.CellRendererText()
cell.set_property('width', self._FILTER_WIDTH)
cell.set_property('ellipsize', self._FILTER_ELLIPSIZE)
self.tag.pack_start(cell, True)
self.tag.add_attribute(cell, 'text', 0)
self.add_text_entry(_('ID'), self.filter_id) self.add_text_entry(_('ID'), self.filter_id)
self.add_text_entry(_('Father'), self.filter_father) self.add_text_entry(_('Father'), self.filter_father)
self.add_text_entry(_('Mother'), self.filter_mother) self.add_text_entry(_('Mother'), self.filter_mother)
self.add_text_entry(_('Child'), self.filter_child) self.add_text_entry(_('Child'), self.filter_child)
self.add_entry(_('Relationship'), self.rtype) self.add_entry(_('Relationship'), self.rtype)
self.add_entry(_('Family Event'), self.etype) self.add_entry(_('Family Event'), self.etype)
self.add_entry(_('Marker'), self.mtype)
self.add_text_entry(_('Family Note'), self.filter_note) self.add_text_entry(_('Family Note'), self.filter_note)
self.add_entry(_('Tag'), self.tag)
self.add_filter_entry(_('Custom filter'), self.generic) self.add_filter_entry(_('Custom filter'), self.generic)
self.add_entry(None, self.filter_regex) self.add_entry(None, self.filter_regex)
@ -127,7 +127,7 @@ class FamilySidebarFilter(SidebarFilter):
self.filter_note.set_text(u'') self.filter_note.set_text(u'')
self.etype.child.set_text(u'') self.etype.child.set_text(u'')
self.rtype.child.set_text(u'') self.rtype.child.set_text(u'')
self.mtype.child.set_text(u'') self.tag.set_active(0)
self.generic.set_active(0) self.generic.set_active(0)
def get_filter(self): def get_filter(self):
@ -138,12 +138,12 @@ class FamilySidebarFilter(SidebarFilter):
note = unicode(self.filter_note.get_text()).strip() note = unicode(self.filter_note.get_text()).strip()
etype = self.filter_event.get_type().xml_str() etype = self.filter_event.get_type().xml_str()
rtype = self.family_stub.get_relationship().xml_str() rtype = self.family_stub.get_relationship().xml_str()
mtype = self.filter_marker.get_marker().xml_str()
regex = self.filter_regex.get_active() regex = self.filter_regex.get_active()
tag = self.tag.get_active() > 0
generic = self.generic.get_active() > 0 generic = self.generic.get_active() > 0
empty = not (gid or father or mother or child or note or mtype empty = not (gid or father or mother or child or note
or regex or etype or rtype or generic) or regex or etype or rtype or tag or generic)
if empty: if empty:
generic_filter = None generic_filter = None
else: else:
@ -184,10 +184,6 @@ class FamilySidebarFilter(SidebarFilter):
rule = HasRelType([rtype]) rule = HasRelType([rtype])
generic_filter.add_rule(rule) generic_filter.add_rule(rule)
if mtype:
rule = HasMarkerOf([mtype])
generic_filter.add_rule(rule)
if note: if note:
if regex: if regex:
rule = HasNoteRegexp([note]) rule = HasNoteRegexp([note])
@ -195,6 +191,14 @@ class FamilySidebarFilter(SidebarFilter):
rule = HasNoteMatchingSubstringOf([note]) rule = HasNoteMatchingSubstringOf([note])
generic_filter.add_rule(rule) generic_filter.add_rule(rule)
# check the Tag
if tag:
model = self.tag.get_model()
node = self.tag.get_active_iter()
attr = model.get_value(node, 0)
rule = HasTag([attr])
generic_filter.add_rule(rule)
if self.generic.get_active() != 0: if self.generic.get_active() != 0:
model = self.generic.get_model() model = self.generic.get_model()
node = self.generic.get_active_iter() node = self.generic.get_active_iter()
@ -211,3 +215,14 @@ class FamilySidebarFilter(SidebarFilter):
all_filter.add_rule(Rules.Family.AllFamilies([])) all_filter.add_rule(Rules.Family.AllFamilies([]))
self.generic.set_model(build_filter_model('Family', [all_filter])) self.generic.set_model(build_filter_model('Family', [all_filter]))
self.generic.set_active(0) self.generic.set_active(0)
def on_tags_changed(self, tag_list):
"""
Update the list of tags in the tag filter.
"""
model = gtk.ListStore(str)
model.append(('',))
for tag_name in tag_list:
model.append((tag_name,))
self.tag.set_model(model)
self.tag.set_active(0)

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2002-2006 Donald N. Allingham # Copyright (C) 2002-2006 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -41,7 +42,7 @@ import gtk
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from Filters.SideBar import SidebarFilter from Filters.SideBar import SidebarFilter
from Filters import GenericFilterFactory, build_filter_model, Rules from Filters import GenericFilterFactory, build_filter_model, Rules
from Filters.Rules.MediaObject import (RegExpIdOf, HasIdOf, HasMedia, from Filters.Rules.MediaObject import (RegExpIdOf, HasIdOf, HasMedia, HasTag,
HasNoteRegexp, MatchesFilter, HasNoteRegexp, MatchesFilter,
HasNoteMatchingSubstringOf) HasNoteMatchingSubstringOf)
@ -65,6 +66,7 @@ class MediaSidebarFilter(SidebarFilter):
self.filter_regex = gtk.CheckButton(_('Use regular expressions')) self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
self.tag = gtk.ComboBox()
self.generic = gtk.ComboBox() self.generic = gtk.ComboBox()
SidebarFilter.__init__(self, dbstate, uistate, "MediaObject") SidebarFilter.__init__(self, dbstate, uistate, "MediaObject")
@ -77,12 +79,19 @@ class MediaSidebarFilter(SidebarFilter):
self.generic.add_attribute(cell, 'text', 0) self.generic.add_attribute(cell, 'text', 0)
self.on_filters_changed('MediaObject') self.on_filters_changed('MediaObject')
cell = gtk.CellRendererText()
cell.set_property('width', self._FILTER_WIDTH)
cell.set_property('ellipsize', self._FILTER_ELLIPSIZE)
self.tag.pack_start(cell, True)
self.tag.add_attribute(cell, 'text', 0)
self.add_text_entry(_('ID'), self.filter_id) self.add_text_entry(_('ID'), self.filter_id)
self.add_text_entry(_('Title'), self.filter_title) self.add_text_entry(_('Title'), self.filter_title)
self.add_text_entry(_('Type'), self.filter_type) self.add_text_entry(_('Type'), self.filter_type)
self.add_text_entry(_('Path'), self.filter_path) self.add_text_entry(_('Path'), self.filter_path)
self.add_text_entry(_('Date'), self.filter_date) self.add_text_entry(_('Date'), self.filter_date)
self.add_text_entry(_('Note'), self.filter_note) self.add_text_entry(_('Note'), self.filter_note)
self.add_entry(_('Tag'), self.tag)
self.add_filter_entry(_('Custom filter'), self.generic) self.add_filter_entry(_('Custom filter'), self.generic)
self.add_entry(None, self.filter_regex) self.add_entry(None, self.filter_regex)
@ -93,6 +102,7 @@ class MediaSidebarFilter(SidebarFilter):
self.filter_path.set_text('') self.filter_path.set_text('')
self.filter_date.set_text('') self.filter_date.set_text('')
self.filter_note.set_text('') self.filter_note.set_text('')
self.tag.set_active(0)
self.generic.set_active(0) self.generic.set_active(0)
def get_filter(self): def get_filter(self):
@ -103,10 +113,11 @@ class MediaSidebarFilter(SidebarFilter):
date = unicode(self.filter_date.get_text()).strip() date = unicode(self.filter_date.get_text()).strip()
note = unicode(self.filter_note.get_text()).strip() note = unicode(self.filter_note.get_text()).strip()
regex = self.filter_regex.get_active() regex = self.filter_regex.get_active()
tag = self.tag.get_active() > 0
gen = self.generic.get_active() > 0 gen = self.generic.get_active() > 0
empty = not (gid or title or mime or path or date empty = not (gid or title or mime or path or date
or note or regex or gen) or note or regex or tag or gen)
if empty: if empty:
generic_filter = None generic_filter = None
else: else:
@ -128,6 +139,14 @@ class MediaSidebarFilter(SidebarFilter):
rule = HasNoteMatchingSubstringOf([note]) rule = HasNoteMatchingSubstringOf([note])
generic_filter.add_rule(rule) generic_filter.add_rule(rule)
# check the Tag
if tag:
model = self.tag.get_model()
node = self.tag.get_active_iter()
attr = model.get_value(node, 0)
rule = HasTag([attr])
generic_filter.add_rule(rule)
if self.generic.get_active() != 0: if self.generic.get_active() != 0:
model = self.generic.get_model() model = self.generic.get_model()
node = self.generic.get_active_iter() node = self.generic.get_active_iter()
@ -145,3 +164,14 @@ class MediaSidebarFilter(SidebarFilter):
self.generic.set_model(build_filter_model('MediaObject', self.generic.set_model(build_filter_model('MediaObject',
[all_filter])) [all_filter]))
self.generic.set_active(0) self.generic.set_active(0)
def on_tags_changed(self, tag_list):
"""
Update the list of tags in the tag filter.
"""
model = gtk.ListStore(str)
model.append(('',))
for tag_name in tag_list:
model.append((tag_name,))
self.tag.set_model(model)
self.tag.set_active(0)

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2002-2006 Donald N. Allingham # Copyright (C) 2002-2006 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -44,7 +45,8 @@ from gen.lib import Note, NoteType
from Filters.SideBar import SidebarFilter from Filters.SideBar import SidebarFilter
from Filters import GenericFilterFactory, build_filter_model, Rules from Filters import GenericFilterFactory, build_filter_model, Rules
from Filters.Rules.Note import RegExpIdOf, HasIdOf, HasNote, MatchesFilter from Filters.Rules.Note import (RegExpIdOf, HasIdOf, HasNote, MatchesFilter,
HasTag)
GenericNoteFilter = GenericFilterFactory('Note') GenericNoteFilter = GenericFilterFactory('Note')
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -69,6 +71,7 @@ class NoteSidebarFilter(SidebarFilter):
self.filter_regex = gtk.CheckButton(_('Use regular expressions')) self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
self.tag = gtk.ComboBox()
self.generic = gtk.ComboBox() self.generic = gtk.ComboBox()
SidebarFilter.__init__(self, dbstate, uistate, "Note") SidebarFilter.__init__(self, dbstate, uistate, "Note")
@ -81,9 +84,16 @@ class NoteSidebarFilter(SidebarFilter):
self.generic.add_attribute(cell, 'text', 0) self.generic.add_attribute(cell, 'text', 0)
self.on_filters_changed('Note') self.on_filters_changed('Note')
cell = gtk.CellRendererText()
cell.set_property('width', self._FILTER_WIDTH)
cell.set_property('ellipsize', self._FILTER_ELLIPSIZE)
self.tag.pack_start(cell, True)
self.tag.add_attribute(cell, 'text', 0)
self.add_text_entry(_('ID'), self.filter_id) self.add_text_entry(_('ID'), self.filter_id)
self.add_text_entry(_('Text'), self.filter_text) self.add_text_entry(_('Text'), self.filter_text)
self.add_entry(_('Type'), self.ntype) self.add_entry(_('Type'), self.ntype)
self.add_entry(_('Tag'), self.tag)
self.add_filter_entry(_('Custom filter'), self.generic) self.add_filter_entry(_('Custom filter'), self.generic)
self.add_entry(None, self.filter_regex) self.add_entry(None, self.filter_regex)
@ -91,6 +101,7 @@ class NoteSidebarFilter(SidebarFilter):
self.filter_id.set_text('') self.filter_id.set_text('')
self.filter_text.set_text('') self.filter_text.set_text('')
self.ntype.child.set_text('') self.ntype.child.set_text('')
self.tag.set_active(0)
self.generic.set_active(0) self.generic.set_active(0)
def get_filter(self): def get_filter(self):
@ -98,9 +109,10 @@ class NoteSidebarFilter(SidebarFilter):
text = unicode(self.filter_text.get_text()).strip() text = unicode(self.filter_text.get_text()).strip()
ntype = self.note.get_type().xml_str() ntype = self.note.get_type().xml_str()
regex = self.filter_regex.get_active() regex = self.filter_regex.get_active()
tag = self.tag.get_active() > 0
gen = self.generic.get_active() > 0 gen = self.generic.get_active() > 0
empty = not (gid or text or ntype or regex or gen) empty = not (gid or text or ntype or regex or tag or gen)
if empty: if empty:
generic_filter = None generic_filter = None
else: else:
@ -115,6 +127,13 @@ class NoteSidebarFilter(SidebarFilter):
rule = HasNote([text, ntype]) rule = HasNote([text, ntype])
generic_filter.add_rule(rule) generic_filter.add_rule(rule)
# check the Tag
if tag:
model = self.tag.get_model()
node = self.tag.get_active_iter()
attr = model.get_value(node, 0)
rule = HasTag([attr])
generic_filter.add_rule(rule)
if self.generic.get_active() != 0: if self.generic.get_active() != 0:
model = self.generic.get_model() model = self.generic.get_model()
@ -132,3 +151,14 @@ class NoteSidebarFilter(SidebarFilter):
all_filter.add_rule(Rules.Note.AllNotes([])) all_filter.add_rule(Rules.Note.AllNotes([]))
self.generic.set_model(build_filter_model('Note', [all_filter])) self.generic.set_model(build_filter_model('Note', [all_filter]))
self.generic.set_active(0) self.generic.set_active(0)
def on_tags_changed(self, tag_list):
"""
Update the list of tags in the tag filter.
"""
model = gtk.ListStore(str)
model.append(('',))
for tag_name in tag_list:
model.append((tag_name,))
self.tag.set_model(model)
self.tag.set_active(0)

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2002-2006 Donald N. Allingham # Copyright (C) 2002-2006 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -45,10 +46,9 @@ import gen.lib
import DateHandler import DateHandler
from Filters.SideBar import SidebarFilter from Filters.SideBar import SidebarFilter
from Filters.Rules.Person import (RegExpName, SearchName, RegExpIdOf, from Filters.Rules.Person import (RegExpName, SearchName, RegExpIdOf, MatchIdOf,
MatchIdOf, IsMale, IsFemale, HasUnknownGender, IsMale, IsFemale, HasUnknownGender, HasEvent,
HasMarkerOf, HasEvent, HasTag, HasTag, HasBirth, HasDeath, HasNoteRegexp,
HasBirth, HasDeath, HasNoteRegexp,
HasNoteMatchingSubstringOf, MatchesFilter) HasNoteMatchingSubstringOf, MatchesFilter)
from Filters import GenericFilter, build_filter_model, Rules from Filters import GenericFilter, build_filter_model, Rules
@ -84,16 +84,6 @@ class PersonSidebarFilter(SidebarFilter):
self.filter_event.set_type, self.filter_event.set_type,
self.filter_event.get_type) self.filter_event.get_type)
self.filter_marker = gen.lib.Person()
self.filter_marker.set_marker((gen.lib.MarkerType.CUSTOM, u''))
self.mtype = gtk.ComboBoxEntry()
self.marker_menu = widgets.MonitoredDataType(
self.mtype,
self.filter_marker.set_marker,
self.filter_marker.get_marker)
self.tag = gtk.ComboBox()
self.filter_note = gtk.Entry() self.filter_note = gtk.Entry()
self.filter_gender = gtk.combo_box_new_text() self.filter_gender = gtk.combo_box_new_text()
map(self.filter_gender.append_text, map(self.filter_gender.append_text,
@ -102,6 +92,7 @@ class PersonSidebarFilter(SidebarFilter):
self.filter_regex = gtk.CheckButton(_('Use regular expressions')) self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
self.tag = gtk.ComboBox()
self.generic = gtk.ComboBox() self.generic = gtk.ComboBox()
SidebarFilter.__init__(self, dbstate, uistate, "Person") SidebarFilter.__init__(self, dbstate, uistate, "Person")
@ -139,9 +130,8 @@ class PersonSidebarFilter(SidebarFilter):
self.add_text_entry(_('Death date'), self.filter_death, self.add_text_entry(_('Death date'), self.filter_death,
_('example: "%s" or "%s"') % (msg1, msg2)) _('example: "%s" or "%s"') % (msg1, msg2))
self.add_entry(_('Event'), self.etype) self.add_entry(_('Event'), self.etype)
self.add_entry(_('Marker'), self.mtype)
self.add_entry(_('Tag'), self.tag)
self.add_text_entry(_('Note'), self.filter_note) self.add_text_entry(_('Note'), self.filter_note)
self.add_entry(_('Tag'), self.tag)
self.add_filter_entry(_('Custom filter'), self.generic) self.add_filter_entry(_('Custom filter'), self.generic)
self.add_entry(None, self.filter_regex) self.add_entry(None, self.filter_regex)
@ -153,7 +143,6 @@ class PersonSidebarFilter(SidebarFilter):
self.filter_note.set_text(u'') self.filter_note.set_text(u'')
self.filter_gender.set_active(0) self.filter_gender.set_active(0)
self.etype.child.set_text(u'') self.etype.child.set_text(u'')
self.mtype.child.set_text(u'')
self.tag.set_active(0) self.tag.set_active(0)
self.generic.set_active(0) self.generic.set_active(0)
@ -172,17 +161,16 @@ class PersonSidebarFilter(SidebarFilter):
# extract remaining data from the menus # extract remaining data from the menus
etype = self.filter_event.get_type().xml_str() etype = self.filter_event.get_type().xml_str()
mtype = self.filter_marker.get_marker().xml_str()
gender = self.filter_gender.get_active() gender = self.filter_gender.get_active()
regex = self.filter_regex.get_active() regex = self.filter_regex.get_active()
generic = self.generic.get_active() > 0
tag = self.tag.get_active() > 0 tag = self.tag.get_active() > 0
generic = self.generic.get_active() > 0
# check to see if the filter is empty. If it is empty, then # check to see if the filter is empty. If it is empty, then
# we don't build a filter # we don't build a filter
empty = not (name or gid or birth or death or etype or mtype empty = not (name or gid or birth or death or etype
or note or gender or regex or generic or tag) or note or gender or regex or tag or generic)
if empty: if empty:
generic_filter = None generic_filter = None
else: else:
@ -216,19 +204,6 @@ class PersonSidebarFilter(SidebarFilter):
else: else:
generic_filter.add_rule(HasUnknownGender([])) generic_filter.add_rule(HasUnknownGender([]))
# check the Marker type
if mtype:
rule = HasMarkerOf([mtype])
generic_filter.add_rule(rule)
# check the Tag
if tag:
model = self.tag.get_model()
node = self.tag.get_active_iter()
attr = model.get_value(node, 0)
rule = HasTag([attr])
generic_filter.add_rule(rule)
# Build an event filter if needed # Build an event filter if needed
if etype: if etype:
rule = HasEvent([etype, u'', u'', u'']) rule = HasEvent([etype, u'', u'', u''])
@ -255,6 +230,14 @@ class PersonSidebarFilter(SidebarFilter):
rule = HasNoteMatchingSubstringOf([note]) rule = HasNoteMatchingSubstringOf([note])
generic_filter.add_rule(rule) generic_filter.add_rule(rule)
# check the Tag
if tag:
model = self.tag.get_model()
node = self.tag.get_active_iter()
attr = model.get_value(node, 0)
rule = HasTag([attr])
generic_filter.add_rule(rule)
if self.generic.get_active() != 0: if self.generic.get_active() != 0:
model = self.generic.get_model() model = self.generic.get_model()
node = self.generic.get_active_iter() node = self.generic.get_active_iter()

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2002-2006 Donald N. Allingham # Copyright (C) 2002-2006 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by

View File

@ -108,15 +108,6 @@ class MergeEvents(ManagedWindow.ManagedWindow):
for widget_name in ('desc1', 'desc2', 'desc_btn1', 'desc_btn2'): for widget_name in ('desc1', 'desc2', 'desc_btn1', 'desc_btn2'):
self.get_widget(widget_name).set_sensitive(False) self.get_widget(widget_name).set_sensitive(False)
entry1 = self.get_widget("marker1")
entry2 = self.get_widget("marker2")
entry1.set_text(str(self.ev1.get_marker()))
entry2.set_text(str(self.ev2.get_marker()))
if entry1.get_text() == entry2.get_text():
for widget_name in ('marker1', 'marker2', 'marker_btn1',
'marker_btn2'):
self.get_widget(widget_name).set_sensitive(False)
gramps1 = self.ev1.get_gramps_id() gramps1 = self.ev1.get_gramps_id()
gramps2 = self.ev2.get_gramps_id() gramps2 = self.ev2.get_gramps_id()
entry1 = self.get_widget("gramps1") entry1 = self.get_widget("gramps1")
@ -150,14 +141,12 @@ class MergeEvents(ManagedWindow.ManagedWindow):
self.get_widget("date_btn1").set_active(True) self.get_widget("date_btn1").set_active(True)
self.get_widget("place_btn1").set_active(True) self.get_widget("place_btn1").set_active(True)
self.get_widget("desc_btn1").set_active(True) self.get_widget("desc_btn1").set_active(True)
self.get_widget("marker_btn1").set_active(True)
self.get_widget("gramps_btn1").set_active(True) self.get_widget("gramps_btn1").set_active(True)
else: else:
self.get_widget("type_btn2").set_active(True) self.get_widget("type_btn2").set_active(True)
self.get_widget("date_btn2").set_active(True) self.get_widget("date_btn2").set_active(True)
self.get_widget("place_btn2").set_active(True) self.get_widget("place_btn2").set_active(True)
self.get_widget("desc_btn2").set_active(True) self.get_widget("desc_btn2").set_active(True)
self.get_widget("marker_btn2").set_active(True)
self.get_widget("gramps_btn2").set_active(True) self.get_widget("gramps_btn2").set_active(True)
def cb_help(self, obj): def cb_help(self, obj):
@ -187,8 +176,6 @@ class MergeEvents(ManagedWindow.ManagedWindow):
phoenix.set_place_handle(titanic.get_place_handle()) phoenix.set_place_handle(titanic.get_place_handle())
if self.get_widget("desc_btn1").get_active() ^ use_handle1: if self.get_widget("desc_btn1").get_active() ^ use_handle1:
phoenix.set_description(titanic.get_description()) phoenix.set_description(titanic.get_description())
if self.get_widget("marker_btn1").get_active() ^ use_handle1:
phoenix.set_marker(titanic.get_marker())
if self.get_widget("gramps_btn1").get_active() ^ use_handle1: if self.get_widget("gramps_btn1").get_active() ^ use_handle1:
phoenix.set_gramps_id(titanic.get_gramps_id()) phoenix.set_gramps_id(titanic.get_gramps_id())
# cause is deprecated. # cause is deprecated.

View File

@ -113,15 +113,6 @@ class MergeFamilies(ManagedWindow.ManagedWindow):
for widget_name in ('rel1', 'rel2', 'rel_btn1', 'rel_btn2'): for widget_name in ('rel1', 'rel2', 'rel_btn1', 'rel_btn2'):
self.get_widget(widget_name).set_sensitive(False) self.get_widget(widget_name).set_sensitive(False)
entry1 = self.get_widget("marker1")
entry2 = self.get_widget("marker2")
entry1.set_text(str(self.fy1.get_marker()))
entry2.set_text(str(self.fy2.get_marker()))
if entry1.get_text() == entry2.get_text():
for widget_name in ('marker1', 'marker2', 'marker_btn1',
'marker_btn2'):
self.get_widget(widget_name).set_sensitive(False)
gramps1 = self.fy1.get_gramps_id() gramps1 = self.fy1.get_gramps_id()
gramps2 = self.fy2.get_gramps_id() gramps2 = self.fy2.get_gramps_id()
entry1 = self.get_widget("gramps1") entry1 = self.get_widget("gramps1")
@ -152,13 +143,11 @@ class MergeFamilies(ManagedWindow.ManagedWindow):
self.get_widget("father_btn1").set_active(True) self.get_widget("father_btn1").set_active(True)
self.get_widget("mother_btn1").set_active(True) self.get_widget("mother_btn1").set_active(True)
self.get_widget("rel_btn1").set_active(True) self.get_widget("rel_btn1").set_active(True)
self.get_widget("marker_btn1").set_active(True)
self.get_widget("gramps_btn1").set_active(True) self.get_widget("gramps_btn1").set_active(True)
else: else:
self.get_widget("father_btn2").set_active(True) self.get_widget("father_btn2").set_active(True)
self.get_widget("mother_btn2").set_active(True) self.get_widget("mother_btn2").set_active(True)
self.get_widget("rel_btn2").set_active(True) self.get_widget("rel_btn2").set_active(True)
self.get_widget("marker_btn2").set_active(True)
self.get_widget("gramps_btn2").set_active(True) self.get_widget("gramps_btn2").set_active(True)
def cb_help(self, obj): def cb_help(self, obj):
@ -232,9 +221,6 @@ class MergeFamilies(ManagedWindow.ManagedWindow):
if self.get_widget("rel_btn1").get_active() ^ use_handle1: if self.get_widget("rel_btn1").get_active() ^ use_handle1:
phoenix.set_relationship(titanic.get_relationship()) phoenix.set_relationship(titanic.get_relationship())
need_commit = True need_commit = True
if self.get_widget("marker_btn1").get_active() ^ use_handle1:
phoenix.set_marker(titanic.get_marker())
need_commit = True
if self.get_widget("gramps_btn1").get_active() ^ use_handle1: if self.get_widget("gramps_btn1").get_active() ^ use_handle1:
phoenix.set_gramps_id(titanic.get_gramps_id()) phoenix.set_gramps_id(titanic.get_gramps_id())
need_commit = True need_commit = True

View File

@ -99,15 +99,6 @@ class MergeNotes(ManagedWindow.ManagedWindow):
'format_btn2'): 'format_btn2'):
self.get_widget(widget_name).set_sensitive(False) self.get_widget(widget_name).set_sensitive(False)
entry1 = self.get_widget("marker1")
entry2 = self.get_widget("marker2")
entry1.set_text(str(self.no1.get_marker()))
entry2.set_text(str(self.no2.get_marker()))
if entry1.get_text() == entry2.get_text():
for widget_name in ('marker1', 'marker2', 'marker_btn1',
'marker_btn2'):
self.get_widget(widget_name).set_sensitive(False)
gramps1 = self.no1.get_gramps_id() gramps1 = self.no1.get_gramps_id()
gramps2 = self.no2.get_gramps_id() gramps2 = self.no2.get_gramps_id()
entry1 = self.get_widget("gramps1") entry1 = self.get_widget("gramps1")
@ -144,13 +135,11 @@ class MergeNotes(ManagedWindow.ManagedWindow):
self.get_widget("text_btn1").set_active(True) self.get_widget("text_btn1").set_active(True)
self.get_widget("type_btn1").set_active(True) self.get_widget("type_btn1").set_active(True)
self.get_widget("format_btn1").set_active(True) self.get_widget("format_btn1").set_active(True)
self.get_widget("marker_btn1").set_active(True)
self.get_widget("gramps_btn1").set_active(True) self.get_widget("gramps_btn1").set_active(True)
else: else:
self.get_widget("text_btn2").set_active(True) self.get_widget("text_btn2").set_active(True)
self.get_widget("type_btn2").set_active(True) self.get_widget("type_btn2").set_active(True)
self.get_widget("format_btn2").set_active(True) self.get_widget("format_btn2").set_active(True)
self.get_widget("marker_btn2").set_active(True)
self.get_widget("gramps_btn2").set_active(True) self.get_widget("gramps_btn2").set_active(True)
def cb_help(self, obj): def cb_help(self, obj):
@ -177,8 +166,6 @@ class MergeNotes(ManagedWindow.ManagedWindow):
phoenix.set_type(titanic.get_type()) phoenix.set_type(titanic.get_type())
if self.get_widget("format_btn1").get_active() ^ use_handle1: if self.get_widget("format_btn1").get_active() ^ use_handle1:
phoenix.set_format(titanic.get_format()) phoenix.set_format(titanic.get_format())
if self.get_widget("marker_btn1").get_active() ^ use_handle1:
phoenix.set_marker(titanic.get_marker())
if self.get_widget("gramps_btn1").get_active() ^ use_handle1: if self.get_widget("gramps_btn1").get_active() ^ use_handle1:
phoenix.set_gramps_id(titanic.get_gramps_id()) phoenix.set_gramps_id(titanic.get_gramps_id())

View File

@ -102,15 +102,6 @@ class MergePeople(ManagedWindow.ManagedWindow):
'gender_btn2'): 'gender_btn2'):
self.get_widget(widget_name).set_sensitive(False) self.get_widget(widget_name).set_sensitive(False)
entry1 = self.get_widget("marker1")
entry2 = self.get_widget("marker2")
entry1.set_text(str(self.pr1.get_marker()))
entry2.set_text(str(self.pr2.get_marker()))
if entry1.get_text() == entry2.get_text():
for widget_name in ('marker1', 'marker2', 'marker_btn1',
'marker_btn2'):
self.get_widget(widget_name).set_sensitive(False)
gramps1 = self.pr1.get_gramps_id() gramps1 = self.pr1.get_gramps_id()
gramps2 = self.pr2.get_gramps_id() gramps2 = self.pr2.get_gramps_id()
entry1 = self.get_widget("gramps1") entry1 = self.get_widget("gramps1")
@ -143,12 +134,10 @@ class MergePeople(ManagedWindow.ManagedWindow):
if obj.get_active(): if obj.get_active():
self.get_widget("name_btn1").set_active(True) self.get_widget("name_btn1").set_active(True)
self.get_widget("gender_btn1").set_active(True) self.get_widget("gender_btn1").set_active(True)
self.get_widget("marker_btn1").set_active(True)
self.get_widget("gramps_btn1").set_active(True) self.get_widget("gramps_btn1").set_active(True)
else: else:
self.get_widget("name_btn2").set_active(True) self.get_widget("name_btn2").set_active(True)
self.get_widget("gender_btn2").set_active(True) self.get_widget("gender_btn2").set_active(True)
self.get_widget("marker_btn2").set_active(True)
self.get_widget("gramps_btn2").set_active(True) self.get_widget("gramps_btn2").set_active(True)
def on_expander2_activated(self, obj): def on_expander2_activated(self, obj):
@ -325,8 +314,6 @@ class MergePeople(ManagedWindow.ManagedWindow):
titanic.set_primary_name(swapname) titanic.set_primary_name(swapname)
if self.get_widget("gender_btn1").get_active() ^ use_handle1: if self.get_widget("gender_btn1").get_active() ^ use_handle1:
phoenix.set_gender(titanic.get_gender()) phoenix.set_gender(titanic.get_gender())
if self.get_widget("marker_btn1").get_active() ^ use_handle1:
phoenix.set_marker(titanic.get_marker())
if self.get_widget("gramps_btn1").get_active() ^ use_handle1: if self.get_widget("gramps_btn1").get_active() ^ use_handle1:
swapid = phoenix.get_gramps_id() swapid = phoenix.get_gramps_id()
phoenix.set_gramps_id(titanic.get_gramps_id()) phoenix.set_gramps_id(titanic.get_gramps_id())

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2000-2007 Donald N. Allingham # Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -302,12 +303,6 @@ class DbReadBase(object):
""" """
raise NotImplementedError raise NotImplementedError
def get_marker_types(self):
"""
Return a list of all marker types available in the database.
"""
raise NotImplementedError
def get_media_attribute_types(self): def get_media_attribute_types(self):
""" """
Return a list of all Attribute types associated with Media and MediaRef Return a list of all Attribute types associated with Media and MediaRef

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2000-2007 Donald N. Allingham # Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -264,7 +265,6 @@ class DbBsddbRead(DbReadBase, Callback):
self.individual_event_names = set() self.individual_event_names = set()
self.individual_attributes = set() self.individual_attributes = set()
self.family_attributes = set() self.family_attributes = set()
self.marker_names = set()
self.child_ref_types = set() self.child_ref_types = set()
self.family_rel_types = set() self.family_rel_types = set()
self.event_role_names = set() self.event_role_names = set()
@ -1217,12 +1217,6 @@ class DbBsddbRead(DbReadBase, Callback):
""" """
return list(self.family_event_names) return list(self.family_event_names)
def get_marker_types(self):
"""
Return a list of all marker types available in the database.
"""
return list(self.marker_names)
def get_media_attribute_types(self): def get_media_attribute_types(self):
""" """
Return a list of all Attribute types assocated with Media and MediaRef Return a list of all Attribute types assocated with Media and MediaRef

View File

@ -39,7 +39,6 @@ class DbTest(object):
"get_family_relation_types", "get_family_relation_types",
"get_from_handle", "get_from_handle",
"get_gramps_ids", "get_gramps_ids",
"get_marker_types",
"get_media_attribute_types", "get_media_attribute_types",
"get_media_bookmarks", "get_media_bookmarks",
"get_media_cursor", "get_media_cursor",
@ -62,6 +61,7 @@ class DbTest(object):
"get_number_of_places", "get_number_of_places",
"get_number_of_repositories", "get_number_of_repositories",
"get_number_of_sources", "get_number_of_sources",
"get_number_of_tags",
"get_object_from_gramps_id", "get_object_from_gramps_id",
"get_object_from_handle", "get_object_from_handle",
"get_person_attribute_types", "get_person_attribute_types",
@ -83,6 +83,7 @@ class DbTest(object):
"get_raw_place_data", "get_raw_place_data",
"get_raw_repository_data", "get_raw_repository_data",
"get_raw_source_data", "get_raw_source_data",
"get_raw_tag_data",
"get_reference_map_cursor", "get_reference_map_cursor",
"get_reference_map_primary_cursor", "get_reference_map_primary_cursor",
"get_reference_map_referenced_cursor", "get_reference_map_referenced_cursor",
@ -100,6 +101,10 @@ class DbTest(object):
"get_source_from_handle", "get_source_from_handle",
"get_source_handles", "get_source_handles",
"get_source_media_types", "get_source_media_types",
"get_tag_cursor",
"get_tag_from_name",
"get_tag_from_handle",
"get_tag_handles",
"get_surname_list", "get_surname_list",
"get_url_types", "get_url_types",
"gramps_upgrade", "gramps_upgrade",
@ -113,6 +118,7 @@ class DbTest(object):
"has_place_handle", "has_place_handle",
"has_repository_handle", "has_repository_handle",
"has_source_handle", "has_source_handle",
"has_tag_handle",
"is_open", "is_open",
"iter_event_handles", "iter_event_handles",
"iter_events", "iter_events",
@ -130,6 +136,8 @@ class DbTest(object):
"iter_repository_handles", "iter_repository_handles",
"iter_source_handles", "iter_source_handles",
"iter_sources", "iter_sources",
"iter_tag_handles",
"iter_tags",
"load", "load",
"report_bm_change", "report_bm_change",
"request_rebuild", "request_rebuild",
@ -164,6 +172,7 @@ class DbTest(object):
"add_place", "add_place",
"add_repository", "add_repository",
"add_source", "add_source",
"add_tag",
"add_to_surname_list", "add_to_surname_list",
"build_surname_list", "build_surname_list",
"commit_base", "commit_base",
@ -177,6 +186,7 @@ class DbTest(object):
"commit_place", "commit_place",
"commit_repository", "commit_repository",
"commit_source", "commit_source",
"commit_tag",
"delete_primary_from_reference_map", "delete_primary_from_reference_map",
"need_upgrade", "need_upgrade",
"rebuild_secondary", "rebuild_secondary",
@ -190,6 +200,7 @@ class DbTest(object):
"remove_place", "remove_place",
"remove_repository", "remove_repository",
"remove_source", "remove_source",
"remove_tag",
"set_auto_remove", "set_auto_remove",
"set_default_person_handle", "set_default_person_handle",
"set_name_group_mapping", "set_name_group_mapping",

View File

@ -22,6 +22,10 @@
from __future__ import with_statement from __future__ import with_statement
from gen.db import BSDDBTxn from gen.db import BSDDBTxn
from gen.lib.markertype import MarkerType
from gen.lib.tag import Tag
import time
""" """
upgrade upgrade
""" """
@ -29,26 +33,155 @@ upgrade
def gramps_upgrade_15(self): def gramps_upgrade_15(self):
"""Upgrade database from version 14 to 15.""" """Upgrade database from version 14 to 15."""
# This upgrade adds tagging # This upgrade adds tagging
length = len(self.person_map) length = (len(self.note_map) + len(self.person_map) +
len(self.event_map) + len(self.family_map) +
len(self.repository_map) + len(self.media_map) +
len(self.place_map) + len(self.source_map))
self.set_total(length) self.set_total(length)
self.tags = {}
# --------------------------------- # ---------------------------------
# Modify Person # Modify Person
# --------------------------------- # ---------------------------------
# Append the new tag field # Replace the old marker field with the new tag list field.
for handle in self.person_map.keys(): for handle in self.person_map.keys():
person = self.person_map[handle] person = self.person_map[handle]
new_person = list(person) new_person = list(person)
new_person.append([]) tag_handle = convert_marker(self, new_person[18])
if tag_handle:
new_person[18] = [tag_handle]
else:
new_person[18] = []
new_person = tuple(new_person) new_person = tuple(new_person)
with BSDDBTxn(self.env, self.person_map) as txn: with BSDDBTxn(self.env, self.person_map) as txn:
txn.put(str(handle), new_person) txn.put(str(handle), new_person)
self.update() self.update()
# ---------------------------------
# Modify Family
# ---------------------------------
# Replace the old marker field with the new tag list field.
for handle in self.family_map.keys():
family = self.family_map[handle]
new_family = list(family)
tag_handle = convert_marker(self, new_family[13])
if tag_handle:
new_family[13] = [tag_handle]
else:
new_family[13] = []
new_family = tuple(new_family)
with BSDDBTxn(self.env, self.family_map) as txn:
txn.put(str(handle), new_family)
self.update()
# ---------------------------------
# Modify Note
# ---------------------------------
# Replace the old marker field with the new tag list field.
for handle in self.note_map.keys():
note = self.note_map[handle]
new_note = list(note)
tag_handle = convert_marker(self, new_note[6])
if tag_handle:
new_note[6] = [tag_handle]
else:
new_note[6] = []
new_note = tuple(new_note)
with BSDDBTxn(self.env, self.note_map) as txn:
txn.put(str(handle), new_note)
self.update()
# ---------------------------------
# Modify Media object
# ---------------------------------
# Replace the old marker field with the new tag list field.
for handle in self.media_map.keys():
media = self.media_map[handle]
new_media = list(media)
new_media[10] = []
new_media = tuple(new_media)
with BSDDBTxn(self.env, self.media_map) as txn:
txn.put(str(handle), new_media)
self.update()
# ---------------------------------
# Modify Event
# ---------------------------------
# Replace the old marker field with the new tag list field.
for handle in self.event_map.keys():
event = self.event_map[handle]
new_event = list(event)
new_event = new_event[:10] + new_event[11:]
#new_event[11] = []
new_event = tuple(new_event)
with BSDDBTxn(self.env, self.event_map) as txn:
txn.put(str(handle), new_event)
self.update()
# ---------------------------------
# Modify Place
# ---------------------------------
# Remove the old marker field.
for handle in self.place_map.keys():
place = self.place_map[handle]
new_place = list(place)
new_place = new_place[:11] + new_place[12:]
new_place = tuple(new_place)
with BSDDBTxn(self.env, self.place_map) as txn:
txn.put(str(handle), new_place)
self.update()
# ---------------------------------
# Modify Source
# ---------------------------------
# Remove the old marker field.
for handle in self.source_map.keys():
source = self.source_map[handle]
new_source = list(source)
new_source = new_source[:11] + new_source[12:]
new_source = tuple(new_source)
with BSDDBTxn(self.env, self.source_map) as txn:
txn.put(str(handle), new_source)
self.update()
# ---------------------------------
# Modify Repository
# ---------------------------------
# Remove the old marker field.
for handle in self.repository_map.keys():
repository = self.repository_map[handle]
new_repository = list(repository)
new_repository = new_repository[:7] + new_repository[8:]
new_repository = tuple(new_repository)
with BSDDBTxn(self.env, self.repository_map) as txn:
txn.put(str(handle), new_repository)
self.update()
# Bump up database version. Separate transaction to save metadata. # Bump up database version. Separate transaction to save metadata.
with BSDDBTxn(self.env, self.metadata) as txn: with BSDDBTxn(self.env, self.metadata) as txn:
txn.put('version', 15) txn.put('version', 15)
def convert_marker(self, marker_field):
"""Convert a marker into a tag."""
marker = MarkerType()
marker.unserialize(marker_field)
tag_name = str(marker)
if tag_name != '':
if tag_name not in self.tags:
tag = Tag()
handle = self.create_id()
tag.set_handle(handle)
tag.set_change_time(time.time())
tag.set_name(tag_name)
tag.set_priority(len(self.tags))
with BSDDBTxn(self.env, self.tag_map) as txn:
txn.put(handle, tag.serialize())
self.tags[tag_name] = handle
return self.tags[tag_name]
else:
return None
def gramps_upgrade_14(self): def gramps_upgrade_14(self):
"""Upgrade database from version 13 to 14.""" """Upgrade database from version 13 to 14."""
# This upgrade modifies notes and dates # This upgrade modifies notes and dates
@ -353,3 +486,4 @@ def convert_name_14(name):
first_name, surname, suffix, title, first_name, surname, suffix, title,
name_type, prefix, patronymic, name_type, prefix, patronymic,
group_as, sort_as, display_as, call) group_as, sort_as, display_as, call)

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2000-2008 Donald N. Allingham # Copyright (C) 2000-2008 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -1411,9 +1412,6 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
[str(attr.type) for attr in person.attribute_list [str(attr.type) for attr in person.attribute_list
if attr.type.is_custom() and str(attr.type)]) if attr.type.is_custom() and str(attr.type)])
if person.marker.is_custom():
self.marker_names.add(str(person.marker))
self.event_role_names.update([str(eref.role) self.event_role_names.update([str(eref.role)
for eref in person.event_ref_list for eref in person.event_ref_list
if eref.role.is_custom()]) if eref.role.is_custom()])

View File

@ -38,7 +38,6 @@ from gen.lib.attrbase import AttributeBase
from gen.lib.datebase import DateBase from gen.lib.datebase import DateBase
from gen.lib.placebase import PlaceBase from gen.lib.placebase import PlaceBase
from gen.lib.eventtype import EventType from gen.lib.eventtype import EventType
from gen.lib.markertype import MarkerType
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -107,7 +106,7 @@ class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
NoteBase.serialize(self), NoteBase.serialize(self),
MediaBase.serialize(self), MediaBase.serialize(self),
AttributeBase.serialize(self), AttributeBase.serialize(self),
self.change, self.marker.serialize(), self.private) self.change, self.private)
def unserialize(self, data): def unserialize(self, data):
""" """
@ -121,10 +120,8 @@ class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
(self.handle, self.gramps_id, the_type, date, (self.handle, self.gramps_id, the_type, date,
self.__description, self.place, self.__description, self.place,
source_list, note_list, media_list, attribute_list, source_list, note_list, media_list, attribute_list,
self.change, marker, self.private) = data self.change, self.private) = data
self.marker = MarkerType()
self.marker.unserialize(marker)
self.__type = EventType() self.__type = EventType()
self.__type.unserialize(the_type) self.__type.unserialize(the_type)
DateBase.unserialize(self, date) DateBase.unserialize(self, date)

View File

@ -3,6 +3,7 @@
# #
# Copyright (C) 2000-2007 Donald N. Allingham # Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2010 Michiel D. Nauta # Copyright (C) 2010 Michiel D. Nauta
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -44,9 +45,9 @@ from gen.lib.mediabase import MediaBase
from gen.lib.attrbase import AttributeBase from gen.lib.attrbase import AttributeBase
from gen.lib.eventref import EventRef from gen.lib.eventref import EventRef
from gen.lib.ldsordbase import LdsOrdBase from gen.lib.ldsordbase import LdsOrdBase
from gen.lib.tagbase import TagBase
from gen.lib.childref import ChildRef from gen.lib.childref import ChildRef
from gen.lib.familyreltype import FamilyRelType from gen.lib.familyreltype import FamilyRelType
from gen.lib.markertype import MarkerType
from gen.lib.const import IDENTICAL, EQUAL, DIFFERENT from gen.lib.const import IDENTICAL, EQUAL, DIFFERENT
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -55,7 +56,7 @@ from gen.lib.const import IDENTICAL, EQUAL, DIFFERENT
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase, class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
PrimaryObject): TagBase, PrimaryObject):
""" """
The Family record is the GRAMPS in-memory representation of the The Family record is the GRAMPS in-memory representation of the
relationships between people. It contains all the information relationships between people. It contains all the information
@ -86,6 +87,7 @@ class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
MediaBase.__init__(self) MediaBase.__init__(self)
AttributeBase.__init__(self) AttributeBase.__init__(self)
LdsOrdBase.__init__(self) LdsOrdBase.__init__(self)
TagBase.__init__(self)
self.father_handle = None self.father_handle = None
self.mother_handle = None self.mother_handle = None
self.child_ref_list = [] self.child_ref_list = []
@ -121,7 +123,7 @@ class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
LdsOrdBase.serialize(self), LdsOrdBase.serialize(self),
SourceBase.serialize(self), SourceBase.serialize(self),
NoteBase.serialize(self), NoteBase.serialize(self),
self.change, self.marker.serialize(), self.private) self.change, TagBase.serialize(self), self.private)
def unserialize(self, data): def unserialize(self, data):
""" """
@ -131,10 +133,8 @@ class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
(self.handle, self.gramps_id, self.father_handle, self.mother_handle, (self.handle, self.gramps_id, self.father_handle, self.mother_handle,
child_ref_list, the_type, event_ref_list, media_list, child_ref_list, the_type, event_ref_list, media_list,
attribute_list, lds_seal_list, source_list, note_list, attribute_list, lds_seal_list, source_list, note_list,
self.change, marker, self.private) = data self.change, tag_list, self.private) = data
self.marker = MarkerType()
self.marker.unserialize(marker)
self.type = FamilyRelType() self.type = FamilyRelType()
self.type.unserialize(the_type) self.type.unserialize(the_type)
self.event_ref_list = [EventRef().unserialize(er) self.event_ref_list = [EventRef().unserialize(er)
@ -146,6 +146,7 @@ class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
SourceBase.unserialize(self, source_list) SourceBase.unserialize(self, source_list)
NoteBase.unserialize(self, note_list) NoteBase.unserialize(self, note_list)
LdsOrdBase.unserialize(self, lds_seal_list) LdsOrdBase.unserialize(self, lds_seal_list)
TagBase.unserialize(self, tag_list)
def _has_handle_reference(self, classname, handle): def _has_handle_reference(self, classname, handle):
""" """
@ -310,6 +311,7 @@ class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
in ([ref.ref for ref in self.child_ref_list] + in ([ref.ref for ref in self.child_ref_list] +
[self.father_handle, self.mother_handle]) [self.father_handle, self.mother_handle])
if handle] if handle]
ret += self.get_referenced_tag_handles()
return ret return ret
def get_handle_referents(self): def get_handle_referents(self):
@ -326,7 +328,7 @@ class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
""" """
Merge the content of acquisition into this family. Merge the content of acquisition into this family.
Lost: handle, id, marker, relation, father, mother of acquisition. Lost: handle, id, relation, father, mother of acquisition.
:param acquisition: The family to merge with the present family. :param acquisition: The family to merge with the present family.
:rtype acquisition: Family :rtype acquisition: Family
@ -341,6 +343,7 @@ class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
self._merge_attribute_list(acquisition) self._merge_attribute_list(acquisition)
self._merge_note_list(acquisition) self._merge_note_list(acquisition)
self._merge_source_reference_list(acquisition) self._merge_source_reference_list(acquisition)
self._merge_tag_list(acquisition)
def set_relationship(self, relationship_type): def set_relationship(self, relationship_type):
""" """

View File

@ -21,6 +21,9 @@
""" """
Marker types. Marker types.
From version 3.3 onwards, this is only kept to convert markers into tags
when loading old database files.
""" """
#------------------------------------------------------------------------- #-------------------------------------------------------------------------

View File

@ -3,6 +3,7 @@
# #
# Copyright (C) 2000-2007 Donald N. Allingham # Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2010 Michiel D. Nauta # Copyright (C) 2010 Michiel D. Nauta
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -42,7 +43,7 @@ from gen.lib.srcbase import SourceBase
from gen.lib.notebase import NoteBase from gen.lib.notebase import NoteBase
from gen.lib.datebase import DateBase from gen.lib.datebase import DateBase
from gen.lib.attrbase import AttributeBase from gen.lib.attrbase import AttributeBase
from gen.lib.markertype import MarkerType from gen.lib.tagbase import TagBase
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -50,7 +51,7 @@ from gen.lib.markertype import MarkerType
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class MediaObject(SourceBase, NoteBase, DateBase, AttributeBase, class MediaObject(SourceBase, NoteBase, DateBase, AttributeBase,
PrimaryObject): TagBase, PrimaryObject):
""" """
Container for information about an image file, including location, Container for information about an image file, including location,
description and privacy. description and privacy.
@ -71,6 +72,7 @@ class MediaObject(SourceBase, NoteBase, DateBase, AttributeBase,
NoteBase.__init__(self, source) NoteBase.__init__(self, source)
DateBase.__init__(self, source) DateBase.__init__(self, source)
AttributeBase.__init__(self, source) AttributeBase.__init__(self, source)
TagBase.__init__(self)
if source: if source:
self.path = source.path self.path = source.path
@ -107,7 +109,7 @@ class MediaObject(SourceBase, NoteBase, DateBase, AttributeBase,
NoteBase.serialize(self), NoteBase.serialize(self),
self.change, self.change,
DateBase.serialize(self, no_text_date), DateBase.serialize(self, no_text_date),
self.marker.serialize(), TagBase.serialize(self),
self.private) self.private)
def unserialize(self, data): def unserialize(self, data):
@ -120,14 +122,13 @@ class MediaObject(SourceBase, NoteBase, DateBase, AttributeBase,
""" """
(self.handle, self.gramps_id, self.path, self.mime, self.desc, (self.handle, self.gramps_id, self.path, self.mime, self.desc,
attribute_list, source_list, note_list, self.change, attribute_list, source_list, note_list, self.change,
date, marker, self.private) = data date, tag_list, self.private) = data
self.marker = MarkerType()
self.marker.unserialize(marker)
AttributeBase.unserialize(self, attribute_list) AttributeBase.unserialize(self, attribute_list)
SourceBase.unserialize(self, source_list) SourceBase.unserialize(self, source_list)
NoteBase.unserialize(self, note_list) NoteBase.unserialize(self, note_list)
DateBase.unserialize(self, date) DateBase.unserialize(self, date)
TagBase.unserialize(self, tag_list)
def get_text_data_list(self): def get_text_data_list(self):
""" """
@ -175,7 +176,8 @@ class MediaObject(SourceBase, NoteBase, DateBase, AttributeBase,
:returns: List of (classname, handle) tuples for referenced objects. :returns: List of (classname, handle) tuples for referenced objects.
:rtype: list :rtype: list
""" """
return self.get_referenced_note_handles() return self.get_referenced_note_handles() + \
self.get_referenced_tag_handles()
def get_handle_referents(self): def get_handle_referents(self):
""" """
@ -191,7 +193,7 @@ class MediaObject(SourceBase, NoteBase, DateBase, AttributeBase,
""" """
Merge the content of acquisition into this media object. Merge the content of acquisition into this media object.
Lost: handle, id, marker, file, date of acquisition. Lost: handle, id, file, date of acquisition.
:param acquisition: The media object to merge with the present object. :param acquisition: The media object to merge with the present object.
:rtype acquisition: MediaObject :rtype acquisition: MediaObject
@ -200,6 +202,7 @@ class MediaObject(SourceBase, NoteBase, DateBase, AttributeBase,
self._merge_attribute_list(acquisition) self._merge_attribute_list(acquisition)
self._merge_note_list(acquisition) self._merge_note_list(acquisition)
self._merge_source_reference_list(acquisition) self._merge_source_reference_list(acquisition)
self._merge_tag_list(acquisition)
def set_mime_type(self, mime_type): def set_mime_type(self, mime_type):
""" """

View File

@ -3,6 +3,7 @@
# #
# Copyright (C) 2000-2007 Donald N. Allingham # Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2010 Michiel D. Nauta # Copyright (C) 2010 Michiel D. Nauta
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -31,8 +32,8 @@ Note class for GRAMPS.
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gen.lib.primaryobj import BasicPrimaryObject from gen.lib.primaryobj import BasicPrimaryObject
from gen.lib.tagbase import TagBase
from gen.lib.notetype import NoteType from gen.lib.notetype import NoteType
from gen.lib.markertype import MarkerType
from gen.lib.styledtext import StyledText from gen.lib.styledtext import StyledText
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -40,7 +41,7 @@ from gen.lib.styledtext import StyledText
# Class for notes used throughout the majority of GRAMPS objects # Class for notes used throughout the majority of GRAMPS objects
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class Note(BasicPrimaryObject): class Note(BasicPrimaryObject, TagBase):
"""Define a text note. """Define a text note.
Starting from GRAMPS 3.1 Note object stores the text in :class:`gen.lib.styledtext.StyledText` Starting from GRAMPS 3.1 Note object stores the text in :class:`gen.lib.styledtext.StyledText`
@ -74,12 +75,13 @@ class Note(BasicPrimaryObject):
POS_FORMAT, POS_FORMAT,
POS_TYPE, POS_TYPE,
POS_CHANGE, POS_CHANGE,
POS_MARKER, POS_TAGS,
POS_PRIVATE,) = range(8) POS_PRIVATE,) = range(8)
def __init__(self, text=""): def __init__(self, text=""):
"""Create a new Note object, initializing from the passed string.""" """Create a new Note object, initializing from the passed string."""
BasicPrimaryObject.__init__(self) BasicPrimaryObject.__init__(self)
TagBase.__init__(self)
self.text = StyledText(text) self.text = StyledText(text)
self.format = Note.FLOWED self.format = Note.FLOWED
self.type = NoteType() self.type = NoteType()
@ -92,7 +94,7 @@ class Note(BasicPrimaryObject):
""" """
return (self.handle, self.gramps_id, self.text.serialize(), self.format, return (self.handle, self.gramps_id, self.text.serialize(), self.format,
self.type.serialize(), self.change, self.marker.serialize(), self.type.serialize(), self.change, TagBase.serialize(self),
self.private) self.private)
def unserialize(self, data): def unserialize(self, data):
@ -103,14 +105,13 @@ class Note(BasicPrimaryObject):
""" """
(self.handle, self.gramps_id, the_text, self.format, (self.handle, self.gramps_id, the_text, self.format,
the_type, self.change, the_marker, self.private) = data the_type, self.change, tag_list, self.private) = data
self.text = StyledText() self.text = StyledText()
self.text.unserialize(the_text) self.text.unserialize(the_text)
self.marker = MarkerType()
self.marker.unserialize(the_marker)
self.type = NoteType() self.type = NoteType()
self.type.unserialize(the_type) self.type.unserialize(the_type)
TagBase.unserialize(self, tag_list)
def get_text_data_list(self): def get_text_data_list(self):
"""Return the list of all textual attributes of the object. """Return the list of all textual attributes of the object.
@ -121,16 +122,27 @@ class Note(BasicPrimaryObject):
""" """
return [str(self.text)] return [str(self.text)]
def get_referenced_handles(self):
"""
Return the list of (classname, handle) tuples for all directly
referenced primary objects.
:returns: List of (classname, handle) tuples for referenced objects.
:rtype: list
"""
return self.get_referenced_tag_handles()
def merge(self, acquisition): def merge(self, acquisition):
""" """
Merge the content of acquisition into this note. Merge the content of acquisition into this note.
Lost: handle, id, marker, type, format, text and tags of acquisition. Lost: handle, id, type, format, text and styles of acquisition.
:param acquisition: The note to merge with the present note. :param acquisition: The note to merge with the present note.
:rtype acquisition: Note :rtype acquisition: Note
""" """
self._merge_privacy(acquisition) self._merge_privacy(acquisition)
self._merge_tag_list(acquisition)
def set(self, text): def set(self, text):
"""Set the text associated with the note to the passed string. """Set the text associated with the note to the passed string.

View File

@ -3,6 +3,7 @@
# #
# Copyright (C) 2000-2007 Donald N. Allingham # Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2010 Michiel D. Nauta # Copyright (C) 2010 Michiel D. Nauta
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -44,7 +45,6 @@ from gen.lib.eventref import EventRef
from gen.lib.personref import PersonRef from gen.lib.personref import PersonRef
from gen.lib.attrtype import AttributeType from gen.lib.attrtype import AttributeType
from gen.lib.eventroletype import EventRoleType from gen.lib.eventroletype import EventRoleType
from gen.lib.markertype import MarkerType
from gen.lib.attribute import Attribute from gen.lib.attribute import Attribute
from gen.lib.const import IDENTICAL, EQUAL, DIFFERENT from gen.lib.const import IDENTICAL, EQUAL, DIFFERENT
@ -94,7 +94,6 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
LdsOrdBase.__init__(self) LdsOrdBase.__init__(self)
TagBase.__init__(self) TagBase.__init__(self)
self.primary_name = Name() self.primary_name = Name()
self.marker = MarkerType()
self.event_ref_list = [] self.event_ref_list = []
self.family_list = [] self.family_list = []
self.parent_family_list = [] self.parent_family_list = []
@ -153,10 +152,9 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
SourceBase.serialize(self), # 15 SourceBase.serialize(self), # 15
NoteBase.serialize(self), # 16 NoteBase.serialize(self), # 16
self.change, # 17 self.change, # 17
self.marker.serialize(), # 18 TagBase.serialize(self), # 18
self.private, # 19 self.private, # 19
[pr.serialize() for pr in self.person_ref_list], # 20 [pr.serialize() for pr in self.person_ref_list] # 20
TagBase.serialize(self) # 21
) )
def unserialize(self, data): def unserialize(self, data):
@ -186,14 +184,11 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
source_list, # 15 source_list, # 15
note_list, # 16 note_list, # 16
self.change, # 17 self.change, # 17
marker, # 18 tag_list, # 18
self.private, # 19 self.private, # 19
person_ref_list, # 20 person_ref_list, # 20
tag_list, # 21
) = data ) = data
self.marker = MarkerType()
self.marker.unserialize(marker)
self.primary_name = Name() self.primary_name = Name()
self.primary_name.unserialize(primary_name) self.primary_name.unserialize(primary_name)
self.alternate_names = [Name().unserialize(name) self.alternate_names = [Name().unserialize(name)
@ -235,8 +230,6 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
elif classname == 'Place': elif classname == 'Place':
return any(ordinance.place == handle return any(ordinance.place == handle
for ordinance in self.lds_ord_list) for ordinance in self.lds_ord_list)
elif classname == 'Tag':
return handle in self.tag_list
return False return False
def _remove_handle_references(self, classname, handle_list): def _remove_handle_references(self, classname, handle_list):
@ -279,9 +272,6 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
for ordinance in self.lds_ord_list: for ordinance in self.lds_ord_list:
if ordinance.place in handle_list: if ordinance.place in handle_list:
ordinance.place = None ordinance.place = None
elif classname == 'Tag':
for handle in handle_list:
self.tag_list.remove(handle)
def _replace_handle_reference(self, classname, old_handle, new_handle): def _replace_handle_reference(self, classname, old_handle, new_handle):
if classname == 'Event': if classname == 'Event':
@ -447,6 +437,7 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
self._merge_person_ref_list(acquisition) self._merge_person_ref_list(acquisition)
self._merge_note_list(acquisition) self._merge_note_list(acquisition)
self._merge_source_reference_list(acquisition) self._merge_source_reference_list(acquisition)
self._merge_tag_list(acquisition)
map(self.add_parent_family_handle, map(self.add_parent_family_handle,
acquisition.get_parent_family_handle_list()) acquisition.get_parent_family_handle_list())

View File

@ -36,7 +36,6 @@ from gen.lib.notebase import NoteBase
from gen.lib.mediabase import MediaBase from gen.lib.mediabase import MediaBase
from gen.lib.urlbase import UrlBase from gen.lib.urlbase import UrlBase
from gen.lib.location import Location from gen.lib.location import Location
from gen.lib.markertype import MarkerType
_EMPTY_LOC = Location().serialize() _EMPTY_LOC = Location().serialize()
@ -107,7 +106,7 @@ class Place(SourceBase, NoteBase, MediaBase, UrlBase, PrimaryObject):
MediaBase.serialize(self), MediaBase.serialize(self),
SourceBase.serialize(self), SourceBase.serialize(self),
NoteBase.serialize(self), NoteBase.serialize(self),
self.change, self.marker.serialize() ,self.private) self.change, self.private)
def unserialize(self, data): def unserialize(self, data):
""" """
@ -120,15 +119,13 @@ class Place(SourceBase, NoteBase, MediaBase, UrlBase, PrimaryObject):
""" """
(self.handle, self.gramps_id, self.title, self.long, self.lat, (self.handle, self.gramps_id, self.title, self.long, self.lat,
main_loc, alt_loc, urls, media_list, source_list, note_list, main_loc, alt_loc, urls, media_list, source_list, note_list,
self.change, marker, self.private) = data self.change, self.private) = data
if main_loc is None: if main_loc is None:
self.main_loc = None self.main_loc = None
else: else:
self.main_loc = Location().unserialize(main_loc) self.main_loc = Location().unserialize(main_loc)
self.alt_loc = [Location().unserialize(al) for al in alt_loc] self.alt_loc = [Location().unserialize(al) for al in alt_loc]
self.marker = MarkerType()
self.marker.unserialize(marker)
UrlBase.unserialize(self, urls) UrlBase.unserialize(self, urls)
MediaBase.unserialize(self, media_list) MediaBase.unserialize(self, media_list)
SourceBase.unserialize(self, source_list) SourceBase.unserialize(self, source_list)

View File

@ -31,7 +31,6 @@ Basic Primary Object class for GRAMPS.
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gen.lib.tableobj import TableObject from gen.lib.tableobj import TableObject
from gen.lib.privacybase import PrivacyBase from gen.lib.privacybase import PrivacyBase
from gen.lib.markertype import MarkerType
from gen.lib.srcbase import SourceBase from gen.lib.srcbase import SourceBase
from gen.lib.mediabase import MediaBase from gen.lib.mediabase import MediaBase
@ -68,10 +67,8 @@ class BasicPrimaryObject(TableObject, PrivacyBase):
PrivacyBase.__init__(self, source) PrivacyBase.__init__(self, source)
if source: if source:
self.gramps_id = source.gramps_id self.gramps_id = source.gramps_id
self.marker = source.marker
else: else:
self.gramps_id = None self.gramps_id = None
self.marker = MarkerType()
def set_gramps_id(self, gramps_id): def set_gramps_id(self, gramps_id):
""" """
@ -133,26 +130,6 @@ class BasicPrimaryObject(TableObject, PrivacyBase):
""" """
pass pass
def set_marker(self, marker):
"""
Set the marker for the object.
:param marker: marker assigned to the object
:type marker: MarkerType
"""
self.marker.set(marker)
def get_marker(self):
"""
Return the marker for the object.
The exact type depends on the derived class type.
:returns: Returns the marker for the object.
:rtype: MarkerType
"""
return self.marker
def has_source_reference(self, handle): def has_source_reference(self, handle):
""" """
Indicate if the object has a source references. Indicate if the object has a source references.
@ -295,9 +272,3 @@ class PrimaryObject(BasicPrimaryObject):
Replace the handle reference with the new reference. Replace the handle reference with the new reference.
""" """
pass pass
def set_marker(self, marker):
self.marker.set(marker)
def get_marker(self):
return self.marker

View File

@ -35,7 +35,6 @@ from gen.lib.notebase import NoteBase
from gen.lib.addressbase import AddressBase from gen.lib.addressbase import AddressBase
from gen.lib.urlbase import UrlBase from gen.lib.urlbase import UrlBase
from gen.lib.repotype import RepositoryType from gen.lib.repotype import RepositoryType
from gen.lib.markertype import MarkerType
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -65,7 +64,7 @@ class Repository(NoteBase, AddressBase, UrlBase, PrimaryObject):
NoteBase.serialize(self), NoteBase.serialize(self),
AddressBase.serialize(self), AddressBase.serialize(self),
UrlBase.serialize(self), UrlBase.serialize(self),
self.change, self.marker.serialize(), self.private) self.change, self.private)
def unserialize(self, data): def unserialize(self, data):
""" """
@ -73,10 +72,8 @@ class Repository(NoteBase, AddressBase, UrlBase, PrimaryObject):
back into the data in a Repository structure. back into the data in a Repository structure.
""" """
(self.handle, self.gramps_id, the_type, self.name, note_list, (self.handle, self.gramps_id, the_type, self.name, note_list,
address_list, urls, self.change, marker, self.private) = data address_list, urls, self.change, self.private) = data
self.marker = MarkerType()
self.marker.unserialize(marker)
self.type = RepositoryType() self.type = RepositoryType()
self.type.unserialize(the_type) self.type.unserialize(the_type)
NoteBase.unserialize(self, note_list) NoteBase.unserialize(self, note_list)

View File

@ -34,7 +34,6 @@ from gen.lib.primaryobj import PrimaryObject
from gen.lib.mediabase import MediaBase from gen.lib.mediabase import MediaBase
from gen.lib.notebase import NoteBase from gen.lib.notebase import NoteBase
from gen.lib.reporef import RepoRef from gen.lib.reporef import RepoRef
from gen.lib.markertype import MarkerType
from gen.lib.const import DIFFERENT, EQUAL, IDENTICAL from gen.lib.const import DIFFERENT, EQUAL, IDENTICAL
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -50,7 +49,6 @@ class Source(MediaBase, NoteBase, PrimaryObject):
PrimaryObject.__init__(self) PrimaryObject.__init__(self)
MediaBase.__init__(self) MediaBase.__init__(self)
NoteBase.__init__(self) NoteBase.__init__(self)
self.marker = MarkerType()
self.title = "" self.title = ""
self.author = "" self.author = ""
self.pubinfo = "" self.pubinfo = ""
@ -68,7 +66,7 @@ class Source(MediaBase, NoteBase, PrimaryObject):
MediaBase.serialize(self), unicode(self.abbrev), MediaBase.serialize(self), unicode(self.abbrev),
self.change, self.datamap, self.change, self.datamap,
[rr.serialize() for rr in self.reporef_list], [rr.serialize() for rr in self.reporef_list],
self.marker.serialize(), self.private) self.private)
def unserialize(self, data): def unserialize(self, data):
""" """
@ -78,10 +76,8 @@ class Source(MediaBase, NoteBase, PrimaryObject):
(self.handle, self.gramps_id, self.title, self.author, (self.handle, self.gramps_id, self.title, self.author,
self.pubinfo, note_list, media_list, self.pubinfo, note_list, media_list,
self.abbrev, self.change, self.datamap, reporef_list, self.abbrev, self.change, self.datamap, reporef_list,
marker, self.private) = data self.private) = data
self.marker = MarkerType()
self.marker.unserialize(marker)
NoteBase.unserialize(self, note_list) NoteBase.unserialize(self, note_list)
MediaBase.unserialize(self, media_list) MediaBase.unserialize(self, media_list)
self.reporef_list = [RepoRef().unserialize(item) for item in reporef_list] self.reporef_list = [RepoRef().unserialize(item) for item in reporef_list]

View File

@ -117,3 +117,14 @@ class TagBase(object):
:rtype: list :rtype: list
""" """
return [('Tag', handle) for handle in self.tag_list] return [('Tag', handle) for handle in self.tag_list]
def _merge_tag_list(self, acquisition):
"""
Merge the list of tag from acquisition with our own.
:param acquisition: The tag list of this object will be merged with
the current tag list.
:rtype acquisition: TagBase
"""
for addendum in acquisition.get_tag_list():
self.add_tag(addendum)

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2007 Brian G. Matherly # Copyright (C) 2007 Brian G. Matherly
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -747,6 +748,7 @@ def sanitize_person(db, person):
new_person.set_gramps_id(person.get_gramps_id()) new_person.set_gramps_id(person.get_gramps_id())
new_person.set_handle(person.get_handle()) new_person.set_handle(person.get_handle())
new_person.set_change_time(person.get_change_time()) new_person.set_change_time(person.get_change_time())
new_person.set_tag_list(person.get_tag_list())
# copy names if not private # copy names if not private
name = person.get_primary_name() name = person.get_primary_name()
@ -782,9 +784,6 @@ def sanitize_person(db, person):
if name and not name.get_privacy(): if name and not name.get_privacy():
new_person.add_alternate_name(sanitize_name(db, name)) new_person.add_alternate_name(sanitize_name(db, name))
# set complete flag
new_person.set_marker(person.get_marker())
# copy event list # copy event list
for event_ref in person.get_event_ref_list(): for event_ref in person.get_event_ref_list():
if event_ref and not event_ref.get_privacy(): if event_ref and not event_ref.get_privacy():
@ -816,9 +815,6 @@ def sanitize_person(db, person):
copy_notes(db, person, new_person) copy_notes(db, person, new_person)
copy_associations(db, person, new_person) copy_associations(db, person, new_person)
# copy tags
new_person.set_tag_list(person.get_tag_list())
return new_person return new_person
def sanitize_source(db, source): def sanitize_source(db, source):
@ -844,7 +840,6 @@ def sanitize_source(db, source):
new_source.set_gramps_id(source.get_gramps_id()) new_source.set_gramps_id(source.get_gramps_id())
new_source.set_handle(source.get_handle()) new_source.set_handle(source.get_handle())
new_source.set_change_time(source.get_change_time()) new_source.set_change_time(source.get_change_time())
new_source.set_marker(source.get_marker())
new_source.set_data_map(source.get_data_map()) new_source.set_data_map(source.get_data_map())
for repo_ref in source.get_reporef_list(): for repo_ref in source.get_reporef_list():
@ -882,12 +877,12 @@ def sanitize_media(db, media):
new_media.set_handle(media.get_handle()) new_media.set_handle(media.get_handle())
new_media.set_change_time(media.get_change_time()) new_media.set_change_time(media.get_change_time())
new_media.set_date_object(media.get_date_object()) new_media.set_date_object(media.get_date_object())
new_media.set_marker(media.get_marker()) new_media.set_tag_list(media.get_tag_list())
copy_source_ref_list(db, media, new_media) copy_source_ref_list(db, media, new_media)
copy_attributes(db, media, new_media) copy_attributes(db, media, new_media)
copy_notes(db, media, new_media) copy_notes(db, media, new_media)
return new_media return new_media
def sanitize_place(db, place): def sanitize_place(db, place):
@ -914,7 +909,6 @@ def sanitize_place(db, place):
new_place.set_latitude(place.get_latitude()) new_place.set_latitude(place.get_latitude())
new_place.set_main_location(place.get_main_location()) new_place.set_main_location(place.get_main_location())
new_place.set_alternate_locations(place.get_alternate_locations()) new_place.set_alternate_locations(place.get_alternate_locations())
new_place.set_marker(place.get_marker())
copy_source_ref_list(db, place, new_place) copy_source_ref_list(db, place, new_place)
copy_notes(db, place, new_place) copy_notes(db, place, new_place)
@ -944,7 +938,6 @@ def sanitize_event(db, event):
new_event.set_gramps_id(event.get_gramps_id()) new_event.set_gramps_id(event.get_gramps_id())
new_event.set_handle(event.get_handle()) new_event.set_handle(event.get_handle())
new_event.set_date_object(event.get_date_object()) new_event.set_date_object(event.get_date_object())
new_event.set_marker(event.get_marker())
new_event.set_change_time(event.get_change_time()) new_event.set_change_time(event.get_change_time())
copy_source_ref_list(db, event, new_event) copy_source_ref_list(db, event, new_event)
@ -977,9 +970,9 @@ def sanitize_family(db, family):
new_family.set_gramps_id(family.get_gramps_id()) new_family.set_gramps_id(family.get_gramps_id())
new_family.set_handle(family.get_handle()) new_family.set_handle(family.get_handle())
new_family.set_marker(family.get_marker())
new_family.set_relationship(family.get_relationship()) new_family.set_relationship(family.get_relationship())
new_family.set_change_time(family.get_change_time()) new_family.set_change_time(family.get_change_time())
new_family.set_tag_list(family.get_tag_list())
# Copy the father handle. # Copy the father handle.
father_handle = family.get_father_handle() father_handle = family.get_father_handle()
@ -1048,7 +1041,6 @@ def sanitize_repository(db, repository):
new_repository.set_gramps_id(repository.get_gramps_id()) new_repository.set_gramps_id(repository.get_gramps_id())
new_repository.set_handle(repository.get_handle()) new_repository.set_handle(repository.get_handle())
new_repository.set_change_time(repository.get_change_time()) new_repository.set_change_time(repository.get_change_time())
new_repository.set_marker(repository.get_marker())
copy_notes(db, repository, new_repository) copy_notes(db, repository, new_repository)
copy_addresses(db, repository, new_repository) copy_addresses(db, repository, new_repository)

View File

@ -598,10 +598,6 @@ class ProxyDbBase(DbReadBase):
instances in the database""" instances in the database"""
return self.db.get_family_event_types() return self.db.get_family_event_types()
def get_marker_types(self):
"""return a list of all marker types available in the database"""
return self.db.get_marker_types()
def get_media_attribute_types(self): def get_media_attribute_types(self):
"""returns a list of all Attribute types associated with Media """returns a list of all Attribute types associated with Media
and MediaRef instances in the database""" and MediaRef instances in the database"""

View File

@ -479,8 +479,8 @@
<object class="GtkTable" id="info"> <object class="GtkTable" id="info">
<property name="visible">True</property> <property name="visible">True</property>
<property name="border_width">6</property> <property name="border_width">6</property>
<property name="n_rows">2</property> <property name="n_rows">3</property>
<property name="n_columns">6</property> <property name="n_columns">4</property>
<property name="column_spacing">12</property> <property name="column_spacing">12</property>
<property name="row_spacing">6</property> <property name="row_spacing">6</property>
<child> <child>
@ -491,7 +491,7 @@
<property name="use_markup">True</property> <property name="use_markup">True</property>
</object> </object>
<packing> <packing>
<property name="right_attach">6</property> <property name="right_attach">4</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
@ -502,7 +502,6 @@
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="label" translatable="yes">_ID:</property> <property name="label" translatable="yes">_ID:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="justify">center</property>
<property name="mnemonic_widget">gid</property> <property name="mnemonic_widget">gid</property>
</object> </object>
<packing> <packing>
@ -546,24 +545,6 @@
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel" id="label590">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Marker:</property>
<property name="use_underline">True</property>
<property name="justify">center</property>
<property name="mnemonic_widget">marker</property>
</object>
<packing>
<property name="left_attach">4</property>
<property name="right_attach">5</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child> <child>
<object class="GtkComboBoxEntry" id="marriage_type"> <object class="GtkComboBoxEntry" id="marriage_type">
<property name="visible">True</property> <property name="visible">True</property>
@ -573,21 +554,55 @@
<property name="right_attach">4</property> <property name="right_attach">4</property>
<property name="top_attach">1</property> <property name="top_attach">1</property>
<property name="bottom_attach">2</property> <property name="bottom_attach">2</property>
<property name="x_options">GTK_SHRINK | GTK_FILL</property> <property name="y_options"></property>
<property name="y_options">GTK_FILL</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkComboBoxEntry" id="marker"> <object class="GtkLabel" id="label1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Tags:</property>
</object> </object>
<packing> <packing>
<property name="left_attach">5</property> <property name="top_attach">2</property>
<property name="right_attach">6</property> <property name="bottom_attach">3</property>
<property name="top_attach">1</property> <property name="x_options">GTK_FILL</property>
<property name="bottom_attach">2</property> <property name="y_options"></property>
<property name="x_options">GTK_SHRINK | GTK_FILL</property> <property name="x_padding">10</property>
<property name="y_options">GTK_FILL</property> </packing>
</child>
<child>
<object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="tag_label">
<property name="visible">True</property>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="tag_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">4</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing> </packing>
</child> </child>
</object> </object>

View File

@ -23,7 +23,7 @@
<object class="GtkTable" id="table8"> <object class="GtkTable" id="table8">
<property name="visible">True</property> <property name="visible">True</property>
<property name="border_width">12</property> <property name="border_width">12</property>
<property name="n_rows">4</property> <property name="n_rows">5</property>
<property name="n_columns">4</property> <property name="n_columns">4</property>
<property name="column_spacing">12</property> <property name="column_spacing">12</property>
<property name="row_spacing">6</property> <property name="row_spacing">6</property>
@ -99,8 +99,8 @@
<property name="justify">center</property> <property name="justify">center</property>
</object> </object>
<packing> <packing>
<property name="top_attach">3</property> <property name="top_attach">4</property>
<property name="bottom_attach">4</property> <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
@ -133,7 +133,7 @@
</child> </child>
</object> </object>
<packing> <packing>
<property name="bottom_attach">3</property> <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property> <property name="y_options">GTK_FILL</property>
</packing> </packing>
@ -263,6 +263,52 @@
<property name="bottom_attach">3</property> <property name="bottom_attach">3</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Tags:</property>
</object>
<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">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="tag_label">
<property name="visible">True</property>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="tag_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">4</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="position">0</property> <property name="position">0</property>

View File

@ -52,7 +52,7 @@
<object class="GtkTable" id="table79"> <object class="GtkTable" id="table79">
<property name="visible">True</property> <property name="visible">True</property>
<property name="border_width">6</property> <property name="border_width">6</property>
<property name="n_rows">2</property> <property name="n_rows">3</property>
<property name="n_columns">5</property> <property name="n_columns">5</property>
<property name="column_spacing">6</property> <property name="column_spacing">6</property>
<property name="row_spacing">6</property> <property name="row_spacing">6</property>
@ -65,6 +65,8 @@
<property name="mnemonic_widget">type</property> <property name="mnemonic_widget">type</property>
</object> </object>
<packing> <packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property> <property name="top_attach">1</property>
<property name="bottom_attach">2</property> <property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
@ -76,11 +78,11 @@
<property name="visible">True</property> <property name="visible">True</property>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">3</property>
<property name="right_attach">2</property> <property name="right_attach">4</property>
<property name="top_attach">1</property> <property name="top_attach">1</property>
<property name="bottom_attach">2</property> <property name="bottom_attach">2</property>
<property name="y_options">GTK_FILL</property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
<child> <child>
@ -92,6 +94,8 @@
<property name="mnemonic_widget">id</property> <property name="mnemonic_widget">id</property>
</object> </object>
<packing> <packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
@ -105,21 +109,8 @@
<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>
<property name="y_options"></property> <property name="top_attach">1</property>
</packing> <property name="bottom_attach">2</property>
</child>
<child>
<object class="GtkLabel" id="label709">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Marker:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">marker</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
@ -141,22 +132,10 @@ Use monospace font to keep preformatting.</property>
<packing> <packing>
<property name="left_attach">3</property> <property name="left_attach">3</property>
<property name="right_attach">4</property> <property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkComboBoxEntry" id="marker">
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">5</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child> <child>
<object class="GtkToggleButton" id="private"> <object class="GtkToggleButton" id="private">
<property name="visible">True</property> <property name="visible">True</property>
@ -174,12 +153,63 @@ Use monospace font to keep preformatting.</property>
<packing> <packing>
<property name="left_attach">4</property> <property name="left_attach">4</property>
<property name="right_attach">5</property> <property name="right_attach">5</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Tags:</property>
</object>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="tag_label">
<property name="visible">True</property>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="tag_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">5</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child> <child>
<placeholder/> <placeholder/>
</child> </child>

View File

@ -427,26 +427,10 @@ Title: A title used to refer to the person, such as 'Dr.' or 'Rev.'</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="label443"> <placeholder/>
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Marker:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">marker</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkComboBoxEntry" id="marker"> <placeholder/>
<property name="visible">True</property>
</object>
<packing>
<property name="position">3</property>
</packing>
</child> </child>
</object> </object>
<packing> <packing>
@ -495,14 +479,15 @@ Title: A title used to refer to the person, such as 'Dr.' or 'Rev.'</property>
<object class="GtkLabel" id="label1"> <object class="GtkLabel" id="label1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="label" translatable="yes">_Tags:</property> <property name="label" translatable="yes">Tags:</property>
<property name="use_underline">True</property>
</object> </object>
<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>
<property name="top_attach">6</property> <property name="top_attach">6</property>
<property name="bottom_attach">7</property> <property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing> </packing>
</child> </child>
<child> <child>
@ -522,10 +507,7 @@ Title: A title used to refer to the person, such as 'Dr.' or 'Rev.'</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<child> <child>
<object class="GtkImage" id="tag_image"> <placeholder/>
<property name="visible">True</property>
<property name="stock">gramps-tag</property>
</object>
</child> </child>
</object> </object>
<packing> <packing>

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<interface> <interface>
<!-- interface-requires gtk+ 2.12 --> <!-- interface-requires gtk+ 2.12 -->
<!-- interface-requires grampswidgets 0.0 --> <!-- interface-naming-policy toplevel-contextual -->
<object class="GtkDialog" id="mergeevent"> <object class="GtkDialog" id="mergeevent">
<property name="modal">True</property> <property name="modal">True</property>
<property name="default_width">500</property> <property name="default_width">500</property>
@ -23,6 +23,7 @@
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property> <property name="fill">False</property>
<property name="padding">15</property> <property name="padding">15</property>
<property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -43,6 +44,7 @@ primary data for the merged event.</property>
<object class="GtkRadioButton" id="handle_btn1"> <object class="GtkRadioButton" id="handle_btn1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<child> <child>
<object class="GtkLabel" id="label_handle_btn1"> <object class="GtkLabel" id="label_handle_btn1">
@ -54,12 +56,14 @@ primary data for the merged event.</property>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property> <property name="fill">False</property>
<property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkRadioButton" id="handle_btn2"> <object class="GtkRadioButton" id="handle_btn2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<property name="group">handle_btn1</property> <property name="group">handle_btn1</property>
<child> <child>
@ -93,7 +97,7 @@ primary data for the merged event.</property>
<object class="GtkTable" id="table1"> <object class="GtkTable" id="table1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="border_width">6</property> <property name="border_width">6</property>
<property name="n_rows">7</property> <property name="n_rows">6</property>
<property name="n_columns">4</property> <property name="n_columns">4</property>
<property name="column_spacing">6</property> <property name="column_spacing">6</property>
<property name="row_spacing">6</property> <property name="row_spacing">6</property>
@ -261,41 +265,6 @@ primary data for the merged event.</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkRadioButton" id="marker_btn1">
<property name="label" translatable="yes">Marker:</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="marker_btn2">
<property name="label" translatable="yes">Marker:</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<property name="group">marker_btn1</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child> <child>
<object class="GtkRadioButton" id="gramps_btn1"> <object class="GtkRadioButton" id="gramps_btn1">
<property name="label" translatable="yes">Gramps ID:</property> <property name="label" translatable="yes">Gramps ID:</property>
@ -306,8 +275,8 @@ primary data for the merged event.</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</object> </object>
<packing> <packing>
<property name="top_attach">6</property> <property name="top_attach">5</property>
<property name="bottom_attach">7</property> <property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
@ -325,8 +294,8 @@ primary data for the merged event.</property>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>
<property name="right_attach">3</property> <property name="right_attach">3</property>
<property name="top_attach">6</property> <property name="top_attach">5</property>
<property name="bottom_attach">7</property> <property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
@ -443,34 +412,6 @@ primary data for the merged event.</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkEntry" id="marker1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkEntry" id="marker2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="y_options"></property>
</packing>
</child>
<child> <child>
<object class="GtkEntry" id="gramps1"> <object class="GtkEntry" id="gramps1">
<property name="visible">True</property> <property name="visible">True</property>
@ -480,8 +421,8 @@ primary data for the merged event.</property>
<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>
<property name="top_attach">6</property> <property name="top_attach">5</property>
<property name="bottom_attach">7</property> <property name="bottom_attach">6</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
@ -494,8 +435,8 @@ primary data for the merged event.</property>
<packing> <packing>
<property name="left_attach">3</property> <property name="left_attach">3</property>
<property name="right_attach">4</property> <property name="right_attach">4</property>
<property name="top_attach">6</property> <property name="top_attach">5</property>
<property name="bottom_attach">7</property> <property name="bottom_attach">6</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
@ -505,37 +446,10 @@ primary data for the merged event.</property>
<child> <child>
<placeholder/> <placeholder/>
</child> </child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object> </object>
<packing>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="label6"> <object class="GtkLabel" id="label6">
@ -558,8 +472,8 @@ primary data for the merged event.</property>
</child> </child>
</object> </object>
<packing> <packing>
<property name="position">3</property>
<property name="expand">False</property> <property name="expand">False</property>
<property name="position">3</property>
</packing> </packing>
</child> </child>
</object> </object>

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<interface> <interface>
<!-- interface-requires gtk+ 2.12 --> <!-- interface-requires gtk+ 2.12 -->
<!-- interface-requires grampswidgets 0.0 --> <!-- interface-naming-policy toplevel-contextual -->
<object class="GtkDialog" id="mergefamily"> <object class="GtkDialog" id="mergefamily">
<property name="modal">True</property> <property name="modal">True</property>
<property name="default_width">500</property> <property name="default_width">500</property>
@ -24,6 +24,7 @@
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property> <property name="fill">False</property>
<property name="padding">15</property> <property name="padding">15</property>
<property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -44,6 +45,7 @@ primary data for the merged family.</property>
<object class="GtkRadioButton" id="handle_btn1"> <object class="GtkRadioButton" id="handle_btn1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<child> <child>
<object class="GtkLabel" id="label_handle_btn1"> <object class="GtkLabel" id="label_handle_btn1">
@ -55,12 +57,14 @@ primary data for the merged family.</property>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property> <property name="fill">False</property>
<property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkRadioButton" id="handle_btn2"> <object class="GtkRadioButton" id="handle_btn2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<property name="group">handle_btn1</property> <property name="group">handle_btn1</property>
<child> <child>
@ -94,7 +98,7 @@ primary data for the merged family.</property>
<object class="GtkTable" id="table1"> <object class="GtkTable" id="table1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="border_width">6</property> <property name="border_width">6</property>
<property name="n_rows">6</property> <property name="n_rows">5</property>
<property name="n_columns">4</property> <property name="n_columns">4</property>
<property name="column_spacing">6</property> <property name="column_spacing">6</property>
<property name="row_spacing">6</property> <property name="row_spacing">6</property>
@ -227,41 +231,6 @@ primary data for the merged family.</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkRadioButton" id="marker_btn1">
<property name="label" translatable="yes">Marker:</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="marker_btn2">
<property name="label" translatable="yes">Marker:</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<property name="group">marker_btn1</property>
</object>
<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="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child> <child>
<object class="GtkRadioButton" id="gramps_btn1"> <object class="GtkRadioButton" id="gramps_btn1">
<property name="label" translatable="yes">Gramps ID:</property> <property name="label" translatable="yes">Gramps ID:</property>
@ -272,8 +241,8 @@ primary data for the merged family.</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</object> </object>
<packing> <packing>
<property name="top_attach">5</property> <property name="top_attach">4</property>
<property name="bottom_attach">6</property> <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
@ -291,8 +260,8 @@ primary data for the merged family.</property>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>
<property name="right_attach">3</property> <property name="right_attach">3</property>
<property name="top_attach">5</property> <property name="top_attach">4</property>
<property name="bottom_attach">6</property> <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
@ -381,34 +350,6 @@ primary data for the merged family.</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkEntry" id="marker1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
</object>
<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>
<object class="GtkEntry" id="marker2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_options"></property>
</packing>
</child>
<child> <child>
<object class="GtkEntry" id="gramps1"> <object class="GtkEntry" id="gramps1">
<property name="visible">True</property> <property name="visible">True</property>
@ -418,8 +359,8 @@ primary data for the merged family.</property>
<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>
<property name="top_attach">5</property> <property name="top_attach">4</property>
<property name="bottom_attach">6</property> <property name="bottom_attach">5</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
@ -432,8 +373,8 @@ primary data for the merged family.</property>
<packing> <packing>
<property name="left_attach">3</property> <property name="left_attach">3</property>
<property name="right_attach">4</property> <property name="right_attach">4</property>
<property name="top_attach">5</property> <property name="top_attach">4</property>
<property name="bottom_attach">6</property> <property name="bottom_attach">5</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
@ -443,42 +384,15 @@ primary data for the merged family.</property>
<child> <child>
<placeholder/> <placeholder/>
</child> </child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object> </object>
<packing>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="label6"> <object class="GtkLabel" id="label6">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Events, lds_ord, media objects, attributes, notes and sources of both families will be combined.</property> <property name="label" translatable="yes">Events, lds_ord, media objects, attributes, notes, sources and tags of both families will be combined.</property>
<property name="wrap">True</property> <property name="wrap">True</property>
</object> </object>
<packing> <packing>
@ -496,8 +410,8 @@ primary data for the merged family.</property>
</child> </child>
</object> </object>
<packing> <packing>
<property name="position">3</property>
<property name="expand">False</property> <property name="expand">False</property>
<property name="position">3</property>
</packing> </packing>
</child> </child>
</object> </object>

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<interface> <interface>
<!-- interface-requires gtk+ 2.12 --> <!-- interface-requires gtk+ 2.12 -->
<!-- interface-requires grampswidgets 0.0 --> <!-- interface-naming-policy toplevel-contextual -->
<object class="GtkDialog" id="mergeobject"> <object class="GtkDialog" id="mergeobject">
<property name="modal">True</property> <property name="modal">True</property>
<property name="default_width">500</property> <property name="default_width">500</property>
@ -23,6 +23,7 @@
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property> <property name="fill">False</property>
<property name="padding">15</property> <property name="padding">15</property>
<property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -43,6 +44,7 @@ primary data for the merged object.</property>
<object class="GtkRadioButton" id="handle_btn1"> <object class="GtkRadioButton" id="handle_btn1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<child> <child>
<object class="GtkLabel" id="label_handle_btn1"> <object class="GtkLabel" id="label_handle_btn1">
@ -54,12 +56,14 @@ primary data for the merged object.</property>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property> <property name="fill">False</property>
<property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkRadioButton" id="handle_btn2"> <object class="GtkRadioButton" id="handle_btn2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<property name="group">handle_btn1</property> <property name="group">handle_btn1</property>
<child> <child>
@ -379,42 +383,15 @@ primary data for the merged object.</property>
<child> <child>
<placeholder/> <placeholder/>
</child> </child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object> </object>
<packing>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="label6"> <object class="GtkLabel" id="label6">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Attributes, sources and notes of both objects will be combined.</property> <property name="label" translatable="yes">Attributes, sources, notes and tags of both objects will be combined.</property>
<property name="wrap">True</property> <property name="wrap">True</property>
</object> </object>
<packing> <packing>
@ -432,8 +409,8 @@ primary data for the merged object.</property>
</child> </child>
</object> </object>
<packing> <packing>
<property name="position">3</property>
<property name="expand">False</property> <property name="expand">False</property>
<property name="position">3</property>
</packing> </packing>
</child> </child>
</object> </object>

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<interface> <interface>
<!-- interface-requires gtk+ 2.12 --> <!-- interface-requires gtk+ 2.12 -->
<!-- interface-requires grampswidgets 0.0 --> <!-- interface-naming-policy toplevel-contextual -->
<object class="GtkDialog" id="mergenote"> <object class="GtkDialog" id="mergenote">
<property name="modal">True</property> <property name="modal">True</property>
<property name="default_width">600</property> <property name="default_width">600</property>
@ -23,6 +23,7 @@
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property> <property name="fill">False</property>
<property name="padding">15</property> <property name="padding">15</property>
<property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -43,6 +44,7 @@ primary data for the merged note.</property>
<object class="GtkRadioButton" id="handle_btn1"> <object class="GtkRadioButton" id="handle_btn1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<child> <child>
<object class="GtkLabel" id="label_handle_btn1"> <object class="GtkLabel" id="label_handle_btn1">
@ -54,12 +56,14 @@ primary data for the merged note.</property>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property> <property name="fill">False</property>
<property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkRadioButton" id="handle_btn2"> <object class="GtkRadioButton" id="handle_btn2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<property name="group">handle_btn1</property> <property name="group">handle_btn1</property>
<child> <child>
@ -93,7 +97,7 @@ primary data for the merged note.</property>
<object class="GtkTable" id="table1"> <object class="GtkTable" id="table1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="border_width">6</property> <property name="border_width">6</property>
<property name="n_rows">6</property> <property name="n_rows">5</property>
<property name="n_columns">4</property> <property name="n_columns">4</property>
<property name="column_spacing">6</property> <property name="column_spacing">6</property>
<property name="row_spacing">6</property> <property name="row_spacing">6</property>
@ -226,41 +230,6 @@ primary data for the merged note.</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkRadioButton" id="marker_btn1">
<property name="label" translatable="yes">Marker:</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="marker_btn2">
<property name="label" translatable="yes">Marker:</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<property name="group">marker_btn1</property>
</object>
<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="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child> <child>
<object class="GtkRadioButton" id="gramps_btn1"> <object class="GtkRadioButton" id="gramps_btn1">
<property name="label" translatable="yes">Gramps ID:</property> <property name="label" translatable="yes">Gramps ID:</property>
@ -271,8 +240,8 @@ primary data for the merged note.</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</object> </object>
<packing> <packing>
<property name="top_attach">5</property> <property name="top_attach">4</property>
<property name="bottom_attach">6</property> <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
@ -290,8 +259,8 @@ primary data for the merged note.</property>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>
<property name="right_attach">3</property> <property name="right_attach">3</property>
<property name="top_attach">5</property> <property name="top_attach">4</property>
<property name="bottom_attach">6</property> <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
@ -331,7 +300,6 @@ primary data for the merged note.</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="editable">False</property> <property name="editable">False</property>
<property name="warp_mode">word</property>
</object> </object>
</child> </child>
</object> </object>
@ -399,34 +367,6 @@ primary data for the merged note.</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkEntry" id="marker1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
</object>
<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>
<object class="GtkEntry" id="marker2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_options"></property>
</packing>
</child>
<child> <child>
<object class="GtkEntry" id="gramps1"> <object class="GtkEntry" id="gramps1">
<property name="visible">True</property> <property name="visible">True</property>
@ -436,8 +376,8 @@ primary data for the merged note.</property>
<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>
<property name="top_attach">5</property> <property name="top_attach">4</property>
<property name="bottom_attach">6</property> <property name="bottom_attach">5</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
@ -450,8 +390,8 @@ primary data for the merged note.</property>
<packing> <packing>
<property name="left_attach">3</property> <property name="left_attach">3</property>
<property name="right_attach">4</property> <property name="right_attach">4</property>
<property name="top_attach">5</property> <property name="top_attach">4</property>
<property name="bottom_attach">6</property> <property name="bottom_attach">5</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
@ -461,42 +401,14 @@ primary data for the merged note.</property>
<child> <child>
<placeholder/> <placeholder/>
</child> </child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object> </object>
<packing>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="label6"> <object class="GtkLabel" id="label6">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="wrap">True</property> <property name="wrap">True</property>
</object> </object>
<packing> <packing>

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<interface> <interface>
<!-- interface-requires gtk+ 2.12 --> <!-- interface-requires gtk+ 2.12 -->
<!-- interface-requires grampswidgets 0.0 --> <!-- interface-naming-policy toplevel-contextual -->
<object class="GtkDialog" id="mergeperson"> <object class="GtkDialog" id="mergeperson">
<property name="modal">True</property> <property name="modal">True</property>
<property name="default_width">700</property> <property name="default_width">700</property>
@ -23,6 +23,7 @@
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property> <property name="fill">False</property>
<property name="padding">15</property> <property name="padding">15</property>
<property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -43,6 +44,7 @@ primary data for the merged person.</property>
<object class="GtkRadioButton" id="handle_btn1"> <object class="GtkRadioButton" id="handle_btn1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<child> <child>
<object class="GtkLabel" id="label_handle_btn1"> <object class="GtkLabel" id="label_handle_btn1">
@ -54,12 +56,14 @@ primary data for the merged person.</property>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property> <property name="fill">False</property>
<property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkRadioButton" id="handle_btn2"> <object class="GtkRadioButton" id="handle_btn2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<property name="group">handle_btn1</property> <property name="group">handle_btn1</property>
<child> <child>
@ -93,7 +97,7 @@ primary data for the merged person.</property>
<object class="GtkTable" id="table1"> <object class="GtkTable" id="table1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="border_width">6</property> <property name="border_width">6</property>
<property name="n_rows">5</property> <property name="n_rows">4</property>
<property name="n_columns">4</property> <property name="n_columns">4</property>
<property name="column_spacing">6</property> <property name="column_spacing">6</property>
<property name="row_spacing">6</property> <property name="row_spacing">6</property>
@ -191,41 +195,6 @@ primary data for the merged person.</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkRadioButton" id="marker_btn1">
<property name="label" translatable="yes">Marker:</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="marker_btn2">
<property name="label" translatable="yes">Marker:</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<property name="group">marker_btn1</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child> <child>
<object class="GtkRadioButton" id="gramps_btn1"> <object class="GtkRadioButton" id="gramps_btn1">
<property name="label" translatable="yes">Gramps ID:</property> <property name="label" translatable="yes">Gramps ID:</property>
@ -236,8 +205,8 @@ primary data for the merged person.</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</object> </object>
<packing> <packing>
<property name="top_attach">4</property> <property name="top_attach">3</property>
<property name="bottom_attach">5</property> <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
@ -255,8 +224,8 @@ primary data for the merged person.</property>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">2</property>
<property name="right_attach">3</property> <property name="right_attach">3</property>
<property name="top_attach">4</property> <property name="top_attach">3</property>
<property name="bottom_attach">5</property> <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
@ -317,34 +286,6 @@ primary data for the merged person.</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkEntry" id="marker1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
</object>
<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>
<object class="GtkEntry" id="marker2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options"></property>
</packing>
</child>
<child> <child>
<object class="GtkEntry" id="gramps1"> <object class="GtkEntry" id="gramps1">
<property name="visible">True</property> <property name="visible">True</property>
@ -354,8 +295,8 @@ primary data for the merged person.</property>
<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>
<property name="top_attach">4</property> <property name="top_attach">3</property>
<property name="bottom_attach">5</property> <property name="bottom_attach">4</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
@ -368,8 +309,8 @@ primary data for the merged person.</property>
<packing> <packing>
<property name="left_attach">3</property> <property name="left_attach">3</property>
<property name="right_attach">4</property> <property name="right_attach">4</property>
<property name="top_attach">4</property> <property name="top_attach">3</property>
<property name="bottom_attach">5</property> <property name="bottom_attach">4</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
@ -379,36 +320,15 @@ primary data for the merged person.</property>
<child> <child>
<placeholder/> <placeholder/>
</child> </child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object> </object>
<packing>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="label6"> <object class="GtkLabel" id="label6">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Events, media objects, addresses, attributes, urls, notes and sources of both persons will be combined.</property> <property name="label" translatable="yes">Events, media objects, addresses, attributes, urls, notes, sources and tags of both persons will be combined.</property>
<property name="wrap">True</property> <property name="wrap">True</property>
</object> </object>
<packing> <packing>
@ -426,8 +346,8 @@ primary data for the merged person.</property>
</child> </child>
</object> </object>
<packing> <packing>
<property name="position">3</property>
<property name="expand">False</property> <property name="expand">False</property>
<property name="position">3</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -437,7 +357,6 @@ primary data for the merged person.</property>
<child> <child>
<object class="GtkHBox" id="hbox1"> <object class="GtkHBox" id="hbox1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="orientation">horizontal</property>
<property name="spacing">5</property> <property name="spacing">5</property>
<child> <child>
<object class="GtkScrolledWindow" id="scrolledwindow1"> <object class="GtkScrolledWindow" id="scrolledwindow1">

View File

@ -3,6 +3,7 @@
# #
# Copyright (C) 2000-2007 Donald N. Allingham # Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2009 Gary Burton # Copyright (C) 2009 Gary Burton
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -67,7 +68,8 @@ from editperson import EditPerson
from displaytabs import (EmbeddedList, EventEmbedList, SourceEmbedList, from displaytabs import (EmbeddedList, EventEmbedList, SourceEmbedList,
FamilyAttrEmbedList, NoteTab, GalleryTab, FamilyAttrEmbedList, NoteTab, GalleryTab,
FamilyLdsEmbedList, ChildModel) FamilyLdsEmbedList, ChildModel)
from gui.widgets import (PrivacyButton, MonitoredEntry, MonitoredDataType) from gui.widgets import (PrivacyButton, MonitoredEntry, MonitoredDataType,
MonitoredTagList)
from gen.plug import CATEGORY_QR_FAMILY from gen.plug import CATEGORY_QR_FAMILY
from QuestionDialog import (ErrorDialog, RunDatabaseRepair, WarningDialog, from QuestionDialog import (ErrorDialog, RunDatabaseRepair, WarningDialog,
MessageHideDialog) MessageHideDialog)
@ -95,8 +97,8 @@ class ChildEmbedList(EmbeddedList):
'del' : _('Remove the child from the family'), 'del' : _('Remove the child from the family'),
'edit' : _('Edit the child reference'), 'edit' : _('Edit the child reference'),
'share' : _('Add an existing person as a child of the family'), 'share' : _('Add an existing person as a child of the family'),
'up' : _('Move the child up in the childrens list'), 'up' : _('Move the child up in the childrens list'),
'down' : _('Move the child down in the childrens list'), 'down' : _('Move the child down in the childrens list'),
} }
_column_names = [ _column_names = [
@ -485,7 +487,7 @@ class EditFamily(EditPrimary):
self.obj.mother_handle != objreal.mother_handle or self.obj.mother_handle != objreal.mother_handle or
self.obj.private != objreal.private or self.obj.private != objreal.private or
self.obj.type != objreal.type or self.obj.type != objreal.type or
self.obj.marker != objreal.marker or self.obj.get_tag_list() != objreal.get_tag_list() or
self.obj.child_ref_list != objreal.child_ref_list) self.obj.child_ref_list != objreal.child_ref_list)
if maindatachanged: if maindatachanged:
self.obj.gramps_id = objreal.gramps_id self.obj.gramps_id = objreal.gramps_id
@ -493,7 +495,7 @@ class EditFamily(EditPrimary):
self.obj.mother_handle = objreal.mother_handle self.obj.mother_handle = objreal.mother_handle
self.obj.private = objreal.private self.obj.private = objreal.private
self.obj.type = objreal.type self.obj.type = objreal.type
self.obj.marker = objreal.marker self.obj.set_tag_list(objreal.get_tag_list())
self.obj.child_ref_list = objreal.child_ref_list self.obj.child_ref_list = objreal.child_ref_list
self.reload_people() self.reload_people()
@ -625,13 +627,14 @@ class EditFamily(EditPrimary):
self.obj.get_gramps_id, self.obj.get_gramps_id,
self.db.readonly) self.db.readonly)
self.marker = MonitoredDataType( self.tags = MonitoredTagList(
self.top.get_object('marker'), self.top.get_object("tag_label"),
self.obj.set_marker, self.top.get_object("tag_button"),
self.obj.get_marker, self.obj.set_tag_list,
self.db.readonly, self.obj.get_tag_list,
self.db.get_marker_types(), self.db,
) self.uistate, self.track,
self.db.readonly)
self.data_type = MonitoredDataType( self.data_type = MonitoredDataType(
self.top.get_object('marriage_type'), self.top.get_object('marriage_type'),

View File

@ -3,6 +3,7 @@
# #
# Copyright (C) 2000-2006 Donald N. Allingham # Copyright (C) 2000-2006 Donald N. Allingham
# Copyright (C) 2009 Gary Burton # Copyright (C) 2009 Gary Burton
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -46,7 +47,8 @@ import gen.mime
import ThumbNails import ThumbNails
import Utils import Utils
from editprimary import EditPrimary from editprimary import EditPrimary
from gui.widgets import MonitoredDate, MonitoredEntry, PrivacyButton from gui.widgets import (MonitoredDate, MonitoredEntry, PrivacyButton,
MonitoredTagList)
from displaytabs import (SourceEmbedList, AttrEmbedList, NoteTab, from displaytabs import (SourceEmbedList, AttrEmbedList, NoteTab,
MediaBackRefList) MediaBackRefList)
from addmedia import AddMediaObject from addmedia import AddMediaObject
@ -125,6 +127,15 @@ class EditMedia(EditPrimary):
self.obj.set_gramps_id, self.obj.set_gramps_id,
self.obj.get_gramps_id, self.db.readonly) self.obj.get_gramps_id, self.db.readonly)
self.tags = MonitoredTagList(
self.glade.get_object("tag_label"),
self.glade.get_object("tag_button"),
self.obj.set_tag_list,
self.obj.get_tag_list,
self.db,
self.uistate, self.track,
self.db.readonly)
self.privacy = PrivacyButton(self.glade.get_object("private"), self.privacy = PrivacyButton(self.glade.get_object("private"),
self.obj, self.db.readonly) self.obj, self.db.readonly)

View File

@ -2,8 +2,9 @@
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2000-2006 Donald N. Allingham # Copyright (C) 2000-2006 Donald N. Allingham
# 2009 Gary Burton # Copyright (C) 2009 Gary Burton
# 2009 Benny Malengier # Copyright (C) 2009 Benny Malengier
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -50,7 +51,7 @@ import const
from editprimary import EditPrimary from editprimary import EditPrimary
from displaytabs import GrampsTab, NoteBackRefList from displaytabs import GrampsTab, NoteBackRefList
from gui.widgets import (MonitoredDataType, MonitoredCheckbox, from gui.widgets import (MonitoredDataType, MonitoredCheckbox,
MonitoredEntry, PrivacyButton) MonitoredEntry, PrivacyButton, MonitoredTagList)
from gen.lib import Note from gen.lib import Note
from QuestionDialog import ErrorDialog from QuestionDialog import ErrorDialog
from glade import Glade from glade import Glade
@ -204,13 +205,15 @@ class EditNote(EditPrimary):
self.obj.set_gramps_id, self.obj.set_gramps_id,
self.obj.get_gramps_id, self.obj.get_gramps_id,
self.db.readonly) self.db.readonly)
self.marker = MonitoredDataType( self.tags = MonitoredTagList(
self.top.get_object('marker'), self.top.get_object("tag_label"),
self.obj.set_marker, self.top.get_object("tag_button"),
self.obj.get_marker, self.obj.set_tag_list,
self.db.readonly, self.obj.get_tag_list,
self.db.get_marker_types()) self.db,
self.uistate, self.track,
self.db.readonly)
self.priv = PrivacyButton( self.priv = PrivacyButton(
self.top.get_object("private"), self.top.get_object("private"),

View File

@ -3,6 +3,7 @@
# #
# Copyright (C) 2000-2007 Donald N. Allingham # Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2009 Gary Burton # Copyright (C) 2009 Gary Burton
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -253,14 +254,6 @@ class EditPerson(EditPrimary):
), ),
self.db.readonly) self.db.readonly)
self.marker = widgets.MonitoredDataType(
self.top.get_object('marker'),
self.obj.set_marker,
self.obj.get_marker,
self.db.readonly,
self.db.get_marker_types(),
)
self.ntype_field = widgets.MonitoredDataType( self.ntype_field = widgets.MonitoredDataType(
self.top.get_object("ntype"), self.top.get_object("ntype"),
self.pname.set_type, self.pname.set_type,

View File

@ -225,9 +225,9 @@ class ListView(NavigationView):
column = gtk.TreeViewColumn(name, self.renderer) column = gtk.TreeViewColumn(name, self.renderer)
if self.model and self.model.marker_column() is not None: if self.model and self.model.color_column() is not None:
mcol = self.model.marker_column() fg_col = self.model.color_column()
column.add_attribute(self.renderer, 'foreground', mcol) column.add_attribute(self.renderer, 'foreground', fg_col)
if pair[1] in self.markup_columns: if pair[1] in self.markup_columns:
column.add_attribute(self.renderer, 'markup', pair[1]) column.add_attribute(self.renderer, 'markup', pair[1])

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2000-2007 Donald N. Allingham # Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -26,6 +27,7 @@
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import logging import logging
log = logging.getLogger(".") log = logging.getLogger(".")
import locale
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -56,8 +58,6 @@ from gui.views.treemodels.flatbasemodel import FlatBaseModel
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class FamilyModel(FlatBaseModel): class FamilyModel(FlatBaseModel):
_MARKER_COL = 13
def __init__(self, db, scol=0, order=gtk.SORT_ASCENDING, search=None, def __init__(self, db, scol=0, order=gtk.SORT_ASCENDING, search=None,
skip=set(), sort_map=None): skip=set(), sort_map=None):
self.gen_cursor = db.get_family_cursor self.gen_cursor = db.get_family_cursor
@ -68,11 +68,11 @@ class FamilyModel(FlatBaseModel):
self.column_mother, self.column_mother,
self.column_type, self.column_type,
self.column_marriage, self.column_marriage,
self.column_tags,
self.column_change, self.column_change,
self.column_handle, self.column_handle,
self.column_tooltip, self.column_tag_color,
self.column_marker_text, self.column_tooltip,
self.column_marker_color,
] ]
self.smap = [ self.smap = [
self.column_id, self.column_id,
@ -80,20 +80,20 @@ class FamilyModel(FlatBaseModel):
self.sort_mother, self.sort_mother,
self.column_type, self.column_type,
self.sort_marriage, self.sort_marriage,
self.column_tags,
self.sort_change, self.sort_change,
self.column_handle, self.column_handle,
self.column_tooltip, self.column_tag_color,
self.column_marker_text, self.column_tooltip,
self.column_marker_color,
] ]
FlatBaseModel.__init__(self, db, scol, order, tooltip_column=7, FlatBaseModel.__init__(self, db, scol, order, tooltip_column=9,
search=search, skip=skip, sort_map=sort_map) search=search, skip=skip, sort_map=sort_map)
def marker_column(self): def color_column(self):
""" """
Return the column for marker colour. Return the color column.
""" """
return 9 return 8
def on_get_n_columns(self): def on_get_n_columns(self):
return len(self.fmap)+1 return len(self.fmap)+1
@ -159,27 +159,6 @@ class FamilyModel(FlatBaseModel):
def column_change(self, data): def column_change(self, data):
return Utils.format_time(data[12]) return Utils.format_time(data[12])
def column_marker_text(self, data):
try:
if data[FamilyModel._MARKER_COL]:
return str(data[FamilyModel._MARKER_COL])
except IndexError:
return ""
return ""
def column_marker_color(self, data):
try:
col = data[FamilyModel._MARKER_COL][0]
if col == gen.lib.MarkerType.COMPLETE:
return self.complete_color
elif col == gen.lib.MarkerType.TODO_TYPE:
return self.todo_color
elif col == gen.lib.MarkerType.CUSTOM:
return self.custom_color
except IndexError:
pass
return None
def column_tooltip(self, data): def column_tooltip(self, data):
if const.USE_TIPS: if const.USE_TIPS:
try: try:
@ -191,3 +170,30 @@ class FamilyModel(FlatBaseModel):
return t return t
else: else:
return u'' return u''
def get_tag_name(self, tag_handle):
"""
Return the tag name from the given tag handle.
"""
return self.db.get_tag_from_handle(tag_handle).get_name()
def column_tag_color(self, data):
"""
Return the tag color.
"""
tag_color = '#000000000000'
tag_priority = None
for handle in data[13]:
tag = self.db.get_tag_from_handle(handle)
this_priority = tag.get_priority()
if tag_priority is None or this_priority < tag_priority:
tag_color = tag.get_color()
tag_priority = this_priority
return tag_color
def column_tags(self, data):
"""
Return the sorted list of tags.
"""
tag_list = map(self.get_tag_name, data[13])
return ', '.join(sorted(tag_list, key=locale.strxfrm))

View File

@ -2,7 +2,8 @@
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2000-2006 Donald N. Allingham # Copyright (C) 2000-2006 Donald N. Allingham
# Copyright (C) 2009 Benny Malengier # Copyright (C) 2009 Benny Malengier
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -493,9 +494,9 @@ class FlatBaseModel(gtk.GenericTreeModel):
""" """
return self._tooltip_column return self._tooltip_column
def marker_column(self): def color_column(self):
""" """
Return the column for marker colour. Return the color column.
""" """
return None return None

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2000-2006 Donald N. Allingham # Copyright (C) 2000-2006 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -27,6 +28,7 @@
from gen.ggettext import gettext as _ from gen.ggettext import gettext as _
import logging import logging
log = logging.getLogger(".") log = logging.getLogger(".")
import locale
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -64,9 +66,11 @@ class MediaModel(FlatBaseModel):
self.column_id, self.column_id,
self.column_mime, self.column_mime,
self.column_path, self.column_path,
self.column_change,
self.column_date, self.column_date,
self.column_tags,
self.column_change,
self.column_handle, self.column_handle,
self.column_tag_color,
self.column_tooltip self.column_tooltip
] ]
@ -75,13 +79,22 @@ class MediaModel(FlatBaseModel):
self.column_id, self.column_id,
self.column_mime, self.column_mime,
self.column_path, self.column_path,
self.sort_change,
self.sort_date, self.sort_date,
self.column_tags,
self.sort_change,
self.column_handle, self.column_handle,
self.column_tag_color,
self.column_tooltip
] ]
FlatBaseModel.__init__(self, db, scol, order, tooltip_column=7, FlatBaseModel.__init__(self, db, scol, order, tooltip_column=9,
search=search, skip=skip, sort_map=sort_map) search=search, skip=skip, sort_map=sort_map)
def color_column(self):
"""
Return the color column.
"""
return 8
def on_get_n_columns(self): def on_get_n_columns(self):
return len(self.fmap)+1 return len(self.fmap)+1
@ -141,3 +154,30 @@ class MediaModel(FlatBaseModel):
return t return t
else: else:
return u'' return u''
def get_tag_name(self, tag_handle):
"""
Return the tag name from the given tag handle.
"""
return self.db.get_tag_from_handle(tag_handle).get_name()
def column_tag_color(self, data):
"""
Return the tag color.
"""
tag_color = '#000000000000'
tag_priority = None
for handle in data[10]:
tag = self.db.get_tag_from_handle(handle)
this_priority = tag.get_priority()
if tag_priority is None or this_priority < tag_priority:
tag_color = tag.get_color()
tag_priority = this_priority
return tag_color
def column_tags(self, data):
"""
Return the sorted list of tags.
"""
tag_list = map(self.get_tag_name, data[10])
return ', '.join(sorted(tag_list, key=locale.strxfrm))

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2000-2007 Donald N. Allingham # Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -26,6 +27,7 @@
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import logging import logging
_LOG = logging.getLogger(".gui.notemodel") _LOG = logging.getLogger(".gui.notemodel")
import locale
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -41,7 +43,7 @@ import gtk
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import Utils import Utils
from gui.views.treemodels.flatbasemodel import FlatBaseModel from gui.views.treemodels.flatbasemodel import FlatBaseModel
from gen.lib import (Note, NoteType, MarkerType, StyledText) from gen.lib import (Note, NoteType, StyledText)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -60,26 +62,26 @@ class NoteModel(FlatBaseModel):
self.column_preview, self.column_preview,
self.column_id, self.column_id,
self.column_type, self.column_type,
self.column_marker, self.column_tags,
self.column_change, self.column_change,
self.column_handle, self.column_handle,
self.column_marker_color self.column_tag_color
] ]
self.smap = [ self.smap = [
self.column_preview, self.column_preview,
self.column_id, self.column_id,
self.column_type, self.column_type,
self.column_marker, self.column_tags,
self.sort_change, self.sort_change,
self.column_handle, self.column_handle,
self.column_marker_color self.column_tag_color
] ]
FlatBaseModel.__init__(self, db, scol, order, search=search, FlatBaseModel.__init__(self, db, scol, order, search=search,
skip=skip, sort_map=sort_map) skip=skip, sort_map=sort_map)
def marker_column(self): def color_column(self):
""" """
Return the column for marker colour. Return the color column.
""" """
return 6 return 6
@ -101,12 +103,6 @@ class NoteModel(FlatBaseModel):
temp.set(data[Note.POS_TYPE]) temp.set(data[Note.POS_TYPE])
return unicode(str(temp)) return unicode(str(temp))
def column_marker(self, data):
"""Return the marker type of the Note in readable format."""
temp = MarkerType()
temp.set(data[Note.POS_MARKER])
return unicode(str(temp))
def column_preview(self, data): def column_preview(self, data):
"""Return a shortend version of the Note's text.""" """Return a shortend version of the Note's text."""
#data is the encoding in the database, make it a unicode object #data is the encoding in the database, make it a unicode object
@ -118,23 +114,35 @@ class NoteModel(FlatBaseModel):
else: else:
return note return note
def column_marker_color(self, data):
"""Return the color of the Note's marker type if exist."""
try:
col = data[Note.POS_MARKER][MarkerType.POS_VALUE]
if col == MarkerType.COMPLETE:
return self.complete_color
elif col == MarkerType.TODO_TYPE:
return self.todo_color
elif col == MarkerType.CUSTOM:
return self.custom_color
else:
return None
except IndexError:
return None
def sort_change(self, data): def sort_change(self, data):
return "%012x" % data[Note.POS_CHANGE] return "%012x" % data[Note.POS_CHANGE]
def column_change(self,data): def column_change(self,data):
return Utils.format_time(data[Note.POS_CHANGE]) return Utils.format_time(data[Note.POS_CHANGE])
def get_tag_name(self, tag_handle):
"""
Return the tag name from the given tag handle.
"""
return self.db.get_tag_from_handle(tag_handle).get_name()
def column_tag_color(self, data):
"""
Return the tag color.
"""
tag_color = '#000000000000'
tag_priority = None
for handle in data[Note.POS_TAGS]:
tag = self.db.get_tag_from_handle(handle)
this_priority = tag.get_priority()
if tag_priority is None or this_priority < tag_priority:
tag_color = tag.get_color()
tag_priority = this_priority
return tag_color
def column_tags(self, data):
"""
Return the sorted list of tags.
"""
tag_list = map(self.get_tag_name, data[Note.POS_TAGS])
return ', '.join(sorted(tag_list, key=locale.strxfrm))

View File

@ -3,7 +3,7 @@
# #
# Copyright (C) 2000-2007 Donald N. Allingham # Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2009 Gary Burton # Copyright (C) 2009 Gary Burton
# Copyright (C) 2009 Nick Hall # Copyright (C) 2009-2010 Nick Hall
# Copyright (C) 2009 Benny Malengier # Copyright (C) 2009 Benny Malengier
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
@ -57,7 +57,7 @@ _LOG = logging.getLogger(".")
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import const import const
from gen.lib import Name, EventRef, EventType, EventRoleType, MarkerType from gen.lib import Name, EventRef, EventType, EventRoleType
from gen.display.name import displayer as name_displayer from gen.display.name import displayer as name_displayer
import DateHandler import DateHandler
import ToolTips import ToolTips
@ -79,9 +79,8 @@ COLUMN_DEATH = 5
COLUMN_BIRTH = 6 COLUMN_BIRTH = 6
COLUMN_EVENT = 7 COLUMN_EVENT = 7
COLUMN_FAMILY = 8 COLUMN_FAMILY = 8
COLUMN_TAGS = 21
COLUMN_CHANGE = 17 COLUMN_CHANGE = 17
COLUMN_MARKER = 18 COLUMN_TAGS = 18
invalid_date_format = config.get('preferences.invalid-date-format') invalid_date_format = config.get('preferences.invalid-date-format')
@ -121,7 +120,6 @@ class PeopleBaseModel(object):
self.column_tags, self.column_tags,
self.column_change, self.column_change,
self.column_int_id, self.column_int_id,
self.column_marker_text,
self.column_tag_color, self.column_tag_color,
self.column_tooltip, self.column_tooltip,
] ]
@ -137,7 +135,6 @@ class PeopleBaseModel(object):
self.column_tags, self.column_tags,
self.sort_change, self.sort_change,
self.column_int_id, self.column_int_id,
self.column_marker_text,
self.column_tag_color, self.column_tag_color,
self.column_tooltip, self.column_tooltip,
] ]
@ -150,11 +147,11 @@ class PeopleBaseModel(object):
self.lru_bdate = LRU(PeopleBaseModel._CACHE_SIZE) self.lru_bdate = LRU(PeopleBaseModel._CACHE_SIZE)
self.lru_ddate = LRU(PeopleBaseModel._CACHE_SIZE) self.lru_ddate = LRU(PeopleBaseModel._CACHE_SIZE)
def marker_column(self): def color_column(self):
""" """
Return the column for marker colour. Return the color column.
""" """
return 12 return 11
def clear_local_cache(self, handle=None): def clear_local_cache(self, handle=None):
""" Clear the LRU cache """ """ Clear the LRU cache """
@ -419,11 +416,6 @@ class PeopleBaseModel(object):
return "<i>" + cgi.escape(place_title) + "</i>" return "<i>" + cgi.escape(place_title) + "</i>"
return u"" return u""
def column_marker_text(self, data):
if COLUMN_MARKER < len(data):
return str(data[COLUMN_MARKER])
return ""
def column_tooltip(self, data): def column_tooltip(self, data):
if const.USE_TIPS: if const.USE_TIPS:
return ToolTips.TipFromFunction( return ToolTips.TipFromFunction(
@ -446,7 +438,7 @@ class PeopleBaseModel(object):
""" """
Return the tag color. Return the tag color.
""" """
tag_color = None tag_color = '#000000000000'
tag_priority = None tag_priority = None
for handle in data[COLUMN_TAGS]: for handle in data[COLUMN_TAGS]:
tag = self.db.get_tag_from_handle(handle) tag = self.db.get_tag_from_handle(handle)

View File

@ -379,9 +379,9 @@ class TreeBaseModel(gtk.GenericTreeModel):
""" """
return self._tooltip_column return self._tooltip_column
def marker_column(self): def color_column(self):
""" """
Return the marker color column. Return the color column.
""" """
return None return None
@ -772,7 +772,7 @@ class TreeBaseModel(gtk.GenericTreeModel):
node = self.nodemap.node(nodeid) node = self.nodemap.node(nodeid)
if node.handle is None: if node.handle is None:
# Header rows dont get the foreground color set # Header rows dont get the foreground color set
if col == self.marker_column(): if col == self.color_column():
return None return None
# Look for header fuction for column and call it # Look for header fuction for column and call it

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2000-2006 Donald N. Allingham # Copyright (C) 2000-2006 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by

View File

@ -7,6 +7,7 @@
# Copyright (C) 2008 Robert Cheramy <robert@cheramy.net> # Copyright (C) 2008 Robert Cheramy <robert@cheramy.net>
# Copyright (C) 2009 Douglas S. Blank # Copyright (C) 2009 Douglas S. Blank
# Copyright (C) 2010 Jakim Friant # Copyright (C) 2010 Jakim Friant
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -429,7 +430,7 @@ class GrampsXmlWriter(UpdateCallback):
ntype = escxml(note.get_type().xml_str()) ntype = escxml(note.get_type().xml_str())
format = note.get_format() format = note.get_format()
text = note.get_styledtext() text = note.get_styledtext()
tags = text.get_tags() styles = text.get_tags()
text = str(text) text = str(text)
self.g.write(' type="%s"' % ntype) self.g.write(' type="%s"' % ntype)
@ -439,23 +440,25 @@ class GrampsXmlWriter(UpdateCallback):
self.write_text('text', text, index + 1) self.write_text('text', text, index + 1)
if tags: if styles:
self.write_texttags(tags, index + 1) self.write_styles(styles, index + 1)
for tag_handle in note.get_tag_list():
self.write_ref("tagref", tag_handle, index+1)
self.g.write(' ' * index + '</note>\n') self.g.write(' ' * index + '</note>\n')
def write_texttags(self, tags, index=3): def write_styles(self, styles, index=3):
for tag in tags: for style in styles:
name = tag.name.xml_str() name = style.name.xml_str()
value = tag.value value = style.value
self.g.write(' ' * index + '<style name="%s"' % name) self.g.write(' ' * index + '<style name="%s"' % name)
if value: if value:
self.g.write(' value="%s"' % escxml(str(value))) self.g.write(' value="%s"' % escxml(str(value)))
self.g.write('>\n') self.g.write('>\n')
for (start, end) in tag.ranges: for (start, end) in style.ranges:
self.g.write((' ' * (index + 1)) + self.g.write((' ' * (index + 1)) +
'<range start="%d" end="%d"/>\n' % (start, end)) '<range start="%d" end="%d"/>\n' % (start, end))
@ -540,6 +543,10 @@ class GrampsXmlWriter(UpdateCallback):
self.write_note_list(family.get_note_list(),index+1) self.write_note_list(family.get_note_list(),index+1)
for s in family.get_source_references(): for s in family.get_source_references():
self.dump_source_ref(s,index+1) self.dump_source_ref(s,index+1)
for tag_handle in family.get_tag_list():
self.write_ref("tagref", tag_handle, index+1)
self.g.write("%s</family>\n" % sp) self.g.write("%s</family>\n" % sp)
def write_source(self,source,index=1): def write_source(self,source,index=1):
@ -745,16 +752,11 @@ class GrampsXmlWriter(UpdateCallback):
""" """
if not obj: if not obj:
return return
marker = obj.get_marker().xml_str()
if marker:
marker_text = ' marker="%s"' % escxml(marker)
else:
marker_text = ''
priv_text = conf_priv(obj) priv_text = conf_priv(obj)
id_text = ' id="%s"' % escxml(obj.gramps_id) id_text = ' id="%s"' % escxml(obj.gramps_id)
self.write_table_tag(tagname, obj, index, False) self.write_table_tag(tagname, obj, index, False)
self.g.write(id_text + priv_text + marker_text) self.g.write(id_text + priv_text)
if close: if close:
self.g.write('>\n') self.g.write('>\n')
@ -1164,6 +1166,10 @@ class GrampsXmlWriter(UpdateCallback):
self.write_date(dval, index+1) self.write_date(dval, index+1)
for s in obj.get_source_references(): for s in obj.get_source_references():
self.dump_source_ref(s, index+1) self.dump_source_ref(s, index+1)
for tag_handle in obj.get_tag_list():
self.write_ref("tagref", tag_handle, index+1)
self.g.write("%s</object>\n" % (" "*index)) self.g.write("%s</object>\n" % (" "*index))
#------------------------------------------------------------------------- #-------------------------------------------------------------------------

View File

@ -3,6 +3,7 @@
# #
# Copyright (C) 2000-2007 Donald N. Allingham # Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2009 Douglas S. Blank # Copyright (C) 2009 Douglas S. Blank
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -1110,11 +1111,8 @@ class GrampsParser(UpdateCallback):
else: else:
self.person.change = self.change self.person.change = self.change
self.info.add('merge-overwrite', PERSON_KEY, self.person) self.info.add('merge-overwrite', PERSON_KEY, self.person)
# Old and new markers: complete=1 and marker=word both have to work
if attrs.get('complete'): # this is only true for complete=1 self.convert_marker(attrs, self.person)
self.person.marker.set(gen.lib.MarkerType.COMPLETE)
else:
self.person.marker.set_from_xml_str(attrs.get("marker", ''))
def start_people(self, attrs): def start_people(self, attrs):
if 'home' in attrs: if 'home' in attrs:
@ -1222,11 +1220,7 @@ class GrampsParser(UpdateCallback):
if 'type' in attrs: if 'type' in attrs:
self.family.type.set_from_xml_str(attrs["type"]) self.family.type.set_from_xml_str(attrs["type"])
# Old and new markers: complete=1 and marker=word both have to work self.convert_marker(attrs, self.family)
if attrs.get('complete'): # this is only true for complete=1
self.family.marker.set(gen.lib.MarkerType.COMPLETE)
else:
self.family.marker.set_from_xml_str(attrs.get("marker", ''))
def start_rel(self, attrs): def start_rel(self, attrs):
if 'type' in attrs: if 'type' in attrs:
@ -1409,11 +1403,8 @@ class GrampsParser(UpdateCallback):
self.info.add('merge-overwrite', NOTE_KEY, self.note) self.info.add('merge-overwrite', NOTE_KEY, self.note)
self.note.format = int(attrs.get('format', gen.lib.Note.FLOWED)) self.note.format = int(attrs.get('format', gen.lib.Note.FLOWED))
self.note.type.set_from_xml_str(attrs['type']) self.note.type.set_from_xml_str(attrs['type'])
# Old and new markers: complete=1 and marker=word both have to work
if attrs.get('complete'): # this is only true for complete=1 self.convert_marker(attrs, self.note)
self.note.marker.set(gen.lib.MarkerType.COMPLETE)
else:
self.note.marker.set_from_xml_str(attrs.get("marker", ''))
# Since StyledText was introduced (XML v1.3.0) the clear text # Since StyledText was introduced (XML v1.3.0) the clear text
# part of the note is moved between <text></text> tags. # part of the note is moved between <text></text> tags.
@ -2417,6 +2408,28 @@ class GrampsParser(UpdateCallback):
if self.func: if self.func:
self.tlist.append(data) self.tlist.append(data)
def convert_marker(self, attrs, obj):
"""
Convert markers into tags.
Old and new markers: complete=1 and marker=word
"""
if attrs.get('complete'): # this is only true for complete=1
tag_name = 'Complete'
else:
tag_name = attrs.get('marker')
if tag_name is not None:
tag_name = _(tag_name)
tag = self.db.get_tag_from_name(tag_name)
if tag is None:
tag = gen.lib.Tag()
tag.set_name(tag_name)
tag.set_priority(self.db.get_number_of_tags())
tag_handle = self.db.add_tag(tag, self.trans)
else:
tag_handle = tag.get_handle()
obj.add_tag(tag_handle)
def append_value(orig, val): def append_value(orig, val):
if orig: if orig:

View File

@ -2,7 +2,7 @@
# #
# Copyright (C) 2000-2007 Donald N. Allingham # Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2008 Gary Burton # Copyright (C) 2008 Gary Burton
# Copyright (C) 2009 Nick Hall # Copyright (C) 2009-2010 Nick Hall
# Copyright (C) 2010 Benny Malengier # Copyright (C) 2010 Benny Malengier
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify

View File

@ -3,7 +3,8 @@
# #
# Copyright (C) 2007-2008 Brian G. Matherly # Copyright (C) 2007-2008 Brian G. Matherly
# Copyright (C) 2009 Gary Burton # Copyright (C) 2009 Gary Burton
# Copyright (C) 2010 Jakim Friant # Copyright (C) 2010 Jakim Friant
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -22,7 +23,7 @@
# $Id$ # $Id$
"""Reports/Text Reports/Marker Report""" """Reports/Text Reports/Tag Report"""
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -43,21 +44,22 @@ from gui.plug.report import MenuReportOptions
from gen.plug.docgen import (IndexMark, FontStyle, ParagraphStyle, from gen.plug.docgen import (IndexMark, FontStyle, ParagraphStyle,
TableStyle, TableCellStyle, FONT_SANS_SERIF, TableStyle, TableCellStyle, FONT_SANS_SERIF,
INDEX_TYPE_TOC, PARA_ALIGN_CENTER) INDEX_TYPE_TOC, PARA_ALIGN_CENTER)
from gen.lib import MarkerType, NoteType from gen.lib import NoteType
from Filters import GenericFilterFactory, Rules from Filters import GenericFilterFactory, Rules
from gen.display.name import displayer as name_displayer from gen.display.name import displayer as name_displayer
from Errors import ReportError
import DateHandler import DateHandler
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# MarkerReport # TagReport
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
class MarkerReport(Report): class TagReport(Report):
def __init__(self, database, options_class): def __init__(self, database, options_class):
""" """
Create the MarkerReport object that produces the report. Create the TagReport object that produces the report.
The arguments are: The arguments are:
@ -68,70 +70,68 @@ class MarkerReport(Report):
This report needs the following parameters (class variables) This report needs the following parameters (class variables)
that come in the options class. that come in the options class.
marker - The marker each object must match to be included. tag - The tag each object must match to be included.
""" """
Report.__init__(self, database, options_class) Report.__init__(self, database, options_class)
menu = options_class.menu menu = options_class.menu
self.marker = menu.get_option_by_name('marker').get_value() self.tag = menu.get_option_by_name('tag').get_value()
if not self.tag:
raise ReportError(_('Tag Report'),
_('You must first create a tag before running this report.'))
def write_report(self): def write_report(self):
markerstr = self.marker self.doc.start_paragraph("TR-Title")
# Use localized name if this is not a custom marker title = _("Tag Report for %s Items") % self.tag
if self.marker in MarkerType._E2IMAP:
mtype = MarkerType._E2IMAP[self.marker]
markerstr = MarkerType._I2SMAP[mtype]
self.doc.start_paragraph("MR-Title")
title = _("Marker Report for %s Items") % markerstr
mark = IndexMark(title, INDEX_TYPE_TOC, 1) mark = IndexMark(title, INDEX_TYPE_TOC, 1)
self.doc.write_text(title, mark) self.doc.write_text(title, mark)
self.doc.end_paragraph() self.doc.end_paragraph()
self.write_people() self.write_people()
self.write_families() self.write_families()
self.write_events() #self.write_events()
self.write_notes() self.write_notes()
self.write_media()
def write_people(self): def write_people(self):
plist = self.database.iter_person_handles() plist = self.database.iter_person_handles()
FilterClass = GenericFilterFactory('Person') FilterClass = GenericFilterFactory('Person')
filter = FilterClass() filter = FilterClass()
filter.add_rule(Rules.Person.HasMarkerOf([self.marker])) filter.add_rule(Rules.Person.HasTag([self.tag]))
ind_list = filter.apply(self.database, plist) ind_list = filter.apply(self.database, plist)
if not ind_list: if not ind_list:
return return
self.doc.start_paragraph("MR-Heading") self.doc.start_paragraph("TR-Heading")
header = _("People") header = _("People")
mark = IndexMark(header, INDEX_TYPE_TOC, 2) mark = IndexMark(header, INDEX_TYPE_TOC, 2)
self.doc.write_text(header, mark) self.doc.write_text(header, mark)
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.start_table('PeopleTable','MR-Table') self.doc.start_table('PeopleTable','TR-Table')
self.doc.start_row() self.doc.start_row()
self.doc.start_cell('MR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('MR-Normal-Bold') self.doc.start_paragraph('TR-Normal-Bold')
self.doc.write_text(_("Id")) self.doc.write_text(_("Id"))
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
self.doc.start_cell('MR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('MR-Normal-Bold') self.doc.start_paragraph('TR-Normal-Bold')
self.doc.write_text(_("Name")) self.doc.write_text(_("Name"))
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
self.doc.start_cell('MR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('MR-Normal-Bold') self.doc.start_paragraph('TR-Normal-Bold')
self.doc.write_text(_("Birth")) self.doc.write_text(_("Birth"))
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
self.doc.start_cell('MR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('MR-Normal-Bold') self.doc.start_paragraph('TR-Normal-Bold')
self.doc.write_text(_("Death")) self.doc.write_text(_("Death"))
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
@ -143,22 +143,22 @@ class MarkerReport(Report):
self.doc.start_row() self.doc.start_row()
self.doc.start_cell('MR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('MR-Normal') self.doc.start_paragraph('TR-Normal')
self.doc.write_text(person.get_gramps_id()) self.doc.write_text(person.get_gramps_id())
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
name = name_displayer.display(person) name = name_displayer.display(person)
mark = ReportUtils.get_person_mark(self.database, person) mark = ReportUtils.get_person_mark(self.database, person)
self.doc.start_cell('MR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('MR-Normal') self.doc.start_paragraph('TR-Normal')
self.doc.write_text(name, mark) self.doc.write_text(name, mark)
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
self.doc.start_cell('MR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('MR-Normal') self.doc.start_paragraph('TR-Normal')
birth_ref = person.get_birth_ref() birth_ref = person.get_birth_ref()
if birth_ref: if birth_ref:
event = self.database.get_event_from_handle(birth_ref.ref) event = self.database.get_event_from_handle(birth_ref.ref)
@ -166,8 +166,8 @@ class MarkerReport(Report):
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
self.doc.start_cell('MR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('MR-Normal') self.doc.start_paragraph('TR-Normal')
death_ref = person.get_death_ref() death_ref = person.get_death_ref()
if death_ref: if death_ref:
event = self.database.get_event_from_handle(death_ref.ref) event = self.database.get_event_from_handle(death_ref.ref)
@ -183,42 +183,42 @@ class MarkerReport(Report):
flist = self.database.iter_family_handles() flist = self.database.iter_family_handles()
FilterClass = GenericFilterFactory('Family') FilterClass = GenericFilterFactory('Family')
filter = FilterClass() filter = FilterClass()
filter.add_rule(Rules.Family.HasMarkerOf([self.marker])) filter.add_rule(Rules.Family.HasTag([self.tag]))
fam_list = filter.apply(self.database, flist) fam_list = filter.apply(self.database, flist)
if not fam_list: if not fam_list:
return return
self.doc.start_paragraph("MR-Heading") self.doc.start_paragraph("TR-Heading")
header = _("Families") header = _("Families")
mark = IndexMark(header,INDEX_TYPE_TOC, 2) mark = IndexMark(header,INDEX_TYPE_TOC, 2)
self.doc.write_text(header, mark) self.doc.write_text(header, mark)
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.start_table('FamilyTable','MR-Table') self.doc.start_table('FamilyTable','TR-Table')
self.doc.start_row() self.doc.start_row()
self.doc.start_cell('MR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('MR-Normal-Bold') self.doc.start_paragraph('TR-Normal-Bold')
self.doc.write_text(_("Id")) self.doc.write_text(_("Id"))
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
self.doc.start_cell('MR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('MR-Normal-Bold') self.doc.start_paragraph('TR-Normal-Bold')
self.doc.write_text(_("Father")) self.doc.write_text(_("Father"))
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
self.doc.start_cell('MR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('MR-Normal-Bold') self.doc.start_paragraph('TR-Normal-Bold')
self.doc.write_text(_("Mother")) self.doc.write_text(_("Mother"))
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
self.doc.start_cell('MR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('MR-Normal-Bold') self.doc.start_paragraph('TR-Normal-Bold')
self.doc.write_text(_("Relationship")) self.doc.write_text(_("Relationship"))
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
@ -230,14 +230,14 @@ class MarkerReport(Report):
self.doc.start_row() self.doc.start_row()
self.doc.start_cell('MR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('MR-Normal') self.doc.start_paragraph('TR-Normal')
self.doc.write_text(family.get_gramps_id()) self.doc.write_text(family.get_gramps_id())
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
self.doc.start_cell('MR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('MR-Normal') self.doc.start_paragraph('TR-Normal')
father_handle = family.get_father_handle() father_handle = family.get_father_handle()
if father_handle: if father_handle:
father = self.database.get_person_from_handle(father_handle) father = self.database.get_person_from_handle(father_handle)
@ -246,8 +246,8 @@ class MarkerReport(Report):
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
self.doc.start_cell('MR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('MR-Normal') self.doc.start_paragraph('TR-Normal')
mother_handle = family.get_mother_handle() mother_handle = family.get_mother_handle()
if mother_handle: if mother_handle:
mother = self.database.get_person_from_handle(mother_handle) mother = self.database.get_person_from_handle(mother_handle)
@ -256,8 +256,8 @@ class MarkerReport(Report):
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
self.doc.start_cell('MR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('MR-Normal') self.doc.start_paragraph('TR-Normal')
relation = family.get_relationship() relation = family.get_relationship()
self.doc.write_text(str(relation) ) self.doc.write_text(str(relation) )
self.doc.end_paragraph() self.doc.end_paragraph()
@ -269,46 +269,46 @@ class MarkerReport(Report):
def write_events(self): def write_events(self):
# At the time of this writing, the GRAMPS UI does not allow the setting # At the time of this writing, the GRAMPS UI does not allow the setting
# of markers for events. # of tags for events.
elist = self.database.get_event_handles() elist = self.database.get_event_handles()
FilterClass = GenericFilterFactory('Event') FilterClass = GenericFilterFactory('Event')
filter = FilterClass() filter = FilterClass()
filter.add_rule(Rules.Event.HasMarkerOf([self.marker])) filter.add_rule(Rules.Event.HasTag([self.tag]))
event_list = filter.apply(self.database, elist) event_list = filter.apply(self.database, elist)
if not event_list: if not event_list:
return return
self.doc.start_paragraph("MR-Heading") self.doc.start_paragraph("TR-Heading")
header = _("Events") header = _("Events")
mark = IndexMark(header, INDEX_TYPE_TOC, 2) mark = IndexMark(header, INDEX_TYPE_TOC, 2)
self.doc.write_text(header, mark) self.doc.write_text(header, mark)
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.start_table('EventTable','MR-Table') self.doc.start_table('EventTable','TR-Table')
self.doc.start_row() self.doc.start_row()
self.doc.start_cell('MR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('MR-Normal-Bold') self.doc.start_paragraph('TR-Normal-Bold')
self.doc.write_text(_("Id")) self.doc.write_text(_("Id"))
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
self.doc.start_cell('MR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('MR-Normal-Bold') self.doc.start_paragraph('TR-Normal-Bold')
self.doc.write_text(_("Date")) self.doc.write_text(_("Date"))
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
self.doc.start_cell('MR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('MR-Normal-Bold') self.doc.start_paragraph('TR-Normal-Bold')
self.doc.write_text(_("Place")) self.doc.write_text(_("Place"))
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
self.doc.start_cell('MR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('MR-Normal-Bold') self.doc.start_paragraph('TR-Normal-Bold')
self.doc.write_text(_("Description")) self.doc.write_text(_("Description"))
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
@ -320,22 +320,22 @@ class MarkerReport(Report):
self.doc.start_row() self.doc.start_row()
self.doc.start_cell('MR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('MR-Normal') self.doc.start_paragraph('TR-Normal')
self.doc.write_text(event.get_gramps_id()) self.doc.write_text(event.get_gramps_id())
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
self.doc.start_cell('MR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('MR-Normal') self.doc.start_paragraph('TR-Normal')
date = DateHandler.get_date(event) date = DateHandler.get_date(event)
if date: if date:
self.doc.write_text(date) self.doc.write_text(date)
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
self.doc.start_cell('MR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('MR-Normal') self.doc.start_paragraph('TR-Normal')
place_handle = event.get_place_handle() place_handle = event.get_place_handle()
place = ReportUtils.place_name(self.database, place_handle) place = ReportUtils.place_name(self.database, place_handle)
if place: if place:
@ -343,8 +343,8 @@ class MarkerReport(Report):
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
self.doc.start_cell('MR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('MR-Normal') self.doc.start_paragraph('TR-Normal')
descr = event.get_description() descr = event.get_description()
if descr: if descr:
self.doc.write_text( descr ) self.doc.write_text( descr )
@ -359,36 +359,36 @@ class MarkerReport(Report):
nlist = self.database.get_note_handles() nlist = self.database.get_note_handles()
FilterClass = GenericFilterFactory('Note') FilterClass = GenericFilterFactory('Note')
filter = FilterClass() filter = FilterClass()
filter.add_rule(Rules.Note.HasMarkerOf([self.marker])) filter.add_rule(Rules.Note.HasTag([self.tag]))
note_list = filter.apply(self.database, nlist) note_list = filter.apply(self.database, nlist)
if not note_list: if not note_list:
return return
self.doc.start_paragraph("MR-Heading") self.doc.start_paragraph("TR-Heading")
header = _("Notes") header = _("Notes")
mark = IndexMark(header, INDEX_TYPE_TOC, 2) mark = IndexMark(header, INDEX_TYPE_TOC, 2)
self.doc.write_text(header ,mark) self.doc.write_text(header ,mark)
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.start_table('NoteTable','MR-Table') self.doc.start_table('NoteTable','TR-Table')
self.doc.start_row() self.doc.start_row()
self.doc.start_cell('MR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('MR-Normal-Bold') self.doc.start_paragraph('TR-Normal-Bold')
self.doc.write_text(_("Id")) self.doc.write_text(_("Id"))
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
self.doc.start_cell('MR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('MR-Normal-Bold') self.doc.start_paragraph('TR-Normal-Bold')
self.doc.write_text(_("Type")) self.doc.write_text(_("Type"))
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
self.doc.start_cell('MR-TableCell', 2) self.doc.start_cell('TR-TableCell', 2)
self.doc.start_paragraph('MR-Normal-Bold') self.doc.start_paragraph('TR-Normal-Bold')
self.doc.write_text(_("Text")) self.doc.write_text(_("Text"))
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
@ -400,22 +400,22 @@ class MarkerReport(Report):
self.doc.start_row() self.doc.start_row()
self.doc.start_cell('MR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('MR-Normal') self.doc.start_paragraph('TR-Normal')
self.doc.write_text(note.get_gramps_id()) self.doc.write_text(note.get_gramps_id())
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
self.doc.start_cell('MR-TableCell') self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('MR-Normal') self.doc.start_paragraph('TR-Normal')
type = note.get_type() type = note.get_type()
self.doc.write_text(str(type)) self.doc.write_text(str(type))
self.doc.end_paragraph() self.doc.end_paragraph()
self.doc.end_cell() self.doc.end_cell()
self.doc.start_cell('MR-TableCell', 2) self.doc.start_cell('TR-TableCell', 2)
self.doc.write_styled_note(note.get_styledtext(), self.doc.write_styled_note(note.get_styledtext(),
note.get_format(), 'MR-Note', note.get_format(), 'TR-Note',
contains_html= note.get_type() \ contains_html= note.get_type() \
== NoteType.HTML_CODE) == NoteType.HTML_CODE)
self.doc.end_cell() self.doc.end_cell()
@ -424,12 +424,95 @@ class MarkerReport(Report):
self.doc.end_table() self.doc.end_table()
def write_media(self):
mlist = self.database.get_media_object_handles()
FilterClass = GenericFilterFactory('MediaObject')
filter = FilterClass()
filter.add_rule(Rules.MediaObject.HasTag([self.tag]))
media_list = filter.apply(self.database, mlist)
if not media_list:
return
self.doc.start_paragraph("TR-Heading")
header = _("Media")
mark = IndexMark(header, INDEX_TYPE_TOC, 2)
self.doc.write_text(header ,mark)
self.doc.end_paragraph()
self.doc.start_table('MediaTable','TR-Table')
self.doc.start_row()
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal-Bold')
self.doc.write_text(_("Id"))
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal-Bold')
self.doc.write_text(_("Title"))
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal-Bold')
self.doc.write_text(_("Type"))
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal-Bold')
self.doc.write_text(_("Date"))
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.end_row()
for media_handle in media_list:
media = self.database.get_object_from_handle(media_handle)
self.doc.start_row()
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal')
self.doc.write_text(media.get_gramps_id())
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal')
title = media.get_description()
self.doc.write_text(str(title))
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal')
mime_type = media.get_mime_type()
self.doc.write_text(str(mime_type))
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal')
date = DateHandler.get_date(media)
if date:
self.doc.write_text(date)
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.end_row()
self.doc.end_table()
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# MarkerOptions # TagOptions
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
class MarkerOptions(MenuReportOptions): class TagOptions(MenuReportOptions):
def __init__(self, name, dbase): def __init__(self, name, dbase):
self.__db = dbase self.__db = dbase
@ -437,26 +520,28 @@ class MarkerOptions(MenuReportOptions):
def add_menu_options(self, menu): def add_menu_options(self, menu):
""" """
Add options to the menu for the marker report. Add options to the menu for the tag report.
""" """
category_name = _("Report Options") category_name = _("Report Options")
marker = EnumeratedListOption(_('Marker'), all_tags = []
MarkerType._I2EMAP[MarkerType.COMPLETE]) for handle in self.__db.get_tag_handles():
# Add built-in marker types tag = self.__db.get_tag_from_handle(handle)
for mtype in MarkerType._I2SMAP: all_tags.append(tag.get_name())
if mtype != MarkerType.NONE and mtype != MarkerType.CUSTOM:
# Use translated name for built-in marker types if len(all_tags) > 0:
marker.add_item(MarkerType._I2EMAP[mtype], tag_option = EnumeratedListOption(_('Tag'), all_tags[0])
MarkerType._I2SMAP[mtype] ) for tag_name in all_tags:
# Add custom marker types tag_option.add_item(tag_name, tag_name)
for m in self.__db.get_marker_types(): else:
marker.add_item( m, m ) tag_option = EnumeratedListOption(_('Tag'), '')
marker.set_help( _("The marker to use for the report")) tag_option.add_item('', '')
menu.add_option(category_name,"marker",marker)
tag_option.set_help( _("The tag to use for the report"))
menu.add_option(category_name, "tag", tag_option)
def make_default_style(self,default_style): def make_default_style(self,default_style):
"""Make the default output style for the Marker Report.""" """Make the default output style for the Tag Report."""
# Paragraph Styles # Paragraph Styles
f = FontStyle() f = FontStyle()
f.set_size(16) f.set_size(16)
@ -470,7 +555,7 @@ class MarkerOptions(MenuReportOptions):
p.set_font(f) p.set_font(f)
p.set_alignment(PARA_ALIGN_CENTER) p.set_alignment(PARA_ALIGN_CENTER)
p.set_description(_("The style used for the title of the page.")) p.set_description(_("The style used for the title of the page."))
default_style.add_paragraph_style("MR-Title", p) default_style.add_paragraph_style("TR-Title", p)
font = FontStyle() font = FontStyle()
font.set(face=FONT_SANS_SERIF, size=14, italic=1) font.set(face=FONT_SANS_SERIF, size=14, italic=1)
@ -480,7 +565,7 @@ class MarkerOptions(MenuReportOptions):
para.set_top_margin(0.25) para.set_top_margin(0.25)
para.set_bottom_margin(0.25) para.set_bottom_margin(0.25)
para.set_description(_('The style used for the section headers.')) para.set_description(_('The style used for the section headers.'))
default_style.add_paragraph_style("MR-Heading", para) default_style.add_paragraph_style("TR-Heading", para)
font = FontStyle() font = FontStyle()
font.set_size(12) font.set_size(12)
@ -490,7 +575,7 @@ class MarkerOptions(MenuReportOptions):
p.set_top_margin(ReportUtils.pt2cm(3)) p.set_top_margin(ReportUtils.pt2cm(3))
p.set_bottom_margin(ReportUtils.pt2cm(3)) p.set_bottom_margin(ReportUtils.pt2cm(3))
p.set_description(_('The basic style used for the text display.')) p.set_description(_('The basic style used for the text display.'))
default_style.add_paragraph_style("MR-Normal", p) default_style.add_paragraph_style("TR-Normal", p)
font = FontStyle() font = FontStyle()
font.set_size(12) font.set_size(12)
@ -501,18 +586,18 @@ class MarkerOptions(MenuReportOptions):
p.set_top_margin(ReportUtils.pt2cm(3)) p.set_top_margin(ReportUtils.pt2cm(3))
p.set_bottom_margin(ReportUtils.pt2cm(3)) p.set_bottom_margin(ReportUtils.pt2cm(3))
p.set_description(_('The basic style used for table headings.')) p.set_description(_('The basic style used for table headings.'))
default_style.add_paragraph_style("MR-Normal-Bold", p) default_style.add_paragraph_style("TR-Normal-Bold", p)
para = ParagraphStyle() para = ParagraphStyle()
p.set(first_indent=-0.75, lmargin=.75) p.set(first_indent=-0.75, lmargin=.75)
para.set_top_margin(ReportUtils.pt2cm(3)) para.set_top_margin(ReportUtils.pt2cm(3))
para.set_bottom_margin(ReportUtils.pt2cm(3)) para.set_bottom_margin(ReportUtils.pt2cm(3))
para.set_description(_('The basic style used for the note display.')) para.set_description(_('The basic style used for the note display.'))
default_style.add_paragraph_style("MR-Note",para) default_style.add_paragraph_style("TR-Note",para)
#Table Styles #Table Styles
cell = TableCellStyle() cell = TableCellStyle()
default_style.add_cell_style('MR-TableCell', cell) default_style.add_cell_style('TR-TableCell', cell)
table = TableStyle() table = TableStyle()
table.set_width(100) table.set_width(100)
@ -521,4 +606,4 @@ class MarkerOptions(MenuReportOptions):
table.set_column_width(1, 30) table.set_column_width(1, 30)
table.set_column_width(2, 30) table.set_column_width(2, 30)
table.set_column_width(3, 30) table.set_column_width(3, 30)
default_style.add_table_style('MR-Table',table) default_style.add_table_style('TR-Table',table)

View File

@ -243,24 +243,24 @@ plg.report_modes = [REPORT_MODE_GUI, REPORT_MODE_BKI, REPORT_MODE_CLI]
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# Marker Report # Tag Report
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
plg = newplugin() plg = newplugin()
plg.id = 'marker_report' plg.id = 'tag_report'
plg.name = _("Marker Report") plg.name = _("Tag Report")
plg.description = _("Produces a list of people with a specified marker") plg.description = _("Produces a list of people with a specified tag")
plg.version = '1.0' plg.version = '1.0'
plg.gramps_target_version = '3.3' plg.gramps_target_version = '3.3'
plg.status = STABLE plg.status = STABLE
plg.fname = 'MarkerReport.py' plg.fname = 'TagReport.py'
plg.ptype = REPORT plg.ptype = REPORT
plg.authors = ["Brian G. Matherly"] plg.authors = ["Brian G. Matherly"]
plg.authors_email = ["brian@gramps-project.org"] plg.authors_email = ["brian@gramps-project.org"]
plg.category = CATEGORY_TEXT plg.category = CATEGORY_TEXT
plg.reportclass = 'MarkerReport' plg.reportclass = 'TagReport'
plg.optionclass = 'MarkerOptions' plg.optionclass = 'TagOptions'
plg.report_modes = [REPORT_MODE_GUI, REPORT_MODE_BKI, REPORT_MODE_CLI] plg.report_modes = [REPORT_MODE_GUI, REPORT_MODE_BKI, REPORT_MODE_CLI]
plg.require_active = False plg.require_active = False

View File

@ -1,9 +1,10 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2007-2009 Stephane Charette # Copyright (C) 2007-2009 Stephane Charette
# Copyright (C) 2008 Brian Matherly # Copyright (C) 2008 Brian Matherly
# Copyright (C) 2010 Jakim Friant # Copyright (C) 2010 Jakim Friant
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -24,6 +25,13 @@
"Find people who are not related to the selected person" "Find people who are not related to the selected person"
#------------------------------------------------------------------------
#
# Python modules
#
#------------------------------------------------------------------------
import locale
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# GNOME/GTK modules # GNOME/GTK modules
@ -47,6 +55,7 @@ from gui.utils import ProgressMeter
import GrampsDisplay import GrampsDisplay
from gen.ggettext import sgettext as _ from gen.ggettext import sgettext as _
from glade import Glade from glade import Glade
from gen.lib import Tag
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -91,13 +100,18 @@ class NotRelated(tool.ActivePersonTool, ManagedWindow.ManagedWindow) :
title = topDialog.get_object("title") title = topDialog.get_object("title")
self.set_window(window, title, self.title) self.set_window(window, title, self.title)
self.markercombo = topDialog.get_object("markercombo") self.tagcombo = topDialog.get_object("tagcombo")
self.markerapply = topDialog.get_object("markerapply") tagmodel = gtk.ListStore(str)
self.markercombo.set_sensitive(False) self.tagcombo.set_model(tagmodel)
self.markerapply.set_sensitive(False) self.tagcombo.set_text_column(0)
self.markerapply.connect('clicked', self.applyMarkerClicked) tagmodel.append((_('ToDo'),))
tagmodel.append((_('NotRelated'),))
self.tagcombo.set_sensitive(False)
self.tagapply = topDialog.get_object("tagapply")
self.tagapply.set_sensitive(False)
self.tagapply.connect('clicked', self.applyTagClicked)
# start the progress indicator # start the progress indicator
self.progress = ProgressMeter(self.title,_('Starting')) self.progress = ProgressMeter(self.title,_('Starting'))
@ -106,7 +120,7 @@ class NotRelated(tool.ActivePersonTool, ManagedWindow.ManagedWindow) :
gobject.TYPE_STRING, # 0==name gobject.TYPE_STRING, # 0==name
gobject.TYPE_STRING, # 1==person gid gobject.TYPE_STRING, # 1==person gid
gobject.TYPE_STRING, # 2==parents gobject.TYPE_STRING, # 2==parents
gobject.TYPE_STRING, # 3==marker gobject.TYPE_STRING, # 3==tags
gobject.TYPE_STRING) # 4==family gid (not shown to user) gobject.TYPE_STRING) # 4==family gid (not shown to user)
# note -- don't assign the model to the tree until it has been populated, # note -- don't assign the model to the tree until it has been populated,
@ -115,7 +129,7 @@ class NotRelated(tool.ActivePersonTool, ManagedWindow.ManagedWindow) :
col1 = gtk.TreeViewColumn(_('Name'), gtk.CellRendererText(), text=0) col1 = gtk.TreeViewColumn(_('Name'), gtk.CellRendererText(), text=0)
col2 = gtk.TreeViewColumn(_('ID'), gtk.CellRendererText(), text=1) col2 = gtk.TreeViewColumn(_('ID'), gtk.CellRendererText(), text=1)
col3 = gtk.TreeViewColumn(_('Parents'), gtk.CellRendererText(), text=2) col3 = gtk.TreeViewColumn(_('Parents'), gtk.CellRendererText(), text=2)
col4 = gtk.TreeViewColumn(_('Marker'), gtk.CellRendererText(), text=3) col4 = gtk.TreeViewColumn(_('Tags'), gtk.CellRendererText(), text=3)
col1.set_resizable(True) col1.set_resizable(True)
col2.set_resizable(True) col2.set_resizable(True)
col3.set_resizable(True) col3.set_resizable(True)
@ -189,8 +203,8 @@ class NotRelated(tool.ActivePersonTool, ManagedWindow.ManagedWindow) :
def rowSelectionChanged(self, selection) : def rowSelectionChanged(self, selection) :
state = selection.count_selected_rows() > 0 state = selection.count_selected_rows() > 0
self.markercombo.set_sensitive(state) self.tagcombo.set_sensitive(state)
self.markerapply.set_sensitive(state) self.tagapply.set_sensitive(state)
def rowActivated(self, treeView, path, column) : def rowActivated(self, treeView, path, column) :
@ -222,23 +236,36 @@ class NotRelated(tool.ActivePersonTool, ManagedWindow.ManagedWindow) :
GrampsDisplay.help(WIKI_HELP_PAGE , WIKI_HELP_SEC) GrampsDisplay.help(WIKI_HELP_PAGE , WIKI_HELP_SEC)
def applyMarkerClicked(self, button) : def applyTagClicked(self, button) :
progress = None progress = None
rows = self.treeSelection.count_selected_rows() rows = self.treeSelection.count_selected_rows()
marker = self.markercombo.get_active_text() tag_name = self.tagcombo.get_active_text()
# start the db transaction
transaction = self.db.transaction_begin()
tag = self.db.get_tag_from_name(tag_name)
if not tag:
# create the tag if it doesn't already exist
tag = Tag()
tag.set_name(tag_name)
tag.set_priority(self.db.get_number_of_tags())
tag_handle = self.db.add_tag(tag, transaction)
else:
tag_handle = tag.get_handle()
# if more than 1 person is selected, use a progress indicator # if more than 1 person is selected, use a progress indicator
if rows > 1: if rows > 1:
progress = ProgressMeter(self.title,_('Starting')) progress = ProgressMeter(self.title,_('Starting'))
#TRANS: no singular form needed, as rows is always > 1 #TRANS: no singular form needed, as rows is always > 1
progress.set_pass(ngettext("Setting marker for %d person", 'Setting marker for %d people', \ progress.set_pass(ngettext("Setting tag for %d person",
rows) % rows, rows) "Setting tag for %d people",
rows) % rows, rows)
# start the db transaction
transaction = self.db.transaction_begin()
# iterate through all of the selected rows # iterate through all of the selected rows
(model, paths) = self.treeSelection.get_selected_rows() (model, paths) = self.treeSelection.get_selected_rows()
for path in paths: for path in paths:
if progress: if progress:
progress.step() progress.step()
@ -248,20 +275,28 @@ class NotRelated(tool.ActivePersonTool, ManagedWindow.ManagedWindow) :
personGid = self.model.get_value(iter, 1) personGid = self.model.get_value(iter, 1)
person = self.db.get_person_from_gramps_id(personGid) person = self.db.get_person_from_gramps_id(personGid)
# change the marker # add the tag to the person
person.set_marker(marker) person.add_tag(tag_handle)
self.model.set_value(iter, 3, marker)
# save this change # save this change
self.db.commit_person(person, transaction) self.db.commit_person(person, transaction)
# commit the entire transaction # commit the entire transaction
self.db.transaction_commit(transaction, "mark not related") self.db.transaction_commit(transaction, "Tag not related")
# refresh the tags column
self.treeView.set_model(None)
for path in paths:
iter = self.model.get_iter(path)
personGid = self.model.get_value(iter, 1)
person = self.db.get_person_from_gramps_id(personGid)
self.model.set_value(iter, 3, self.get_tag_list(person))
self.treeView.set_model(self.model)
self.treeView.expand_all()
if progress: if progress:
progress.close() progress.close()
def findRelatedPeople(self) : def findRelatedPeople(self) :
#TRANS: No singular form is needed. #TRANS: No singular form is needed.
@ -371,7 +406,9 @@ class NotRelated(tool.ActivePersonTool, ManagedWindow.ManagedWindow) :
surname = primaryname.get_surname() surname = primaryname.get_surname()
name = primaryname.get_name() name = primaryname.get_name()
gid = person.get_gramps_id() gid = person.get_gramps_id()
marker = person.get_marker()
# Retrieve the sorted tag list
tag_list = self.get_tag_list(person)
# find the names of the parents # find the names of the parents
familygid = '' familygid = ''
@ -414,12 +451,23 @@ class NotRelated(tool.ActivePersonTool, ManagedWindow.ManagedWindow) :
iter = self.model.append(None, [surname, '', '', '', '']) iter = self.model.append(None, [surname, '', '', '', ''])
# finally, we now get to add this person to the model # finally, we now get to add this person to the model
self.model.append(iter, [name, gid, parentNames, marker, familygid]) self.model.append(iter, [name, gid, parentNames, tag_list,
familygid])
def build_menu_names(self, obj): def build_menu_names(self, obj):
return (self.title, None) return (self.title, None)
def get_tag_list(self, person):
"""
Return a sorted list of tag names for the given person.
"""
tags = []
for handle in person.get_tag_list():
tag = self.db.get_tag_from_handle(handle)
tags.append(tag.get_name())
tags.sort(key=locale.strxfrm)
return ', '.join(tags)
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# NotRelatedOptions # NotRelatedOptions

View File

@ -2,23 +2,6 @@
<interface> <interface>
<!-- interface-requires gtk+ 2.12 --> <!-- interface-requires gtk+ 2.12 -->
<!-- interface-naming-policy toplevel-contextual --> <!-- interface-naming-policy toplevel-contextual -->
<object class="GtkListStore" id="model1">
<columns>
<!-- column-name gchararray -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes"></col>
</row>
<row>
<col id="0" translatable="yes">ToDo</col>
</row>
<row>
<col id="0" translatable="yes">NotRelated</col>
</row>
</data>
</object>
<object class="GtkDialog" id="notrelated"> <object class="GtkDialog" id="notrelated">
<property name="default_width">450</property> <property name="default_width">450</property>
<property name="default_height">400</property> <property name="default_height">400</property>
@ -86,24 +69,16 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="spacing">3</property> <property name="spacing">3</property>
<child> <child>
<object class="GtkComboBoxEntry" id="markercombo"> <object class="GtkComboBoxEntry" id="tagcombo">
<property name="visible">True</property> <property name="visible">True</property>
<property name="model">model1</property> <accelerator key="T" signal="grab_focus" modifiers="GDK_MOD1_MASK"/>
<property name="text_column">0</property>
<accelerator key="M" signal="grab_focus" modifiers="GDK_MOD1_MASK"/>
<child>
<object class="GtkCellRendererText" id="renderer1"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object> </object>
<packing> <packing>
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="markerapply"> <object class="GtkButton" id="tagapply">
<property name="label">gtk-apply</property> <property name="label">gtk-apply</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
@ -121,9 +96,9 @@
</object> </object>
</child> </child>
<child type="label"> <child type="label">
<object class="GtkLabel" id="marker"> <object class="GtkLabel" id="tag">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">_Marker</property> <property name="label" translatable="yes">_Tag</property>
<property name="use_markup">True</property> <property name="use_markup">True</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
</object> </object>

View File

@ -1,6 +1,7 @@
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2001-2006 Donald N. Allingham # Copyright (C) 2001-2006 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -69,7 +70,8 @@ class FamilyView(ListView):
COL_MOTHER = 2 COL_MOTHER = 2
COL_REL = 3 COL_REL = 3
COL_MARDATE = 4 COL_MARDATE = 4
COL_CHAN = 5 COL_TAGS = 5
COL_CHAN = 6
# name of the columns # name of the columns
COLUMN_NAMES = [ COLUMN_NAMES = [
_('ID'), _('ID'),
@ -77,6 +79,7 @@ class FamilyView(ListView):
_('Mother'), _('Mother'),
_('Relationship'), _('Relationship'),
_('Marriage Date'), _('Marriage Date'),
_('Tags'),
_('Last Changed'), _('Last Changed'),
] ]
#default setting with visible columns, order of the col, and their size #default setting with visible columns, order of the col, and their size
@ -84,8 +87,8 @@ class FamilyView(ListView):
('columns.visible', [COL_ID, COL_FATHER, COL_MOTHER, COL_REL, ('columns.visible', [COL_ID, COL_FATHER, COL_MOTHER, COL_REL,
COL_MARDATE]), COL_MARDATE]),
('columns.rank', [COL_ID, COL_FATHER, COL_MOTHER, COL_REL, ('columns.rank', [COL_ID, COL_FATHER, COL_MOTHER, COL_REL,
COL_MARDATE, COL_CHAN]), COL_MARDATE, COL_TAGS, COL_CHAN]),
('columns.size', [75, 200, 200, 100, 100, 100]) ('columns.size', [75, 200, 200, 100, 100, 100, 100])
) )
ADD_MSG = _("Add a new family") ADD_MSG = _("Add a new family")
@ -101,6 +104,7 @@ class FamilyView(ListView):
'family-update' : self.row_update, 'family-update' : self.row_update,
'family-delete' : self.row_delete, 'family-delete' : self.row_delete,
'family-rebuild' : self.object_build, 'family-rebuild' : self.object_build,
'tag-update' : self.tag_updated
} }
ListView.__init__( ListView.__init__(
@ -199,6 +203,20 @@ class FamilyView(ListView):
]) ])
self._add_action_group(self.all_action) self._add_action_group(self.all_action)
def set_active(self):
"""
Called when the page is displayed.
"""
ListView.set_active(self)
self.uistate.viewmanager.tags.tag_enable()
def set_inactive(self):
"""
Called when the page is no longer displayed.
"""
ListView.set_inactive(self)
self.uistate.viewmanager.tags.tag_disable()
def get_bookmarks(self): def get_bookmarks(self):
return self.dbstate.db.get_family_bookmarks() return self.dbstate.db.get_family_bookmarks()
@ -270,3 +288,23 @@ class FamilyView(ListView):
Indicate that the drag type is a FAMILY_LINK Indicate that the drag type is a FAMILY_LINK
""" """
return DdTargets.FAMILY_LINK return DdTargets.FAMILY_LINK
def tag_updated(self, handle_list):
"""
Update tagged rows when a tag color changes.
"""
all_links = set([])
for tag_handle in handle_list:
links = set([link[1] for link in
self.dbstate.db.find_backlink_handles(tag_handle,
include_classes='Family')])
all_links = all_links.union(links)
self.row_update(list(all_links))
def add_tag(self, transaction, family_handle, tag_handle):
"""
Add the given tag to the given family.
"""
family = self.dbstate.db.get_family_from_handle(family_handle)
family.add_tag(tag_handle)
self.dbstate.db.commit_family(family, transaction)

View File

@ -2,6 +2,7 @@
# #
# Copyright (C) 2001-2006 Donald N. Allingham # Copyright (C) 2001-2006 Donald N. Allingham
# Copyright (C) 2008 Gary Burton # Copyright (C) 2008 Gary Burton
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -82,24 +83,26 @@ class MediaView(ListView):
COL_ID = 1 COL_ID = 1
COL_TYPE = 2 COL_TYPE = 2
COL_PATH = 3 COL_PATH = 3
COL_CHAN = 4 COL_DATE = 4
COL_DATE = 5 COL_TAGS = 5
COL_CHAN = 6
#name of the columns #name of the columns
COLUMN_NAMES = [ COLUMN_NAMES = [
_('Title'), _('Title'),
_('ID'), _('ID'),
_('Type'), _('Type'),
_('Path'), _('Path'),
_('Last Changed'),
_('Date'), _('Date'),
_('Tags'),
_('Last Changed'),
] ]
# default setting with visible columns, order of the col, and their size # default setting with visible columns, order of the col, and their size
CONFIGSETTINGS = ( CONFIGSETTINGS = (
('columns.visible', [COL_TITLE, COL_ID, COL_TYPE, COL_PATH, ('columns.visible', [COL_TITLE, COL_ID, COL_TYPE, COL_PATH,
COL_DATE]), COL_DATE]),
('columns.rank', [COL_TITLE, COL_ID, COL_TYPE, COL_PATH, ('columns.rank', [COL_TITLE, COL_ID, COL_TYPE, COL_PATH,
COL_DATE, COL_CHAN]), COL_DATE, COL_TAGS, COL_CHAN]),
('columns.size', [200, 75, 100, 200, 150, 150]) ('columns.size', [200, 75, 100, 200, 150, 100, 150])
) )
ADD_MSG = _("Add a new media object") ADD_MSG = _("Add a new media object")
@ -117,6 +120,7 @@ class MediaView(ListView):
'media-update' : self.row_update, 'media-update' : self.row_update,
'media-delete' : self.row_delete, 'media-delete' : self.row_delete,
'media-rebuild' : self.object_build, 'media-rebuild' : self.object_build,
'tag-update' : self.tag_updated
} }
ListView.__init__( ListView.__init__(
@ -236,6 +240,20 @@ class MediaView(ListView):
self._add_action('QuickReport', None, _("Quick View"), None, None, None) self._add_action('QuickReport', None, _("Quick View"), None, None, None)
self._add_action('Dummy', None, ' ', None, None, self.dummy_report) self._add_action('Dummy', None, ' ', None, None, self.dummy_report)
def set_active(self):
"""
Called when the page is displayed.
"""
ListView.set_active(self)
self.uistate.viewmanager.tags.tag_enable()
def set_inactive(self):
"""
Called when the page is no longer displayed.
"""
ListView.set_inactive(self)
self.uistate.viewmanager.tags.tag_disable()
def view_media(self, obj): def view_media(self, obj):
""" """
Launch external viewers for the selected objects. Launch external viewers for the selected objects.
@ -451,3 +469,23 @@ class MediaView(ListView):
return obj.get_handle() return obj.get_handle()
else: else:
return None return None
def tag_updated(self, handle_list):
"""
Update tagged rows when a tag color changes.
"""
all_links = set([])
for tag_handle in handle_list:
links = set([link[1] for link in
self.dbstate.db.find_backlink_handles(tag_handle,
include_classes='MediaObject')])
all_links = all_links.union(links)
self.row_update(list(all_links))
def add_tag(self, transaction, media_handle, tag_handle):
"""
Add the given tag to the given media object.
"""
media = self.dbstate.db.get_object_from_handle(media_handle)
media.add_tag(tag_handle)
self.dbstate.db.commit_media_object(media, transaction)

View File

@ -2,6 +2,7 @@
# #
# Copyright (C) 2001-2006 Donald N. Allingham # Copyright (C) 2001-2006 Donald N. Allingham
# Copyright (C) 2008 Gary Burton # Copyright (C) 2008 Gary Burton
# Copyright (C) 2010 Nick Hall
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -69,21 +70,20 @@ class NoteView(ListView):
COL_PREVIEW = 0 COL_PREVIEW = 0
COL_ID = 1 COL_ID = 1
COL_TYPE = 2 COL_TYPE = 2
COL_MARKER = 3 COL_TAGS = 3
COL_CHAN = 4 COL_CHAN = 4
COLUMN_NAMES = [ COLUMN_NAMES = [
_('Preview'), _('Preview'),
_('ID'), _('ID'),
_('Type'), _('Type'),
_('Marker'), _('Tags'),
_('Last Changed') _('Last Changed')
] ]
# default setting with visible columns, order of the col, and their size # default setting with visible columns, order of the col, and their size
CONFIGSETTINGS = ( CONFIGSETTINGS = (
('columns.visible', [COL_PREVIEW, COL_ID, COL_TYPE, COL_MARKER]), ('columns.visible', [COL_PREVIEW, COL_ID, COL_TYPE]),
('columns.rank', [COL_PREVIEW, COL_ID, COL_TYPE, COL_MARKER, ('columns.rank', [COL_PREVIEW, COL_ID, COL_TYPE, COL_TAGS, COL_CHAN]),
COL_CHAN]),
('columns.size', [350, 75, 100, 100, 100])) ('columns.size', [350, 75, 100, 100, 100]))
ADD_MSG = _("Add a new note") ADD_MSG = _("Add a new note")
@ -99,6 +99,7 @@ class NoteView(ListView):
'note-update' : self.row_update, 'note-update' : self.row_update,
'note-delete' : self.row_delete, 'note-delete' : self.row_delete,
'note-rebuild' : self.object_build, 'note-rebuild' : self.object_build,
'tag-update' : self.tag_updated
} }
ListView.__init__( ListView.__init__(
@ -213,6 +214,20 @@ class NoteView(ListView):
self._add_action('QuickReport', None, _("Quick View"), None, None, None) self._add_action('QuickReport', None, _("Quick View"), None, None, None)
self._add_action('Dummy', None, ' ', None, None, self.dummy_report) self._add_action('Dummy', None, ' ', None, None, self.dummy_report)
def set_active(self):
"""
Called when the page is displayed.
"""
ListView.set_active(self)
self.uistate.viewmanager.tags.tag_enable()
def set_inactive(self):
"""
Called when the page is no longer displayed.
"""
ListView.set_inactive(self)
self.uistate.viewmanager.tags.tag_disable()
def get_handle_from_gramps_id(self, gid): def get_handle_from_gramps_id(self, gid):
obj = self.dbstate.db.get_note_from_gramps_id(gid) obj = self.dbstate.db.get_note_from_gramps_id(gid)
if obj: if obj:
@ -259,3 +274,23 @@ class NoteView(ListView):
else: else:
import Merge import Merge
Merge.MergeNotes(self.dbstate, self.uistate, mlist[0], mlist[1]) Merge.MergeNotes(self.dbstate, self.uistate, mlist[0], mlist[1])
def tag_updated(self, handle_list):
"""
Update tagged rows when a tag color changes.
"""
all_links = set([])
for tag_handle in handle_list:
links = set([link[1] for link in
self.dbstate.db.find_backlink_handles(tag_handle,
include_classes='Note')])
all_links = all_links.union(links)
self.row_update(list(all_links))
def add_tag(self, transaction, note_handle, tag_handle):
"""
Add the given tag to the given note.
"""
note = self.dbstate.db.get_note_from_handle(note_handle)
note.add_tag(tag_handle)
self.dbstate.db.commit_note(note, transaction)