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
#
# Copyright (C) 2001 Graham J. Williams
# Copyright (C) 2001 Graham J. Williams
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
#
# 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
@ -171,8 +172,8 @@ FAMILY
<!ELEMENT families (family)*>
<!ELEMENT family (rel?, father?, mother?, eventref*, lds_ord*,
objref*, childref*, attribute*, noteref*, sourceref*)>
<!ELEMENT family (rel?, father?, mother?, eventref*, lds_ord*, objref*,
childref*, attribute*, noteref*, sourceref*, tagref*)>
<!ATTLIST family
id CDATA #REQUIRED
handle ID #REQUIRED
@ -277,7 +278,7 @@ OBJECTS
<!ELEMENT objects (object)*>
<!ELEMENT object (file, attribute*, noteref*,
(daterange|datespan|dateval|datestr)?, sourceref*)>
(daterange|datespan|dateval|datestr)?, sourceref*, tagref*)>
<!ATTLIST object
id CDATA #REQUIRED
handle ID #REQUIRED
@ -316,7 +317,7 @@ NOTES
<!ELEMENT notes (note)*>
<!ELEMENT note (text, style*)>
<!ELEMENT note (text, style*, tagref*)>
<!ATTLIST note
id CDATA #REQUIRED
handle ID #REQUIRED

View File

