Add tagging to all primary objects

svn: r21194
This commit is contained in:
Nick Hall 2013-01-22 16:12:15 +00:00
parent bc202fb9ac
commit 46ded3e7db
62 changed files with 1731 additions and 539 deletions

View File

@ -25,15 +25,15 @@
--> -->
<!-- <!--
This is the Document Type Definition file for v1.5.0 This is the Document Type Definition file for v1.6.0
of the GRAMPS XML genealogy data format. of the GRAMPS XML genealogy data format.
Please use the following formal public identifier to identify it: Please use the following formal public identifier to identify it:
"-//GRAMPS//DTD GRAMPS XML V1.5.0//EN" "-//GRAMPS//DTD GRAMPS XML V1.6.0//EN"
For example: For example:
<!DOCTYPE database PUBLIC "-//GRAMPS//DTD GRAMPS XML V1.5.0//EN" <!DOCTYPE database PUBLIC "-//GRAMPS//DTD GRAMPS XML V1.6.0//EN"
"http://gramps-project.org/xml/1.5.0/grampsxml.dtd" "http://gramps-project.org/xml/1.6.0/grampsxml.dtd"
[...]> [...]>
--> -->
@ -215,7 +215,8 @@ EVENT
<!ELEMENT events (event)*> <!ELEMENT events (event)*>
<!ELEMENT event (type?, (daterange|datespan|dateval|datestr)?, place?, cause?, <!ELEMENT event (type?, (daterange|datespan|dateval|datestr)?, place?, cause?,
description?, attribute*, noteref*, citationref*, objref*)> description?, attribute*, noteref*, citationref*, objref*,
tagref*)>
<!ATTLIST event <!ATTLIST event
id CDATA #IMPLIED id CDATA #IMPLIED
handle ID #REQUIRED handle ID #REQUIRED
@ -229,7 +230,7 @@ SOURCES
<!ELEMENT sources (source)*> <!ELEMENT sources (source)*>
<!ELEMENT source (stitle?, sauthor?, spubinfo?, sabbrev?, <!ELEMENT source (stitle?, sauthor?, spubinfo?, sabbrev?,
noteref*, objref*, data_item*, reporef*)> noteref*, objref*, data_item*, reporef*, tagref*)>
<!ATTLIST source <!ATTLIST source
id CDATA #IMPLIED id CDATA #IMPLIED
handle ID #REQUIRED handle ID #REQUIRED
@ -248,7 +249,7 @@ PLACES
<!ELEMENT places (placeobj)*> <!ELEMENT places (placeobj)*>
<!ELEMENT placeobj (ptitle?, coord?, location*, objref*, url*, noteref*, <!ELEMENT placeobj (ptitle?, coord?, location*, objref*, url*, noteref*,
citationref*)> citationref*, tagref*)>
<!ATTLIST placeobj <!ATTLIST placeobj
id CDATA #IMPLIED id CDATA #IMPLIED
handle ID #REQUIRED handle ID #REQUIRED
@ -305,7 +306,7 @@ REPOSITORIES
<!ELEMENT repositories (repository)*> <!ELEMENT repositories (repository)*>
<!ELEMENT repository (rname, type, address*, url*, noteref*)> <!ELEMENT repository (rname, type, address*, url*, noteref*, tagref*)>
<!ATTLIST repository <!ATTLIST repository
id CDATA #IMPLIED id CDATA #IMPLIED
handle ID #REQUIRED handle ID #REQUIRED
@ -368,7 +369,7 @@ CITATIONS
<!ELEMENT citations (citation)*> <!ELEMENT citations (citation)*>
<!ELEMENT citation ((daterange|datespan|dateval|datestr)?, page?, confidence?, <!ELEMENT citation ((daterange|datespan|dateval|datestr)?, page?, confidence?,
noteref*, objref*, data_item*, sourceref)> noteref*, objref*, data_item*, sourceref, tagref*)>
<!ATTLIST citation <!ATTLIST citation
id CDATA #IMPLIED id CDATA #IMPLIED
handle ID #REQUIRED handle ID #REQUIRED

View File

@ -32,7 +32,7 @@
<grammar <grammar
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
ns="http://gramps-project.org/xml/1.5.0/" ns="http://gramps-project.org/xml/1.6.0/"
xmlns="http://relaxng.org/ns/structure/1.0"> xmlns="http://relaxng.org/ns/structure/1.0">
<start><element name="database"> <start><element name="database">
@ -160,6 +160,9 @@
<value>0</value> <value>0</value>
<value>1</value> <value>1</value>
</choice></attribute></optional> </choice></attribute></optional>
<zeroOrMore><element name="tagref">
<ref name="tagref-content"/>
</element></zeroOrMore>
</define> </define>
<define name="person-content"> <define name="person-content">
@ -205,9 +208,6 @@
<zeroOrMore><element name="citationref"> <zeroOrMore><element name="citationref">
<ref name="citationref-content"/> <ref name="citationref-content"/>
</element></zeroOrMore> </element></zeroOrMore>
<zeroOrMore><element name="tagref">
<ref name="tagref-content"/>
</element></zeroOrMore>
</define> </define>
<define name="child-rel"> <define name="child-rel">
@ -403,9 +403,6 @@
<zeroOrMore><element name="citationref"> <zeroOrMore><element name="citationref">
<ref name="citationref-content"/> <ref name="citationref-content"/>
</element></zeroOrMore> </element></zeroOrMore>
<zeroOrMore><element name="tagref">
<ref name="tagref-content"/>
</element></zeroOrMore>
</define> </define>
<define name="event-content"> <define name="event-content">
@ -520,9 +517,6 @@
<zeroOrMore><element name="citationref"> <zeroOrMore><element name="citationref">
<ref name="citationref-content"/> <ref name="citationref-content"/>
</element></zeroOrMore> </element></zeroOrMore>
<zeroOrMore><element name="tagref">
<ref name="tagref-content"/>
</element></zeroOrMore>
</define> </define>
<define name="repository-content"> <define name="repository-content">
@ -581,9 +575,6 @@
</choice></attribute></optional> </choice></attribute></optional>
<attribute name="type"><text/></attribute> <attribute name="type"><text/></attribute>
<ref name="styledtext"/> <ref name="styledtext"/>
<zeroOrMore><element name="tagref">
<ref name="tagref-content"/>
</element></zeroOrMore>
</define> </define>
<define name="styledtext"> <define name="styledtext">

View File

@ -43,12 +43,101 @@ if config.get('preferences.use-bsddb3') or sys.version_info[0] >= 3:
else: else:
from bsddb import db from bsddb import db
from . import BSDDBTxn from . import BSDDBTxn
from ..constfunc import UNITYPE
from ..lib.nameorigintype import NameOriginType from ..lib.nameorigintype import NameOriginType
from .write import _mkname, SURNAMES from .write import _mkname, SURNAMES
from .dbconst import (PERSON_KEY, FAMILY_KEY, EVENT_KEY, from .dbconst import (PERSON_KEY, FAMILY_KEY, EVENT_KEY,
MEDIA_KEY, PLACE_KEY, REPOSITORY_KEY) MEDIA_KEY, PLACE_KEY, REPOSITORY_KEY)
from gramps.gui.dialog import (InfoDialog) from gramps.gui.dialog import (InfoDialog)
def gramps_upgrade_17(self):
"""Upgrade database from version 16 to 17. This upgrade adds tags to
event, place, repository, source and citation objects.
"""
length = (len(self.event_map) + len(self.place_map) +
len(self.repository_map) + len(self.source_map) +
len(self.citation_map))
self.set_total(length)
# ---------------------------------
# Modify Event
# ---------------------------------
# Add new tag_list field.
for handle in self.event_map.keys():
event = self.event_map[handle]
new_event = list(event)
new_event = new_event[:11] + [[]] + new_event[11:]
new_event = tuple(new_event)
with BSDDBTxn(self.env, self.event_map) as txn:
if isinstance(handle, UNITYPE):
handle = handle.encode('utf-8')
txn.put(handle, new_event)
self.update()
# ---------------------------------
# Modify Place
# ---------------------------------
# Add new tag_list field.
for handle in self.place_map.keys():
place = self.place_map[handle]
new_place = list(place)
new_place = new_place[:12] + [[]] + new_place[12:]
new_place = tuple(new_place)
with BSDDBTxn(self.env, self.place_map) as txn:
if isinstance(handle, UNITYPE):
handle = handle.encode('utf-8')
txn.put(handle, new_place)
self.update()
# ---------------------------------
# Modify Repository
# ---------------------------------
# Add new tag_list field.
for handle in self.repository_map.keys():
repository = self.repository_map[handle]
new_repository = list(repository)
new_repository = new_repository[:8] + [[]] + new_repository[8:]
new_repository = tuple(new_repository)
with BSDDBTxn(self.env, self.repository_map) as txn:
if isinstance(handle, UNITYPE):
handle = handle.encode('utf-8')
txn.put(handle, new_repository)
self.update()
# ---------------------------------
# Modify Source
# ---------------------------------
# Add new tag_list field.
for handle in self.source_map.keys():
source = self.source_map[handle]
new_source = list(source)
new_source = new_source[:11] + [[]] + new_source[11:]
new_source = tuple(new_source)
with BSDDBTxn(self.env, self.source_map) as txn:
if isinstance(handle, UNITYPE):
handle = handle.encode('utf-8')
txn.put(handle, new_source)
self.update()
# ---------------------------------
# Modify Citation
# ---------------------------------
# Add new tag_list field.
for handle in self.citation_map.keys():
citation = self.citation_map[handle]
new_citation = list(citation)
new_citation = new_citation[:10] + [[]] + new_citation[10:]
new_citation = tuple(new_citation)
with BSDDBTxn(self.env, self.citation_map) as txn:
if isinstance(handle, UNITYPE):
handle = handle.encode('utf-8')
txn.put(handle, new_citation)
self.update()
# Bump up database version. Separate transaction to save metadata.
with BSDDBTxn(self.env, self.metadata) as txn:
txn.put(b'version', 17)
def gramps_upgrade_16(self): def gramps_upgrade_16(self):
"""Upgrade database from version 15 to 16. This upgrade converts all """Upgrade database from version 15 to 16. This upgrade converts all
SourceRef child objects to Citation Primary objects. SourceRef child objects to Citation Primary objects.

View File

@ -86,7 +86,7 @@ from ..constfunc import win, conv_to_unicode, cuni, UNITYPE, handle2internal
_LOG = logging.getLogger(DBLOGNAME) _LOG = logging.getLogger(DBLOGNAME)
LOG = logging.getLogger(".citation") LOG = logging.getLogger(".citation")
_MINVERSION = 9 _MINVERSION = 9
_DBVERSION = 16 _DBVERSION = 17
IDTRANS = "person_id" IDTRANS = "person_id"
FIDTRANS = "family_id" FIDTRANS = "family_id"
@ -2005,6 +2005,8 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
upgrade.gramps_upgrade_15(self) upgrade.gramps_upgrade_15(self)
if version < 16: if version < 16:
upgrade.gramps_upgrade_16(self) upgrade.gramps_upgrade_16(self)
if version < 17:
upgrade.gramps_upgrade_17(self)
self.reset() self.reset()
self.set_total(6) self.set_total(6)

View File

