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.
This commit is contained in:
Nick Hall 2023-07-26 00:20:51 +01:00
parent caa2560b11
commit f026cfb720
4 changed files with 55 additions and 3 deletions

View File

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

View File

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

View File

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

View File

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