@ -4,6 +4,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2005-2007 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
#
# 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
@ -364,6 +365,9 @@
<zeroOrMore><element name="sourceref">
<ref name="sourceref-content"/>
</element></zeroOrMore>
<zeroOrMore><element name="tagref">
<ref name="tagref-content"/>
</element></zeroOrMore>
</define>
<define name="event-content">
@ -457,6 +461,9 @@
<zeroOrMore><element name="sourceref">
<ref name="sourceref-content"/>
</element></zeroOrMore>
<zeroOrMore><element name="tagref">
<ref name="tagref-content"/>
</element></zeroOrMore>
</define>
<define name="repository-content">
@ -513,6 +520,9 @@
</choice></attribute></optional>
<attribute name="type"><text/></attribute>
<ref name="styledtext"/>
<zeroOrMore><element name="tagref">
<ref name="tagref-content"/>
</element></zeroOrMore>
</define>
<define name="styledtext">

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
#
# 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
# 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
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
"""
Rule that checks for a family with a particular tag.
"""
#-------------------------------------------------------------------------
#
@ -32,15 +34,17 @@ from gen.ggettext import gettext as _
# GRAMPS modules
#
#-------------------------------------------------------------------------
from Filters.Rules._HasMarkerBase import HasMarkerBase
from Filters.Rules._HasTagBase import HasTagBase
#-------------------------------------------------------------------------
#
# HasEvent
# HasTag
#
#-------------------------------------------------------------------------
class HasMarkerOf(HasMarkerBase):
"""Rule that checks for a family with a particular marker"""
name = _('Families with <marker>')
description = _("Matches Families with a marker of a particular value")
class HasTag(HasTagBase):
"""
Rule that checks for a family with a particular tag.
"""
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 _HasAttribute import HasAttribute
from _HasEvent import HasEvent
from _HasMarkerOf import HasMarkerOf
from _IsBookmarked import IsBookmarked
from _MatchesFilter import MatchesFilter
from _FatherHasNameOf import FatherHasNameOf
@ -56,6 +55,7 @@ from _MotherHasIdOf import MotherHasIdOf
from _ChildHasNameOf import ChildHasNameOf
from _ChildHasIdOf import ChildHasIdOf
from _ChangedSince import ChangedSince
from _HasTag import HasTag
editor_rule_list = [
AllFamilies,
@ -72,7 +72,6 @@ editor_rule_list = [
FamilyPrivate,
HasEvent,
HasAttribute,
HasMarkerOf,
IsBookmarked,
MatchesFilter,
FatherHasNameOf,
@ -82,4 +81,5 @@ editor_rule_list = [
ChildHasNameOf,
ChildHasIdOf,
ChangedSince,
HasTag,
]

View File

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

View File

@ -1,7 +1,7 @@
#
# 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
# 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
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
"""
Rule that checks for a media object with a particular tag.
"""
#-------------------------------------------------------------------------
#
@ -32,15 +34,17 @@ from gen.ggettext import gettext as _
# GRAMPS modules
#
#-------------------------------------------------------------------------
from Filters.Rules._HasMarkerBase import HasMarkerBase
from Filters.Rules._HasTagBase import HasTagBase
#-------------------------------------------------------------------------
#
# HasEvent
# HasTag
#
#-------------------------------------------------------------------------
class HasMarkerOf(HasMarkerBase):
"""Rule that checks for a note with a particular marker"""
name = _('Notes with <marker>')
description = _("Matches Notes with a marker of a particular value")
class HasTag(HasTagBase):
"""
Rule that checks for a media object with a particular tag.
"""
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 _HasAttribute import HasAttribute
from _ChangedSince import ChangedSince
from _HasTag import HasTag
editor_rule_list = [
AllMedia,
@ -47,4 +48,5 @@ editor_rule_list = [
MatchesFilter,
HasAttribute,
ChangedSince,
HasTag,
]

View File

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

View File

@ -1,7 +1,7 @@
#
# 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
# 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
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
"""
Rule that checks for a note with a particular tag.
"""
#-------------------------------------------------------------------------
#
@ -32,15 +34,17 @@ from gen.ggettext import gettext as _
# GRAMPS modules
#
#-------------------------------------------------------------------------
from Filters.Rules._HasMarkerBase import HasMarkerBase
from Filters.Rules._HasTagBase import HasTagBase
#-------------------------------------------------------------------------
#
# HasEvent
# HasTag
#
#-------------------------------------------------------------------------
class HasMarkerOf(HasMarkerBase):
"""Rule that checks for an event with a particular marker"""
name = _('Events with <marker>')
description = _("Matches Events with a marker of a particular value")
class HasTag(HasTagBase):
"""
Rule that checks for a note with a particular tag.
"""
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 _HasNote import HasNote
from _ChangedSince import ChangedSince
from _HasTag import HasTag
editor_rule_list = [
AllNotes,
@ -49,4 +50,5 @@ editor_rule_list = [
NotePrivate,
MatchesFilter,
ChangedSince,
HasTag,
]

View File

@ -71,7 +71,6 @@ pkgdata_PYTHON = \
_MatchIdOf.py \
_HasNoteRegexp.py \
_RegExpName.py \
_HasMarkerOf.py \
__init__.py
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 _HasTextMatchingSubstringOf import HasTextMatchingSubstringOf
from _HasUnknownGender import HasUnknownGender
from _HasMarkerOf import HasMarkerOf
from _HaveAltFamilies import HaveAltFamilies
from _HaveChildren import HaveChildren
from _IncompleteNames import IncompleteNames
@ -130,7 +129,6 @@ editor_rule_list = [
HasTag,
HasSource,
HasSourceOf,
HasMarkerOf,
HaveAltFamilies,
HavePhotos,
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
#
# Copyright (C) 2002-2006 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
#
# 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
@ -48,7 +49,7 @@ from Filters.Rules.Family import (RegExpIdOf, HasIdOf, RegExpFatherName,
SearchFatherName, RegExpMotherName,
SearchMotherName, RegExpChildName,
SearchChildName, HasEvent, HasRelType,
HasMarkerOf, HasNoteRegexp,
HasTag, HasNoteRegexp,
HasNoteMatchingSubstringOf, MatchesFilter)
GenericFamilyFilter = GenericFilterFactory('Family')
@ -84,18 +85,11 @@ class FamilySidebarFilter(SidebarFilter):
self.family_stub.set_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_regex = gtk.CheckButton(_('Use regular expressions'))
self.tag = gtk.ComboBox()
self.generic = gtk.ComboBox()
SidebarFilter.__init__(self, dbstate, uistate, "Family")
@ -108,14 +102,20 @@ class FamilySidebarFilter(SidebarFilter):
self.generic.add_attribute(cell, 'text', 0)
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(_('Father'), self.filter_father)
self.add_text_entry(_('Mother'), self.filter_mother)
self.add_text_entry(_('Child'), self.filter_child)
self.add_entry(_('Relationship'), self.rtype)
self.add_entry(_('Family Event'), self.etype)
self.add_entry(_('Marker'), self.mtype)
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_entry(None, self.filter_regex)
@ -127,7 +127,7 @@ class FamilySidebarFilter(SidebarFilter):
self.filter_note.set_text(u'')
self.etype.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)
def get_filter(self):
@ -138,12 +138,12 @@ class FamilySidebarFilter(SidebarFilter):
note = unicode(self.filter_note.get_text()).strip()
etype = self.filter_event.get_type().xml_str()
rtype = self.family_stub.get_relationship().xml_str()
mtype = self.filter_marker.get_marker().xml_str()
regex = self.filter_regex.get_active()
tag = self.tag.get_active() > 0
generic = self.generic.get_active() > 0
empty = not (gid or father or mother or child or note or mtype
or regex or etype or rtype or generic)
empty = not (gid or father or mother or child or note
or regex or etype or rtype or tag or generic)
if empty:
generic_filter = None
else:
@ -184,10 +184,6 @@ class FamilySidebarFilter(SidebarFilter):
rule = HasRelType([rtype])
generic_filter.add_rule(rule)
if mtype:
rule = HasMarkerOf([mtype])
generic_filter.add_rule(rule)
if note:
if regex:
rule = HasNoteRegexp([note])
@ -195,6 +191,14 @@ class FamilySidebarFilter(SidebarFilter):
rule = HasNoteMatchingSubstringOf([note])
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:
model = self.generic.get_model()
node = self.generic.get_active_iter()
@ -211,3 +215,14 @@ class FamilySidebarFilter(SidebarFilter):
all_filter.add_rule(Rules.Family.AllFamilies([]))
self.generic.set_model(build_filter_model('Family', [all_filter]))
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
#
# Copyright (C) 2002-2006 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
#
# 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
@ -41,7 +42,7 @@ import gtk
#-------------------------------------------------------------------------
from Filters.SideBar import SidebarFilter
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,
HasNoteMatchingSubstringOf)
@ -65,6 +66,7 @@ class MediaSidebarFilter(SidebarFilter):
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
self.tag = gtk.ComboBox()
self.generic = gtk.ComboBox()
SidebarFilter.__init__(self, dbstate, uistate, "MediaObject")
@ -77,12 +79,19 @@ class MediaSidebarFilter(SidebarFilter):
self.generic.add_attribute(cell, 'text', 0)
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(_('Title'), self.filter_title)
self.add_text_entry(_('Type'), self.filter_type)
self.add_text_entry(_('Path'), self.filter_path)
self.add_text_entry(_('Date'), self.filter_date)
self.add_text_entry(_('Note'), self.filter_note)
self.add_entry(_('Tag'), self.tag)
self.add_filter_entry(_('Custom filter'), self.generic)
self.add_entry(None, self.filter_regex)
@ -93,6 +102,7 @@ class MediaSidebarFilter(SidebarFilter):
self.filter_path.set_text('')
self.filter_date.set_text('')
self.filter_note.set_text('')
self.tag.set_active(0)
self.generic.set_active(0)
def get_filter(self):
@ -103,10 +113,11 @@ class MediaSidebarFilter(SidebarFilter):
date = unicode(self.filter_date.get_text()).strip()
note = unicode(self.filter_note.get_text()).strip()
regex = self.filter_regex.get_active()
tag = self.tag.get_active() > 0
gen = self.generic.get_active() > 0
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:
generic_filter = None
else:
@ -128,6 +139,14 @@ class MediaSidebarFilter(SidebarFilter):
rule = HasNoteMatchingSubstringOf([note])
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:
model = self.generic.get_model()
node = self.generic.get_active_iter()
@ -145,3 +164,14 @@ class MediaSidebarFilter(SidebarFilter):
self.generic.set_model(build_filter_model('MediaObject',
[all_filter]))
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
#
# Copyright (C) 2002-2006 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
#
# 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
@ -44,7 +45,8 @@ from gen.lib import Note, NoteType
from Filters.SideBar import SidebarFilter
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')
#-------------------------------------------------------------------------
@ -69,6 +71,7 @@ class NoteSidebarFilter(SidebarFilter):
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
self.tag = gtk.ComboBox()
self.generic = gtk.ComboBox()
SidebarFilter.__init__(self, dbstate, uistate, "Note")
@ -81,9 +84,16 @@ class NoteSidebarFilter(SidebarFilter):
self.generic.add_attribute(cell, 'text', 0)
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(_('Text'), self.filter_text)
self.add_entry(_('Type'), self.ntype)
self.add_entry(_('Tag'), self.tag)
self.add_filter_entry(_('Custom filter'), self.generic)
self.add_entry(None, self.filter_regex)
@ -91,6 +101,7 @@ class NoteSidebarFilter(SidebarFilter):
self.filter_id.set_text('')
self.filter_text.set_text('')
self.ntype.child.set_text('')
self.tag.set_active(0)
self.generic.set_active(0)
def get_filter(self):
@ -98,9 +109,10 @@ class NoteSidebarFilter(SidebarFilter):
text = unicode(self.filter_text.get_text()).strip()
ntype = self.note.get_type().xml_str()
regex = self.filter_regex.get_active()
tag = self.tag.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:
generic_filter = None
else:
@ -115,6 +127,13 @@ class NoteSidebarFilter(SidebarFilter):
rule = HasNote([text, ntype])
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:
model = self.generic.get_model()
@ -132,3 +151,14 @@ class NoteSidebarFilter(SidebarFilter):
all_filter.add_rule(Rules.Note.AllNotes([]))
self.generic.set_model(build_filter_model('Note', [all_filter]))
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
#
# Copyright (C) 2002-2006 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
#
# 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
@ -45,10 +46,9 @@ import gen.lib
import DateHandler
from Filters.SideBar import SidebarFilter
from Filters.Rules.Person import (RegExpName, SearchName, RegExpIdOf,
MatchIdOf, IsMale, IsFemale, HasUnknownGender,
HasMarkerOf, HasEvent, HasTag,
HasBirth, HasDeath, HasNoteRegexp,
from Filters.Rules.Person import (RegExpName, SearchName, RegExpIdOf, MatchIdOf,
IsMale, IsFemale, HasUnknownGender, HasEvent,
HasTag, HasBirth, HasDeath, HasNoteRegexp,
HasNoteMatchingSubstringOf, MatchesFilter)
from Filters import GenericFilter, build_filter_model, Rules
@ -84,16 +84,6 @@ class PersonSidebarFilter(SidebarFilter):
self.filter_event.set_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_gender = gtk.combo_box_new_text()
map(self.filter_gender.append_text,
@ -102,6 +92,7 @@ class PersonSidebarFilter(SidebarFilter):
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
self.tag = gtk.ComboBox()
self.generic = gtk.ComboBox()
SidebarFilter.__init__(self, dbstate, uistate, "Person")
@ -139,9 +130,8 @@ class PersonSidebarFilter(SidebarFilter):
self.add_text_entry(_('Death date'), self.filter_death,
_('example: "%s" or "%s"') % (msg1, msg2))
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_entry(_('Tag'), self.tag)
self.add_filter_entry(_('Custom filter'), self.generic)
self.add_entry(None, self.filter_regex)
@ -153,7 +143,6 @@ class PersonSidebarFilter(SidebarFilter):
self.filter_note.set_text(u'')
self.filter_gender.set_active(0)
self.etype.child.set_text(u'')
self.mtype.child.set_text(u'')
self.tag.set_active(0)
self.generic.set_active(0)
@ -172,17 +161,16 @@ class PersonSidebarFilter(SidebarFilter):
# extract remaining data from the menus
etype = self.filter_event.get_type().xml_str()
mtype = self.filter_marker.get_marker().xml_str()
gender = self.filter_gender.get_active()
regex = self.filter_regex.get_active()
generic = self.generic.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
# we don't build a filter
empty = not (name or gid or birth or death or etype or mtype
or note or gender or regex or generic or tag)
empty = not (name or gid or birth or death or etype
or note or gender or regex or tag or generic)
if empty:
generic_filter = None
else:
@ -216,19 +204,6 @@ class PersonSidebarFilter(SidebarFilter):
else:
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
if etype:
rule = HasEvent([etype, u'', u'', u''])
@ -255,6 +230,14 @@ class PersonSidebarFilter(SidebarFilter):
rule = HasNoteMatchingSubstringOf([note])
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:
model = self.generic.get_model()
node = self.generic.get_active_iter()

View File

@ -2,6 +2,7 @@
# 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
# 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'):
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()
gramps2 = self.ev2.get_gramps_id()
entry1 = self.get_widget("gramps1")
@ -150,14 +141,12 @@ class MergeEvents(ManagedWindow.ManagedWindow):
self.get_widget("date_btn1").set_active(True)
self.get_widget("place_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)
else:
self.get_widget("type_btn2").set_active(True)
self.get_widget("date_btn2").set_active(True)
self.get_widget("place_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)
def cb_help(self, obj):
@ -187,8 +176,6 @@ class MergeEvents(ManagedWindow.ManagedWindow):
phoenix.set_place_handle(titanic.get_place_handle())
if self.get_widget("desc_btn1").get_active() ^ use_handle1:
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:
phoenix.set_gramps_id(titanic.get_gramps_id())
# cause is deprecated.

View File

@ -113,15 +113,6 @@ class MergeFamilies(ManagedWindow.ManagedWindow):
for widget_name in ('rel1', 'rel2', 'rel_btn1', 'rel_btn2'):
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()
gramps2 = self.fy2.get_gramps_id()
entry1 = self.get_widget("gramps1")
@ -152,13 +143,11 @@ class MergeFamilies(ManagedWindow.ManagedWindow):
self.get_widget("father_btn1").set_active(True)
self.get_widget("mother_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)
else:
self.get_widget("father_btn2").set_active(True)
self.get_widget("mother_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)
def cb_help(self, obj):
@ -232,9 +221,6 @@ class MergeFamilies(ManagedWindow.ManagedWindow):
if self.get_widget("rel_btn1").get_active() ^ use_handle1:
phoenix.set_relationship(titanic.get_relationship())
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:
phoenix.set_gramps_id(titanic.get_gramps_id())
need_commit = True

View File

@ -99,15 +99,6 @@ class MergeNotes(ManagedWindow.ManagedWindow):
'format_btn2'):
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()
gramps2 = self.no2.get_gramps_id()
entry1 = self.get_widget("gramps1")
@ -144,13 +135,11 @@ class MergeNotes(ManagedWindow.ManagedWindow):
self.get_widget("text_btn1").set_active(True)
self.get_widget("type_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)
else:
self.get_widget("text_btn2").set_active(True)
self.get_widget("type_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)
def cb_help(self, obj):
@ -177,8 +166,6 @@ class MergeNotes(ManagedWindow.ManagedWindow):
phoenix.set_type(titanic.get_type())
if self.get_widget("format_btn1").get_active() ^ use_handle1:
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:
phoenix.set_gramps_id(titanic.get_gramps_id())

View File

@ -102,15 +102,6 @@ class MergePeople(ManagedWindow.ManagedWindow):
'gender_btn2'):
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()
gramps2 = self.pr2.get_gramps_id()
entry1 = self.get_widget("gramps1")
@ -143,12 +134,10 @@ class MergePeople(ManagedWindow.ManagedWindow):
if obj.get_active():
self.get_widget("name_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)
else:
self.get_widget("name_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)
def on_expander2_activated(self, obj):
@ -325,8 +314,6 @@ class MergePeople(ManagedWindow.ManagedWindow):
titanic.set_primary_name(swapname)
if self.get_widget("gender_btn1").get_active() ^ use_handle1:
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:
swapid = phoenix.get_gramps_id()
phoenix.set_gramps_id(titanic.get_gramps_id())

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
#
# 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
@ -302,12 +303,6 @@ class DbReadBase(object):
"""
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):
"""
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
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
#
# 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
@ -264,7 +265,6 @@ class DbBsddbRead(DbReadBase, Callback):
self.individual_event_names = set()
self.individual_attributes = set()
self.family_attributes = set()
self.marker_names = set()
self.child_ref_types = set()
self.family_rel_types = set()
self.event_role_names = set()
@ -1217,12 +1217,6 @@ class DbBsddbRead(DbReadBase, Callback):
"""
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):
"""
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_from_handle",
"get_gramps_ids",
"get_marker_types",
"get_media_attribute_types",
"get_media_bookmarks",
"get_media_cursor",
@ -62,6 +61,7 @@ class DbTest(object):
"get_number_of_places",
"get_number_of_repositories",
"get_number_of_sources",
"get_number_of_tags",
"get_object_from_gramps_id",
"get_object_from_handle",
"get_person_attribute_types",
@ -83,6 +83,7 @@ class DbTest(object):
"get_raw_place_data",
"get_raw_repository_data",
"get_raw_source_data",
"get_raw_tag_data",
"get_reference_map_cursor",
"get_reference_map_primary_cursor",
"get_reference_map_referenced_cursor",
@ -100,6 +101,10 @@ class DbTest(object):
"get_source_from_handle",
"get_source_handles",
"get_source_media_types",
"get_tag_cursor",
"get_tag_from_name",
"get_tag_from_handle",
"get_tag_handles",
"get_surname_list",
"get_url_types",
"gramps_upgrade",
@ -113,6 +118,7 @@ class DbTest(object):
"has_place_handle",
"has_repository_handle",
"has_source_handle",
"has_tag_handle",
"is_open",
"iter_event_handles",
"iter_events",
@ -130,6 +136,8 @@ class DbTest(object):
"iter_repository_handles",
"iter_source_handles",
"iter_sources",
"iter_tag_handles",
"iter_tags",
"load",
"report_bm_change",
"request_rebuild",
@ -164,6 +172,7 @@ class DbTest(object):
"add_place",
"add_repository",
"add_source",
"add_tag",
"add_to_surname_list",
"build_surname_list",
"commit_base",
@ -177,6 +186,7 @@ class DbTest(object):
"commit_place",
"commit_repository",
"commit_source",
"commit_tag",
"delete_primary_from_reference_map",
"need_upgrade",
"rebuild_secondary",
@ -190,6 +200,7 @@ class DbTest(object):
"remove_place",
"remove_repository",
"remove_source",
"remove_tag",
"set_auto_remove",
"set_default_person_handle",
"set_name_group_mapping",

View File

@ -22,6 +22,10 @@
from __future__ import with_statement
from gen.db import BSDDBTxn
from gen.lib.markertype import MarkerType
from gen.lib.tag import Tag
import time
"""
upgrade
"""
@ -29,26 +33,155 @@ upgrade
def gramps_upgrade_15(self):
"""Upgrade database from version 14 to 15."""
# 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.tags = {}
# ---------------------------------
# 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():
person = self.person_map[handle]
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)
with BSDDBTxn(self.env, self.person_map) as txn:
txn.put(str(handle), new_person)
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.
with BSDDBTxn(self.env, self.metadata) as txn:
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):
"""Upgrade database from version 13 to 14."""
# This upgrade modifies notes and dates
@ -353,3 +486,4 @@ def convert_name_14(name):
first_name, surname, suffix, title,
name_type, prefix, patronymic,
group_as, sort_as, display_as, call)

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2008 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
#
# 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
@ -1411,9 +1412,6 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
[str(attr.type) for attr in person.attribute_list
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)
for eref in person.event_ref_list
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.placebase import PlaceBase
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),
MediaBase.serialize(self),
AttributeBase.serialize(self),
self.change, self.marker.serialize(), self.private)
self.change, self.private)
def unserialize(self, data):
"""
@ -121,10 +120,8 @@ class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
(self.handle, self.gramps_id, the_type, date,
self.__description, self.place,
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.unserialize(the_type)
DateBase.unserialize(self, date)

View File

@ -3,6 +3,7 @@
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2010 Michiel D. Nauta
# Copyright (C) 2010 Nick Hall
#
# 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
@ -44,9 +45,9 @@ from gen.lib.mediabase import MediaBase
from gen.lib.attrbase import AttributeBase
from gen.lib.eventref import EventRef
from gen.lib.ldsordbase import LdsOrdBase
from gen.lib.tagbase import TagBase
from gen.lib.childref import ChildRef
from gen.lib.familyreltype import FamilyRelType
from gen.lib.markertype import MarkerType
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,
PrimaryObject):
TagBase, PrimaryObject):
"""
The Family record is the GRAMPS in-memory representation of the
relationships between people. It contains all the information
@ -86,6 +87,7 @@ class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
MediaBase.__init__(self)
AttributeBase.__init__(self)
LdsOrdBase.__init__(self)
TagBase.__init__(self)
self.father_handle = None
self.mother_handle = None
self.child_ref_list = []
@ -121,7 +123,7 @@ class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
LdsOrdBase.serialize(self),
SourceBase.serialize(self),
NoteBase.serialize(self),
self.change, self.marker.serialize(), self.private)
self.change, TagBase.serialize(self), self.private)
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,
child_ref_list, the_type, event_ref_list, media_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.unserialize(the_type)
self.event_ref_list = [EventRef().unserialize(er)
@ -146,6 +146,7 @@ class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
SourceBase.unserialize(self, source_list)
NoteBase.unserialize(self, note_list)
LdsOrdBase.unserialize(self, lds_seal_list)
TagBase.unserialize(self, tag_list)
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] +
[self.father_handle, self.mother_handle])
if handle]
ret += self.get_referenced_tag_handles()
return ret
def get_handle_referents(self):
@ -326,7 +328,7 @@ class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
"""
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.
:rtype acquisition: Family
@ -341,6 +343,7 @@ class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
self._merge_attribute_list(acquisition)
self._merge_note_list(acquisition)
self._merge_source_reference_list(acquisition)
self._merge_tag_list(acquisition)
def set_relationship(self, relationship_type):
"""

View File

@ -21,6 +21,9 @@
"""
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) 2010 Michiel D. Nauta
# Copyright (C) 2010 Nick Hall
#
# 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
@ -42,7 +43,7 @@ from gen.lib.srcbase import SourceBase
from gen.lib.notebase import NoteBase
from gen.lib.datebase import DateBase
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,
PrimaryObject):
TagBase, PrimaryObject):
"""
Container for information about an image file, including location,
description and privacy.
@ -71,6 +72,7 @@ class MediaObject(SourceBase, NoteBase, DateBase, AttributeBase,
NoteBase.__init__(self, source)
DateBase.__init__(self, source)
AttributeBase.__init__(self, source)
TagBase.__init__(self)
if source:
self.path = source.path
@ -107,7 +109,7 @@ class MediaObject(SourceBase, NoteBase, DateBase, AttributeBase,
NoteBase.serialize(self),
self.change,
DateBase.serialize(self, no_text_date),
self.marker.serialize(),
TagBase.serialize(self),
self.private)
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,
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)
SourceBase.unserialize(self, source_list)
NoteBase.unserialize(self, note_list)
DateBase.unserialize(self, date)
TagBase.unserialize(self, tag_list)
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.
:rtype: list
"""
return self.get_referenced_note_handles()
return self.get_referenced_note_handles() + \
self.get_referenced_tag_handles()
def get_handle_referents(self):
"""
@ -191,7 +193,7 @@ class MediaObject(SourceBase, NoteBase, DateBase, AttributeBase,
"""
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.
:rtype acquisition: MediaObject
@ -200,6 +202,7 @@ class MediaObject(SourceBase, NoteBase, DateBase, AttributeBase,
self._merge_attribute_list(acquisition)
self._merge_note_list(acquisition)
self._merge_source_reference_list(acquisition)
self._merge_tag_list(acquisition)
def set_mime_type(self, mime_type):
"""

View File

@ -3,6 +3,7 @@
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2010 Michiel D. Nauta
# Copyright (C) 2010 Nick Hall
#
# 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
@ -31,8 +32,8 @@ Note class for GRAMPS.
#
#-------------------------------------------------------------------------
from gen.lib.primaryobj import BasicPrimaryObject
from gen.lib.tagbase import TagBase
from gen.lib.notetype import NoteType
from gen.lib.markertype import MarkerType
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 Note(BasicPrimaryObject):
class Note(BasicPrimaryObject, TagBase):
"""Define a text note.
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_TYPE,
POS_CHANGE,
POS_MARKER,
POS_TAGS,
POS_PRIVATE,) = range(8)
def __init__(self, text=""):
"""Create a new Note object, initializing from the passed string."""
BasicPrimaryObject.__init__(self)
TagBase.__init__(self)
self.text = StyledText(text)
self.format = Note.FLOWED
self.type = NoteType()
@ -92,7 +94,7 @@ class Note(BasicPrimaryObject):
"""
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)
def unserialize(self, data):
@ -103,14 +105,13 @@ class Note(BasicPrimaryObject):
"""
(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.unserialize(the_text)
self.marker = MarkerType()
self.marker.unserialize(the_marker)
self.type = NoteType()
self.type.unserialize(the_type)
TagBase.unserialize(self, tag_list)
def get_text_data_list(self):
"""Return the list of all textual attributes of the object.
@ -121,16 +122,27 @@ class Note(BasicPrimaryObject):
"""
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):
"""
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.
:rtype acquisition: Note
"""
self._merge_privacy(acquisition)
self._merge_tag_list(acquisition)
def set(self, text):
"""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) 2010 Michiel D. Nauta
# Copyright (C) 2010 Nick Hall
#
# 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
@ -44,7 +45,6 @@ from gen.lib.eventref import EventRef
from gen.lib.personref import PersonRef
from gen.lib.attrtype import AttributeType
from gen.lib.eventroletype import EventRoleType
from gen.lib.markertype import MarkerType
from gen.lib.attribute import Attribute
from gen.lib.const import IDENTICAL, EQUAL, DIFFERENT
@ -94,7 +94,6 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
LdsOrdBase.__init__(self)
TagBase.__init__(self)
self.primary_name = Name()
self.marker = MarkerType()
self.event_ref_list = []
self.family_list = []
self.parent_family_list = []
@ -153,10 +152,9 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
SourceBase.serialize(self), # 15
NoteBase.serialize(self), # 16
self.change, # 17
self.marker.serialize(), # 18
TagBase.serialize(self), # 18
self.private, # 19
[pr.serialize() for pr in self.person_ref_list], # 20
TagBase.serialize(self) # 21
[pr.serialize() for pr in self.person_ref_list] # 20
)
def unserialize(self, data):
@ -186,14 +184,11 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
source_list, # 15
note_list, # 16
self.change, # 17
marker, # 18
tag_list, # 18
self.private, # 19
person_ref_list, # 20
tag_list, # 21
) = data
self.marker = MarkerType()
self.marker.unserialize(marker)
self.primary_name = Name()
self.primary_name.unserialize(primary_name)
self.alternate_names = [Name().unserialize(name)
@ -235,8 +230,6 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
elif classname == 'Place':
return any(ordinance.place == handle
for ordinance in self.lds_ord_list)
elif classname == 'Tag':
return handle in self.tag_list
return False
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:
if ordinance.place in handle_list:
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):
if classname == 'Event':
@ -447,6 +437,7 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
self._merge_person_ref_list(acquisition)
self._merge_note_list(acquisition)
self._merge_source_reference_list(acquisition)
self._merge_tag_list(acquisition)
map(self.add_parent_family_handle,
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.urlbase import UrlBase
from gen.lib.location import Location
from gen.lib.markertype import MarkerType
_EMPTY_LOC = Location().serialize()
@ -107,7 +106,7 @@ class Place(SourceBase, NoteBase, MediaBase, UrlBase, PrimaryObject):
MediaBase.serialize(self),
SourceBase.serialize(self),
NoteBase.serialize(self),
self.change, self.marker.serialize() ,self.private)
self.change, self.private)
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,
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:
self.main_loc = None
else:
self.main_loc = Location().unserialize(main_loc)
self.alt_loc = [Location().unserialize(al) for al in alt_loc]
self.marker = MarkerType()
self.marker.unserialize(marker)
UrlBase.unserialize(self, urls)
MediaBase.unserialize(self, media_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.privacybase import PrivacyBase
from gen.lib.markertype import MarkerType
from gen.lib.srcbase import SourceBase
from gen.lib.mediabase import MediaBase
@ -68,10 +67,8 @@ class BasicPrimaryObject(TableObject, PrivacyBase):
PrivacyBase.__init__(self, source)
if source:
self.gramps_id = source.gramps_id
self.marker = source.marker
else:
self.gramps_id = None
self.marker = MarkerType()
def set_gramps_id(self, gramps_id):
"""
@ -133,26 +130,6 @@ class BasicPrimaryObject(TableObject, PrivacyBase):
"""
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):
"""
Indicate if the object has a source references.
@ -295,9 +272,3 @@ class PrimaryObject(BasicPrimaryObject):
Replace the handle reference with the new reference.
"""
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.urlbase import UrlBase
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),
AddressBase.serialize(self),
UrlBase.serialize(self),
self.change, self.marker.serialize(), self.private)
self.change, self.private)
def unserialize(self, data):
"""
@ -73,10 +72,8 @@ class Repository(NoteBase, AddressBase, UrlBase, PrimaryObject):
back into the data in a Repository structure.
"""
(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.unserialize(the_type)
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.notebase import NoteBase
from gen.lib.reporef import RepoRef
from gen.lib.markertype import MarkerType
from gen.lib.const import DIFFERENT, EQUAL, IDENTICAL
#-------------------------------------------------------------------------
@ -50,7 +49,6 @@ class Source(MediaBase, NoteBase, PrimaryObject):
PrimaryObject.__init__(self)
MediaBase.__init__(self)
NoteBase.__init__(self)
self.marker = MarkerType()
self.title = ""
self.author = ""
self.pubinfo = ""
@ -68,7 +66,7 @@ class Source(MediaBase, NoteBase, PrimaryObject):
MediaBase.serialize(self), unicode(self.abbrev),
self.change, self.datamap,
[rr.serialize() for rr in self.reporef_list],
self.marker.serialize(), self.private)
self.private)
def unserialize(self, data):
"""
@ -78,10 +76,8 @@ class Source(MediaBase, NoteBase, PrimaryObject):
(self.handle, self.gramps_id, self.title, self.author,
self.pubinfo, note_list, media_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)
MediaBase.unserialize(self, media_list)
self.reporef_list = [RepoRef().unserialize(item) for item in reporef_list]

View File

@ -117,3 +117,14 @@ class TagBase(object):
:rtype: 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
#
# Copyright (C) 2007 Brian G. Matherly
# Copyright (C) 2010 Nick Hall
#
# 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
@ -747,6 +748,7 @@ def sanitize_person(db, person):
new_person.set_gramps_id(person.get_gramps_id())
new_person.set_handle(person.get_handle())
new_person.set_change_time(person.get_change_time())
new_person.set_tag_list(person.get_tag_list())
# copy names if not private
name = person.get_primary_name()
@ -782,9 +784,6 @@ def sanitize_person(db, person):
if name and not name.get_privacy():
new_person.add_alternate_name(sanitize_name(db, name))
# set complete flag
new_person.set_marker(person.get_marker())
# copy event list
for event_ref in person.get_event_ref_list():
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_associations(db, person, new_person)
# copy tags
new_person.set_tag_list(person.get_tag_list())
return new_person
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_handle(source.get_handle())
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())
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_change_time(media.get_change_time())
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_attributes(db, media, new_media)
copy_notes(db, media, new_media)
return new_media
def sanitize_place(db, place):
@ -914,7 +909,6 @@ def sanitize_place(db, place):
new_place.set_latitude(place.get_latitude())
new_place.set_main_location(place.get_main_location())
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_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_handle(event.get_handle())
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())
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_handle(family.get_handle())
new_family.set_marker(family.get_marker())
new_family.set_relationship(family.get_relationship())
new_family.set_change_time(family.get_change_time())
new_family.set_tag_list(family.get_tag_list())
# Copy the 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_handle(repository.get_handle())
new_repository.set_change_time(repository.get_change_time())
new_repository.set_marker(repository.get_marker())
copy_notes(db, repository, new_repository)
copy_addresses(db, repository, new_repository)

View File

@ -598,10 +598,6 @@ class ProxyDbBase(DbReadBase):
instances in the database"""
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):
"""returns a list of all Attribute types associated with Media
and MediaRef instances in the database"""