@ -42,6 +42,7 @@ from ._matchespagesubstringof import MatchesPageSubstringOf
from ._matchesrepositoryfilter import MatchesRepositoryFilter from ._matchesrepositoryfilter import MatchesRepositoryFilter
from ._matchessourcefilter import MatchesSourceFilter from ._matchessourcefilter import MatchesSourceFilter
from ._regexpidof import RegExpIdOf from ._regexpidof import RegExpIdOf
from ._hastag import HasTag
editor_rule_list = [ editor_rule_list = [
HasCitation, HasCitation,
@ -59,5 +60,6 @@ editor_rule_list = [
MatchesPageSubstringOf, MatchesPageSubstringOf,
MatchesRepositoryFilter, MatchesRepositoryFilter,
MatchesSourceFilter, MatchesSourceFilter,
RegExpIdOf RegExpIdOf,
HasTag
] ]

View File

@ -0,0 +1,51 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# 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
# 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$
"""
Rule that checks for a citation with a particular tag.
"""
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
from .._hastagbase import HasTagBase
#-------------------------------------------------------------------------
#
# HasTag
#
#-------------------------------------------------------------------------
class HasTag(HasTagBase):
"""
Rule that checks for a citation with a particular tag.
"""
labels = [ _('Tag:') ]
name = _('Citations with the <tag>')
description = _("Matches citations with the particular tag")

View File

@ -47,6 +47,7 @@ from ._matchessourcefilter import MatchesSourceFilter
from ._hasattribute import HasAttribute from ._hasattribute import HasAttribute
from ._hasdata import HasData from ._hasdata import HasData
from ._changedsince import ChangedSince from ._changedsince import ChangedSince
from ._hastag import HasTag
editor_rule_list = [ editor_rule_list = [
AllEvents, AllEvents,
@ -67,5 +68,6 @@ editor_rule_list = [
MatchesSourceFilter, MatchesSourceFilter,
HasAttribute, HasAttribute,
HasData, HasData,
ChangedSince ChangedSince,
HasTag
] ]

View File

@ -0,0 +1,51 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# 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
# 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$
"""
Rule that checks for an event with a particular tag.
"""
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
from .._hastagbase import HasTagBase
#-------------------------------------------------------------------------
#
# HasTag
#
#-------------------------------------------------------------------------
class HasTag(HasTagBase):
"""
Rule that checks for an event with a particular tag.
"""
labels = [ _('Tag:') ]
name = _('Events with the <tag>')
description = _("Matches events with the particular tag")

View File

@ -44,6 +44,7 @@ from ._inlatlonneighborhood import InLatLonNeighborhood
from ._matcheseventfilter import MatchesEventFilter from ._matcheseventfilter import MatchesEventFilter
from ._matchessourceconfidence import MatchesSourceConfidence from ._matchessourceconfidence import MatchesSourceConfidence
from ._changedsince import ChangedSince from ._changedsince import ChangedSince
from ._hastag import HasTag
editor_rule_list = [ editor_rule_list = [
AllPlaces, AllPlaces,
@ -65,4 +66,5 @@ editor_rule_list = [
InLatLonNeighborhood, InLatLonNeighborhood,
MatchesEventFilter, MatchesEventFilter,
ChangedSince, ChangedSince,
HasTag
] ]

View File

@ -0,0 +1,51 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# 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
# 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$
"""
Rule that checks for a place with a particular tag.
"""
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
from .._hastagbase import HasTagBase
#-------------------------------------------------------------------------
#
# HasTag
#
#-------------------------------------------------------------------------
class HasTag(HasTagBase):
"""
Rule that checks for a place with a particular tag.
"""
labels = [ _('Tag:') ]
name = _('Places with the <tag>')
description = _("Matches places with the particular tag")

View File

@ -35,6 +35,7 @@ from ._matchesfilter import MatchesFilter
from ._hasrepo import HasRepo from ._hasrepo import HasRepo
from ._changedsince import ChangedSince from ._changedsince import ChangedSince
from ._matchesnamesubstringof import MatchesNameSubstringOf from ._matchesnamesubstringof import MatchesNameSubstringOf
from ._hastag import HasTag
editor_rule_list = [ editor_rule_list = [
AllRepos, AllRepos,
@ -46,5 +47,6 @@ editor_rule_list = [
RepoPrivate, RepoPrivate,
MatchesFilter, MatchesFilter,
ChangedSince, ChangedSince,
MatchesNameSubstringOf MatchesNameSubstringOf,
HasTag
] ]

View File

@ -0,0 +1,51 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# 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
# 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$
"""
Rule that checks for a repository with a particular tag.
"""
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
from .._hastagbase import HasTagBase
#-------------------------------------------------------------------------
#
# HasTag
#
#-------------------------------------------------------------------------
class HasTag(HasTagBase):
"""
Rule that checks for a repository with a particular tag.
"""
labels = [ _('Tag:') ]
name = _('Repositories with the <tag>')
description = _("Matches repositories with the particular tag")

View File

@ -43,6 +43,7 @@ from ._hasrepository import HasRepository
from ._matchestitlesubstringof import MatchesTitleSubstringOf from ._matchestitlesubstringof import MatchesTitleSubstringOf
from ._hasrepositorycallnumberref import HasRepositoryCallNumberRef from ._hasrepositorycallnumberref import HasRepositoryCallNumberRef
from ._matchesrepositoryfilter import MatchesRepositoryFilter from ._matchesrepositoryfilter import MatchesRepositoryFilter
from ._hastag import HasTag
editor_rule_list = [ editor_rule_list = [
AllSources, AllSources,
@ -59,5 +60,6 @@ editor_rule_list = [
HasRepository, HasRepository,
MatchesTitleSubstringOf, MatchesTitleSubstringOf,
HasRepositoryCallNumberRef, HasRepositoryCallNumberRef,
MatchesRepositoryFilter MatchesRepositoryFilter,
HasTag
] ]

View File

@ -0,0 +1,51 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# 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
# 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$
"""
Rule that checks for a source with a particular tag.
"""
#-------------------------------------------------------------------------
#
# Standard Python modules
#
#-------------------------------------------------------------------------
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.get_translation().gettext
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
from .._hastagbase import HasTagBase
#-------------------------------------------------------------------------
#
# HasTag
#
#-------------------------------------------------------------------------
class HasTag(HasTagBase):
"""
Rule that checks for a source with a particular tag.
"""
labels = [ _('Tag:') ]
name = _('Sources with the <tag>')
description = _("Matches sources with the particular tag")

View File

@ -43,6 +43,7 @@ from .primaryobj import PrimaryObject
from .mediabase import MediaBase from .mediabase import MediaBase
from .notebase import NoteBase from .notebase import NoteBase
from .datebase import DateBase from .datebase import DateBase
from .tagbase import TagBase
from ..constfunc import cuni from ..constfunc import cuni
from .handle import Handle from .handle import Handle
@ -91,7 +92,8 @@ class Citation(MediaBase, NoteBase, PrimaryObject, DateBase):
MediaBase.serialize(self), # 7 MediaBase.serialize(self), # 7
self.datamap, # 8 self.datamap, # 8
self.change, # 9 self.change, # 9
self.private) # 10 TagBase.serialize(self), # 10
self.private) # 11
def to_struct(self): def to_struct(self):
""" """
@ -123,7 +125,8 @@ class Citation(MediaBase, NoteBase, PrimaryObject, DateBase):
"media_list": MediaBase.to_struct(self), # 7 "media_list": MediaBase.to_struct(self), # 7
"datamap": self.datamap, # 8 "datamap": self.datamap, # 8
"change": self.change, # 9 "change": self.change, # 9
"private": self.private} # 10 "tag_list": TagBase.to_struct(self), # 10
"private": self.private} # 11
def unserialize(self, data): def unserialize(self, data):
""" """
@ -140,12 +143,14 @@ class Citation(MediaBase, NoteBase, PrimaryObject, DateBase):
media_list, # 7 media_list, # 7
self.datamap, # 8 self.datamap, # 8
self.change, # 9 self.change, # 9
self.private # 10 tag_list, # 10
self.private # 11
) = data ) = data
DateBase.unserialize(self, date) DateBase.unserialize(self, date)
NoteBase.unserialize(self, note_list) NoteBase.unserialize(self, note_list)
MediaBase.unserialize(self, media_list) MediaBase.unserialize(self, media_list)
TagBase.unserialize(self, tag_list)
return self return self
def _has_handle_reference(self, classname, handle): def _has_handle_reference(self, classname, handle):
@ -244,7 +249,8 @@ class Citation(MediaBase, NoteBase, PrimaryObject, DateBase):
:returns: List of (classname, handle) tuples for referenced objects. :returns: List of (classname, handle) tuples for referenced objects.
:rtype: list :rtype: list
""" """
ret = self.get_referenced_note_handles() ret = (self.get_referenced_note_handles() +
self.get_referenced_tag_handles())
if self.get_reference_handle(): if self.get_reference_handle():
ret += [('Source', self.get_reference_handle())] ret += [('Source', self.get_reference_handle())]
return ret return ret
@ -259,6 +265,7 @@ class Citation(MediaBase, NoteBase, PrimaryObject, DateBase):
self._merge_privacy(acquisition) self._merge_privacy(acquisition)
self._merge_note_list(acquisition) self._merge_note_list(acquisition)
self._merge_media_list(acquisition) self._merge_media_list(acquisition)
self._merge_tag_list(acquisition)
# merge confidence # merge confidence
level_priority = [0, 4, 1, 3, 2] level_priority = [0, 4, 1, 3, 2]
idx = min(level_priority.index(self.confidence), idx = min(level_priority.index(self.confidence),

View File

@ -46,6 +46,7 @@ from .mediabase import MediaBase
from .attrbase import AttributeBase from .attrbase import AttributeBase
from .datebase import DateBase from .datebase import DateBase
from .placebase import PlaceBase from .placebase import PlaceBase
from .tagbase import TagBase
from .eventtype import EventType from .eventtype import EventType
from .handle import Handle from .handle import Handle
@ -116,7 +117,7 @@ class Event(CitationBase, NoteBase, MediaBase, AttributeBase,
NoteBase.serialize(self), NoteBase.serialize(self),
MediaBase.serialize(self), MediaBase.serialize(self),
AttributeBase.serialize(self), AttributeBase.serialize(self),
self.change, self.private) self.change, TagBase.serialize(self), self.private)
def to_struct(self): def to_struct(self):
""" """
@ -149,6 +150,7 @@ class Event(CitationBase, NoteBase, MediaBase, AttributeBase,
"media_list": MediaBase.to_struct(self), "media_list": MediaBase.to_struct(self),
"attribute_list": AttributeBase.to_struct(self), "attribute_list": AttributeBase.to_struct(self),
"change": self.change, "change": self.change,
"tag_list": TagBase.to_struct(self),
"private": self.private} "private": self.private}
def unserialize(self, data): def unserialize(self, data):
@ -163,7 +165,7 @@ class Event(CitationBase, NoteBase, MediaBase, AttributeBase,
(self.handle, self.gramps_id, the_type, date, (self.handle, self.gramps_id, the_type, date,
self.__description, self.place, self.__description, self.place,
citation_list, note_list, media_list, attribute_list, citation_list, note_list, media_list, attribute_list,
self.change, self.private) = data self.change, tag_list, self.private) = data
self.__type = EventType() self.__type = EventType()
self.__type.unserialize(the_type) self.__type.unserialize(the_type)
@ -172,6 +174,7 @@ class Event(CitationBase, NoteBase, MediaBase, AttributeBase,
AttributeBase.unserialize(self, attribute_list) AttributeBase.unserialize(self, attribute_list)
CitationBase.unserialize(self, citation_list) CitationBase.unserialize(self, citation_list)
NoteBase.unserialize(self, note_list) NoteBase.unserialize(self, note_list)
TagBase.unserialize(self, tag_list)
return self return self
def _has_handle_reference(self, classname, handle): def _has_handle_reference(self, classname, handle):
@ -263,8 +266,9 @@ class Event(CitationBase, NoteBase, MediaBase, AttributeBase,
:returns: List of (classname, handle) tuples for referenced objects. :returns: List of (classname, handle) tuples for referenced objects.
:rtype: list :rtype: list
""" """
ret = self.get_referenced_note_handles() + \ ret = (self.get_referenced_note_handles() +
self.get_referenced_citation_handles() self.get_referenced_citation_handles() +
self.get_referenced_tag_handles())
if self.place: if self.place:
ret.append(('Place', self.place)) ret.append(('Place', self.place))
return ret return ret
@ -338,6 +342,7 @@ class Event(CitationBase, NoteBase, MediaBase, AttributeBase,
self._merge_note_list(acquisition) self._merge_note_list(acquisition)
self._merge_citation_list(acquisition) self._merge_citation_list(acquisition)
self._merge_media_list(acquisition) self._merge_media_list(acquisition)
self._merge_tag_list(acquisition)
def set_type(self, the_type): def set_type(self, the_type):
""" """

View File

@ -60,7 +60,7 @@ from .handle import Handle
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class Family(CitationBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase, class Family(CitationBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
TagBase, PrimaryObject): PrimaryObject):
""" """
The Family record is the GRAMPS in-memory representation of the The Family record is the GRAMPS in-memory representation of the
relationships between people. It contains all the information relationships between people. It contains all the information
@ -91,7 +91,6 @@ class Family(CitationBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
MediaBase.__init__(self) MediaBase.__init__(self)
AttributeBase.__init__(self) AttributeBase.__init__(self)
LdsOrdBase.__init__(self) LdsOrdBase.__init__(self)
TagBase.__init__(self)
self.father_handle = None self.father_handle = None
self.mother_handle = None self.mother_handle = None
self.child_ref_list = [] self.child_ref_list = []

View File

@ -60,7 +60,7 @@ from .handle import Handle
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class MediaObject(CitationBase, NoteBase, DateBase, AttributeBase, class MediaObject(CitationBase, NoteBase, DateBase, AttributeBase,
TagBase, PrimaryObject): PrimaryObject):
""" """
Container for information about an image file, including location, Container for information about an image file, including location,
description and privacy. description and privacy.
@ -81,7 +81,6 @@ class MediaObject(CitationBase, NoteBase, DateBase, AttributeBase,
NoteBase.__init__(self, source) NoteBase.__init__(self, source)
DateBase.__init__(self, source) DateBase.__init__(self, source)
AttributeBase.__init__(self, source) AttributeBase.__init__(self, source)
TagBase.__init__(self)
if source: if source:
self.path = source.path self.path = source.path

View File

@ -43,7 +43,7 @@ from .handle import Handle
# Class for notes used throughout the majority of GRAMPS objects # Class for notes used throughout the majority of GRAMPS objects
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class Note(BasicPrimaryObject, TagBase): class Note(BasicPrimaryObject):
"""Define a text note. """Define a text note.
Starting from GRAMPS 3.1 Note object stores the text in :class:`gen.lib.styledtext.StyledText` Starting from GRAMPS 3.1 Note object stores the text in :class:`gen.lib.styledtext.StyledText`
@ -83,7 +83,6 @@ class Note(BasicPrimaryObject, TagBase):
def __init__(self, text=""): def __init__(self, text=""):
"""Create a new Note object, initializing from the passed string.""" """Create a new Note object, initializing from the passed string."""
BasicPrimaryObject.__init__(self) BasicPrimaryObject.__init__(self)
TagBase.__init__(self)
self.text = StyledText(text) self.text = StyledText(text)
self.format = Note.FLOWED self.format = Note.FLOWED
self.type = NoteType() self.type = NoteType()

View File

@ -60,7 +60,7 @@ from .handle import Handle
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class Person(CitationBase, NoteBase, AttributeBase, MediaBase, class Person(CitationBase, NoteBase, AttributeBase, MediaBase,
AddressBase, UrlBase, LdsOrdBase, TagBase, PrimaryObject): AddressBase, UrlBase, LdsOrdBase, PrimaryObject):
""" """
The Person record is the GRAMPS in-memory representation of an The Person record is the GRAMPS in-memory representation of an
individual person. It contains all the information related to individual person. It contains all the information related to
@ -98,7 +98,6 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase,
AddressBase.__init__(self) AddressBase.__init__(self)
UrlBase.__init__(self) UrlBase.__init__(self)
LdsOrdBase.__init__(self) LdsOrdBase.__init__(self)
TagBase.__init__(self)
self.primary_name = Name() self.primary_name = Name()
self.event_ref_list = [] self.event_ref_list = []
self.family_list = [] self.family_list = []

View File

@ -37,6 +37,7 @@ from .citationbase import CitationBase
from .notebase import NoteBase from .notebase import NoteBase
from .mediabase import MediaBase from .mediabase import MediaBase
from .urlbase import UrlBase from .urlbase import UrlBase
from .tagbase import TagBase
from .location import Location from .location import Location
from .handle import Handle from .handle import Handle
@ -109,7 +110,7 @@ class Place(CitationBase, NoteBase, MediaBase, UrlBase, PrimaryObject):
MediaBase.serialize(self), MediaBase.serialize(self),
CitationBase.serialize(self), CitationBase.serialize(self),
NoteBase.serialize(self), NoteBase.serialize(self),
self.change, self.private) self.change, TagBase.serialize(self), self.private)
def to_struct(self): def to_struct(self):
""" """
@ -148,6 +149,7 @@ class Place(CitationBase, NoteBase, MediaBase, UrlBase, PrimaryObject):
"citation_list": CitationBase.to_struct(self), "citation_list": CitationBase.to_struct(self),
"note_list": NoteBase.to_struct(self), "note_list": NoteBase.to_struct(self),
"change": self.change, "change": self.change,
"tag_list": TagBase.to_struct(self),
"private": self.private} "private": self.private}
def unserialize(self, data): def unserialize(self, data):
@ -161,7 +163,7 @@ class Place(CitationBase, NoteBase, MediaBase, UrlBase, PrimaryObject):
""" """
(self.handle, self.gramps_id, self.title, self.long, self.lat, (self.handle, self.gramps_id, self.title, self.long, self.lat,
main_loc, alt_loc, urls, media_list, citation_list, note_list, main_loc, alt_loc, urls, media_list, citation_list, note_list,
self.change, self.private) = data self.change, tag_list, self.private) = data
if main_loc is None: if main_loc is None:
self.main_loc = None self.main_loc = None
@ -172,6 +174,7 @@ class Place(CitationBase, NoteBase, MediaBase, UrlBase, PrimaryObject):
MediaBase.unserialize(self, media_list) MediaBase.unserialize(self, media_list)
CitationBase.unserialize(self, citation_list) CitationBase.unserialize(self, citation_list)
NoteBase.unserialize(self, note_list) NoteBase.unserialize(self, note_list)
TagBase.unserialize(self, tag_list)
return self return self
def get_text_data_list(self): def get_text_data_list(self):
@ -233,8 +236,9 @@ class Place(CitationBase, NoteBase, MediaBase, UrlBase, PrimaryObject):
:returns: List of (classname, handle) tuples for referenced objects. :returns: List of (classname, handle) tuples for referenced objects.
:rtype: list :rtype: list
""" """
return self.get_referenced_note_handles() + \ return (self.get_referenced_note_handles() +
self.get_referenced_citation_handles() self.get_referenced_citation_handles() +
self.get_referenced_tag_handles())
def merge(self, acquisition): def merge(self, acquisition):
""" Merge the content of acquisition into this place. """ Merge the content of acquisition into this place.
@ -248,6 +252,7 @@ class Place(CitationBase, NoteBase, MediaBase, UrlBase, PrimaryObject):
self._merge_url_list(acquisition) self._merge_url_list(acquisition)
self._merge_note_list(acquisition) self._merge_note_list(acquisition)
self._merge_citation_list(acquisition) self._merge_citation_list(acquisition)
self._merge_tag_list(acquisition)
def set_title(self, title): def set_title(self, title):
""" """

View File

@ -34,13 +34,14 @@ from .tableobj import TableObject
from .privacybase import PrivacyBase from .privacybase import PrivacyBase
from .citationbase import CitationBase from .citationbase import CitationBase
from .mediabase import MediaBase from .mediabase import MediaBase
from .tagbase import TagBase
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Basic Primary Object class # Basic Primary Object class
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class BasicPrimaryObject(TableObject, PrivacyBase): class BasicPrimaryObject(TableObject, PrivacyBase, TagBase):
""" """
The BasicPrimaryObject is the base class for Note objects. The BasicPrimaryObject is the base class for Note objects.
@ -66,6 +67,7 @@ class BasicPrimaryObject(TableObject, PrivacyBase):
""" """
TableObject.__init__(self, source) TableObject.__init__(self, source)
PrivacyBase.__init__(self, source) PrivacyBase.__init__(self, source)
TagBase.__init__(self)
if source: if source:
self.gramps_id = source.gramps_id self.gramps_id = source.gramps_id
else: else:

View File

@ -35,6 +35,7 @@ from .primaryobj import PrimaryObject
from .notebase import NoteBase from .notebase import NoteBase
from .addressbase import AddressBase from .addressbase import AddressBase
from .urlbase import UrlBase from .urlbase import UrlBase
from .tagbase import TagBase
from .repotype import RepositoryType from .repotype import RepositoryType
from ..constfunc import cuni from ..constfunc import cuni
from .handle import Handle from .handle import Handle
@ -67,7 +68,7 @@ class Repository(NoteBase, AddressBase, UrlBase, PrimaryObject):
NoteBase.serialize(self), NoteBase.serialize(self),
AddressBase.serialize(self), AddressBase.serialize(self),
UrlBase.serialize(self), UrlBase.serialize(self),
self.change, self.private) self.change, TagBase.serialize(self), self.private)
def to_struct(self): def to_struct(self):
""" """
@ -97,6 +98,7 @@ class Repository(NoteBase, AddressBase, UrlBase, PrimaryObject):
"address_list": AddressBase.to_struct(self), "address_list": AddressBase.to_struct(self),
"urls": UrlBase.to_struct(self), "urls": UrlBase.to_struct(self),
"change": self.change, "change": self.change,
"tag_list": TagBase.to_struct(self),
"private": self.private} "private": self.private}
def unserialize(self, data): def unserialize(self, data):
@ -105,13 +107,14 @@ class Repository(NoteBase, AddressBase, UrlBase, PrimaryObject):
back into the data in a Repository structure. back into the data in a Repository structure.
""" """
(self.handle, self.gramps_id, the_type, self.name, note_list, (self.handle, self.gramps_id, the_type, self.name, note_list,
address_list, urls, self.change, self.private) = data address_list, urls, self.change, tag_list, self.private) = data
self.type = RepositoryType() self.type = RepositoryType()
self.type.unserialize(the_type) self.type.unserialize(the_type)
NoteBase.unserialize(self, note_list) NoteBase.unserialize(self, note_list)
AddressBase.unserialize(self, address_list) AddressBase.unserialize(self, address_list)
UrlBase.unserialize(self, urls) UrlBase.unserialize(self, urls)
TagBase.unserialize(self, tag_list)
return self return self
def get_text_data_list(self): def get_text_data_list(self):
@ -170,7 +173,8 @@ class Repository(NoteBase, AddressBase, UrlBase, PrimaryObject):
:returns: List of (classname, handle) tuples for referenced objects. :returns: List of (classname, handle) tuples for referenced objects.
:rtype: list :rtype: list
""" """
return self.get_referenced_note_handles() return (self.get_referenced_note_handles() +
self.get_referenced_tag_handles())
def has_citation_reference(self, citation_handle) : def has_citation_reference(self, citation_handle) :
""" """
@ -236,6 +240,7 @@ class Repository(NoteBase, AddressBase, UrlBase, PrimaryObject):
self._merge_address_list(acquisition) self._merge_address_list(acquisition)
self._merge_url_list(acquisition) self._merge_url_list(acquisition)
self._merge_note_list(acquisition) self._merge_note_list(acquisition)
self._merge_tag_list(acquisition)
def set_type(self, the_type): def set_type(self, the_type):
""" """

View File

@ -34,6 +34,7 @@ Source object for GRAMPS.
from .primaryobj import PrimaryObject from .primaryobj import PrimaryObject
from .mediabase import MediaBase from .mediabase import MediaBase
from .notebase import NoteBase from .notebase import NoteBase
from .tagbase import TagBase
from .reporef import RepoRef from .reporef import RepoRef
from .const import DIFFERENT, EQUAL, IDENTICAL from .const import DIFFERENT, EQUAL, IDENTICAL
from ..constfunc import cuni from ..constfunc import cuni
@ -69,7 +70,7 @@ class Source(MediaBase, NoteBase, PrimaryObject):
MediaBase.serialize(self), cuni(self.abbrev), MediaBase.serialize(self), cuni(self.abbrev),
self.change, self.datamap, self.change, self.datamap,
[rr.serialize() for rr in self.reporef_list], [rr.serialize() for rr in self.reporef_list],
self.private) TagBase.serialize(self), self.private)
def to_struct(self): def to_struct(self):
""" """
@ -102,6 +103,7 @@ class Source(MediaBase, NoteBase, PrimaryObject):
"change": self.change, "change": self.change,
"datamap": {"dict": self.datamap}, "datamap": {"dict": self.datamap},
"reporef_list": [rr.to_struct() for rr in self.reporef_list], "reporef_list": [rr.to_struct() for rr in self.reporef_list],
"tag_list": TagBase.to_struct(self),
"private": self.private} "private": self.private}
def unserialize(self, data): def unserialize(self, data):
@ -112,10 +114,11 @@ class Source(MediaBase, NoteBase, PrimaryObject):
(self.handle, self.gramps_id, self.title, self.author, (self.handle, self.gramps_id, self.title, self.author,
self.pubinfo, note_list, media_list, self.pubinfo, note_list, media_list,
self.abbrev, self.change, self.datamap, reporef_list, self.abbrev, self.change, self.datamap, reporef_list,
self.private) = data tag_list, self.private) = data
NoteBase.unserialize(self, note_list) NoteBase.unserialize(self, note_list)
MediaBase.unserialize(self, media_list) MediaBase.unserialize(self, media_list)
TagBase.unserialize(self, tag_list)
self.reporef_list = [RepoRef().unserialize(item) for item in reporef_list] self.reporef_list = [RepoRef().unserialize(item) for item in reporef_list]
return self return self
@ -225,7 +228,8 @@ class Source(MediaBase, NoteBase, PrimaryObject):
:returns: List of (classname, handle) tuples for referenced objects. :returns: List of (classname, handle) tuples for referenced objects.
:rtype: list :rtype: list
""" """
return self.get_referenced_note_handles() return (self.get_referenced_note_handles() +
self.get_referenced_tag_handles())
def merge(self, acquisition): def merge(self, acquisition):
""" """
@ -237,6 +241,7 @@ class Source(MediaBase, NoteBase, PrimaryObject):
self._merge_privacy(acquisition) self._merge_privacy(acquisition)
self._merge_note_list(acquisition) self._merge_note_list(acquisition)
self._merge_media_list(acquisition) self._merge_media_list(acquisition)
self._merge_tag_list(acquisition)
my_datamap = self.get_data_map() my_datamap = self.get_data_map()
acquisition_map = acquisition.get_data_map() acquisition_map = acquisition.get_data_map()
for key in acquisition.get_data_map(): for key in acquisition.get_data_map():

