Skip to content

Commit

Permalink
Fix bug in editors that occurred when source icons were added
Browse files Browse the repository at this point in the history
Source attributes do not have citations which means that they
cannot share the same attribute model.
  • Loading branch information
Nick-Hall committed Jul 27, 2023
1 parent caa2560 commit f026cfb
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 3 deletions.
3 changes: 2 additions & 1 deletion gramps/gui/editors/displaytabs/attrmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,13 @@
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,
])
4 changes: 2 additions & 2 deletions gramps/gui/editors/displaytabs/srcattrembedlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
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)

Expand Down Expand Up @@ -74,7 +74,7 @@ def __init__(self, dbstate, uistate, track, data):
"""
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
Expand Down
50 changes: 50 additions & 0 deletions gramps/gui/editors/displaytabs/srcattrmodel.py
Original file line number Diff line number Diff line change
@@ -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,
])
1 change: 1 addition & 0 deletions po/POTFILES.skip
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down

0 comments on commit f026cfb

Please sign in to comment.