View File

@ -479,8 +479,8 @@
<object class="GtkTable" id="info">
<property name="visible">True</property>
<property name="border_width">6</property>
<property name="n_rows">2</property>
<property name="n_columns">6</property>
<property name="n_rows">3</property>
<property name="n_columns">4</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
@ -491,7 +491,7 @@
<property name="use_markup">True</property>
</object>
<packing>
<property name="right_attach">6</property>
<property name="right_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
@ -502,7 +502,6 @@
<property name="xalign">0</property>
<property name="label" translatable="yes">_ID:</property>
<property name="use_underline">True</property>
<property name="justify">center</property>
<property name="mnemonic_widget">gid</property>
</object>
<packing>
@ -546,24 +545,6 @@
<property name="y_options"></property>
</packing>
</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>
<object class="GtkComboBoxEntry" id="marriage_type">
<property name="visible">True</property>
@ -573,21 +554,55 @@
<property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkComboBoxEntry" id="marker">
<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">5</property>
<property name="right_attach">6</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="x_padding">10</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>
</child>
</object>

View File

@ -23,7 +23,7 @@
<object class="GtkTable" id="table8">
<property name="visible">True</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="column_spacing">12</property>
<property name="row_spacing">6</property>
@ -99,8 +99,8 @@
<property name="justify">center</property>
</object>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</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>
@ -133,7 +133,7 @@
</child>
</object>
<packing>
<property name="bottom_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -263,6 +263,52 @@
<property name="bottom_attach">3</property>
</packing>
</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>
<packing>
<property name="position">0</property>