View File

@ -46,9 +46,9 @@ from gramps.gen.db import DbTxn
from .editprimary import EditPrimary from .editprimary import EditPrimary
from .displaytabs import (NoteTab, GalleryTab, DataEmbedList, from .displaytabs import (NoteTab, GalleryTab, DataEmbedList,
SourceBackRefList, RepoEmbedList, CitationBackRefList) SourceBackRefList, RepoEmbedList, CitationBackRefList)
from ..widgets import (MonitoredEntry, PrivacyButton, MonitoredMenu, from ..widgets import (MonitoredEntry, PrivacyButton, MonitoredMenu,
MonitoredDate) MonitoredDate, MonitoredTagList)
from ..dialog import ErrorDialog from ..dialog import ErrorDialog
from .editreference import RefTab from .editreference import RefTab
from ..glade import Glade from ..glade import Glade
@ -277,6 +277,15 @@ class EditCitation(EditPrimary):
(_('Very High'), Citation.CONF_VERY_HIGH)], (_('Very High'), Citation.CONF_VERY_HIGH)],
self.db.readonly) self.db.readonly)
self.tags2 = MonitoredTagList(
self.glade.get_object("tag_label2"),
self.glade.get_object("tag_button2"),
self.obj.set_tag_list,
self.obj.get_tag_list,
self.db,
self.uistate, self.track,
self.db.readonly)
self.ref_privacy = PrivacyButton( self.ref_privacy = PrivacyButton(
self.glade.get_object('privacy'), self.obj, self.db.readonly) self.glade.get_object('privacy'), self.obj, self.db.readonly)
@ -296,6 +305,15 @@ class EditCitation(EditPrimary):
self.glade.get_object('gid'), self.source.set_gramps_id, self.glade.get_object('gid'), self.source.set_gramps_id,
self.source.get_gramps_id,self.db.readonly) self.source.get_gramps_id,self.db.readonly)
self.tags = MonitoredTagList(
self.glade.get_object("tag_label"),
self.glade.get_object("tag_button"),
self.source.set_tag_list,
self.source.get_tag_list,
self.db,
self.uistate, self.track,
self.db.readonly)
self.source_privacy = PrivacyButton( self.source_privacy = PrivacyButton(
self.glade.get_object("private"), self.glade.get_object("private"),
self.source, self.db.readonly) self.source, self.db.readonly)

View File

@ -51,9 +51,9 @@ from .objectentries import PlaceEntry
from ..glade import Glade from ..glade import Glade
from ..dialog import ErrorDialog from ..dialog import ErrorDialog
from .displaytabs import (CitationEmbedList, NoteTab, GalleryTab, from .displaytabs import (CitationEmbedList, NoteTab, GalleryTab,
EventBackRefList, AttrEmbedList) EventBackRefList, AttrEmbedList)
from ..widgets import (MonitoredEntry, PrivacyButton, from ..widgets import (MonitoredEntry, PrivacyButton, MonitoredDataType,
MonitoredDataType, MonitoredDate) MonitoredDate, MonitoredTagList)
from gramps.gen.utils.db import get_participant_from_event from gramps.gen.utils.db import get_participant_from_event
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -153,8 +153,16 @@ class EditEvent(EditPrimary):
self.obj.set_gramps_id, self.obj.set_gramps_id,
self.obj.get_gramps_id, self.db.readonly) self.obj.get_gramps_id, self.db.readonly)
self.priv = PrivacyButton( self.top.get_object("private"), self.tags = MonitoredTagList(self.top.get_object("tag_label"),
self.obj, self.db.readonly) 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"),
self.obj, self.db.readonly)
self.event_menu = MonitoredDataType(self.top.get_object("personal_events"), self.event_menu = MonitoredDataType(self.top.get_object("personal_events"),
self.obj.set_type, self.obj.set_type,

View File

@ -52,7 +52,7 @@ from gramps.gen.db import DbTxn
from .editprimary import EditPrimary from .editprimary import EditPrimary
from .displaytabs import (GrampsTab, LocationEmbedList, CitationEmbedList, from .displaytabs import (GrampsTab, LocationEmbedList, CitationEmbedList,
GalleryTab, NoteTab, WebEmbedList, PlaceBackRefList) GalleryTab, NoteTab, WebEmbedList, PlaceBackRefList)
from ..widgets import MonitoredEntry, PrivacyButton from ..widgets import MonitoredEntry, PrivacyButton, MonitoredTagList
from gramps.gen.errors import ValidationError from gramps.gen.errors import ValidationError
from gramps.gen.utils.place import conv_lat_lon from gramps.gen.utils.place import conv_lat_lon
from ..dialog import ErrorDialog from ..dialog import ErrorDialog
@ -177,6 +177,14 @@ class EditPlace(EditPrimary):
self.obj.set_gramps_id, self.obj.set_gramps_id,
self.obj.get_gramps_id, self.db.readonly) self.obj.get_gramps_id, self.db.readonly)
self.tags = MonitoredTagList(self.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.privacy = PrivacyButton(self.top.get_object("private"), self.obj, self.privacy = PrivacyButton(self.top.get_object("private"), self.obj,
self.db.readonly) self.db.readonly)

View File

@ -44,7 +44,8 @@ from gi.repository import Gtk
from gramps.gen.lib import NoteType, Repository from gramps.gen.lib import NoteType, Repository
from gramps.gen.db import DbTxn from gramps.gen.db import DbTxn
from ..widgets import MonitoredEntry, MonitoredDataType, PrivacyButton from ..widgets import (MonitoredEntry, MonitoredDataType, PrivacyButton,
MonitoredTagList)
from .displaytabs import AddrEmbedList, WebEmbedList, NoteTab, SourceBackRefList from .displaytabs import AddrEmbedList, WebEmbedList, NoteTab, SourceBackRefList
from .editprimary import EditPrimary from .editprimary import EditPrimary
from ..dialog import ErrorDialog from ..dialog import ErrorDialog
@ -93,14 +94,21 @@ class EditRepository(EditPrimary):
self.type = MonitoredDataType(self.glade.get_object("repository_type"), self.type = MonitoredDataType(self.glade.get_object("repository_type"),
self.obj.set_type, self.obj.get_type, self.obj.set_type, self.obj.get_type,
self.db.readonly, self.db.readonly,
self.db.get_repository_types(), self.db.get_repository_types())
)
self.call_number = MonitoredEntry(self.glade.get_object('gid'), self.call_number = MonitoredEntry(self.glade.get_object('gid'),
self.obj.set_gramps_id, self.obj.set_gramps_id,
self.obj.get_gramps_id, self.obj.get_gramps_id,
self.db.readonly) self.db.readonly)
self.tags = MonitoredTagList(self.glade.get_object("tag_label"),
self.glade.get_object("tag_button"),
self.obj.set_tag_list,
self.obj.get_tag_list,
self.db,
self.uistate, self.track,
self.db.readonly)
self.privacy = PrivacyButton(self.glade.get_object("private"), self.privacy = PrivacyButton(self.glade.get_object("private"),
self.obj, self.db.readonly) self.obj, self.db.readonly)

View File

@ -50,8 +50,8 @@ from gramps.gen.db import DbTxn
from .editprimary import EditPrimary from .editprimary import EditPrimary
from .displaytabs import (NoteTab, GalleryTab, DataEmbedList, from .displaytabs import (NoteTab, GalleryTab, DataEmbedList,
CitationBackRefList, RepoEmbedList) CitationBackRefList, RepoEmbedList)
from ..widgets import MonitoredEntry, PrivacyButton from ..widgets import MonitoredEntry, PrivacyButton, MonitoredTagList
from ..dialog import ErrorDialog from ..dialog import ErrorDialog
from ..glade import Glade from ..glade import Glade
@ -116,6 +116,14 @@ class EditSource(EditPrimary):
self.obj.set_gramps_id, self.obj.set_gramps_id,
self.obj.get_gramps_id, self.db.readonly) self.obj.get_gramps_id, self.db.readonly)
self.tags = MonitoredTagList(self.glade.get_object("tag_label"),
self.glade.get_object("tag_button"),
self.obj.set_tag_list,
self.obj.get_tag_list,
self.db,
self.uistate, self.track,
self.db.readonly)
self.priv = PrivacyButton(self.glade.get_object("private"), self.obj, self.priv = PrivacyButton(self.glade.get_object("private"), self.obj,
self.db.readonly) self.db.readonly)

View File

@ -49,7 +49,7 @@ from gramps.gen.constfunc import cuni
from gramps.gen.filters import GenericFilterFactory, rules from gramps.gen.filters import GenericFilterFactory, rules
from gramps.gen.filters.rules.citation import (RegExpIdOf, HasIdOf, HasCitation, from gramps.gen.filters.rules.citation import (RegExpIdOf, HasIdOf, HasCitation,
HasNoteMatchingSubstringOf, HasNoteMatchingSubstringOf,
HasNoteRegexp, MatchesFilter) HasNoteRegexp, MatchesFilter, HasTag)
from gramps.gen.utils.string import confidence from gramps.gen.utils.string import confidence
GenericCitationFilter = GenericFilterFactory('Citation') GenericCitationFilter = GenericFilterFactory('Citation')
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -76,6 +76,7 @@ class CitationSidebarFilter(SidebarFilter):
self.filter_regex = Gtk.CheckButton(_('Use regular expressions')) self.filter_regex = Gtk.CheckButton(_('Use regular expressions'))
self.tag = Gtk.ComboBox()
self.generic = Gtk.ComboBox() self.generic = Gtk.ComboBox()
SidebarFilter.__init__(self, dbstate, uistate, "Citation") SidebarFilter.__init__(self, dbstate, uistate, "Citation")
@ -94,11 +95,18 @@ class CitationSidebarFilter(SidebarFilter):
self.filter_conf.pack_start(cell, True) self.filter_conf.pack_start(cell, True)
self.filter_conf.add_attribute(cell, 'text', 0) self.filter_conf.add_attribute(cell, 'text', 0)
cell = Gtk.CellRendererText()
cell.set_property('width', self._FILTER_WIDTH)
cell.set_property('ellipsize', self._FILTER_ELLIPSIZE)
self.tag.pack_start(cell, True)
self.tag.add_attribute(cell, 'text', 0)
self.add_text_entry(_('ID'), self.filter_id) self.add_text_entry(_('ID'), self.filter_id)
self.add_text_entry(_('Volume/Page'), self.filter_page) self.add_text_entry(_('Volume/Page'), self.filter_page)
self.add_text_entry(_('Date'), self.filter_date) self.add_text_entry(_('Date'), self.filter_date)
self.add_entry(_('Confidence'), self.filter_conf) self.add_entry(_('Confidence'), self.filter_conf)
self.add_text_entry(_('Note'), self.filter_note) self.add_text_entry(_('Note'), self.filter_note)
self.add_entry(_('Tag'), self.tag)
self.add_filter_entry(_('Custom filter'), self.generic) self.add_filter_entry(_('Custom filter'), self.generic)
self.add_entry(None, self.filter_regex) self.add_entry(None, self.filter_regex)
@ -108,6 +116,7 @@ class CitationSidebarFilter(SidebarFilter):
self.filter_date.set_text('') self.filter_date.set_text('')
self.filter_conf.set_active(2) self.filter_conf.set_active(2)
self.filter_note.set_text('') self.filter_note.set_text('')
self.tag.set_active(0)
self.generic.set_active(0) self.generic.set_active(0)
def get_filter(self): def get_filter(self):
@ -125,9 +134,10 @@ class CitationSidebarFilter(SidebarFilter):
# conf = self.citn.get_confidence_level() # conf = self.citn.get_confidence_level()
note = cuni(self.filter_note.get_text()).strip() note = cuni(self.filter_note.get_text()).strip()
regex = self.filter_regex.get_active() regex = self.filter_regex.get_active()
tag = self.tag.get_active() > 0
gen = self.generic.get_active() > 0 gen = self.generic.get_active() > 0
empty = not (gid or page or date or conf or note or regex or gen) empty = not (gid or page or date or conf or note or regex or tag or gen)
if empty: if empty:
generic_filter = None generic_filter = None
else: else:
@ -149,12 +159,20 @@ class CitationSidebarFilter(SidebarFilter):
rule = HasNoteMatchingSubstringOf([note]) rule = HasNoteMatchingSubstringOf([note])
generic_filter.add_rule(rule) generic_filter.add_rule(rule)
if self.generic.get_active() != 0: # check the Tag
model = self.generic.get_model() if tag:
node = self.generic.get_active_iter() model = self.tag.get_model()
obj = cuni(model.get_value(node, 0)) node = self.tag.get_active_iter()
rule = MatchesFilter([obj]) attr = model.get_value(node, 0)
generic_filter.add_rule(rule) 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()
obj = cuni(model.get_value(node, 0))
rule = MatchesFilter([obj])
generic_filter.add_rule(rule)
return generic_filter return generic_filter
@ -165,3 +183,14 @@ class CitationSidebarFilter(SidebarFilter):
all_filter.add_rule(rules.citation.AllCitations([])) all_filter.add_rule(rules.citation.AllCitations([]))
self.generic.set_model(build_filter_model('Citation', [all_filter])) self.generic.set_model(build_filter_model('Citation', [all_filter]))
self.generic.set_active(0) self.generic.set_active(0)
def on_tags_changed(self, tag_list):
"""
Update the list of tags in the tag filter.
"""
model = Gtk.ListStore(str)
model.append(('',))
for tag_name in tag_list:
model.append((tag_name,))
self.tag.set_model(model)
self.tag.set_active(0)

View File

@ -48,7 +48,7 @@ from gramps.gen.constfunc import cuni
from gramps.gen.filters import GenericFilterFactory, rules from gramps.gen.filters import GenericFilterFactory, rules
from gramps.gen.filters.rules.event import (RegExpIdOf, HasIdOf, HasNoteRegexp, from gramps.gen.filters.rules.event import (RegExpIdOf, HasIdOf, HasNoteRegexp,
HasNoteMatchingSubstringOf, MatchesFilter, HasNoteMatchingSubstringOf, MatchesFilter,
HasEvent) HasEvent, HasTag)
GenericEventFilter = GenericFilterFactory('Event') GenericEventFilter = GenericFilterFactory('Event')
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -78,6 +78,7 @@ class EventSidebarFilter(SidebarFilter):
self.filter_regex = Gtk.CheckButton(_('Use regular expressions')) self.filter_regex = Gtk.CheckButton(_('Use regular expressions'))
self.tag = Gtk.ComboBox()
self.generic = Gtk.ComboBox() self.generic = Gtk.ComboBox()
SidebarFilter.__init__(self, dbstate, uistate, "Event") SidebarFilter.__init__(self, dbstate, uistate, "Event")
@ -90,6 +91,12 @@ class EventSidebarFilter(SidebarFilter):
self.generic.add_attribute(cell, 'text', 0) self.generic.add_attribute(cell, 'text', 0)
self.on_filters_changed('Event') self.on_filters_changed('Event')
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.etype.get_child().set_width_chars(5) self.etype.get_child().set_width_chars(5)
self.add_text_entry(_('ID'), self.filter_id) self.add_text_entry(_('ID'), self.filter_id)
@ -99,6 +106,7 @@ class EventSidebarFilter(SidebarFilter):
self.add_text_entry(_('Date'), self.filter_date) self.add_text_entry(_('Date'), self.filter_date)
self.add_text_entry(_('Place'), self.filter_place) self.add_text_entry(_('Place'), self.filter_place)
self.add_text_entry(_('Note'), self.filter_note) self.add_text_entry(_('Note'), self.filter_note)
self.add_entry(_('Tag'), self.tag)
self.add_filter_entry(_('Custom filter'), self.generic) self.add_filter_entry(_('Custom filter'), self.generic)
self.add_regex_entry(self.filter_regex) self.add_regex_entry(self.filter_regex)
@ -110,6 +118,7 @@ class EventSidebarFilter(SidebarFilter):
self.filter_place.set_text('') self.filter_place.set_text('')
self.filter_note.set_text('') self.filter_note.set_text('')
self.etype.get_child().set_text('') self.etype.get_child().set_text('')
self.tag.set_active(0)
self.generic.set_active(0) self.generic.set_active(0)
def get_filter(self): def get_filter(self):
@ -120,11 +129,12 @@ class EventSidebarFilter(SidebarFilter):
place = cuni(self.filter_place.get_text()).strip() place = cuni(self.filter_place.get_text()).strip()
note = cuni(self.filter_note.get_text()).strip() note = cuni(self.filter_note.get_text()).strip()
regex = self.filter_regex.get_active() regex = self.filter_regex.get_active()
tag = self.tag.get_active() > 0
generic = self.generic.get_active() > 0 generic = self.generic.get_active() > 0
etype = self.filter_event.get_type().xml_str() etype = self.filter_event.get_type().xml_str()
empty = not (gid or desc or mainparts or date or place or note empty = not (gid or desc or mainparts or date or place or note
or etype or regex or generic) or etype or regex or tag or generic)
if empty: if empty:
generic_filter = None generic_filter = None
else: else:
@ -147,12 +157,20 @@ class EventSidebarFilter(SidebarFilter):
rule = HasNoteMatchingSubstringOf([note]) rule = HasNoteMatchingSubstringOf([note])
generic_filter.add_rule(rule) generic_filter.add_rule(rule)
if self.generic.get_active() != 0: # check the Tag
model = self.generic.get_model() if tag:
node = self.generic.get_active_iter() model = self.tag.get_model()
obj = cuni(model.get_value(node, 0)) node = self.tag.get_active_iter()
rule = MatchesFilter([obj]) attr = model.get_value(node, 0)
generic_filter.add_rule(rule) 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()
obj = cuni(model.get_value(node, 0))
rule = MatchesFilter([obj])
generic_filter.add_rule(rule)
return generic_filter return generic_filter
@ -163,3 +181,14 @@ class EventSidebarFilter(SidebarFilter):
all_filter.add_rule(rules.event.AllEvents([])) all_filter.add_rule(rules.event.AllEvents([]))
self.generic.set_model(build_filter_model('Event', [all_filter])) self.generic.set_model(build_filter_model('Event', [all_filter]))
self.generic.set_active(0) self.generic.set_active(0)
def on_tags_changed(self, tag_list):
"""
Update the list of tags in the tag filter.
"""
model = Gtk.ListStore(str)
model.append(('',))
for tag_name in tag_list:
model.append((tag_name,))
self.tag.set_model(model)
self.tag.set_active(0)

