From f026cfb7202bf5583eff93814d53bd3cbc044d5d Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Wed, 26 Jul 2023 00:20:51 +0100 Subject: [PATCH] Fix bug in editors that occurred when source icons were added Source attributes do not have citations which means that they cannot share the same attribute model. --- gramps/gui/editors/displaytabs/attrmodel.py | 3 +- .../editors/displaytabs/srcattrembedlist.py | 4 +- .../gui/editors/displaytabs/srcattrmodel.py | 50 +++++++++++++++++++ po/POTFILES.skip | 1 + 4 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 gramps/gui/editors/displaytabs/srcattrmodel.py diff --git a/gramps/gui/editors/displaytabs/attrmodel.py b/gramps/gui/editors/displaytabs/attrmodel.py index 8a358bc87..5fe6a57b3 100644 --- a/gramps/gui/editors/displaytabs/attrmodel.py +++ b/gramps/gui/editors/displaytabs/attrmodel.py @@ -39,12 +39,13 @@ from gi.repository import Gtk class AttrModel(Gtk.ListStore): def __init__(self, attr_list, db): - Gtk.ListStore.__init__(self, str, str, bool, object) + Gtk.ListStore.__init__(self, str, str, bool, bool, object) self.db = db for attr in attr_list: self.append(row=[ str(attr.get_type()), attr.get_value(), + attr.has_citations(), attr.get_privacy(), attr, ]) diff --git a/gramps/gui/editors/displaytabs/srcattrembedlist.py b/gramps/gui/editors/displaytabs/srcattrembedlist.py index f3d138ed3..dfef85cf0 100644 --- a/gramps/gui/editors/displaytabs/srcattrembedlist.py +++ b/gramps/gui/editors/displaytabs/srcattrembedlist.py @@ -35,7 +35,7 @@ from gi.repository import GObject, GLib from gramps.gen.lib import SrcAttribute from gramps.gen.errors import WindowActiveError from ...ddtargets import DdTargets -from .attrmodel import AttrModel +from .srcattrmodel import SrcAttrModel from .embeddedlist import (EmbeddedList, TEXT_COL, MARKUP_COL, ICON_COL, TEXT_EDIT_COL) @@ -74,7 +74,7 @@ class SrcAttrEmbedList(EmbeddedList): """ self.data = data EmbeddedList.__init__(self, dbstate, uistate, track, _('_Attributes'), - AttrModel, move_buttons=True) + SrcAttrModel, move_buttons=True) def get_editor(self): from .. import EditSrcAttribute diff --git a/gramps/gui/editors/displaytabs/srcattrmodel.py b/gramps/gui/editors/displaytabs/srcattrmodel.py new file mode 100644 index 000000000..ee4486e7f --- /dev/null +++ b/gramps/gui/editors/displaytabs/srcattrmodel.py @@ -0,0 +1,50 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2000-2006 Donald N. Allingham +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + +#------------------------------------------------------------------------- +# +# GTK libraries +# +#------------------------------------------------------------------------- +from gi.repository import Gtk +#------------------------------------------------------------------------- +# +# Gramps classes +# +#------------------------------------------------------------------------- + + +#------------------------------------------------------------------------- +# +# SrcAttrModel +# +#------------------------------------------------------------------------- +class SrcAttrModel(Gtk.ListStore): + + def __init__(self, attr_list, db): + Gtk.ListStore.__init__(self, str, str, bool, object) + self.db = db + for attr in attr_list: + self.append(row=[ + str(attr.get_type()), + attr.get_value(), + attr.get_privacy(), + attr, + ]) diff --git a/po/POTFILES.skip b/po/POTFILES.skip index e5d02afc9..1bf3c13b7 100644 --- a/po/POTFILES.skip +++ b/po/POTFILES.skip @@ -343,6 +343,7 @@ gramps/gui/editors/displaytabs/placenamemodel.py gramps/gui/editors/displaytabs/placerefmodel.py gramps/gui/editors/displaytabs/reporefmodel.py gramps/gui/editors/displaytabs/sourcebackreflist.py +gramps/gui/editors/displaytabs/srcattrmodel.py gramps/gui/editors/displaytabs/surnamemodel.py gramps/gui/editors/displaytabs/webmodel.py #