View File

@ -52,7 +52,7 @@
<object class="GtkTable" id="table79">
<property name="visible">True</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="column_spacing">6</property>
<property name="row_spacing">6</property>
@ -65,6 +65,8 @@
<property name="mnemonic_widget">type</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
@ -76,11 +78,11 @@
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
@ -92,6 +94,8 @@
<property name="mnemonic_widget">id</property>
</object>
<packing>
<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>
@ -105,21 +109,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="y_options"></property>
</packing>
</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="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
@ -141,22 +132,10 @@ Use monospace font to keep preformatting.</property>
<packing>
<property name="left_attach">3</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="y_options"></property>
</packing>
</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>
<object class="GtkToggleButton" id="private">
<property name="visible">True</property>
@ -174,12 +153,63 @@ Use monospace font to keep preformatting.</property>
<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>
<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>
<placeholder/>
</child>

View File

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

View File

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

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<interface>
<!-- interface-requires gtk+ 2.12 -->
<!-- interface-requires grampswidgets 0.0 -->
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkDialog" id="mergefamily">
<property name="modal">True</property>
<property name="default_width">500</property>
@ -24,6 +24,7 @@
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">15</property>
<property name="position">0</property>
</packing>
</child>
<child>
@ -44,6 +45,7 @@ primary data for the merged family.</property>
<object class="GtkRadioButton" id="handle_btn1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<child>
<object class="GtkLabel" id="label_handle_btn1">
@ -55,12 +57,14 @@ primary data for the merged family.</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="handle_btn2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<property name="group">handle_btn1</property>
<child>
@ -94,7 +98,7 @@ primary data for the merged family.</property>
<object class="GtkTable" id="table1">
<property name="visible">True</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="column_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>
</packing>
</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>
<object class="GtkRadioButton" id="gramps_btn1">
<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>
</object>
<packing>
<property name="top_attach">5</property>
<property name="bottom_attach">6</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>
@ -291,8 +260,8 @@ primary data for the merged family.</property>
<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="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
@ -381,34 +350,6 @@ primary data for the merged family.</property>
<property name="y_options"></property>
</packing>
</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>
<object class="GtkEntry" id="gramps1">
<property name="visible">True</property>
@ -418,8 +359,8 @@ primary data for the merged family.</property>
<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="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_options"></property>
</packing>
</child>
@ -432,8 +373,8 @@ primary data for the merged family.</property>
<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="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_options"></property>
</packing>
</child>
@ -443,42 +384,15 @@ primary data for the merged family.</property>
<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>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label6">
<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>
</object>
<packing>
@ -496,8 +410,8 @@ primary data for the merged family.</property>
</child>
</object>
<packing>
<property name="position">3</property>
<property name="expand">False</property>
<property name="position">3</property>
</packing>
</child>
</object>