View File

@ -49,7 +49,7 @@ from gramps.gen.constfunc import cuni
from gramps.gen.filters import GenericFilterFactory, rules from gramps.gen.filters import GenericFilterFactory, rules
from gramps.gen.filters.rules.place import (RegExpIdOf, HasIdOf, HasPlace, from gramps.gen.filters.rules.place import (RegExpIdOf, HasIdOf, HasPlace,
HasNoteRegexp, HasNoteMatchingSubstringOf, HasNoteRegexp, HasNoteMatchingSubstringOf,
MatchesFilter) MatchesFilter, HasTag)
GenericPlaceFilter = GenericFilterFactory('Place') GenericPlaceFilter = GenericFilterFactory('Place')
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -75,6 +75,7 @@ class PlaceSidebarFilter(SidebarFilter):
self.filter_note = widgets.BasicEntry() self.filter_note = widgets.BasicEntry()
self.filter_regex = Gtk.CheckButton(_('Use regular expressions')) self.filter_regex = Gtk.CheckButton(_('Use regular expressions'))
self.tag = Gtk.ComboBox()
self.generic = Gtk.ComboBox() self.generic = Gtk.ComboBox()
SidebarFilter.__init__(self, dbstate, uistate, "Place") SidebarFilter.__init__(self, dbstate, uistate, "Place")
@ -87,6 +88,12 @@ class PlaceSidebarFilter(SidebarFilter):
self.generic.add_attribute(cell, 'text', 0) self.generic.add_attribute(cell, 'text', 0)
self.on_filters_changed('Place') self.on_filters_changed('Place')
cell = Gtk.CellRendererText()
cell.set_property('width', self._FILTER_WIDTH)
cell.set_property('ellipsize', self._FILTER_ELLIPSIZE)
self.tag.pack_start(cell, True)
self.tag.add_attribute(cell, 'text', 0)
self.add_text_entry(_('ID'), self.filter_id) self.add_text_entry(_('ID'), self.filter_id)
self.add_text_entry(_('Place Name'), self.filter_title) self.add_text_entry(_('Place Name'), self.filter_title)
self.add_text_entry(_('Street'), self.filter_street) self.add_text_entry(_('Street'), self.filter_street)
@ -98,6 +105,7 @@ class PlaceSidebarFilter(SidebarFilter):
self.add_text_entry(_('ZIP/Postal code'), self.filter_zip) self.add_text_entry(_('ZIP/Postal code'), self.filter_zip)
self.add_text_entry(_('Church parish'), self.filter_parish) self.add_text_entry(_('Church parish'), self.filter_parish)
self.add_text_entry(_('Note'), self.filter_note) self.add_text_entry(_('Note'), self.filter_note)
self.add_entry(_('Tag'), self.tag)
self.add_filter_entry(_('Custom filter'), self.generic) self.add_filter_entry(_('Custom filter'), self.generic)
self.add_regex_entry(self.filter_regex) self.add_regex_entry(self.filter_regex)
@ -113,6 +121,7 @@ class PlaceSidebarFilter(SidebarFilter):
self.filter_zip.set_text('') self.filter_zip.set_text('')
self.filter_parish.set_text('') self.filter_parish.set_text('')
self.filter_note.set_text('') self.filter_note.set_text('')
self.tag.set_active(0)
self.generic.set_active(0) self.generic.set_active(0)
def get_filter(self): def get_filter(self):
@ -128,10 +137,12 @@ class PlaceSidebarFilter(SidebarFilter):
parish = cuni(self.filter_parish.get_text()).strip() parish = cuni(self.filter_parish.get_text()).strip()
note = cuni(self.filter_note.get_text()).strip() note = cuni(self.filter_note.get_text()).strip()
regex = self.filter_regex.get_active() regex = self.filter_regex.get_active()
tag = self.tag.get_active() > 0
gen = self.generic.get_active() > 0 gen = self.generic.get_active() > 0
empty = not (gid or title or street or locality or city or county or empty = not (gid or title or street or locality or city or county or
state or country or zipc or parish or note or regex or gen) state or country or zipc or parish or note or regex or tag
or gen)
if empty: if empty:
generic_filter = None generic_filter = None
else: else:
@ -154,6 +165,14 @@ class PlaceSidebarFilter(SidebarFilter):
rule = HasNoteMatchingSubstringOf([note]) rule = HasNoteMatchingSubstringOf([note])
generic_filter.add_rule(rule) generic_filter.add_rule(rule)
# check the Tag
if tag:
model = self.tag.get_model()
node = self.tag.get_active_iter()
attr = model.get_value(node, 0)
rule = HasTag([attr])
generic_filter.add_rule(rule)
if self.generic.get_active() != 0: if self.generic.get_active() != 0:
model = self.generic.get_model() model = self.generic.get_model()
node = self.generic.get_active_iter() node = self.generic.get_active_iter()
@ -170,3 +189,14 @@ class PlaceSidebarFilter(SidebarFilter):
all_filter.add_rule(rules.place.AllPlaces([])) all_filter.add_rule(rules.place.AllPlaces([]))
self.generic.set_model(build_filter_model('Place', [all_filter])) self.generic.set_model(build_filter_model('Place', [all_filter]))
self.generic.set_active(0) self.generic.set_active(0)
def on_tags_changed(self, tag_list):
"""
Update the list of tags in the tag filter.
"""
model = Gtk.ListStore(str)
model.append(('',))
for tag_name in tag_list:
model.append((tag_name,))
self.tag.set_model(model)
self.tag.set_active(0)

View File

@ -48,7 +48,7 @@ from gramps.gen.constfunc import cuni
from gramps.gen.filters import GenericFilterFactory, rules from gramps.gen.filters import GenericFilterFactory, rules
from gramps.gen.filters.rules.repository import (RegExpIdOf, HasIdOf, HasRepo, from gramps.gen.filters.rules.repository import (RegExpIdOf, HasIdOf, HasRepo,
HasNoteRegexp, MatchesFilter, HasNoteRegexp, MatchesFilter,
HasNoteMatchingSubstringOf) HasNoteMatchingSubstringOf, HasTag)
GenericRepoFilter = GenericFilterFactory('Repository') GenericRepoFilter = GenericFilterFactory('Repository')
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -77,6 +77,7 @@ class RepoSidebarFilter(SidebarFilter):
self.filter_regex = Gtk.CheckButton(_('Use regular expressions')) self.filter_regex = Gtk.CheckButton(_('Use regular expressions'))
self.tag = Gtk.ComboBox()
self.generic = Gtk.ComboBox() self.generic = Gtk.ComboBox()
SidebarFilter.__init__(self, dbstate, uistate, "Repository") SidebarFilter.__init__(self, dbstate, uistate, "Repository")
@ -89,6 +90,12 @@ class RepoSidebarFilter(SidebarFilter):
self.generic.add_attribute(cell, 'text', 0) self.generic.add_attribute(cell, 'text', 0)
self.on_filters_changed('Repository') self.on_filters_changed('Repository')
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.rtype.get_child().set_width_chars(5) self.rtype.get_child().set_width_chars(5)
self.add_text_entry(_('ID'), self.filter_id) self.add_text_entry(_('ID'), self.filter_id)
@ -97,6 +104,7 @@ class RepoSidebarFilter(SidebarFilter):
self.add_text_entry(_('Address'), self.filter_address) self.add_text_entry(_('Address'), self.filter_address)
self.add_text_entry(_('URL'), self.filter_url) self.add_text_entry(_('URL'), self.filter_url)
self.add_text_entry(_('Note'), self.filter_note) self.add_text_entry(_('Note'), self.filter_note)
self.add_entry(_('Tag'), self.tag)
self.add_filter_entry(_('Custom filter'), self.generic) self.add_filter_entry(_('Custom filter'), self.generic)
self.add_regex_entry(self.filter_regex) self.add_regex_entry(self.filter_regex)
@ -107,6 +115,7 @@ class RepoSidebarFilter(SidebarFilter):
self.filter_url.set_text('') self.filter_url.set_text('')
self.rtype.get_child().set_text('') self.rtype.get_child().set_text('')
self.filter_note.set_text('') self.filter_note.set_text('')
self.tag.set_active(0)
self.generic.set_active(0) self.generic.set_active(0)
def get_filter(self): def get_filter(self):
@ -117,10 +126,11 @@ class RepoSidebarFilter(SidebarFilter):
rtype = self.repo.get_type().xml_str() rtype = self.repo.get_type().xml_str()
note = cuni(self.filter_note.get_text()).strip() note = cuni(self.filter_note.get_text()).strip()
regex = self.filter_regex.get_active() regex = self.filter_regex.get_active()
tag = self.tag.get_active() > 0
gen = self.generic.get_active() > 0 gen = self.generic.get_active() > 0
empty = not (gid or title or address or url or rtype empty = not (gid or title or address or url or rtype
or note or regex or gen) or note or regex or tag or gen)
if empty: if empty:
generic_filter = None generic_filter = None
else: else:
@ -142,12 +152,20 @@ class RepoSidebarFilter(SidebarFilter):
rule = HasNoteMatchingSubstringOf([note]) rule = HasNoteMatchingSubstringOf([note])
generic_filter.add_rule(rule) generic_filter.add_rule(rule)
if self.generic.get_active() != 0: # check the Tag
model = self.generic.get_model() if tag:
node = self.generic.get_active_iter() model = self.tag.get_model()
obj = cuni(model.get_value(node, 0)) node = self.tag.get_active_iter()
rule = MatchesFilter([obj]) attr = model.get_value(node, 0)
generic_filter.add_rule(rule) 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()
obj = cuni(model.get_value(node, 0))
rule = MatchesFilter([obj])
generic_filter.add_rule(rule)
return generic_filter return generic_filter
@ -159,3 +177,14 @@ class RepoSidebarFilter(SidebarFilter):
self.generic.set_model(build_filter_model('Repository', self.generic.set_model(build_filter_model('Repository',
[all_filter])) [all_filter]))
self.generic.set_active(0) self.generic.set_active(0)
def on_tags_changed(self, tag_list):
"""
Update the list of tags in the tag filter.
"""
model = Gtk.ListStore(str)
model.append(('',))
for tag_name in tag_list:
model.append((tag_name,))
self.tag.set_model(model)
self.tag.set_active(0)

View File

@ -47,7 +47,7 @@ from gramps.gen.constfunc import cuni
from gramps.gen.filters import GenericFilterFactory, rules from gramps.gen.filters import GenericFilterFactory, rules
from gramps.gen.filters.rules.source import (RegExpIdOf, HasIdOf, HasSource, from gramps.gen.filters.rules.source import (RegExpIdOf, HasIdOf, HasSource,
HasNoteMatchingSubstringOf, HasNoteMatchingSubstringOf,
HasNoteRegexp, MatchesFilter) HasNoteRegexp, MatchesFilter, HasTag)
GenericSourceFilter = GenericFilterFactory('Source') GenericSourceFilter = GenericFilterFactory('Source')
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -68,6 +68,7 @@ class SourceSidebarFilter(SidebarFilter):
self.filter_regex = Gtk.CheckButton(_('Use regular expressions')) self.filter_regex = Gtk.CheckButton(_('Use regular expressions'))
self.tag = Gtk.ComboBox()
self.generic = Gtk.ComboBox() self.generic = Gtk.ComboBox()
SidebarFilter.__init__(self, dbstate, uistate, "Source") SidebarFilter.__init__(self, dbstate, uistate, "Source")
@ -80,12 +81,19 @@ class SourceSidebarFilter(SidebarFilter):
self.generic.add_attribute(cell, 'text', 0) self.generic.add_attribute(cell, 'text', 0)
self.on_filters_changed('Source') self.on_filters_changed('Source')
cell = Gtk.CellRendererText()
cell.set_property('width', self._FILTER_WIDTH)
cell.set_property('ellipsize', self._FILTER_ELLIPSIZE)
self.tag.pack_start(cell, True)
self.tag.add_attribute(cell, 'text', 0)
self.add_text_entry(_('ID'), self.filter_id) self.add_text_entry(_('ID'), self.filter_id)
self.add_text_entry(_('Title'), self.filter_title) self.add_text_entry(_('Title'), self.filter_title)
self.add_text_entry(_('Author'), self.filter_author) self.add_text_entry(_('Author'), self.filter_author)
self.add_text_entry(_('Abbreviation'), self.filter_abbr) self.add_text_entry(_('Abbreviation'), self.filter_abbr)
self.add_text_entry(_('Publication'), self.filter_pub) self.add_text_entry(_('Publication'), self.filter_pub)
self.add_text_entry(_('Note'), self.filter_note) self.add_text_entry(_('Note'), self.filter_note)
self.add_entry(_('Tag'), self.tag)
self.add_filter_entry(_('Custom filter'), self.generic) self.add_filter_entry(_('Custom filter'), self.generic)
self.add_regex_entry(self.filter_regex) self.add_regex_entry(self.filter_regex)
@ -96,6 +104,7 @@ class SourceSidebarFilter(SidebarFilter):
self.filter_abbr.set_text('') self.filter_abbr.set_text('')
self.filter_pub.set_text('') self.filter_pub.set_text('')
self.filter_note.set_text('') self.filter_note.set_text('')
self.tag.set_active(0)
self.generic.set_active(0) self.generic.set_active(0)
def get_filter(self): def get_filter(self):
@ -106,10 +115,11 @@ class SourceSidebarFilter(SidebarFilter):
pub = cuni(self.filter_pub.get_text()).strip() pub = cuni(self.filter_pub.get_text()).strip()
note = cuni(self.filter_note.get_text()).strip() note = cuni(self.filter_note.get_text()).strip()
regex = self.filter_regex.get_active() regex = self.filter_regex.get_active()
tag = self.tag.get_active() > 0
gen = self.generic.get_active() > 0 gen = self.generic.get_active() > 0
empty = not (gid or title or author or abbr or pub or note or regex or empty = not (gid or title or author or abbr or pub or note or regex
gen) or tag or gen)
if empty: if empty:
generic_filter = None generic_filter = None
else: else:
@ -131,12 +141,20 @@ class SourceSidebarFilter(SidebarFilter):
rule = HasNoteMatchingSubstringOf([note]) rule = HasNoteMatchingSubstringOf([note])
generic_filter.add_rule(rule) generic_filter.add_rule(rule)
if self.generic.get_active() != 0: # check the Tag
model = self.generic.get_model() if tag:
node = self.generic.get_active_iter() model = self.tag.get_model()
obj = cuni(model.get_value(node, 0)) node = self.tag.get_active_iter()
rule = MatchesFilter([obj]) attr = model.get_value(node, 0)
generic_filter.add_rule(rule) 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()
obj = cuni(model.get_value(node, 0))
rule = MatchesFilter([obj])
generic_filter.add_rule(rule)
return generic_filter return generic_filter
@ -147,3 +165,14 @@ class SourceSidebarFilter(SidebarFilter):
all_filter.add_rule(rules.source.AllSources([])) all_filter.add_rule(rules.source.AllSources([]))
self.generic.set_model(build_filter_model('Source', [all_filter])) self.generic.set_model(build_filter_model('Source', [all_filter]))
self.generic.set_active(0) self.generic.set_active(0)
def on_tags_changed(self, tag_list):
"""
Update the list of tags in the tag filter.
"""
model = Gtk.ListStore(str)
model.append(('',))
for tag_name in tag_list:
model.append((tag_name,))
self.tag.set_model(model)
self.tag.set_active(0)

View File

@ -23,12 +23,10 @@
<child> <child>
<object class="GtkButton" id="help"> <object class="GtkButton" id="help">
<property name="label">gtk-help</property> <property name="label">gtk-help</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="can_default">True</property> <property name="can_default">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
</object> </object>
<packing> <packing>
@ -40,12 +38,10 @@
<child> <child>
<object class="GtkButton" id="cancel"> <object class="GtkButton" id="cancel">
<property name="label">gtk-cancel</property> <property name="label">gtk-cancel</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="can_default">True</property> <property name="can_default">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
</object> </object>
<packing> <packing>
@ -57,12 +53,10 @@
<child> <child>
<object class="GtkButton" id="ok"> <object class="GtkButton" id="ok">
<property name="label">gtk-ok</property> <property name="label">gtk-ok</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="can_default">True</property> <property name="can_default">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
</object> </object>
<packing> <packing>
@ -114,12 +108,6 @@
<child> <child>
<placeholder/> <placeholder/>
</child> </child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child> <child>
<object class="GtkLabel" id="label612"> <object class="GtkLabel" id="label612">
<property name="visible">True</property> <property name="visible">True</property>
@ -137,13 +125,11 @@
</child> </child>
<child> <child>
<object class="GtkButton" id="date_stat"> <object class="GtkButton" id="date_stat">
<property name="use_action_appearance">False</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="has_tooltip">True</property> <property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes">Invoke date editor</property> <property name="tooltip_text" translatable="yes">Invoke date editor</property>
<property name="use_action_appearance">False</property>
<property name="relief">none</property> <property name="relief">none</property>
<accelerator key="d" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="d" signal="activate" modifiers="GDK_CONTROL_MASK"/>
<child internal-child="accessible"> <child internal-child="accessible">
@ -181,8 +167,8 @@
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="top_attach">2</property> <property name="top_attach">1</property>
<property name="bottom_attach">3</property> <property name="bottom_attach">2</property>
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>
</child> </child>
@ -197,8 +183,8 @@
<property name="mnemonic_widget">volume</property> <property name="mnemonic_widget">volume</property>
</object> </object>
<packing> <packing>
<property name="top_attach">2</property> <property name="top_attach">1</property>
<property name="bottom_attach">3</property> <property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>
@ -214,8 +200,8 @@
<property name="mnemonic_widget">confidence</property> <property name="mnemonic_widget">confidence</property>
</object> </object>
<packing> <packing>
<property name="top_attach">3</property> <property name="top_attach">2</property>
<property name="bottom_attach">4</property> <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>
@ -240,8 +226,8 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="top_attach">3</property> <property name="top_attach">2</property>
<property name="bottom_attach">4</property> <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>
@ -308,59 +294,53 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
<object class="GtkHBox" id="hbox1"> <object class="GtkHBox" id="hbox1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="spacing">12</property> <property name="spacing">6</property>
<child> <child>
<object class="UndoableEntry" id="gid2"> <object class="UndoableEntry" id="gid2">
<property name="width_request">75</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">A unique ID to identify the citation</property> <property name="tooltip_text" translatable="yes">A unique ID to identify the citation</property>
<property name="invisible_char">•</property> <property name="invisible_char">•</property>
<property name="width_chars">6</property>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkToggleButton" id="privacy"> <object class="GtkLabel" id="label3">
<property name="use_action_appearance">False</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">False</property>
<property name="receives_default">True</property> <property name="xalign">0</property>
<property name="use_action_appearance">False</property> <property name="label" translatable="yes">Tags:</property>
<property name="relief">none</property>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/>
<child internal-child="accessible">
<object class="AtkObject" id="privacy-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object>
</child>
<child>
<object class="GtkImage" id="image2677">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">gtk-dialog-authentication</property>
<child internal-child="accessible">
<object class="AtkObject" id="image2677-atkobject">
<property name="AtkObject::accessible-description" translatable="yes">Privacy</property>
</object>
</child>
</object>
</child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property> <property name="fill">True</property>
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel" id="tag_label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="top_attach">1</property> <property name="top_attach">3</property>
<property name="bottom_attach">2</property> <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>
@ -375,12 +355,63 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
<property name="mnemonic_widget">gid2</property> <property name="mnemonic_widget">gid2</property>
</object> </object>
<packing> <packing>
<property name="top_attach">1</property> <property name="top_attach">3</property>
<property name="bottom_attach">2</property> <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>
</child> </child>
<child>
<object class="GtkToggleButton" id="privacy">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="relief">none</property>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/>
<child internal-child="accessible">
<object class="AtkObject" id="privacy-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object>
</child>
<child>
<object class="GtkImage" id="image2677">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">gtk-dialog-authentication</property>
<child internal-child="accessible">
<object class="AtkObject" id="image2677-atkobject">
<property name="AtkObject::accessible-description" translatable="yes">Privacy</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options"/>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkButton" id="tag_button2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="xalign">0</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"/>
<property name="y_options"/>
</packing>
</child>
</object> </object>
</child> </child>
<child type="tab"> <child type="tab">
@ -419,7 +450,7 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="border_width">12</property> <property name="border_width">12</property>
<property name="n_rows">6</property> <property name="n_rows">6</property>
<property name="n_columns">2</property> <property name="n_columns">3</property>
<property name="column_spacing">12</property> <property name="column_spacing">12</property>
<property name="row_spacing">6</property> <property name="row_spacing">6</property>
<child> <child>
@ -483,8 +514,8 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
<property name="mnemonic_widget">pub_info</property> <property name="mnemonic_widget">pub_info</property>
</object> </object>
<packing> <packing>
<property name="top_attach">4</property> <property name="top_attach">2</property>
<property name="bottom_attach">5</property> <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>
@ -498,7 +529,7 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="right_attach">2</property> <property name="right_attach">3</property>
<property name="top_attach">1</property> <property name="top_attach">1</property>
<property name="bottom_attach">2</property> <property name="bottom_attach">2</property>
<property name="y_options"/> <property name="y_options"/>
@ -542,7 +573,7 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
</child> </child>
</object> </object>
<packing> <packing>
<property name="right_attach">2</property> <property name="right_attach">3</property>
<property name="top_attach">5</property> <property name="top_attach">5</property>
<property name="bottom_attach">6</property> <property name="bottom_attach">6</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property> <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
@ -573,9 +604,9 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="right_attach">2</property> <property name="right_attach">3</property>
<property name="top_attach">4</property> <property name="top_attach">2</property>
<property name="bottom_attach">5</property> <property name="bottom_attach">3</property>
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>
</child> </child>
@ -589,8 +620,8 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
<property name="mnemonic_widget">gid</property> <property name="mnemonic_widget">gid</property>
</object> </object>
<packing> <packing>
<property name="top_attach">2</property> <property name="top_attach">4</property>
<property name="bottom_attach">3</property> <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>
@ -601,47 +632,54 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="spacing">12</property> <property name="spacing">12</property>
<child> <child>
<object class="UndoableEntry" id="gid"> <object class="GtkBox" id="box1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">A unique ID to identify the source</property> <property name="spacing">6</property>
<property name="invisible_char">●</property> <child>
<object class="UndoableEntry" id="gid">
<property name="width_request">75</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">A unique ID to identify the source</property>
<property name="invisible_char">●</property>
<property name="width_chars">6</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Tags:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="tag_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="private">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="relief">none</property>
<child internal-child="accessible">
<object class="AtkObject" id="private-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object>
</child>
<child>
<object class="GtkImage" id="image2709">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">gtk-dialog-authentication</property>
<child internal-child="accessible">
<object class="AtkObject" id="image2709-atkobject">
<property name="AtkObject::accessible-description" translatable="yes">Privacy</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
@ -649,8 +687,8 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="top_attach">2</property> <property name="top_attach">4</property>
<property name="bottom_attach">3</property> <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>
@ -664,7 +702,56 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="right_attach">2</property> <property name="right_attach">3</property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="private">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="relief">none</property>
<child internal-child="accessible">
<object class="AtkObject" id="private-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object>
</child>
<child>
<object class="GtkImage" id="image2709">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">gtk-dialog-authentication</property>
<child internal-child="accessible">
<object class="AtkObject" id="image2709-atkobject">
<property name="AtkObject::accessible-description" translatable="yes">Privacy</property>
</object>
</child>
</object>
</child>
</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"/>
<property name="y_options"/>
</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>
<property name="use_stock">True</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"/>
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>
</child> </child>

View File

@ -17,7 +17,6 @@
<child> <child>
<object class="GtkButton" id="button111"> <object class="GtkButton" id="button111">
<property name="label">gtk-cancel</property> <property name="label">gtk-cancel</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="can_default">True</property> <property name="can_default">True</property>
@ -26,7 +25,6 @@
<property name="has_tooltip">True</property> <property name="has_tooltip">True</property>
<property name="tooltip_markup">Close window without changes</property> <property name="tooltip_markup">Close window without changes</property>
<property name="tooltip_text" translatable="yes">Close window without changes</property> <property name="tooltip_text" translatable="yes">Close window without changes</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
</object> </object>
<packing> <packing>
@ -38,7 +36,6 @@
<child> <child>
<object class="GtkButton" id="ok"> <object class="GtkButton" id="ok">
<property name="label">gtk-ok</property> <property name="label">gtk-ok</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="can_default">True</property> <property name="can_default">True</property>
@ -46,7 +43,6 @@
<property name="has_tooltip">True</property> <property name="has_tooltip">True</property>
<property name="tooltip_markup">Accept changes and close window</property> <property name="tooltip_markup">Accept changes and close window</property>
<property name="tooltip_text" translatable="yes">Accept changes and close window</property> <property name="tooltip_text" translatable="yes">Accept changes and close window</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
</object> </object>
<packing> <packing>
@ -58,12 +54,10 @@
<child> <child>
<object class="GtkButton" id="button126"> <object class="GtkButton" id="button126">
<property name="label">gtk-help</property> <property name="label">gtk-help</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="can_default">True</property> <property name="can_default">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
</object> </object>
<packing> <packing>
@ -93,9 +87,6 @@
<property name="n_columns">5</property> <property name="n_columns">5</property>
<property name="column_spacing">12</property> <property name="column_spacing">12</property>
<property name="row_spacing">4</property> <property name="row_spacing">4</property>
<child>
<placeholder/>
</child>
<child> <child>
<object class="GtkLabel" id="label154"> <object class="GtkLabel" id="label154">
<property name="visible">True</property> <property name="visible">True</property>
@ -108,7 +99,7 @@
</object> </object>
<packing> <packing>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"/>
</packing> </packing>
</child> </child>
<child> <child>
@ -125,18 +116,16 @@
<property name="left_attach">2</property> <property name="left_attach">2</property>
<property name="right_attach">3</property> <property name="right_attach">3</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"/>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="date_stat"> <object class="GtkButton" id="date_stat">
<property name="use_action_appearance">False</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="has_tooltip">True</property> <property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes">Invoke date editor</property> <property name="tooltip_text" translatable="yes">Invoke date editor</property>
<property name="use_action_appearance">False</property>
<property name="relief">none</property> <property name="relief">none</property>
<accelerator key="d" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="d" signal="activate" modifiers="GDK_CONTROL_MASK"/>
<accessibility> <accessibility>
@ -166,7 +155,7 @@
<property name="left_attach">4</property> <property name="left_attach">4</property>
<property name="right_attach">5</property> <property name="right_attach">5</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"/>
</packing> </packing>
</child> </child>
<child> <child>
@ -183,43 +172,7 @@
<property name="top_attach">1</property> <property name="top_attach">1</property>
<property name="bottom_attach">2</property> <property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="private">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="relief">none</property>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/>
<child internal-child="accessible">
<object class="AtkObject" id="private-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object>
</child>
<child>
<object class="GtkImage" id="image2674">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">gtk-dialog-authentication</property>
<child internal-child="accessible">
<object class="AtkObject" id="image2674-atkobject">
<property name="AtkObject::accessible-description" translatable="yes">Privacy</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="left_attach">4</property>
<property name="right_attach">5</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>
</packing> </packing>
</child> </child>
<child> <child>
@ -234,7 +187,7 @@
<property name="right_attach">4</property> <property name="right_attach">4</property>
<property name="top_attach">1</property> <property name="top_attach">1</property>
<property name="bottom_attach">2</property> <property name="bottom_attach">2</property>
<property name="y_options"></property> <property name="y_options"/>
</packing> </packing>
</child> </child>
<child> <child>
@ -249,19 +202,17 @@
<property name="mnemonic_widget">select_place</property> <property name="mnemonic_widget">select_place</property>
</object> </object>
<packing> <packing>
<property name="top_attach">3</property> <property name="top_attach">2</property>
<property name="bottom_attach">4</property> <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"/>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="add_del_place"> <object class="GtkButton" id="add_del_place">
<property name="use_action_appearance">False</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="relief">none</property> <property name="relief">none</property>
<accelerator key="a" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="a" signal="activate" modifiers="GDK_CONTROL_MASK"/>
<child> <child>
@ -274,10 +225,10 @@
<packing> <packing>
<property name="left_attach">4</property> <property name="left_attach">4</property>
<property name="right_attach">5</property> <property name="right_attach">5</property>
<property name="top_attach">3</property> <property name="top_attach">2</property>
<property name="bottom_attach">4</property> <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"/>
</packing> </packing>
</child> </child>
<child> <child>
@ -299,11 +250,9 @@
</child> </child>
<child> <child>
<object class="GtkButton" id="select_place"> <object class="GtkButton" id="select_place">
<property name="use_action_appearance">False</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="relief">none</property> <property name="relief">none</property>
<accelerator key="s" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="s" signal="activate" modifiers="GDK_CONTROL_MASK"/>
<accessibility> <accessibility>
@ -337,8 +286,8 @@
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="right_attach">4</property> <property name="right_attach">4</property>
<property name="top_attach">3</property> <property name="top_attach">2</property>
<property name="bottom_attach">4</property> <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property> <property name="y_options">GTK_FILL</property>
</packing> </packing>
@ -360,7 +309,7 @@
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"/>
</packing> </packing>
</child> </child>
<child> <child>
@ -373,25 +322,10 @@
<property name="mnemonic_widget">gid</property> <property name="mnemonic_widget">gid</property>
</object> </object>
<packing> <packing>
<property name="top_attach">2</property> <property name="top_attach">3</property>
<property name="bottom_attach">3</property> <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"/>
</packing>
</child>
<child>
<object class="UndoableEntry" id="gid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">A unique ID to identify the event</property>
<property name="invisible_char">●</property>
</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>
<property name="y_options"></property>
</packing> </packing>
</child> </child>
<child> <child>
@ -405,7 +339,111 @@
<packing> <packing>
<property name="left_attach">3</property> <property name="left_attach">3</property>
<property name="right_attach">4</property> <property name="right_attach">4</property>
<property name="y_options"></property> <property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="private">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="relief">none</property>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/>
<child internal-child="accessible">
<object class="AtkObject" id="private-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object>
</child>
<child>
<object class="GtkImage" id="image2674">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">gtk-dialog-authentication</property>
<child internal-child="accessible">
<object class="AtkObject" id="image2674-atkobject">
<property name="AtkObject::accessible-description" translatable="yes">Privacy</property>
</object>
</child>
</object>
</child>
</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"/>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="UndoableEntry" id="gid">
<property name="width_request">75</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">A unique ID to identify the event</property>
<property name="invisible_char">●</property>
<property name="width_chars">6</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Tags:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="tag_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="yalign">0.4699999988079071</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</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>
<property name="margin_right">1</property>
<property name="use_stock">True</property>
<property name="image_position">right</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">5</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options">GTK_FILL</property>
</packing> </packing>
</child> </child>
</object> </object>

View File

@ -16,12 +16,10 @@
<child> <child>
<object class="GtkButton" id="cancel"> <object class="GtkButton" id="cancel">
<property name="label">gtk-cancel</property> <property name="label">gtk-cancel</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="can_default">True</property> <property name="can_default">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
</object> </object>
<packing> <packing>
@ -33,13 +31,11 @@
<child> <child>
<object class="GtkButton" id="ok"> <object class="GtkButton" id="ok">
<property name="label">gtk-ok</property> <property name="label">gtk-ok</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="can_default">True</property> <property name="can_default">True</property>
<property name="has_default">True</property> <property name="has_default">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
</object> </object>
<packing> <packing>
@ -51,12 +47,10 @@
<child> <child>
<object class="GtkButton" id="help"> <object class="GtkButton" id="help">
<property name="label">gtk-help</property> <property name="label">gtk-help</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="can_default">True</property> <property name="can_default">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
</object> </object>
<packing> <packing>
@ -83,12 +77,9 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="border_width">12</property> <property name="border_width">12</property>
<property name="n_rows">3</property> <property name="n_rows">3</property>
<property name="n_columns">4</property> <property name="n_columns">5</property>
<property name="column_spacing">6</property> <property name="column_spacing">6</property>
<property name="row_spacing">4</property> <property name="row_spacing">4</property>
<child>
<placeholder/>
</child>
<child> <child>
<object class="GtkLabel" id="label244"> <object class="GtkLabel" id="label244">
<property name="visible">True</property> <property name="visible">True</property>
@ -149,7 +140,7 @@
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="right_attach">4</property> <property name="right_attach">5</property>
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>
</child> </child>
@ -169,57 +160,6 @@
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>
</child> </child>
<child>
<object class="UndoableEntry" id="gid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">A unique ID to identify the place</property>
<property name="invisible_char">●</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="private">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="relief">none</property>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/>
<child internal-child="accessible">
<object class="AtkObject" id="private-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object>
</child>
<child>
<object class="GtkImage" id="image2707">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">gtk-dialog-authentication</property>
<child internal-child="accessible">
<object class="AtkObject" id="image2707-atkobject">
<property name="AtkObject::accessible-description" translatable="yes">Privacy</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options"/>
<property name="y_options"/>
</packing>
</child>
<child> <child>
<object class="ValidatableMaskedEntry" id="lat_entry"> <object class="ValidatableMaskedEntry" id="lat_entry">
<property name="visible">True</property> <property name="visible">True</property>
@ -254,6 +194,110 @@ You can set these values via the Geography View by searching the place, or via a
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>
</child> </child>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="UndoableEntry" id="gid">
<property name="width_request">75</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">A unique ID to identify the place</property>
<property name="invisible_char">●</property>
<property name="width_chars">6</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Tags:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="tag_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</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>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="private">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="relief">none</property>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/>
<child internal-child="accessible">
<object class="AtkObject" id="private-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object>
</child>
<child>
<object class="GtkImage" id="image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">gtk-dialog-authentication</property>
<child internal-child="accessible">
<object class="AtkObject" id="image-atkobject">
<property name="AtkObject::accessible-description" translatable="yes">Privacy</property>
</object>
</child>
</object>
</child>
</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"/>
<property name="y_options"/>
</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>
<property name="use_stock">True</property>
</object>
<packing>
<property name="left_attach">4</property>
<property name="right_attach">5</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options"/>
<property name="y_options"/>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>

View File

@ -17,7 +17,6 @@
<child> <child>
<object class="GtkButton" id="cancel"> <object class="GtkButton" id="cancel">
<property name="label">gtk-cancel</property> <property name="label">gtk-cancel</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="can_default">True</property> <property name="can_default">True</property>
@ -25,7 +24,6 @@
<property name="has_tooltip">True</property> <property name="has_tooltip">True</property>
<property name="tooltip_markup">Abandon changes and close window</property> <property name="tooltip_markup">Abandon changes and close window</property>
<property name="tooltip_text" translatable="yes">Abandon changes and close window</property> <property name="tooltip_text" translatable="yes">Abandon changes and close window</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
</object> </object>
<packing> <packing>
@ -37,7 +35,6 @@
<child> <child>
<object class="GtkButton" id="ok"> <object class="GtkButton" id="ok">
<property name="label">gtk-ok</property> <property name="label">gtk-ok</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="can_default">True</property> <property name="can_default">True</property>
@ -46,7 +43,6 @@
<property name="has_tooltip">True</property> <property name="has_tooltip">True</property>
<property name="tooltip_markup">Accept changes and close window</property> <property name="tooltip_markup">Accept changes and close window</property>
<property name="tooltip_text" translatable="yes">Accept changes and close window</property> <property name="tooltip_text" translatable="yes">Accept changes and close window</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
</object> </object>
<packing> <packing>
@ -58,12 +54,10 @@
<child> <child>
<object class="GtkButton" id="help"> <object class="GtkButton" id="help">
<property name="label">gtk-help</property> <property name="label">gtk-help</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="can_default">True</property> <property name="can_default">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
</object> </object>
<packing> <packing>
@ -89,7 +83,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="border_width">12</property> <property name="border_width">12</property>
<property name="n_rows">2</property> <property name="n_rows">3</property>
<property name="n_columns">2</property> <property name="n_columns">2</property>
<property name="column_spacing">4</property> <property name="column_spacing">4</property>
<property name="row_spacing">4</property> <property name="row_spacing">4</property>
@ -97,7 +91,7 @@
<object class="GtkLabel" id="label448"> <object class="GtkLabel" id="label448">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">1</property> <property name="xalign">0</property>
<property name="label" translatable="yes">_Name:</property> <property name="label" translatable="yes">_Name:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="justify">center</property> <property name="justify">center</property>
@ -192,14 +186,12 @@
</child> </child>
<child> <child>
<object class="GtkToggleButton" id="private"> <object class="GtkToggleButton" id="private">
<property name="use_action_appearance">False</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="has_tooltip">True</property> <property name="has_tooltip">True</property>
<property name="tooltip_markup">Indicates if the record is private</property> <property name="tooltip_markup">Indicates if the record is private</property>
<property name="tooltip_text" translatable="yes">Indicates if the record is private</property> <property name="tooltip_text" translatable="yes">Indicates if the record is private</property>
<property name="use_action_appearance">False</property>
<property name="relief">none</property> <property name="relief">none</property>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/> <accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/>
<child internal-child="accessible"> <child internal-child="accessible">
@ -236,6 +228,59 @@
<property name="y_options">GTK_FILL</property> <property name="y_options">GTK_FILL</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Tags:</property>
<property name="justify">right</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"/>
</packing>
</child>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="tag_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<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>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>