View File

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

View File

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

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<interface>
<!-- interface-requires gtk+ 2.12 -->
<!-- interface-requires grampswidgets 0.0 -->
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkDialog" id="mergeperson">
<property name="modal">True</property>
<property name="default_width">700</property>
@ -23,6 +23,7 @@
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">15</property>
<property name="position">0</property>
</packing>
</child>
<child>
@ -43,6 +44,7 @@ primary data for the merged person.</property>
<object class="GtkRadioButton" id="handle_btn1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<child>
<object class="GtkLabel" id="label_handle_btn1">
@ -54,12 +56,14 @@ primary data for the merged person.</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="handle_btn2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<property name="group">handle_btn1</property>
<child>
@ -93,7 +97,7 @@ primary data for the merged person.</property>
<object class="GtkTable" id="table1">
<property name="visible">True</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="column_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>
</packing>
</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>
<object class="GtkRadioButton" id="gramps_btn1">
<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>
</object>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</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>
@ -255,8 +224,8 @@ primary data for the merged person.</property>
<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="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
@ -317,34 +286,6 @@ primary data for the merged person.</property>
<property name="y_options"></property>
</packing>
</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>
<object class="GtkEntry" id="gramps1">
<property name="visible">True</property>
@ -354,8 +295,8 @@ primary data for the merged person.</property>
<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="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options"></property>
</packing>
</child>
@ -368,8 +309,8 @@ primary data for the merged person.</property>
<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="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options"></property>
</packing>
</child>
@ -379,36 +320,15 @@ primary data for the merged person.</property>
<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>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label6">
<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>
</object>
<packing>
@ -426,8 +346,8 @@ primary data for the merged person.</property>
</child>
</object>
<packing>
<property name="position">3</property>
<property name="expand">False</property>
<property name="position">3</property>
</packing>
</child>
<child>
@ -437,7 +357,6 @@ primary data for the merged person.</property>
<child>
<object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="orientation">horizontal</property>
<property name="spacing">5</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">

View File

@ -3,6 +3,7 @@
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2009 Gary Burton
# Copyright (C) 2010 Nick Hall
#
# 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
@ -67,7 +68,8 @@ from editperson import EditPerson
from displaytabs import (EmbeddedList, EventEmbedList, SourceEmbedList,
FamilyAttrEmbedList, NoteTab, GalleryTab,
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 QuestionDialog import (ErrorDialog, RunDatabaseRepair, WarningDialog,
MessageHideDialog)
@ -95,8 +97,8 @@ class ChildEmbedList(EmbeddedList):
'del' : _('Remove the child from the family'),
'edit' : _('Edit the child reference'),
'share' : _('Add an existing person as a child of the family'),
'up' : _('Move the child up in the childrens list'),
'down' : _('Move the child down in the childrens list'),
'up' : _('Move the child up in the childrens list'),
'down' : _('Move the child down in the childrens list'),
}
_column_names = [
@ -485,7 +487,7 @@ class EditFamily(EditPrimary):
self.obj.mother_handle != objreal.mother_handle or
self.obj.private != objreal.private 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)
if maindatachanged:
self.obj.gramps_id = objreal.gramps_id
@ -493,7 +495,7 @@ class EditFamily(EditPrimary):
self.obj.mother_handle = objreal.mother_handle
self.obj.private = objreal.private
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.reload_people()
@ -625,13 +627,14 @@ class EditFamily(EditPrimary):
self.obj.get_gramps_id,
self.db.readonly)
self.marker = MonitoredDataType(
self.top.get_object('marker'),
self.obj.set_marker,
self.obj.get_marker,
self.db.readonly,
self.db.get_marker_types(),
)
self.tags = MonitoredTagList(
self.top.get_object("tag_label"),
self.top.get_object("tag_button"),
self.obj.set_tag_list,
self.obj.get_tag_list,
self.db,
self.uistate, self.track,
self.db.readonly)
self.data_type = MonitoredDataType(
self.top.get_object('marriage_type'),

View File

@ -3,6 +3,7 @@
#
# Copyright (C) 2000-2006 Donald N. Allingham
# Copyright (C) 2009 Gary Burton
# Copyright (C) 2010 Nick Hall
#
# 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
@ -46,7 +47,8 @@ import gen.mime
import ThumbNails
import Utils
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,
MediaBackRefList)
from addmedia import AddMediaObject
@ -125,6 +127,15 @@ class EditMedia(EditPrimary):
self.obj.set_gramps_id,
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.obj, self.db.readonly)

View File

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

View File

@ -3,6 +3,7 @@
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2009 Gary Burton
# Copyright (C) 2010 Nick Hall
#
# 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
@ -253,14 +254,6 @@ class EditPerson(EditPrimary):
),
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.top.get_object("ntype"),
self.pname.set_type,