View File

@ -18,13 +18,11 @@
<child> <child>
<object class="GtkButton" id="cancel"> <object class="GtkButton" id="cancel">
<property name="label">gtk-cancel</property> <property name="label">gtk-cancel</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="can_default">True</property> <property name="can_default">True</property>
<property name="receives_default">False</property> <property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Abandon changes and close window</property> <property name="tooltip_text" translatable="yes">Abandon changes and close window</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
<signal name="clicked" handler="on_sourceEditor_cancel_clicked" swapped="no"/> <signal name="clicked" handler="on_sourceEditor_cancel_clicked" swapped="no"/>
</object> </object>
@ -37,14 +35,12 @@
<child> <child>
<object class="GtkButton" id="ok"> <object class="GtkButton" id="ok">
<property name="label">gtk-ok</property> <property name="label">gtk-ok</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="can_default">True</property> <property name="can_default">True</property>
<property name="has_default">True</property> <property name="has_default">True</property>
<property name="receives_default">False</property> <property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Accept changes and close window</property> <property name="tooltip_text" translatable="yes">Accept changes and close window</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
<signal name="clicked" handler="on_sourceEditor_ok_clicked" swapped="no"/> <signal name="clicked" handler="on_sourceEditor_ok_clicked" swapped="no"/>
</object> </object>
@ -57,12 +53,10 @@
<child> <child>
<object class="GtkButton" id="help"> <object class="GtkButton" id="help">
<property name="label">gtk-help</property> <property name="label">gtk-help</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="can_default">True</property> <property name="can_default">True</property>
<property name="receives_default">False</property> <property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
<signal name="clicked" handler="on_sourceEditor_help_clicked" swapped="no"/> <signal name="clicked" handler="on_sourceEditor_help_clicked" swapped="no"/>
</object> </object>
@ -90,7 +84,7 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="border_width">12</property> <property name="border_width">12</property>
<property name="n_rows">5</property> <property name="n_rows">5</property>
<property name="n_columns">2</property> <property name="n_columns">3</property>
<property name="column_spacing">4</property> <property name="column_spacing">4</property>
<property name="row_spacing">4</property> <property name="row_spacing">4</property>
<child> <child>
@ -134,7 +128,7 @@
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="right_attach">2</property> <property name="right_attach">3</property>
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>
</child> </child>
@ -146,7 +140,7 @@
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="right_attach">2</property> <property name="right_attach">3</property>
<property name="top_attach">1</property> <property name="top_attach">1</property>
<property name="bottom_attach">2</property> <property name="bottom_attach">2</property>
<property name="y_options"/> <property name="y_options"/>
@ -163,8 +157,8 @@
<property name="mnemonic_widget">pubinfo</property> <property name="mnemonic_widget">pubinfo</property>
</object> </object>
<packing> <packing>
<property name="top_attach">4</property> <property name="top_attach">2</property>
<property name="bottom_attach">5</property> <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>
@ -177,9 +171,9 @@
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="right_attach">2</property> <property name="right_attach">3</property>
<property name="top_attach">4</property> <property name="top_attach">2</property>
<property name="bottom_attach">5</property> <property name="bottom_attach">3</property>
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>
</child> </child>
@ -214,6 +208,62 @@
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>
</child> </child>
<child>
<object class="GtkHBox" id="hbox134">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
<object class="UndoableEntry" id="gid">
<property name="width_request">75</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">A unique ID to identify the source</property>
<property name="invisible_char">●</property>
<property name="width_chars">6</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Tags:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="tag_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="ypad">2</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</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">GTK_FILL</property>
</packing>
</child>
<child> <child>
<object class="GtkLabel" id="label658"> <object class="GtkLabel" id="label658">
<property name="visible">True</property> <property name="visible">True</property>
@ -224,72 +274,63 @@
<property name="mnemonic_widget">gid</property> <property name="mnemonic_widget">gid</property>
</object> </object>
<packing> <packing>
<property name="top_attach">2</property> <property name="top_attach">4</property>
<property name="bottom_attach">3</property> <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="private">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="has_tooltip">True</property>
<property name="tooltip_markup" translatable="yes">Indicates if the record is private</property>
<property name="tooltip_text" translatable="yes">Indicates if the record is private</property>
<property name="relief">none</property>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/>
<child internal-child="accessible">
<object class="AtkObject" id="private-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object>
</child>
<child>
<object class="GtkImage" id="image2706">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">gtk-dialog-authentication</property>
<child internal-child="accessible">
<object class="AtkObject" id="image2706-atkobject">
<property name="AtkObject::accessible-description" translatable="yes">Privacy</property>
</object>
</child>
</object>
</child>
</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"/>
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkHBox" id="hbox134"> <object class="GtkButton" id="tag_button">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">True</property>
<property name="spacing">12</property> <property name="receives_default">True</property>
<child> <property name="use_stock">True</property>
<object class="UndoableEntry" id="gid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">A unique ID to identify the source</property>
<property name="invisible_char">●</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="private">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Indicates if the record is private</property>
<property name="use_action_appearance">False</property>
<property name="relief">none</property>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/>
<child internal-child="accessible">
<object class="AtkObject" id="private-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Private</property>
</object>
</child>
<child>
<object class="GtkImage" id="image2706">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">gtk-dialog-authentication</property>
<child internal-child="accessible">
<object class="AtkObject" id="image2706-atkobject">
<property name="AtkObject::accessible-description" translatable="yes">Privacy</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">2</property>
<property name="right_attach">2</property> <property name="right_attach">3</property>
<property name="top_attach">2</property> <property name="top_attach">4</property>
<property name="bottom_attach">3</property> <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property> <property name="x_options"/>
<property name="y_options">GTK_FILL</property> <property name="y_options"/>
</packing> </packing>
</child> </child>
</object> </object>

View File

@ -288,11 +288,22 @@ class ListView(NavigationView):
renderer.set_property('foreground', fg_color) renderer.set_property('foreground', fg_color)
def set_active(self): def set_active(self):
"""
Called when the page is displayed.
"""
NavigationView.set_active(self) NavigationView.set_active(self)
self.uistate.viewmanager.tags.tag_enable()
self.uistate.show_filter_results(self.dbstate, self.uistate.show_filter_results(self.dbstate,
self.model.displayed(), self.model.displayed(),
self.model.total()) self.model.total())
def set_inactive(self):
"""
Called when the page is no longer displayed.
"""
NavigationView.set_inactive(self)
self.uistate.viewmanager.tags.tag_disable()
def __build_tree(self): def __build_tree(self):
profile(self._build_tree) profile(self._build_tree)
@ -660,7 +671,8 @@ class ListView(NavigationView):
""" """
for sig in self.signal_map: for sig in self.signal_map:
self.callman.add_db_signal(sig, self.signal_map[sig]) self.callman.add_db_signal(sig, self.signal_map[sig])
self.callman.add_db_signal('tag-update', self.tag_updated)
def change_db(self, db): def change_db(self, db):
""" """
Called when the database is changed. Called when the database is changed.

View File

@ -266,7 +266,7 @@ class Tags(DbGUIElement):
# Make the dialog modal so that the user can't start another # Make the dialog modal so that the user can't start another
# database transaction while the one setting tags is still running. # database transaction while the one setting tags is still running.
pmon = progressdlg.ProgressMonitor(progressdlg.GtkProgressDialog, pmon = progressdlg.ProgressMonitor(progressdlg.GtkProgressDialog,
("", self.uistate.window, Gtk.DialogFlags.MODAL), popup_time=2) ("", self.uistate.window, Gtk.DialogFlags.MODAL), popup_time=2)
status = progressdlg.LongOpStatus(msg=_("Adding Tags"), status = progressdlg.LongOpStatus(msg=_("Adding Tags"),
total_steps=len(selected), total_steps=len(selected),
interval=len(selected)//20) interval=len(selected)//20)
@ -492,6 +492,8 @@ class OrganizeTagsDialog(object):
self.db.commit_place), self.db.commit_place),
'Source': (self.db.get_source_from_handle, 'Source': (self.db.get_source_from_handle,
self.db.commit_source), self.db.commit_source),
'Citation': (self.db.get_citation_from_handle,
self.db.commit_citation),
'Repository': (self.db.get_repository_from_handle, 'Repository': (self.db.get_repository_from_handle,
self.db.commit_repository), self.db.commit_repository),
'MediaObject': (self.db.get_object_from_handle, 'MediaObject': (self.db.get_object_from_handle,

View File

@ -33,6 +33,7 @@ import cgi
import logging import logging
log = logging.getLogger(".") log = logging.getLogger(".")
LOG = logging.getLogger(".citation") LOG = logging.getLogger(".citation")
import locale
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -59,7 +60,8 @@ COLUMN_PAGE = 3
COLUMN_CONFIDENCE = 4 COLUMN_CONFIDENCE = 4
COLUMN_SOURCE = 5 COLUMN_SOURCE = 5
COLUMN_CHANGE = 9 COLUMN_CHANGE = 9
COLUMN_PRIV = 10 COLUMN_TAGS = 10
COLUMN_PRIV = 11
# Data for the Source object # Data for the Source object
COLUMN2_HANDLE = 0 COLUMN2_HANDLE = 0
@ -69,7 +71,8 @@ COLUMN2_AUTHOR = 3
COLUMN2_PUBINFO = 4 COLUMN2_PUBINFO = 4
COLUMN2_ABBREV = 7 COLUMN2_ABBREV = 7
COLUMN2_CHANGE = 8 COLUMN2_CHANGE = 8
COLUMN2_PRIV = 11 COLUMN2_TAGS = 11
COLUMN2_PRIV = 12
INVALID_DATE_FORMAT = config.get('preferences.invalid-date-format') INVALID_DATE_FORMAT = config.get('preferences.invalid-date-format')
@ -122,6 +125,28 @@ class CitationBaseModel(object):
# There is a problem returning None here. # There is a problem returning None here.
return '' return ''
def citation_tags(self, data):
"""
Return the sorted list of tags.
"""
tag_list = list(map(self.get_tag_name, data[COLUMN_TAGS]))
return ', '.join(sorted(tag_list, key=locale.strxfrm))
def citation_tag_color(self, data):
"""
Return the tag color.
"""
tag_color = "#000000000000"
tag_priority = None
for handle in data[COLUMN_TAGS]:
tag = self.db.get_tag_from_handle(handle)
if tag:
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 citation_change(self, data): def citation_change(self, data):
return format_time(data[COLUMN_CHANGE]) return format_time(data[COLUMN_CHANGE])
@ -183,6 +208,15 @@ class CitationBaseModel(object):
except: except:
return '' return ''
def citation_src_tags(self, data):
source_handle = data[COLUMN_SOURCE]
try:
source = self.db.get_source_from_handle(source_handle)
tag_list = list(map(self.get_tag_name, source.get_tag_list()))
return ', '.join(sorted(tag_list, key=locale.strxfrm))
except:
return ''
def citation_src_chan(self, data): def citation_src_chan(self, data):
source_handle = data[COLUMN_SOURCE] source_handle = data[COLUMN_SOURCE]
try: try:
@ -215,6 +249,28 @@ class CitationBaseModel(object):
# There is a problem returning None here. # There is a problem returning None here.
return '' return ''
def source_src_tags(self, data):
"""
Return the sorted list of tags.
"""
tag_list = list(map(self.get_tag_name, data[COLUMN2_TAGS]))
return ', '.join(sorted(tag_list, key=locale.strxfrm))
def source_src_tag_color(self, data):
"""
Return the tag color.
"""
tag_color = "#000000000000"
tag_priority = None
for handle in data[COLUMN2_TAGS]:
tag = self.db.get_tag_from_handle(handle)
if tag:
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 source_src_chan(self, data): def source_src_chan(self, data):
return format_time(data[COLUMN2_CHANGE]) return format_time(data[COLUMN2_CHANGE])
@ -224,3 +280,9 @@ class CitationBaseModel(object):
def dummy_sort_key(self, data): def dummy_sort_key(self, data):
# dummy sort key for columns that don't have data # dummy sort key for columns that don't have data
return None return None
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()

View File

@ -67,6 +67,7 @@ class CitationListModel(CitationBaseModel, FlatBaseModel):
self.citation_date, self.citation_date,
self.citation_confidence, self.citation_confidence,
self.citation_private, self.citation_private,
self.citation_tags,
self.citation_change, self.citation_change,
self.citation_src_title, self.citation_src_title,
self.citation_src_id, self.citation_src_id,
@ -75,6 +76,7 @@ class CitationListModel(CitationBaseModel, FlatBaseModel):
self.citation_src_pinfo, self.citation_src_pinfo,
self.citation_src_private, self.citation_src_private,
self.citation_src_chan, self.citation_src_chan,
self.citation_tag_color
] ]
self.smap = [ self.smap = [
self.citation_page, self.citation_page,
@ -82,6 +84,7 @@ class CitationListModel(CitationBaseModel, FlatBaseModel):
self.citation_sort_date, self.citation_sort_date,
self.citation_confidence, self.citation_confidence,
self.citation_private, self.citation_private,
self.citation_tags,
self.citation_sort_change, self.citation_sort_change,
self.citation_src_title, self.citation_src_title,
self.citation_src_id, self.citation_src_id,
@ -90,6 +93,7 @@ class CitationListModel(CitationBaseModel, FlatBaseModel):
self.citation_src_pinfo, self.citation_src_pinfo,
self.citation_src_private, self.citation_src_private,
self.citation_src_chan, self.citation_src_chan,
self.citation_tag_color
] ]
FlatBaseModel.__init__(self, db, scol, order, search=search, skip=skip, FlatBaseModel.__init__(self, db, scol, order, search=search, skip=skip,
sort_map=sort_map) sort_map=sort_map)
@ -105,5 +109,11 @@ class CitationListModel(CitationBaseModel, FlatBaseModel):
self.smap = None self.smap = None
FlatBaseModel.destroy(self) FlatBaseModel.destroy(self)
def color_column(self):
"""
Return the color column.
"""
return 14
def do_get_n_columns(self): def do_get_n_columns(self):
return len(self.fmap)+1 return len(self.fmap)+1

View File

@ -80,10 +80,12 @@ class CitationTreeModel(CitationBaseModel, TreeBaseModel):
None, # COL_DATE (not for Source) None, # COL_DATE (not for Source)
None, # COL_CONFIDENCE (not for Source) None, # COL_CONFIDENCE (not for Source)
self.source_src_private, # COL_PRIV (both Source & Citation) self.source_src_private, # COL_PRIV (both Source & Citation)
self.source_src_tags, # COL_TAGS (both Source & Citation)
self.source_src_chan, # COL_CHAN (both Source & Citation) self.source_src_chan, # COL_CHAN (both Source & Citation)
self.source_src_auth, # COL_SRC_AUTH (Source only) self.source_src_auth, # COL_SRC_AUTH (Source only)
self.source_src_abbr, # COL_SRC_ABBR (Source only) self.source_src_abbr, # COL_SRC_ABBR (Source only)
self.source_src_pinfo, # COL_SRC_PINFO (Source only) self.source_src_pinfo, # COL_SRC_PINFO (Source only)
self.source_src_tag_color
] ]
self.smap = [ self.smap = [
self.source_src_title, self.source_src_title,
@ -91,10 +93,12 @@ class CitationTreeModel(CitationBaseModel, TreeBaseModel):
self.dummy_sort_key, self.dummy_sort_key,
self.dummy_sort_key, self.dummy_sort_key,
self.source_src_private, self.source_src_private,
self.source_src_tags,
self.source_sort2_change, self.source_sort2_change,
self.source_src_auth, self.source_src_auth,
self.source_src_abbr, self.source_src_abbr,
self.source_src_pinfo, self.source_src_pinfo,
self.source_src_tag_color
] ]
TreeBaseModel.__init__(self, self.db, scol=scol, order=order, TreeBaseModel.__init__(self, self.db, scol=scol, order=order,
@ -133,10 +137,12 @@ class CitationTreeModel(CitationBaseModel, TreeBaseModel):
self.citation_date, self.citation_date,
self.citation_confidence, self.citation_confidence,
self.citation_private, self.citation_private,
self.citation_tags,
self.citation_change, self.citation_change,
None, None,
None, None,
None, None,
self.citation_tag_color
] ]
self.smap2 = [ self.smap2 = [
self.citation_page, self.citation_page,
@ -144,12 +150,20 @@ class CitationTreeModel(CitationBaseModel, TreeBaseModel):
self.citation_sort_date, self.citation_sort_date,
self.citation_confidence, self.citation_confidence,
self.citation_private, self.citation_private,
self.citation_tags,
self.citation_sort_change, self.citation_sort_change,
self.dummy_sort_key, self.dummy_sort_key,
self.dummy_sort_key, self.dummy_sort_key,
self.dummy_sort_key, self.dummy_sort_key,
self.citation_tag_color
] ]
def color_column(self):
"""
Return the color column.
"""
return 10
def get_tree_levels(self): def get_tree_levels(self):
""" """
Return the headings of the levels in the hierarchy. Return the headings of the levels in the hierarchy.

View File

@ -27,6 +27,7 @@
import cgi import cgi
import logging import logging
log = logging.getLogger(".") log = logging.getLogger(".")
import locale
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -59,7 +60,8 @@ COLUMN_DATE = 3
COLUMN_DESCRIPTION = 4 COLUMN_DESCRIPTION = 4
COLUMN_PLACE = 5 COLUMN_PLACE = 5
COLUMN_CHANGE = 10 COLUMN_CHANGE = 10
COLUMN_PRIV = 11 COLUMN_TAGS = 11
COLUMN_PRIV = 12
INVALID_DATE_FORMAT = config.get('preferences.invalid-date-format') INVALID_DATE_FORMAT = config.get('preferences.invalid-date-format')
@ -82,8 +84,10 @@ class EventModel(FlatBaseModel):
self.column_date, self.column_date,
self.column_place, self.column_place,
self.column_private, self.column_private,
self.column_tags,
self.column_change, self.column_change,
self.column_participant, self.column_participant,
self.column_tag_color
] ]
self.smap = [ self.smap = [
self.column_description, self.column_description,
@ -92,8 +96,10 @@ class EventModel(FlatBaseModel):
self.sort_date, self.sort_date,
self.column_place, self.column_place,
self.column_private, self.column_private,
self.column_tags,
self.sort_change, self.sort_change,
self.column_participant, self.column_participant,
self.column_tag_color
] ]
FlatBaseModel.__init__(self, db, scol, order, search=search, skip=skip, FlatBaseModel.__init__(self, db, scol, order, search=search, skip=skip,
sort_map=sort_map) sort_map=sort_map)
@ -109,6 +115,12 @@ class EventModel(FlatBaseModel):
self.smap = None self.smap = None
FlatBaseModel.destroy(self) FlatBaseModel.destroy(self)
def color_column(self):
"""
Return the color column.
"""
return 9
def do_get_n_columns(self): def do_get_n_columns(self):
return len(self.fmap)+1 return len(self.fmap)+1
@ -167,3 +179,31 @@ class EventModel(FlatBaseModel):
def column_change(self,data): def column_change(self,data):
return format_time(data[COLUMN_CHANGE]) return format_time(data[COLUMN_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[COLUMN_TAGS]:
tag = self.db.get_tag_from_handle(handle)
if tag:
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 = list(map(self.get_tag_name, data[COLUMN_TAGS]))
return ', '.join(sorted(tag_list, key=locale.strxfrm))

View File

@ -33,6 +33,7 @@ Place Model.
import cgi import cgi
import logging import logging
_LOG = logging.getLogger(".gui.views.treemodels.placemodel") _LOG = logging.getLogger(".gui.views.treemodels.placemodel")
import locale
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -94,8 +95,10 @@ class PlaceBaseModel(object):
self.column_latitude, self.column_latitude,
self.column_longitude, self.column_longitude,
self.column_private, self.column_private,
self.column_tags,
self.column_change, self.column_change,
self.column_place_name, self.column_place_name,
self.column_tag_color
] ]
self.smap = [ self.smap = [
self.column_name, self.column_name,
@ -111,8 +114,10 @@ class PlaceBaseModel(object):
self.sort_latitude, self.sort_latitude,
self.sort_longitude, self.sort_longitude,
self.column_private, self.column_private,
self.column_tags,
self.sort_change, self.sort_change,
self.column_place_name, self.column_place_name,
self.column_tag_color
] ]
def destroy(self): def destroy(self):
@ -125,6 +130,12 @@ class PlaceBaseModel(object):
self.fmap = None self.fmap = None
self.smap = None self.smap = None
def color_column(self):
"""
Return the color column.
"""
return 16
def do_get_n_columns(self): def do_get_n_columns(self):
return len(self.fmap)+1 return len(self.fmap)+1
@ -215,7 +226,7 @@ class PlaceBaseModel(object):
return '' return ''
def column_private(self, data): def column_private(self, data):
if data[12]: if data[13]:
return 'gramps-lock' return 'gramps-lock'
else: else:
# There is a problem returning None here. # There is a problem returning None here.
@ -227,6 +238,34 @@ class PlaceBaseModel(object):
def column_change(self, data): def column_change(self, data):
return format_time(data[11]) return format_time(data[11])
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[12]:
tag = self.db.get_tag_from_handle(handle)
if tag:
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 = list(map(self.get_tag_name, data[12]))
return ', '.join(sorted(tag_list, key=locale.strxfrm))
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# PlaceListModel # PlaceListModel

View File

@ -26,6 +26,7 @@
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import logging import logging
log = logging.getLogger(".") log = logging.getLogger(".")
import locale
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -70,7 +71,9 @@ class RepositoryModel(FlatBaseModel):
self.column_email, self.column_email,
self.column_search_url, self.column_search_url,
self.column_private, self.column_private,
self.column_tags,
self.column_change, self.column_change,
self.column_tag_color
] ]
self.smap = [ self.smap = [
@ -87,7 +90,9 @@ class RepositoryModel(FlatBaseModel):
self.column_email, self.column_email,
self.column_search_url, self.column_search_url,
self.column_private, self.column_private,
self.column_tags,
self.sort_change, self.sort_change,
self.column_tag_color
] ]
FlatBaseModel.__init__(self, db, scol, order, search=search, skip=skip, FlatBaseModel.__init__(self, db, scol, order, search=search, skip=skip,
@ -105,6 +110,12 @@ class RepositoryModel(FlatBaseModel):
self.smap = None self.smap = None
FlatBaseModel.destroy(self) FlatBaseModel.destroy(self)
def color_column(self):
"""
Return the color column.
"""
return 15
def do_get_n_columns(self): def do_get_n_columns(self):
return len(self.fmap)+1 return len(self.fmap)+1
@ -215,7 +226,7 @@ class RepositoryModel(FlatBaseModel):
return "" return ""
def column_private(self, data): def column_private(self, data):
if data[8]: if data[9]:
return 'gramps-lock' return 'gramps-lock'
else: else:
# There is a problem returning None here. # There is a problem returning None here.
@ -226,3 +237,31 @@ class RepositoryModel(FlatBaseModel):
def column_change(self,data): def column_change(self,data):
return format_time(data[7]) return format_time(data[7])
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[8]:
tag = self.db.get_tag_from_handle(handle)
if tag:
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 = list(map(self.get_tag_name, data[8]))
return ', '.join(sorted(tag_list, key=locale.strxfrm))

View File

@ -26,6 +26,7 @@
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import logging import logging
log = logging.getLogger(".") log = logging.getLogger(".")
import locale
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -61,7 +62,9 @@ class SourceModel(FlatBaseModel):
self.column_abbrev, self.column_abbrev,
self.column_pubinfo, self.column_pubinfo,
self.column_private, self.column_private,
self.column_tags,
self.column_change, self.column_change,
self.column_tag_color
] ]
self.smap = [ self.smap = [
self.column_title, self.column_title,
@ -70,7 +73,9 @@ class SourceModel(FlatBaseModel):
self.column_abbrev, self.column_abbrev,
self.column_pubinfo, self.column_pubinfo,
self.column_private, self.column_private,
self.column_tags,
self.sort_change, self.sort_change,
self.column_tag_color
] ]
FlatBaseModel.__init__(self, db, scol, order, search=search, skip=skip, FlatBaseModel.__init__(self, db, scol, order, search=search, skip=skip,
sort_map=sort_map) sort_map=sort_map)
@ -86,6 +91,12 @@ class SourceModel(FlatBaseModel):
self.smap = None self.smap = None
FlatBaseModel.destroy(self) FlatBaseModel.destroy(self)
def color_column(self):
"""
Return the color column.
"""
return 8
def do_get_n_columns(self): def do_get_n_columns(self):
return len(self.fmap)+1 return len(self.fmap)+1
@ -105,7 +116,7 @@ class SourceModel(FlatBaseModel):
return cuni(data[4]) return cuni(data[4])
def column_private(self, data): def column_private(self, data):
if data[11]: if data[12]:
return 'gramps-lock' return 'gramps-lock'
else: else:
# There is a problem returning None here. # There is a problem returning None here.
@ -116,3 +127,31 @@ class SourceModel(FlatBaseModel):
def sort_change(self,data): def sort_change(self,data):
return "%012x" % data[8] return "%012x" % data[8]
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[11]:
tag = self.db.get_tag_from_handle(handle)
if tag:
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 = list(map(self.get_tag_name, data[11]))
return ', '.join(sorted(tag_list, key=locale.strxfrm))

View File

@ -584,6 +584,10 @@ class GrampsXmlWriter(UpdateCallback):
self.write_media_list(citation.get_media_list(), index+1) self.write_media_list(citation.get_media_list(), index+1)
self.write_data_map(citation.get_data_map()) self.write_data_map(citation.get_data_map())
self.write_ref("sourceref", citation.get_reference_handle(), index+1) self.write_ref("sourceref", citation.get_reference_handle(), index+1)
for tag_handle in citation.get_tag_list():
self.write_ref("tagref", tag_handle, index+1)
self.g.write("%s</citation>\n" % sp) self.g.write("%s</citation>\n" % sp)
def write_source(self,source,index=1): def write_source(self,source,index=1):
@ -597,6 +601,10 @@ class GrampsXmlWriter(UpdateCallback):
self.write_media_list(source.get_media_list(),index+1) self.write_media_list(source.get_media_list(),index+1)
self.write_data_map(source.get_data_map()) self.write_data_map(source.get_data_map())
self.write_reporef_list(source.get_reporef_list(),index+1) self.write_reporef_list(source.get_reporef_list(),index+1)
for tag_handle in source.get_tag_list():
self.write_ref("tagref", tag_handle, index+1)
self.g.write("%s</source>\n" % sp) self.g.write("%s</source>\n" % sp)
def write_repository(self,repo,index=1): def write_repository(self,repo,index=1):
@ -612,6 +620,10 @@ class GrampsXmlWriter(UpdateCallback):
# url list # url list
self.write_url_list(repo.get_url_list(),index+1) self.write_url_list(repo.get_url_list(),index+1)
self.write_note_list(repo.get_note_list(),index+1) self.write_note_list(repo.get_note_list(),index+1)
for tag_handle in repo.get_tag_list():
self.write_ref("tagref", tag_handle, index+1)
self.g.write("%s</repository>\n" % sp) self.g.write("%s</repository>\n" % sp)
def write_address_list(self, obj,index=1): def write_address_list(self, obj,index=1):
@ -722,6 +734,10 @@ class GrampsXmlWriter(UpdateCallback):
for citation_handle in event.get_citation_list(): for citation_handle in event.get_citation_list():
self.write_ref("citationref", citation_handle, index+1) self.write_ref("citationref", citation_handle, index+1)
self.write_media_list(event.get_media_list(),index+1) self.write_media_list(event.get_media_list(),index+1)
for tag_handle in event.get_tag_list():
self.write_ref("tagref", tag_handle, index+1)
self.g.write("%s</event>\n" % sp) self.g.write("%s</event>\n" % sp)
def dump_ordinance(self, ord,index=1): def dump_ordinance(self, ord,index=1):
@ -1187,6 +1203,10 @@ class GrampsXmlWriter(UpdateCallback):
self.write_note_list(place.get_note_list(), index+1) self.write_note_list(place.get_note_list(), index+1)
for citation_handle in place.get_citation_list(): for citation_handle in place.get_citation_list():
self.write_ref("citationref", citation_handle, index+1) self.write_ref("citationref", citation_handle, index+1)
for tag_handle in place.get_tag_list():
self.write_ref("tagref", tag_handle, index+1)
self.g.write("%s</placeobj>\n" % (" "*index)) self.g.write("%s</placeobj>\n" % (" "*index))
def write_object(self, obj, index=1): def write_object(self, obj, index=1):

View File

@ -1755,7 +1755,22 @@ class GrampsParser(UpdateCallback):
if self.note: if self.note:
self.note.add_tag(handle) self.note.add_tag(handle)
if self.event:
self.event.add_tag(handle)
if self.placeobj:
self.placeobj.add_tag(handle)
if self.repo:
self.repo.add_tag(handle)
if self.source:
self.source.add_tag(handle)
if self.citation:
self.citation.add_tag(handle)
def start_range(self, attrs): def start_range(self, attrs):
self.note_tags[-1].ranges.append((int(attrs['start']), self.note_tags[-1].ranges.append((int(attrs['start']),
int(attrs['end']))) int(attrs['end'])))

View File

@ -35,5 +35,5 @@
# Public Constants # Public Constants
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
GRAMPS_XML_VERSION = "1.5.0" GRAMPS_XML_VERSION = "1.6.0"

View File

@ -129,7 +129,6 @@ class BasePersonView(ListView):
'person-delete' : self.row_delete, 'person-delete' : self.row_delete,
'person-rebuild' : self.object_build, 'person-rebuild' : self.object_build,
'person-groupname-rebuild' : self.object_build, 'person-groupname-rebuild' : self.object_build,
'tag-update' : self.tag_updated,
'no-database': self.no_database, 'no-database': self.no_database,
} }
@ -375,20 +374,6 @@ class BasePersonView(ListView):
self.all_action.set_visible(False) self.all_action.set_visible(False)
self.edit_action.set_visible(False) self.edit_action.set_visible(False)
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 merge(self, obj): def merge(self, obj):
""" """
Merge the selected people. Merge the selected people.

View File

@ -90,7 +90,8 @@ class PlaceBaseView(ListView):
COL_LAT = 10 COL_LAT = 10
COL_LON = 11 COL_LON = 11
COL_PRIV = 12 COL_PRIV = 12
COL_CHAN = 13 COL_TAGS = 13
COL_CHAN = 14
# column definitions # column definitions
COLUMNS = [ COLUMNS = [
(_('Place Name'), MARKUP, None), (_('Place Name'), MARKUP, None),
@ -106,6 +107,7 @@ class PlaceBaseView(ListView):
(_('Latitude'), TEXT, None), (_('Latitude'), TEXT, None),
(_('Longitude'), TEXT, None), (_('Longitude'), TEXT, None),
(_('Private'), ICON, 'gramps-lock'), (_('Private'), ICON, 'gramps-lock'),
(_('Tags'), TEXT, None),
(_('Last Changed'), TEXT, None), (_('Last Changed'), TEXT, None),
] ]
# default setting with visible columns, order of the col, and their size # default setting with visible columns, order of the col, and their size
@ -114,9 +116,10 @@ class PlaceBaseView(ListView):
COL_CITY, COL_COUNTY, COL_STATE]), COL_CITY, COL_COUNTY, COL_STATE]),
('columns.rank', [COL_NAME, COL_ID, COL_STREET, COL_LOCALITY, COL_CITY, ('columns.rank', [COL_NAME, COL_ID, COL_STREET, COL_LOCALITY, COL_CITY,
COL_COUNTY, COL_STATE, COL_COUNTRY, COL_ZIP, COL_COUNTY, COL_STATE, COL_COUNTRY, COL_ZIP,
COL_PARISH, COL_LAT, COL_LON, COL_PRIV, COL_CHAN]), COL_PARISH, COL_LAT, COL_LON, COL_PRIV, COL_TAGS,
COL_CHAN]),
('columns.size', [250, 75, 150, 150, 150, 150, 100, 100, 100, ('columns.size', [250, 75, 150, 150, 150, 150, 100, 100, 100,
100, 150, 150, 40, 100]) 100, 150, 150, 40, 100, 100])
) )
ADD_MSG = _("Add a new place") ADD_MSG = _("Add a new place")
EDIT_MSG = _("Edit the selected place") EDIT_MSG = _("Edit the selected place")
@ -429,6 +432,26 @@ class PlaceBaseView(ListView):
else: else:
return None return None
def tag_updated(self, handle_list):
"""
Update tagged rows when a tag color changes.
"""
all_links = set([])
for tag_handle in handle_list:
links = set([link[1] for link in
self.dbstate.db.find_backlink_handles(tag_handle,
include_classes='Place')])
all_links = all_links.union(links)
self.row_update(list(all_links))
def add_tag(self, transaction, place_handle, tag_handle):
"""
Add the given tag to the given place.
"""
place = self.dbstate.db.get_place_from_handle(place_handle)
place.add_tag(tag_handle)
self.dbstate.db.commit_place(place, transaction)
def get_default_gramplets(self): def get_default_gramplets(self):
""" """
Define the default gramplets for the sidebar and bottombar. Define the default gramplets for the sidebar and bottombar.

View File

@ -85,15 +85,16 @@ class CitationListView(ListView):
COL_ID = 1 COL_ID = 1
COL_DATE = 2 COL_DATE = 2
COL_CONFIDENCE = 3 COL_CONFIDENCE = 3
COL_PRIV = 4 COL_PRIV = 4
COL_CHAN = 5 COL_TAGS = 5
COL_SRC_TITLE = 6 COL_CHAN = 6
COL_SRC_ID = 7 COL_SRC_TITLE = 7
COL_SRC_AUTH = 8 COL_SRC_ID = 8
COL_SRC_ABBR = 9 COL_SRC_AUTH = 9
COL_SRC_PINFO = 10 COL_SRC_ABBR = 10
COL_SRC_PRIV = 11 COL_SRC_PINFO = 11
COL_SRC_CHAN = 12 COL_SRC_PRIV = 12
COL_SRC_CHAN = 13
# column definitions # column definitions
COLUMNS = [ COLUMNS = [
(_('Volume/Page'), TEXT, None), (_('Volume/Page'), TEXT, None),
@ -101,6 +102,7 @@ class CitationListView(ListView):
(_('Date'), MARKUP, None), (_('Date'), MARKUP, None),
(_('Confidence'), TEXT, None), (_('Confidence'), TEXT, None),
(_('Private'), ICON, 'gramps-lock'), (_('Private'), ICON, 'gramps-lock'),
(_('Tags'), TEXT, None),
(_('Last Changed'), TEXT, None), (_('Last Changed'), TEXT, None),
(_('Source: Title'), TEXT, None), (_('Source: Title'), TEXT, None),
(_('Source: ID'), TEXT, None), (_('Source: ID'), TEXT, None),
@ -115,11 +117,11 @@ class CitationListView(ListView):
('columns.visible', [COL_TITLE_PAGE, COL_ID, COL_DATE, ('columns.visible', [COL_TITLE_PAGE, COL_ID, COL_DATE,
COL_CONFIDENCE]), COL_CONFIDENCE]),
('columns.rank', [COL_TITLE_PAGE, COL_ID, COL_DATE, COL_CONFIDENCE, ('columns.rank', [COL_TITLE_PAGE, COL_ID, COL_DATE, COL_CONFIDENCE,
COL_PRIV, COL_CHAN, COL_SRC_TITLE, COL_SRC_ID, COL_PRIV, COL_TAGS, COL_CHAN, COL_SRC_TITLE,
COL_SRC_AUTH, COL_SRC_ABBR, COL_SRC_PINFO, COL_SRC_ID, COL_SRC_AUTH, COL_SRC_ABBR, COL_SRC_PINFO,
COL_SRC_PRIV, COL_SRC_CHAN]), COL_SRC_PRIV, COL_SRC_CHAN]),
('columns.size', [200, 75, 100, 100, 40, 100, 200, 75, 75, 100, 150, ('columns.size', [200, 75, 100, 100, 40, 100, 100, 200, 75, 75, 100,
40, 100]) 150, 40, 100])
) )
ADD_MSG = _("Add a new citation and a new source") ADD_MSG = _("Add a new citation and a new source")
ADD_SOURCE_MSG = _("Add a new source") ADD_SOURCE_MSG = _("Add a new source")
@ -335,6 +337,26 @@ class CitationListView(ListView):
else: else:
return None return None
def tag_updated(self, handle_list):
"""
Update tagged rows when a tag color changes.
"""
all_links = set([])
for tag_handle in handle_list:
links = set([link[1] for link in
self.dbstate.db.find_backlink_handles(tag_handle,
include_classes='Citation')])
all_links = all_links.union(links)
self.row_update(list(all_links))
def add_tag(self, transaction, citation_handle, tag_handle):
"""
Add the given tag to the given citation.
"""
citation = self.dbstate.db.get_citation_from_handle(citation_handle)
citation.add_tag(tag_handle)
self.dbstate.db.commit_citation(citation, transaction)
def get_default_gramplets(self): def get_default_gramplets(self):
""" """
Define the default gramplets for the sidebar and bottombar. Define the default gramplets for the sidebar and bottombar.