View File

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

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
#
# 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
@ -26,6 +27,7 @@
#-------------------------------------------------------------------------
import logging
log = logging.getLogger(".")
import locale
#-------------------------------------------------------------------------
#
@ -56,8 +58,6 @@ from gui.views.treemodels.flatbasemodel import FlatBaseModel
#-------------------------------------------------------------------------
class FamilyModel(FlatBaseModel):
_MARKER_COL = 13
def __init__(self, db, scol=0, order=gtk.SORT_ASCENDING, search=None,
skip=set(), sort_map=None):
self.gen_cursor = db.get_family_cursor
@ -68,11 +68,11 @@ class FamilyModel(FlatBaseModel):
self.column_mother,
self.column_type,
self.column_marriage,
self.column_tags,
self.column_change,
self.column_handle,
self.column_tooltip,
self.column_marker_text,
self.column_marker_color,
self.column_tag_color,
self.column_tooltip,
]
self.smap = [
self.column_id,
@ -80,20 +80,20 @@ class FamilyModel(FlatBaseModel):
self.sort_mother,
self.column_type,
self.sort_marriage,
self.column_tags,
self.sort_change,
self.column_handle,
self.column_tooltip,
self.column_marker_text,
self.column_marker_color,
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)
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):
return len(self.fmap)+1
@ -159,27 +159,6 @@ class FamilyModel(FlatBaseModel):
def column_change(self, data):
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):
if const.USE_TIPS:
try:
@ -191,3 +170,30 @@ class FamilyModel(FlatBaseModel):
return t
else:
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
#
# 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
# 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
def marker_column(self):
def color_column(self):
"""
Return the column for marker colour.
Return the color column.
"""
return None

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
#
# 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
@ -27,6 +28,7 @@
from gen.ggettext import gettext as _
import logging
log = logging.getLogger(".")
import locale
#-------------------------------------------------------------------------
#
@ -64,9 +66,11 @@ class MediaModel(FlatBaseModel):
self.column_id,
self.column_mime,
self.column_path,
self.column_change,
self.column_date,
self.column_tags,
self.column_change,
self.column_handle,
self.column_tag_color,
self.column_tooltip
]
@ -75,13 +79,22 @@ class MediaModel(FlatBaseModel):
self.column_id,
self.column_mime,
self.column_path,
self.sort_change,
self.sort_date,
self.column_tags,
self.sort_change,
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)
def color_column(self):
"""
Return the color column.
"""
return 8
def on_get_n_columns(self):
return len(self.fmap)+1
@ -141,3 +154,30 @@ class MediaModel(FlatBaseModel):
return t
else:
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
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
#
# 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
@ -26,6 +27,7 @@
#-------------------------------------------------------------------------
import logging
_LOG = logging.getLogger(".gui.notemodel")
import locale
#-------------------------------------------------------------------------
#
@ -41,7 +43,7 @@ import gtk
#-------------------------------------------------------------------------
import Utils
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_id,
self.column_type,
self.column_marker,
self.column_tags,
self.column_change,
self.column_handle,
self.column_marker_color
self.column_tag_color
]
self.smap = [
self.column_preview,
self.column_id,
self.column_type,
self.column_marker,
self.column_tags,
self.sort_change,
self.column_handle,
self.column_marker_color
self.column_tag_color
]
FlatBaseModel.__init__(self, db, scol, order, 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 6
@ -101,12 +103,6 @@ class NoteModel(FlatBaseModel):
temp.set(data[Note.POS_TYPE])
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):
"""Return a shortend version of the Note's text."""
#data is the encoding in the database, make it a unicode object
@ -118,23 +114,35 @@ class NoteModel(FlatBaseModel):
else:
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):
return "%012x" % data[Note.POS_CHANGE]
def column_change(self,data):
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) 2009 Gary Burton
# Copyright (C) 2009 Nick Hall
# Copyright (C) 2009-2010 Nick Hall
# Copyright (C) 2009 Benny Malengier
#
# This program is free software; you can redistribute it and/or modify
@ -57,7 +57,7 @@ _LOG = logging.getLogger(".")
#
#-------------------------------------------------------------------------
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
import DateHandler
import ToolTips
@ -79,9 +79,8 @@ COLUMN_DEATH = 5
COLUMN_BIRTH = 6
COLUMN_EVENT = 7
COLUMN_FAMILY = 8
COLUMN_TAGS = 21
COLUMN_CHANGE = 17
COLUMN_MARKER = 18
COLUMN_TAGS = 18
invalid_date_format = config.get('preferences.invalid-date-format')
@ -121,7 +120,6 @@ class PeopleBaseModel(object):
self.column_tags,
self.column_change,
self.column_int_id,
self.column_marker_text,
self.column_tag_color,
self.column_tooltip,
]
@ -137,7 +135,6 @@ class PeopleBaseModel(object):
self.column_tags,
self.sort_change,
self.column_int_id,
self.column_marker_text,
self.column_tag_color,
self.column_tooltip,
]
@ -150,11 +147,11 @@ class PeopleBaseModel(object):
self.lru_bdate = 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):
""" Clear the LRU cache """
@ -419,11 +416,6 @@ class PeopleBaseModel(object):
return "<i>" + cgi.escape(place_title) + "</i>"
return u""
def column_marker_text(self, data):
if COLUMN_MARKER < len(data):
return str(data[COLUMN_MARKER])
return ""
def column_tooltip(self, data):
if const.USE_TIPS:
return ToolTips.TipFromFunction(
@ -446,7 +438,7 @@ class PeopleBaseModel(object):
"""
Return the tag color.
"""
tag_color = None
tag_color = '#000000000000'
tag_priority = None
for handle in data[COLUMN_TAGS]:
tag = self.db.get_tag_from_handle(handle)

View File

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

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
#
# 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

View File

@ -7,6 +7,7 @@
# Copyright (C) 2008 Robert Cheramy <robert@cheramy.net>
# Copyright (C) 2009 Douglas S. Blank
# Copyright (C) 2010 Jakim Friant
# Copyright (C) 2010 Nick Hall
#
# 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
@ -429,7 +430,7 @@ class GrampsXmlWriter(UpdateCallback):
ntype = escxml(note.get_type().xml_str())
format = note.get_format()
text = note.get_styledtext()
tags = text.get_tags()
styles = text.get_tags()
text = str(text)
self.g.write(' type="%s"' % ntype)
@ -439,23 +440,25 @@ class GrampsXmlWriter(UpdateCallback):
self.write_text('text', text, index + 1)
if tags:
self.write_texttags(tags, index + 1)
if styles:
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')
def write_texttags(self, tags, index=3):
for tag in tags:
name = tag.name.xml_str()
value = tag.value
def write_styles(self, styles, index=3):
for style in styles:
name = style.name.xml_str()
value = style.value
self.g.write(' ' * index + '<style name="%s"' % name)
if value:
self.g.write(' value="%s"' % escxml(str(value)))
self.g.write('>\n')
for (start, end) in tag.ranges:
for (start, end) in style.ranges:
self.g.write((' ' * (index + 1)) +
'<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)
for s in family.get_source_references():
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)
def write_source(self,source,index=1):
@ -745,16 +752,11 @@ class GrampsXmlWriter(UpdateCallback):
"""
if not obj:
return
marker = obj.get_marker().xml_str()
if marker:
marker_text = ' marker="%s"' % escxml(marker)
else:
marker_text = ''
priv_text = conf_priv(obj)
id_text = ' id="%s"' % escxml(obj.gramps_id)
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:
self.g.write('>\n')
@ -1164,6 +1166,10 @@ class GrampsXmlWriter(UpdateCallback):
self.write_date(dval, index+1)
for s in obj.get_source_references():
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))
#-------------------------------------------------------------------------

View File

@ -3,6 +3,7 @@
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2009 Douglas S. Blank
# Copyright (C) 2010 Nick Hall
#
# 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
@ -1110,11 +1111,8 @@ class GrampsParser(UpdateCallback):
else:
self.person.change = self.change
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.person.marker.set(gen.lib.MarkerType.COMPLETE)
else:
self.person.marker.set_from_xml_str(attrs.get("marker", ''))
self.convert_marker(attrs, self.person)
def start_people(self, attrs):
if 'home' in attrs:
@ -1222,11 +1220,7 @@ class GrampsParser(UpdateCallback):
if 'type' in attrs:
self.family.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.family.marker.set(gen.lib.MarkerType.COMPLETE)
else:
self.family.marker.set_from_xml_str(attrs.get("marker", ''))
self.convert_marker(attrs, self.family)
def start_rel(self, attrs):
if 'type' in attrs:
@ -1409,11 +1403,8 @@ class GrampsParser(UpdateCallback):
self.info.add('merge-overwrite', NOTE_KEY, self.note)
self.note.format = int(attrs.get('format', gen.lib.Note.FLOWED))
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.note.marker.set(gen.lib.MarkerType.COMPLETE)
else:
self.note.marker.set_from_xml_str(attrs.get("marker", ''))
self.convert_marker(attrs, self.note)
# Since StyledText was introduced (XML v1.3.0) the clear text
# part of the note is moved between <text></text> tags.
@ -2417,6 +2408,28 @@ class GrampsParser(UpdateCallback):
if self.func:
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):
if orig:

View File

@ -2,7 +2,7 @@
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2008 Gary Burton
# Copyright (C) 2009 Nick Hall
# Copyright (C) 2009-2010 Nick Hall
# Copyright (C) 2010 Benny Malengier
#
# 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) 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
# it under the terms of the GNU General Public License as published by
@ -22,7 +23,7 @@
# $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,
TableStyle, TableCellStyle, FONT_SANS_SERIF,
INDEX_TYPE_TOC, PARA_ALIGN_CENTER)
from gen.lib import MarkerType, NoteType
from gen.lib import NoteType
from Filters import GenericFilterFactory, Rules
from gen.display.name import displayer as name_displayer
from Errors import ReportError
import DateHandler
#------------------------------------------------------------------------
#
# MarkerReport
# TagReport
#
#------------------------------------------------------------------------
class MarkerReport(Report):
class TagReport(Report):
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:
@ -68,70 +70,68 @@ class MarkerReport(Report):
This report needs the following parameters (class variables)
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)
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):
markerstr = self.marker
# Use localized name if this is not a custom marker
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
self.doc.start_paragraph("TR-Title")
title = _("Tag Report for %s Items") % self.tag
mark = IndexMark(title, INDEX_TYPE_TOC, 1)
self.doc.write_text(title, mark)
self.doc.end_paragraph()
self.write_people()
self.write_families()
self.write_events()
#self.write_events()
self.write_notes()
self.write_media()
def write_people(self):
plist = self.database.iter_person_handles()
FilterClass = GenericFilterFactory('Person')
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)
if not ind_list:
return
self.doc.start_paragraph("MR-Heading")
self.doc.start_paragraph("TR-Heading")
header = _("People")
mark = IndexMark(header, INDEX_TYPE_TOC, 2)
self.doc.write_text(header, mark)
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_cell('MR-TableCell')
self.doc.start_paragraph('MR-Normal-Bold')
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('MR-TableCell')
self.doc.start_paragraph('MR-Normal-Bold')
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal-Bold')
self.doc.write_text(_("Name"))
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.start_cell('MR-TableCell')
self.doc.start_paragraph('MR-Normal-Bold')
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal-Bold')
self.doc.write_text(_("Birth"))
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.start_cell('MR-TableCell')
self.doc.start_paragraph('MR-Normal-Bold')
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal-Bold')
self.doc.write_text(_("Death"))
self.doc.end_paragraph()
self.doc.end_cell()
@ -143,22 +143,22 @@ class MarkerReport(Report):
self.doc.start_row()
self.doc.start_cell('MR-TableCell')
self.doc.start_paragraph('MR-Normal')
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal')
self.doc.write_text(person.get_gramps_id())
self.doc.end_paragraph()
self.doc.end_cell()
name = name_displayer.display(person)
mark = ReportUtils.get_person_mark(self.database, person)
self.doc.start_cell('MR-TableCell')
self.doc.start_paragraph('MR-Normal')
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal')
self.doc.write_text(name, mark)
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.start_cell('MR-TableCell')
self.doc.start_paragraph('MR-Normal')
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal')
birth_ref = person.get_birth_ref()
if birth_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_cell()
self.doc.start_cell('MR-TableCell')
self.doc.start_paragraph('MR-Normal')
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal')
death_ref = person.get_death_ref()
if death_ref:
event = self.database.get_event_from_handle(death_ref.ref)
@ -183,42 +183,42 @@ class MarkerReport(Report):
flist = self.database.iter_family_handles()
FilterClass = GenericFilterFactory('Family')
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)
if not fam_list:
return
self.doc.start_paragraph("MR-Heading")
self.doc.start_paragraph("TR-Heading")
header = _("Families")
mark = IndexMark(header,INDEX_TYPE_TOC, 2)
self.doc.write_text(header, mark)
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_cell('MR-TableCell')
self.doc.start_paragraph('MR-Normal-Bold')
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('MR-TableCell')
self.doc.start_paragraph('MR-Normal-Bold')
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal-Bold')
self.doc.write_text(_("Father"))
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.start_cell('MR-TableCell')
self.doc.start_paragraph('MR-Normal-Bold')
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal-Bold')
self.doc.write_text(_("Mother"))
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.start_cell('MR-TableCell')
self.doc.start_paragraph('MR-Normal-Bold')
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal-Bold')
self.doc.write_text(_("Relationship"))
self.doc.end_paragraph()
self.doc.end_cell()
@ -230,14 +230,14 @@ class MarkerReport(Report):
self.doc.start_row()
self.doc.start_cell('MR-TableCell')
self.doc.start_paragraph('MR-Normal')
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal')
self.doc.write_text(family.get_gramps_id())
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.start_cell('MR-TableCell')
self.doc.start_paragraph('MR-Normal')
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal')
father_handle = family.get_father_handle()
if 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_cell()
self.doc.start_cell('MR-TableCell')
self.doc.start_paragraph('MR-Normal')
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal')
mother_handle = family.get_mother_handle()
if 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_cell()
self.doc.start_cell('MR-TableCell')
self.doc.start_paragraph('MR-Normal')
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal')
relation = family.get_relationship()
self.doc.write_text(str(relation) )
self.doc.end_paragraph()
@ -269,46 +269,46 @@ class MarkerReport(Report):
def write_events(self):
# 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()
FilterClass = GenericFilterFactory('Event')
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)
if not event_list:
return
self.doc.start_paragraph("MR-Heading")
self.doc.start_paragraph("TR-Heading")
header = _("Events")
mark = IndexMark(header, INDEX_TYPE_TOC, 2)
self.doc.write_text(header, mark)
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_cell('MR-TableCell')
self.doc.start_paragraph('MR-Normal-Bold')
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('MR-TableCell')
self.doc.start_paragraph('MR-Normal-Bold')
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.start_cell('MR-TableCell')
self.doc.start_paragraph('MR-Normal-Bold')
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal-Bold')
self.doc.write_text(_("Place"))
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.start_cell('MR-TableCell')
self.doc.start_paragraph('MR-Normal-Bold')
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal-Bold')
self.doc.write_text(_("Description"))
self.doc.end_paragraph()
self.doc.end_cell()
@ -320,22 +320,22 @@ class MarkerReport(Report):
self.doc.start_row()
self.doc.start_cell('MR-TableCell')
self.doc.start_paragraph('MR-Normal')
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal')
self.doc.write_text(event.get_gramps_id())
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.start_cell('MR-TableCell')
self.doc.start_paragraph('MR-Normal')
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal')
date = DateHandler.get_date(event)
if date:
self.doc.write_text(date)
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.start_cell('MR-TableCell')
self.doc.start_paragraph('MR-Normal')
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal')
place_handle = event.get_place_handle()
place = ReportUtils.place_name(self.database, place_handle)
if place:
@ -343,8 +343,8 @@ class MarkerReport(Report):
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.start_cell('MR-TableCell')
self.doc.start_paragraph('MR-Normal')
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal')
descr = event.get_description()
if descr:
self.doc.write_text( descr )
@ -359,36 +359,36 @@ class MarkerReport(Report):
nlist = self.database.get_note_handles()
FilterClass = GenericFilterFactory('Note')
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)
if not note_list:
return
self.doc.start_paragraph("MR-Heading")
self.doc.start_paragraph("TR-Heading")
header = _("Notes")
mark = IndexMark(header, INDEX_TYPE_TOC, 2)
self.doc.write_text(header ,mark)
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_cell('MR-TableCell')
self.doc.start_paragraph('MR-Normal-Bold')
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('MR-TableCell')
self.doc.start_paragraph('MR-Normal-Bold')
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('MR-TableCell', 2)
self.doc.start_paragraph('MR-Normal-Bold')
self.doc.start_cell('TR-TableCell', 2)
self.doc.start_paragraph('TR-Normal-Bold')
self.doc.write_text(_("Text"))
self.doc.end_paragraph()
self.doc.end_cell()
@ -400,22 +400,22 @@ class MarkerReport(Report):
self.doc.start_row()
self.doc.start_cell('MR-TableCell')
self.doc.start_paragraph('MR-Normal')
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal')
self.doc.write_text(note.get_gramps_id())
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.start_cell('MR-TableCell')
self.doc.start_paragraph('MR-Normal')
self.doc.start_cell('TR-TableCell')
self.doc.start_paragraph('TR-Normal')
type = note.get_type()
self.doc.write_text(str(type))
self.doc.end_paragraph()
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(),
note.get_format(), 'MR-Note',
note.get_format(), 'TR-Note',
contains_html= note.get_type() \
== NoteType.HTML_CODE)
self.doc.end_cell()
@ -424,12 +424,95 @@ class MarkerReport(Report):
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):
self.__db = dbase
@ -437,26 +520,28 @@ class MarkerOptions(MenuReportOptions):
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")
marker = EnumeratedListOption(_('Marker'),
MarkerType._I2EMAP[MarkerType.COMPLETE])
# Add built-in marker types
for mtype in MarkerType._I2SMAP:
if mtype != MarkerType.NONE and mtype != MarkerType.CUSTOM:
# Use translated name for built-in marker types
marker.add_item(MarkerType._I2EMAP[mtype],
MarkerType._I2SMAP[mtype] )
# Add custom marker types
for m in self.__db.get_marker_types():
marker.add_item( m, m )
marker.set_help( _("The marker to use for the report"))
menu.add_option(category_name,"marker",marker)
all_tags = []
for handle in self.__db.get_tag_handles():
tag = self.__db.get_tag_from_handle(handle)
all_tags.append(tag.get_name())
if len(all_tags) > 0:
tag_option = EnumeratedListOption(_('Tag'), all_tags[0])
for tag_name in all_tags:
tag_option.add_item(tag_name, tag_name)
else:
tag_option = EnumeratedListOption(_('Tag'), '')
tag_option.add_item('', '')
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):
"""Make the default output style for the Marker Report."""
"""Make the default output style for the Tag Report."""
# Paragraph Styles
f = FontStyle()
f.set_size(16)
@ -470,7 +555,7 @@ class MarkerOptions(MenuReportOptions):
p.set_font(f)
p.set_alignment(PARA_ALIGN_CENTER)
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.set(face=FONT_SANS_SERIF, size=14, italic=1)
@ -480,7 +565,7 @@ class MarkerOptions(MenuReportOptions):
para.set_top_margin(0.25)
para.set_bottom_margin(0.25)
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.set_size(12)
@ -490,7 +575,7 @@ class MarkerOptions(MenuReportOptions):
p.set_top_margin(ReportUtils.pt2cm(3))
p.set_bottom_margin(ReportUtils.pt2cm(3))
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.set_size(12)
@ -501,18 +586,18 @@ class MarkerOptions(MenuReportOptions):
p.set_top_margin(ReportUtils.pt2cm(3))
p.set_bottom_margin(ReportUtils.pt2cm(3))
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()
p.set(first_indent=-0.75, lmargin=.75)
para.set_top_margin(ReportUtils.pt2cm(3))
para.set_bottom_margin(ReportUtils.pt2cm(3))
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
cell = TableCellStyle()
default_style.add_cell_style('MR-TableCell', cell)
default_style.add_cell_style('TR-TableCell', cell)
table = TableStyle()
table.set_width(100)
@ -521,4 +606,4 @@ class MarkerOptions(MenuReportOptions):
table.set_column_width(1, 30)
table.set_column_width(2, 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.id = 'marker_report'
plg.name = _("Marker Report")
plg.description = _("Produces a list of people with a specified marker")
plg.id = 'tag_report'
plg.name = _("Tag Report")
plg.description = _("Produces a list of people with a specified tag")
plg.version = '1.0'
plg.gramps_target_version = '3.3'
plg.status = STABLE
plg.fname = 'MarkerReport.py'
plg.fname = 'TagReport.py'
plg.ptype = REPORT
plg.authors = ["Brian G. Matherly"]
plg.authors_email = ["brian@gramps-project.org"]
plg.category = CATEGORY_TEXT
plg.reportclass = 'MarkerReport'
plg.optionclass = 'MarkerOptions'
plg.reportclass = 'TagReport'
plg.optionclass = 'TagOptions'
plg.report_modes = [REPORT_MODE_GUI, REPORT_MODE_BKI, REPORT_MODE_CLI]
plg.require_active = False

View File

@ -1,9 +1,10 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2007-2009 Stephane Charette
# Copyright (C) 2008 Brian Matherly
# Copyright (C) 2010 Jakim Friant
# Copyright (C) 2007-2009 Stephane Charette
# Copyright (C) 2008 Brian Matherly
# Copyright (C) 2010 Jakim Friant
# Copyright (C) 2010 Nick Hall
#
# 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
@ -24,6 +25,13 @@
"Find people who are not related to the selected person"
#------------------------------------------------------------------------
#
# Python modules
#
#------------------------------------------------------------------------
import locale
#------------------------------------------------------------------------
#
# GNOME/GTK modules
@ -47,6 +55,7 @@ from gui.utils import ProgressMeter
import GrampsDisplay
from gen.ggettext import sgettext as _
from glade import Glade
from gen.lib import Tag
#-------------------------------------------------------------------------
#
@ -91,13 +100,18 @@ class NotRelated(tool.ActivePersonTool, ManagedWindow.ManagedWindow) :
title = topDialog.get_object("title")
self.set_window(window, title, self.title)
self.markercombo = topDialog.get_object("markercombo")
self.markerapply = topDialog.get_object("markerapply")
self.markercombo.set_sensitive(False)
self.markerapply.set_sensitive(False)
self.markerapply.connect('clicked', self.applyMarkerClicked)
self.tagcombo = topDialog.get_object("tagcombo")
tagmodel = gtk.ListStore(str)
self.tagcombo.set_model(tagmodel)
self.tagcombo.set_text_column(0)
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
self.progress = ProgressMeter(self.title,_('Starting'))
@ -106,7 +120,7 @@ class NotRelated(tool.ActivePersonTool, ManagedWindow.ManagedWindow) :
gobject.TYPE_STRING, # 0==name
gobject.TYPE_STRING, # 1==person gid
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)
# 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)
col2 = gtk.TreeViewColumn(_('ID'), gtk.CellRendererText(), text=1)
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)
col2.set_resizable(True)
col3.set_resizable(True)
@ -189,8 +203,8 @@ class NotRelated(tool.ActivePersonTool, ManagedWindow.ManagedWindow) :
def rowSelectionChanged(self, selection) :
state = selection.count_selected_rows() > 0
self.markercombo.set_sensitive(state)
self.markerapply.set_sensitive(state)
self.tagcombo.set_sensitive(state)
self.tagapply.set_sensitive(state)
def rowActivated(self, treeView, path, column) :
@ -222,23 +236,36 @@ class NotRelated(tool.ActivePersonTool, ManagedWindow.ManagedWindow) :
GrampsDisplay.help(WIKI_HELP_PAGE , WIKI_HELP_SEC)
def applyMarkerClicked(self, button) :
def applyTagClicked(self, button) :
progress = None
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 rows > 1:
progress = ProgressMeter(self.title,_('Starting'))
#TRANS: no singular form needed, as rows is always > 1
progress.set_pass(ngettext("Setting marker for %d person", 'Setting marker for %d people', \
rows) % rows, rows)
progress.set_pass(ngettext("Setting tag for %d person",
"Setting tag for %d people",
rows) % rows, rows)
# start the db transaction
transaction = self.db.transaction_begin()
# iterate through all of the selected rows
(model, paths) = self.treeSelection.get_selected_rows()
for path in paths:
if progress:
progress.step()
@ -248,20 +275,28 @@ class NotRelated(tool.ActivePersonTool, ManagedWindow.ManagedWindow) :
personGid = self.model.get_value(iter, 1)
person = self.db.get_person_from_gramps_id(personGid)
# change the marker
person.set_marker(marker)
self.model.set_value(iter, 3, marker)
# add the tag to the person
person.add_tag(tag_handle)
# save this change
self.db.commit_person(person, 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:
progress.close()
def findRelatedPeople(self) :
#TRANS: No singular form is needed.
@ -371,7 +406,9 @@ class NotRelated(tool.ActivePersonTool, ManagedWindow.ManagedWindow) :
surname = primaryname.get_surname()
name = primaryname.get_name()
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
familygid = ''
@ -414,12 +451,23 @@ class NotRelated(tool.ActivePersonTool, ManagedWindow.ManagedWindow) :
iter = self.model.append(None, [surname, '', '', '', ''])
# 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):
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

View File

@ -2,23 +2,6 @@
<interface>
<!-- interface-requires gtk+ 2.12 -->
<!-- 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">
<property name="default_width">450</property>
<property name="default_height">400</property>
@ -86,24 +69,16 @@
<property name="visible">True</property>
<property name="spacing">3</property>
<child>
<object class="GtkComboBoxEntry" id="markercombo">
<object class="GtkComboBoxEntry" id="tagcombo">
<property name="visible">True</property>
<property name="model">model1</property>
<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>
<accelerator key="T" signal="grab_focus" modifiers="GDK_MOD1_MASK"/>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="markerapply">
<object class="GtkButton" id="tagapply">
<property name="label">gtk-apply</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@ -121,9 +96,9 @@
</object>
</child>
<child type="label">
<object class="GtkLabel" id="marker">
<object class="GtkLabel" id="tag">
<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_underline">True</property>
</object>

View File

@ -1,6 +1,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2001-2006 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
#
# 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
@ -69,7 +70,8 @@ class FamilyView(ListView):
COL_MOTHER = 2
COL_REL = 3
COL_MARDATE = 4
COL_CHAN = 5
COL_TAGS = 5
COL_CHAN = 6
# name of the columns
COLUMN_NAMES = [
_('ID'),
@ -77,6 +79,7 @@ class FamilyView(ListView):
_('Mother'),
_('Relationship'),
_('Marriage Date'),
_('Tags'),
_('Last Changed'),
]
#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,
COL_MARDATE]),
('columns.rank', [COL_ID, COL_FATHER, COL_MOTHER, COL_REL,
COL_MARDATE, COL_CHAN]),
('columns.size', [75, 200, 200, 100, 100, 100])
COL_MARDATE, COL_TAGS, COL_CHAN]),
('columns.size', [75, 200, 200, 100, 100, 100, 100])
)
ADD_MSG = _("Add a new family")
@ -101,6 +104,7 @@ class FamilyView(ListView):
'family-update' : self.row_update,
'family-delete' : self.row_delete,
'family-rebuild' : self.object_build,
'tag-update' : self.tag_updated
}
ListView.__init__(
@ -199,6 +203,20 @@ class FamilyView(ListView):
])
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):
return self.dbstate.db.get_family_bookmarks()
@ -270,3 +288,23 @@ class FamilyView(ListView):
Indicate that the drag type is a 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) 2008 Gary Burton
# Copyright (C) 2010 Nick Hall
#
# 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
@ -82,24 +83,26 @@ class MediaView(ListView):
COL_ID = 1
COL_TYPE = 2
COL_PATH = 3
COL_CHAN = 4
COL_DATE = 5
COL_DATE = 4
COL_TAGS = 5
COL_CHAN = 6
#name of the columns
COLUMN_NAMES = [
_('Title'),
_('ID'),
_('Type'),
_('Path'),
_('Last Changed'),
_('Date'),
_('Tags'),
_('Last Changed'),
]
# default setting with visible columns, order of the col, and their size
CONFIGSETTINGS = (
('columns.visible', [COL_TITLE, COL_ID, COL_TYPE, COL_PATH,
COL_DATE]),
('columns.rank', [COL_TITLE, COL_ID, COL_TYPE, COL_PATH,
COL_DATE, COL_CHAN]),
('columns.size', [200, 75, 100, 200, 150, 150])
COL_DATE, COL_TAGS, COL_CHAN]),
('columns.size', [200, 75, 100, 200, 150, 100, 150])
)
ADD_MSG = _("Add a new media object")
@ -117,6 +120,7 @@ class MediaView(ListView):
'media-update' : self.row_update,
'media-delete' : self.row_delete,
'media-rebuild' : self.object_build,
'tag-update' : self.tag_updated
}
ListView.__init__(
@ -236,6 +240,20 @@ class MediaView(ListView):
self._add_action('QuickReport', None, _("Quick View"), None, None, None)
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):
"""
Launch external viewers for the selected objects.
@ -451,3 +469,23 @@ class MediaView(ListView):
return obj.get_handle()
else:
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) 2008 Gary Burton
# Copyright (C) 2010 Nick Hall
#
# 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
@ -69,21 +70,20 @@ class NoteView(ListView):
COL_PREVIEW = 0
COL_ID = 1
COL_TYPE = 2
COL_MARKER = 3
COL_TAGS = 3
COL_CHAN = 4
COLUMN_NAMES = [
_('Preview'),
_('ID'),
_('Type'),
_('Marker'),
_('Tags'),
_('Last Changed')
]
# default setting with visible columns, order of the col, and their size
CONFIGSETTINGS = (
('columns.visible', [COL_PREVIEW, COL_ID, COL_TYPE, COL_MARKER]),
('columns.rank', [COL_PREVIEW, COL_ID, COL_TYPE, COL_MARKER,
COL_CHAN]),
('columns.visible', [COL_PREVIEW, COL_ID, COL_TYPE]),
('columns.rank', [COL_PREVIEW, COL_ID, COL_TYPE, COL_TAGS, COL_CHAN]),
('columns.size', [350, 75, 100, 100, 100]))
ADD_MSG = _("Add a new note")
@ -99,6 +99,7 @@ class NoteView(ListView):
'note-update' : self.row_update,
'note-delete' : self.row_delete,
'note-rebuild' : self.object_build,
'tag-update' : self.tag_updated
}
ListView.__init__(
@ -213,6 +214,20 @@ class NoteView(ListView):
self._add_action('QuickReport', None, _("Quick View"), None, None, None)
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):
obj = self.dbstate.db.get_note_from_gramps_id(gid)
if obj:
@ -259,3 +274,23 @@ class NoteView(ListView):
else:
import Merge
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)