View File

@ -85,10 +85,11 @@ class CitationTreeView(ListView):
COL_DATE = 2 COL_DATE = 2
COL_CONFIDENCE = 3 COL_CONFIDENCE = 3
COL_PRIV = 4 COL_PRIV = 4
COL_CHAN = 5 COL_TAGS = 5
COL_SRC_AUTH = 6 COL_CHAN = 6
COL_SRC_ABBR = 7 COL_SRC_AUTH = 7
COL_SRC_PINFO = 8 COL_SRC_ABBR = 8
COL_SRC_PINFO = 9
# column definitions # column definitions
COLUMNS = [ COLUMNS = [
(_('Title or Page'), TEXT, None), (_('Title or Page'), TEXT, None),
@ -96,6 +97,7 @@ class CitationTreeView(ListView):
(_('Date'), MARKUP, None), (_('Date'), MARKUP, None),
(_('Confidence'), TEXT, None), (_('Confidence'), TEXT, None),
(_('Private'), ICON, 'gramps-lock'), (_('Private'), ICON, 'gramps-lock'),
(_('Tags'), TEXT, None),
(_('Last Changed'), TEXT, None), (_('Last Changed'), TEXT, None),
(_('Source: Author'), TEXT, None), (_('Source: Author'), TEXT, None),
(_('Source: Abbreviation'), TEXT, None), (_('Source: Abbreviation'), TEXT, None),
@ -114,9 +116,9 @@ class CitationTreeView(ListView):
('columns.visible', [COL_TITLE_PAGE, COL_ID, COL_SRC_AUTH, ('columns.visible', [COL_TITLE_PAGE, COL_ID, COL_SRC_AUTH,
COL_SRC_PINFO]), COL_SRC_PINFO]),
('columns.rank', [COL_TITLE_PAGE, COL_ID, COL_DATE, COL_CONFIDENCE, ('columns.rank', [COL_TITLE_PAGE, COL_ID, COL_DATE, COL_CONFIDENCE,
COL_PRIV, COL_CHAN, COL_SRC_AUTH, COL_PRIV, COL_TAGS, COL_CHAN, COL_SRC_AUTH,
COL_SRC_ABBR, COL_SRC_PINFO]), COL_SRC_ABBR, COL_SRC_PINFO]),
('columns.size', [200, 75, 100, 75, 40, 100, 150, 100, 150]) ('columns.size', [200, 75, 100, 75, 40, 100, 100, 150, 100, 150])
) )
ADD_MSG = _("Add a new citation and a new source") ADD_MSG = _("Add a new citation and a new source")
ADD_SOURCE_MSG = _("Add a new source") ADD_SOURCE_MSG = _("Add a new source")
@ -550,6 +552,26 @@ class CitationTreeView(ListView):
else: else:
return None return None
def tag_updated(self, handle_list):
"""
Update tagged rows when a tag color changes.
"""
all_links = set([])
for tag_handle in handle_list:
links = set([link[1] for link in
self.dbstate.db.find_backlink_handles(tag_handle,
include_classes='Citation')])
all_links = all_links.union(links)
self.row_update(list(all_links))
def add_tag(self, transaction, citation_handle, tag_handle):
"""
Add the given tag to the given citation.
"""
citation = self.dbstate.db.get_citation_from_handle(citation_handle)
citation.add_tag(tag_handle)
self.dbstate.db.commit_citation(citation, transaction)
def get_default_gramplets(self): def get_default_gramplets(self):
""" """
Define the default gramplets for the sidebar and bottombar. Define the default gramplets for the sidebar and bottombar.

View File

@ -76,8 +76,9 @@ class EventView(ListView):
COL_DATE = 3 COL_DATE = 3
COL_PLACE = 4 COL_PLACE = 4
COL_PRIV = 5 COL_PRIV = 5
COL_CHAN = 6 COL_TAGS = 6
COL_PARTIC = 7 COL_CHAN = 7
COL_PARTIC = 8
# column definitions # column definitions
COLUMNS = [ COLUMNS = [
(_('Description'), TEXT, None), (_('Description'), TEXT, None),
@ -86,6 +87,7 @@ class EventView(ListView):
(_('Date'), MARKUP, None), (_('Date'), MARKUP, None),
(_('Place'), TEXT, None), (_('Place'), TEXT, None),
(_('Private'), ICON, 'gramps-lock'), (_('Private'), ICON, 'gramps-lock'),
(_('Tags'), TEXT, None),
(_('Last Changed'), TEXT, None), (_('Last Changed'), TEXT, None),
(_('Main Participants'), TEXT, None), (_('Main Participants'), TEXT, None),
] ]
@ -93,8 +95,8 @@ class EventView(ListView):
CONFIGSETTINGS = ( CONFIGSETTINGS = (
('columns.visible', [COL_DESCR, COL_ID, COL_TYPE, COL_DATE, COL_PLACE]), ('columns.visible', [COL_DESCR, COL_ID, COL_TYPE, COL_DATE, COL_PLACE]),
('columns.rank', [COL_DESCR, COL_ID, COL_TYPE, COL_PARTIC, COL_DATE, ('columns.rank', [COL_DESCR, COL_ID, COL_TYPE, COL_PARTIC, COL_DATE,
COL_PLACE, COL_PRIV, COL_CHAN]), COL_PLACE, COL_PRIV, COL_TAGS, COL_CHAN]),
('columns.size', [200, 75, 100, 230, 150, 200, 40, 100]) ('columns.size', [200, 75, 100, 230, 150, 200, 40, 100, 100])
) )
ADD_MSG = _("Add a new event") ADD_MSG = _("Add a new event")
EDIT_MSG = _("Edit the selected event") EDIT_MSG = _("Edit the selected event")
@ -267,6 +269,26 @@ class EventView(ListView):
else: else:
MergeEvent(self.dbstate, self.uistate, mlist[0], mlist[1]) MergeEvent(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='Event')])
all_links = all_links.union(links)
self.row_update(list(all_links))
def add_tag(self, transaction, event_handle, tag_handle):
"""
Add the given tag to the given event.
"""
event = self.dbstate.db.get_event_from_handle(event_handle)
event.add_tag(tag_handle)
self.dbstate.db.commit_event(event, transaction)
def get_default_gramplets(self): def get_default_gramplets(self):
""" """
Define the default gramplets for the sidebar and bottombar. Define the default gramplets for the sidebar and bottombar.

View File

@ -110,7 +110,6 @@ class FamilyView(ListView):
'family-update' : self.row_update, 'family-update' : self.row_update,
'family-delete' : self.row_delete, 'family-delete' : self.row_delete,
'family-rebuild' : self.object_build, 'family-rebuild' : self.object_build,
'tag-update' : self.tag_updated
} }
ListView.__init__( ListView.__init__(
@ -213,20 +212,6 @@ class FamilyView(ListView):
]) ])
self._add_action_group(self.all_action) self._add_action_group(self.all_action)
def set_active(self):
"""
Called when the page is displayed.
"""
ListView.set_active(self)
self.uistate.viewmanager.tags.tag_enable()
def set_inactive(self):
"""
Called when the page is no longer displayed.
"""
ListView.set_inactive(self)
self.uistate.viewmanager.tags.tag_disable()
def add_bookmark(self, obj): def add_bookmark(self, obj):
mlist = self.selected_handles() mlist = self.selected_handles()
if mlist: if mlist:

View File

@ -133,7 +133,6 @@ class MediaView(ListView):
'media-update' : self.row_update, 'media-update' : self.row_update,
'media-delete' : self.row_delete, 'media-delete' : self.row_delete,
'media-rebuild' : self.object_build, 'media-rebuild' : self.object_build,
'tag-update' : self.tag_updated
} }
ListView.__init__( ListView.__init__(
@ -232,20 +231,6 @@ class MediaView(ListView):
self._add_action('QuickReport', None, _("Quick View"), None, None, None) self._add_action('QuickReport', None, _("Quick View"), None, None, None)
def set_active(self):
"""
Called when the page is displayed.
"""
ListView.set_active(self)
self.uistate.viewmanager.tags.tag_enable()
def set_inactive(self):
"""
Called when the page is no longer displayed.
"""
ListView.set_inactive(self)
self.uistate.viewmanager.tags.tag_disable()
def view_media(self, obj): def view_media(self, obj):
""" """
Launch external viewers for the selected objects. Launch external viewers for the selected objects.

View File

@ -106,7 +106,6 @@ class NoteView(ListView):
'note-update' : self.row_update, 'note-update' : self.row_update,
'note-delete' : self.row_delete, 'note-delete' : self.row_delete,
'note-rebuild' : self.object_build, 'note-rebuild' : self.object_build,
'tag-update' : self.tag_updated
} }
ListView.__init__( ListView.__init__(
@ -203,20 +202,6 @@ class NoteView(ListView):
callback=self.filter_editor,) callback=self.filter_editor,)
self._add_action('QuickReport', None, _("Quick View"), None, None, None) self._add_action('QuickReport', None, _("Quick View"), None, None, None)
def set_active(self):
"""
Called when the page is displayed.
"""
ListView.set_active(self)
self.uistate.viewmanager.tags.tag_enable()
def set_inactive(self):
"""
Called when the page is no longer displayed.
"""
ListView.set_inactive(self)
self.uistate.viewmanager.tags.tag_disable()
def get_handle_from_gramps_id(self, gid): def get_handle_from_gramps_id(self, gid):
obj = self.dbstate.db.get_note_from_gramps_id(gid) obj = self.dbstate.db.get_note_from_gramps_id(gid)
if obj: if obj:

View File

@ -67,8 +67,9 @@ class PlaceTreeView(PlaceBaseView):
COL_LAT = 10 COL_LAT = 10
COL_LON = 11 COL_LON = 11
COL_PRIV = 12 COL_PRIV = 12
COL_CHAN = 13 COL_TAGS = 13
COL_NAME = 14 COL_CHAN = 14
COL_NAME = 15
# column definitions # column definitions
COLUMNS = [ COLUMNS = [
(_('Place'), MARKUP, None), (_('Place'), MARKUP, None),
@ -84,6 +85,7 @@ class PlaceTreeView(PlaceBaseView):
(_('Latitude'), TEXT, None), (_('Latitude'), TEXT, None),
(_('Longitude'), TEXT, None), (_('Longitude'), TEXT, None),
(_('Private'), ICON, 'gramps-lock'), (_('Private'), ICON, 'gramps-lock'),
(_('Tags'), TEXT, None),
(_('Last Changed'), TEXT, None), (_('Last Changed'), TEXT, None),
(_('Place Name'), TEXT, None), (_('Place Name'), TEXT, None),
] ]
@ -93,10 +95,10 @@ class PlaceTreeView(PlaceBaseView):
COL_CITY, COL_COUNTY, COL_STATE]), COL_CITY, COL_COUNTY, COL_STATE]),
('columns.rank', [COL_PLACE, COL_ID, COL_STREET, COL_LOCALITY, COL_CITY, ('columns.rank', [COL_PLACE, COL_ID, COL_STREET, COL_LOCALITY, COL_CITY,
COL_COUNTY, COL_STATE, COL_COUNTRY, COL_ZIP, COL_COUNTY, COL_STATE, COL_COUNTRY, COL_ZIP,
COL_PARISH, COL_LAT, COL_LON, COL_PRIV, COL_CHAN, COL_PARISH, COL_LAT, COL_LON, COL_PRIV, COL_TAGS,
COL_NAME]), COL_CHAN, COL_NAME]),
('columns.size', [250, 75, 150, 150, 150, 150, 100, 100, 100, ('columns.size', [250, 75, 150, 150, 150, 150, 100, 100, 100,
100, 150, 150, 40, 100, 150]) 100, 150, 150, 40, 100, 100, 150])
) )
def __init__(self, pdata, dbstate, uistate): def __init__(self, pdata, dbstate, uistate):

View File

@ -79,7 +79,8 @@ class RepositoryView(ListView):
COL_EMAIL = 10 COL_EMAIL = 10
COL_SURL = 11 COL_SURL = 11
COL_PRIV = 12 COL_PRIV = 12
COL_CHAN = 13 COL_TAGS = 13
COL_CHAN = 14
# column definitions # column definitions
COLUMNS = [ COLUMNS = [
@ -96,6 +97,7 @@ class RepositoryView(ListView):
(_('Email'), TEXT, None), (_('Email'), TEXT, None),
(_('Search URL'), TEXT, None), (_('Search URL'), TEXT, None),
(_('Private'), ICON, 'gramps-lock'), (_('Private'), ICON, 'gramps-lock'),
(_('Tags'), TEXT, None),
(_('Last Changed'), TEXT, None), (_('Last Changed'), TEXT, None),
] ]
# default setting with visible columns, order of the col, and their size # default setting with visible columns, order of the col, and their size
@ -104,9 +106,10 @@ class RepositoryView(ListView):
]), ]),
('columns.rank', [COL_NAME, COL_ID, COL_TYPE, COL_URL, COL_STREET, ('columns.rank', [COL_NAME, COL_ID, COL_TYPE, COL_URL, COL_STREET,
COL_LOCALITY, COL_CITY, COL_STATE, COL_COUNTRY, COL_LOCALITY, COL_CITY, COL_STATE, COL_COUNTRY,
COL_ZIP, COL_EMAIL, COL_SURL, COL_PRIV, COL_CHAN]), COL_ZIP, COL_EMAIL, COL_SURL, COL_PRIV, COL_TAGS,
COL_CHAN]),
('columns.size', [200, 75, 100, 250, 100, 100, 100, 100, 100, ('columns.size', [200, 75, 100, 250, 100, 100, 100, 100, 100,
100, 100, 100, 40, 100]) 100, 100, 100, 40, 100, 100])
) )
ADD_MSG = _("Add a new repository") ADD_MSG = _("Add a new repository")
EDIT_MSG = _("Edit the selected repository") EDIT_MSG = _("Edit the selected repository")
@ -257,6 +260,26 @@ class RepositoryView(ListView):
else: else:
return None return None
def tag_updated(self, handle_list):
"""
Update tagged rows when a tag color changes.
"""
all_links = set([])
for tag_handle in handle_list:
links = set([link[1] for link in
self.dbstate.db.find_backlink_handles(tag_handle,
include_classes='Repository')])
all_links = all_links.union(links)
self.row_update(list(all_links))
def add_tag(self, transaction, repo_handle, tag_handle):
"""
Add the given tag to the given repository.
"""
repo = self.dbstate.db.get_repository_from_handle(repo_handle)
repo.add_tag(tag_handle)
self.dbstate.db.commit_repository(repo, transaction)
def get_default_gramplets(self): def get_default_gramplets(self):
""" """
Define the default gramplets for the sidebar and bottombar. Define the default gramplets for the sidebar and bottombar.

View File

@ -76,7 +76,8 @@ class SourceView(ListView):
COL_ABBR = 3 COL_ABBR = 3
COL_PINFO = 4 COL_PINFO = 4
COL_PRIV = 5 COL_PRIV = 5
COL_CHAN = 6 COL_TAGS = 6
COL_CHAN = 7
# column definitions # column definitions
COLUMNS = [ COLUMNS = [
@ -86,14 +87,15 @@ class SourceView(ListView):
(_('Abbreviation'), TEXT, None), (_('Abbreviation'), TEXT, None),
(_('Publication Information'), TEXT, None), (_('Publication Information'), TEXT, None),
(_('Private'), ICON, 'gramps-lock'), (_('Private'), ICON, 'gramps-lock'),
(_('Tags'), TEXT, None),
(_('Last Changed'), TEXT, None), (_('Last Changed'), TEXT, None),
] ]
# default setting with visible columns, order of the col, and their size # default setting with visible columns, order of the col, and their size
CONFIGSETTINGS = ( CONFIGSETTINGS = (
('columns.visible', [COL_TITLE, COL_ID, COL_AUTH, COL_PINFO]), ('columns.visible', [COL_TITLE, COL_ID, COL_AUTH, COL_PINFO]),
('columns.rank', [COL_TITLE, COL_ID, COL_AUTH, COL_ABBR, COL_PINFO, ('columns.rank', [COL_TITLE, COL_ID, COL_AUTH, COL_ABBR, COL_PINFO,
COL_PRIV, COL_CHAN]), COL_PRIV, COL_TAGS, COL_CHAN]),
('columns.size', [200, 75, 150, 100, 150, 40, 100]) ('columns.size', [200, 75, 150, 100, 150, 40, 100, 100])
) )
ADD_MSG = _("Add a new source") ADD_MSG = _("Add a new source")
EDIT_MSG = _("Edit the selected source") EDIT_MSG = _("Edit the selected source")
@ -241,6 +243,26 @@ class SourceView(ListView):
else: else:
return None return None
def tag_updated(self, handle_list):
"""
Update tagged rows when a tag color changes.
"""
all_links = set([])
for tag_handle in handle_list:
links = set([link[1] for link in
self.dbstate.db.find_backlink_handles(tag_handle,
include_classes='Source')])
all_links = all_links.union(links)
self.row_update(list(all_links))
def add_tag(self, transaction, source_handle, tag_handle):
"""
Add the given tag to the given source.
"""
source = self.dbstate.db.get_source_from_handle(source_handle)
source.add_tag(tag_handle)
self.dbstate.db.commit_source(source, transaction)
def get_default_gramplets(self): def get_default_gramplets(self):
""" """
Define the default gramplets for the sidebar and bottombar. Define the default gramplets for the sidebar and bottombar.