From 188587bbaf27dd87fe0508a40b580d68f0370e37 Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Mon, 27 May 2013 09:35:31 +0000 Subject: [PATCH] Make it possible to show private icon in displaytabs Enable this already in Attribute and SrcAttribute svn: r22427 --- gramps/gui/editors/displaytabs/__init__.py | 2 +- .../gui/editors/displaytabs/addrembedlist.py | 14 ++-- .../gui/editors/displaytabs/attrembedlist.py | 11 ++-- gramps/gui/editors/displaytabs/attrmodel.py | 5 +- gramps/gui/editors/displaytabs/backreflist.py | 8 +-- .../editors/displaytabs/citationembedlist.py | 10 +-- .../gui/editors/displaytabs/embeddedlist.py | 65 +++++++++++++++---- .../gui/editors/displaytabs/eventembedlist.py | 20 +++--- .../editors/displaytabs/groupembeddedlist.py | 2 +- .../gui/editors/displaytabs/ldsembedlist.py | 12 ++-- .../editors/displaytabs/locationembedlist.py | 14 ++-- .../gui/editors/displaytabs/nameembedlist.py | 11 ++-- gramps/gui/editors/displaytabs/notetab.py | 6 +- .../editors/displaytabs/personrefembedlist.py | 8 +-- .../gui/editors/displaytabs/repoembedlist.py | 10 +-- .../editors/displaytabs/srcattrembedlist.py | 13 ++-- gramps/gui/editors/displaytabs/surnametab.py | 8 +-- .../gui/editors/displaytabs/webembedlist.py | 8 +-- 18 files changed, 137 insertions(+), 90 deletions(-) diff --git a/gramps/gui/editors/displaytabs/__init__.py b/gramps/gui/editors/displaytabs/__init__.py index 03485017a..2740aea33 100644 --- a/gramps/gui/editors/displaytabs/__init__.py +++ b/gramps/gui/editors/displaytabs/__init__.py @@ -35,7 +35,7 @@ from .childmodel import ChildModel # Then import tab classes from .grampstab import GrampsTab -from .embeddedlist import EmbeddedList +from .embeddedlist import EmbeddedList, TEXT_COL, MARKUP_COL, ICON_COL from .addrembedlist import AddrEmbedList from .attrembedlist import AttrEmbedList from .backreflist import BackRefList diff --git a/gramps/gui/editors/displaytabs/addrembedlist.py b/gramps/gui/editors/displaytabs/addrembedlist.py index ef53ece58..001a6f4a0 100644 --- a/gramps/gui/editors/displaytabs/addrembedlist.py +++ b/gramps/gui/editors/displaytabs/addrembedlist.py @@ -42,7 +42,7 @@ from gramps.gen.lib import Address from gramps.gen.errors import WindowActiveError from ...ddtargets import DdTargets from .addressmodel import AddressModel -from .embeddedlist import EmbeddedList +from .embeddedlist import EmbeddedList, TEXT_COL, MARKUP_COL, ICON_COL #------------------------------------------------------------------------- # @@ -70,12 +70,12 @@ class AddrEmbedList(EmbeddedList): #index = column in model. Value = # (name, sortcol in model, width, markup/text, weigth_col _column_names = [ - (_('Date'), 0, 150, 1, -1), - (_('Street'), 1, 225, 0, -1), - (_('Locality'), 2, 100, 0, -1), - (_('City'), 3, 100, 0, -1), - (_('State/County'), 4, 100, 0, -1), - (_('Country'), 5, 75, 0, -1), + (_('Date'), 0, 150, MARKUP_COL, -1, None), + (_('Street'), 1, 225, TEXT_COL, -1, None), + (_('Locality'), 2, 100, TEXT_COL, -1, None), + (_('City'), 3, 100, TEXT_COL, -1, None), + (_('State/County'), 4, 100, TEXT_COL, -1, None), + (_('Country'), 5, 75, TEXT_COL, -1, None), ] def __init__(self, dbstate, uistate, track, data): diff --git a/gramps/gui/editors/displaytabs/attrembedlist.py b/gramps/gui/editors/displaytabs/attrembedlist.py index 30835a4b0..867050c7d 100644 --- a/gramps/gui/editors/displaytabs/attrembedlist.py +++ b/gramps/gui/editors/displaytabs/attrembedlist.py @@ -38,7 +38,7 @@ from gramps.gen.lib import Attribute from gramps.gen.errors import WindowActiveError from ...ddtargets import DdTargets from .attrmodel import AttrModel -from .embeddedlist import EmbeddedList +from .embeddedlist import EmbeddedList, TEXT_COL, MARKUP_COL, ICON_COL #------------------------------------------------------------------------- # @@ -47,7 +47,7 @@ from .embeddedlist import EmbeddedList #------------------------------------------------------------------------- class AttrEmbedList(EmbeddedList): - _HANDLE_COL = 2 + _HANDLE_COL = 3 _DND_TYPE = DdTargets.ATTRIBUTE _MSG = { @@ -61,8 +61,9 @@ class AttrEmbedList(EmbeddedList): #index = column in model. Value = # (name, sortcol in model, width, markup/text, weigth_col _column_names = [ - (_('Type'), 0, 250, 0, -1), - (_('Value'), 1, 200, 0, -1), + (_('Type'), 0, 250, TEXT_COL, -1, None), + (_('Value'), 1, 200, TEXT_COL, -1, None), + (_('Private'), 2, 30, ICON_COL, -1, 'gramps-lock') ] def __init__(self, dbstate, uistate, track, data): @@ -90,7 +91,7 @@ class AttrEmbedList(EmbeddedList): return self.data def column_order(self): - return ((1, 0), (1, 1)) + return ((1, 2), (1, 0), (1, 1)) def add_button_clicked(self, obj): pname = '' diff --git a/gramps/gui/editors/displaytabs/attrmodel.py b/gramps/gui/editors/displaytabs/attrmodel.py index adeac16c7..51cbb3019 100644 --- a/gramps/gui/editors/displaytabs/attrmodel.py +++ b/gramps/gui/editors/displaytabs/attrmodel.py @@ -42,11 +42,12 @@ from gi.repository import Gtk class AttrModel(Gtk.ListStore): def __init__(self, attr_list, db): - Gtk.ListStore.__init__(self, str, str, object) + 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, + attr.get_privacy(), + attr, ]) diff --git a/gramps/gui/editors/displaytabs/backreflist.py b/gramps/gui/editors/displaytabs/backreflist.py index de3b5b5c2..953527520 100644 --- a/gramps/gui/editors/displaytabs/backreflist.py +++ b/gramps/gui/editors/displaytabs/backreflist.py @@ -44,7 +44,7 @@ from gi.repository import Gtk #------------------------------------------------------------------------- from gramps.gen.errors import WindowActiveError from ...widgets import SimpleButton -from .embeddedlist import EmbeddedList +from .embeddedlist import EmbeddedList, TEXT_COL, MARKUP_COL, ICON_COL #------------------------------------------------------------------------- # @@ -58,9 +58,9 @@ class BackRefList(EmbeddedList): #index = column in model. Value = # (name, sortcol in model, width, markup/text, weigth_col _column_names = [ - (_('Type'), 0, 100, 0, -1), - (_('ID'), 1, 75, 0, -1), - (_('Name'), 2, 250, 0, -1), + (_('Type'), 0, 100, TEXT_COL, -1, None), + (_('ID'), 1, 75, TEXT_COL, -1, None), + (_('Name'), 2, 250, TEXT_COL, -1, None), ] def __init__(self, dbstate, uistate, track, obj, refmodel, callback=None): diff --git a/gramps/gui/editors/displaytabs/citationembedlist.py b/gramps/gui/editors/displaytabs/citationembedlist.py index 5d00952a5..7ac7a7e0a 100644 --- a/gramps/gui/editors/displaytabs/citationembedlist.py +++ b/gramps/gui/editors/displaytabs/citationembedlist.py @@ -49,7 +49,7 @@ from gramps.gen.lib import Source, Citation from ...dbguielement import DbGUIElement from ...selectors import SelectorFactory from .citationrefmodel import CitationRefModel -from .embeddedlist import EmbeddedList +from .embeddedlist import EmbeddedList, TEXT_COL, MARKUP_COL, ICON_COL from ...ddtargets import DdTargets #------------------------------------------------------------------------- @@ -80,10 +80,10 @@ class CitationEmbedList(EmbeddedList, DbGUIElement): #index = column in model. Value = # (name, sortcol in model, width, markup/text, weigth_col _column_names = [ - (_('Title'), 0, 200, 0, -1), - (_('Author'), 1, 125, 0, -1), - (_('Page'), 2, 100, 0, -1), - (_('ID'), 3, 75, 0, -1), + (_('Title'), 0, 200, TEXT_COL, -1, None), + (_('Author'), 1, 125, TEXT_COL, -1, None), + (_('Page'), 2, 100, TEXT_COL, -1, None), + (_('ID'), 3, 75, TEXT_COL, -1, None), ] def __init__(self, dbstate, uistate, track, data, callertitle=None): diff --git a/gramps/gui/editors/displaytabs/embeddedlist.py b/gramps/gui/editors/displaytabs/embeddedlist.py index 8445536c7..51875dfe0 100644 --- a/gramps/gui/editors/displaytabs/embeddedlist.py +++ b/gramps/gui/editors/displaytabs/embeddedlist.py @@ -52,6 +52,16 @@ from gi.repository import Pango from ...utils import is_right_click from .buttontab import ButtonTab + +#---------------------------------------------------------------- +# +# Constants +# +#---------------------------------------------------------------- +TEXT_COL = 0 +MARKUP_COL = 1 +ICON_COL = 2 + #------------------------------------------------------------------------- # # Classes @@ -80,6 +90,8 @@ class EmbeddedList(ButtonTab): self.changed = False self.model = None self.build_model = build_model + #renderer for pixbuf + self.pb_renderer = None # handle the selection self.tree.set_hover_selection(True) @@ -88,6 +100,7 @@ class EmbeddedList(ButtonTab): self.track_ref_for_deletion("selection") # build the columns + self.col_icons = {} self.columns = [] self.build_columns() @@ -470,19 +483,35 @@ class EmbeddedList(ButtonTab): # assign it to the column name. The text value is extracted # from the model column specified in pair[1] name = self._column_names[pair[1]][0] - renderer = Gtk.CellRendererText() - renderer.set_property('ellipsize', Pango.EllipsizeMode.END) - if self._column_names[pair[1]][3] == 0: - column = Gtk.TreeViewColumn(name, renderer, text=pair[1]) + col_icon = self._column_names[pair[1]][5] + if (self._column_names[pair[1]][3] in [TEXT_COL, MARKUP_COL]): + renderer = Gtk.CellRendererText() + renderer.set_property('ellipsize', Pango.EllipsizeMode.END) + if self._column_names[pair[1]][3] == 0: + column = Gtk.TreeViewColumn(name, renderer, text=pair[1]) + else: + column = Gtk.TreeViewColumn(name, renderer, markup=pair[1]) + if not self._column_names[pair[1]][4] == -1: + #apply weight attribute + column.add_attribute(renderer, "weight", + self._column_names[pair[1]][4]) + elif self._column_names[pair[1]][3] == ICON_COL: + self.col_icons[pair[1]] = col_icon + self.pb_renderer = Gtk.CellRendererPixbuf() + column = Gtk.TreeViewColumn(name, self.pb_renderer) + column.set_cell_data_func(self.pb_renderer, self.icon_func, pair[1]) else: - column = Gtk.TreeViewColumn(name, renderer, markup=pair[1]) - if not self._column_names[pair[1]][4] == -1: - #apply weight attribute - column.add_attribute(renderer, "weight", - self._column_names[pair[1]][4]) - - # insert the colum into the tree - column.set_resizable(True) + raise NotImplementedError, 'Unknown column type' + if col_icon is not None: + image = Gtk.Image() + image.set_from_stock(col_icon, Gtk.IconSize.MENU) + image.set_tooltip_text(name) + image.show() + column.set_widget(image) + column.set_resizable(False) + else: + # insert the colum into the tree + column.set_resizable(True) column.set_clickable(True) column.set_sizing(Gtk.TreeViewColumnSizing.FIXED) #column.set_min_width(self._column_names[pair[1]][2]) @@ -493,6 +522,18 @@ class EmbeddedList(ButtonTab): self.tree.append_column(column) self.track_ref_for_deletion("columns") + def icon_func(self, column, renderer, model, iter_, col_num): + ''' + Set the stock icon property of the cell renderer. We use a cell data + function because there is a problem returning None from a model. + ''' + stock_id = model.get_value(iter_, col_num) + if stock_id == '' or stock_id == False: + stock_id = None + elif stock_id == True: + stock_id = self.col_icons[col_num] + renderer.set_property('stock_id', stock_id) + def construct_model(self): """ Method that creates the model using the passed build_model parameter diff --git a/gramps/gui/editors/displaytabs/eventembedlist.py b/gramps/gui/editors/displaytabs/eventembedlist.py index 5e5937b0b..1c12409c1 100644 --- a/gramps/gui/editors/displaytabs/eventembedlist.py +++ b/gramps/gui/editors/displaytabs/eventembedlist.py @@ -39,6 +39,7 @@ from gi.repository import GObject from gramps.gen.lib import Event, EventRef, EventRoleType, EventType from gramps.gen.errors import WindowActiveError from ...ddtargets import DdTargets +from .embeddedlist import TEXT_COL, MARKUP_COL, ICON_COL from .groupembeddedlist import GroupEmbeddedList from .eventrefmodel import EventRefModel from ...dbguielement import DbGUIElement @@ -72,18 +73,19 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList): #index = column in model. Value = # (name, sortcol in model, width, markup/text, weigth_col _column_names = [ - (_('Description'), -1, 240, 0, EventRefModel.COL_FONTWEIGHT[0]), - (_('Type'), EventRefModel.COL_TYPE[0], 100, 0, - EventRefModel.COL_FONTWEIGHT[0]), - (_('ID'), EventRefModel.COL_GID[0], 60, 0, - EventRefModel.COL_FONTWEIGHT[0]), - (_('Date'), EventRefModel.COL_SORTDATE[0], 150, 1, -1), - (_('Place'), EventRefModel.COL_PLACE[0], 150, 0, -1), - (_('Role'), EventRefModel.COL_ROLE[0], 80, 0, -1), + (_('Description'), -1, 240, TEXT_COL, + EventRefModel.COL_FONTWEIGHT[0], None), + (_('Type'), EventRefModel.COL_TYPE[0], 100, TEXT_COL, + EventRefModel.COL_FONTWEIGHT[0], None), + (_('ID'), EventRefModel.COL_GID[0], 60, TEXT_COL, + EventRefModel.COL_FONTWEIGHT[0], None), + (_('Date'), EventRefModel.COL_SORTDATE[0], 150, MARKUP_COL, -1, None), + (_('Place'), EventRefModel.COL_PLACE[0], 150, TEXT_COL, -1, None), + (_('Role'), EventRefModel.COL_ROLE[0], 80, TEXT_COL, -1, None), None, None, None, - (_('Age'), EventRefModel.COL_SORTAGE[0], 60, 0, -1), + (_('Age'), EventRefModel.COL_SORTAGE[0], 60, TEXT_COL, -1, None), None ] diff --git a/gramps/gui/editors/displaytabs/groupembeddedlist.py b/gramps/gui/editors/displaytabs/groupembeddedlist.py index 35370257e..df21cc806 100644 --- a/gramps/gui/editors/displaytabs/groupembeddedlist.py +++ b/gramps/gui/editors/displaytabs/groupembeddedlist.py @@ -47,7 +47,7 @@ from gi.repository import GObject # #------------------------------------------------------------------------- from ...utils import is_right_click -from .embeddedlist import EmbeddedList +from .embeddedlist import EmbeddedList, TEXT_COL, MARKUP_COL, ICON_COL #------------------------------------------------------------------------- # diff --git a/gramps/gui/editors/displaytabs/ldsembedlist.py b/gramps/gui/editors/displaytabs/ldsembedlist.py index 5989cf907..0efc3ae9a 100644 --- a/gramps/gui/editors/displaytabs/ldsembedlist.py +++ b/gramps/gui/editors/displaytabs/ldsembedlist.py @@ -37,7 +37,7 @@ from gi.repository import GObject from gramps.gen.lib import LdsOrd from gramps.gen.errors import WindowActiveError from .ldsmodel import LdsModel -from .embeddedlist import EmbeddedList +from .embeddedlist import EmbeddedList, TEXT_COL, MARKUP_COL, ICON_COL #------------------------------------------------------------------------- # @@ -60,11 +60,11 @@ class LdsEmbedList(EmbeddedList): #index = column in model. Value = # (name, sortcol in model, width, markup/text, weigth_col _column_names = [ - (_('Type'), 0, 150, 0, -1), - (_('Date'), 1, 150, 1, -1), - (_('Status'), 3, 75, 0, -1), - (_('Temple'), 2, 200, 0, -1), - (_('Place'), 3, 100, 0, -1), + (_('Type'), 0, 150, TEXT_COL, -1, None), + (_('Date'), 1, 150, MARKUP_COL, -1, None), + (_('Status'), 3, 75, TEXT_COL, -1, None), + (_('Temple'), 2, 200, TEXT_COL, -1, None), + (_('Place'), 3, 100, TEXT_COL, -1, None), ] def __init__(self, dbstate, uistate, track, data): diff --git a/gramps/gui/editors/displaytabs/locationembedlist.py b/gramps/gui/editors/displaytabs/locationembedlist.py index 10c613692..a2e576451 100644 --- a/gramps/gui/editors/displaytabs/locationembedlist.py +++ b/gramps/gui/editors/displaytabs/locationembedlist.py @@ -38,7 +38,7 @@ from gramps.gen.lib import Location from gramps.gen.errors import WindowActiveError from ...ddtargets import DdTargets from .locationmodel import LocationModel -from .embeddedlist import EmbeddedList +from .embeddedlist import EmbeddedList, TEXT_COL, MARKUP_COL, ICON_COL #------------------------------------------------------------------------- # @@ -53,12 +53,12 @@ class LocationEmbedList(EmbeddedList): #index = column in model. Value = # (name, sortcol in model, width, markup/text, weigth_col _column_names = [ - (_('Street'), 0, 150, 0, -1), - (_('Locality'), 1, 100, 0, -1), - (_('City'), 2, 100, 0, -1), - (_('County'), 3, 100, 0, -1), - (_('State'), 4, 100, 0, -1), - (_('Country'), 5, 75, 0, -1), + (_('Street'), 0, 150, TEXT_COL, -1, None), + (_('Locality'), 1, 100, TEXT_COL, -1, None), + (_('City'), 2, 100, TEXT_COL, -1, None), + (_('County'), 3, 100, TEXT_COL, -1, None), + (_('State'), 4, 100, TEXT_COL, -1, None), + (_('Country'), 5, 75, TEXT_COL, -1, None), ] def __init__(self, dbstate, uistate, track, data): diff --git a/gramps/gui/editors/displaytabs/nameembedlist.py b/gramps/gui/editors/displaytabs/nameembedlist.py index b3e573425..d9299641b 100644 --- a/gramps/gui/editors/displaytabs/nameembedlist.py +++ b/gramps/gui/editors/displaytabs/nameembedlist.py @@ -46,6 +46,7 @@ from gramps.gen.lib import Name, Surname from gramps.gen.errors import WindowActiveError from ...ddtargets import DdTargets from .namemodel import NameModel +from .embeddedlist import TEXT_COL, MARKUP_COL, ICON_COL from .groupembeddedlist import GroupEmbeddedList #------------------------------------------------------------------------- @@ -70,13 +71,13 @@ class NameEmbedList(GroupEmbeddedList): #index = column in model. Value = # (name, sortcol in model, width, markup/text, weigth_col _column_names = [ - (_('Name'), -1, 250, 0, NameModel.COL_FONTWEIGHT[0]), - (_('Type'), NameModel.COL_TYPE[0], 100, 0, -1), + (_('Name'), -1, 250, TEXT_COL, NameModel.COL_FONTWEIGHT[0], None), + (_('Type'), NameModel.COL_TYPE[0], 100, TEXT_COL, -1, None), None, None, - (_('Group As'), NameModel.COL_GROUPAS[0],100, 0, -1), - (_('Source'), NameModel.COL_HASSOURCE[0],60, 0, -1), - (_('Notes Preview'), NameModel.COL_NOTEPREVIEW[0], 250, 0, -1), + (_('Group As'), NameModel.COL_GROUPAS[0],100, TEXT_COL, -1, None), + (_('Source'), NameModel.COL_HASSOURCE[0],60, TEXT_COL, -1, None), + (_('Notes Preview'), NameModel.COL_NOTEPREVIEW[0], 250, TEXT_COL, -1, None), ] def __init__(self, dbstate, uistate, track, data, person, callback): diff --git a/gramps/gui/editors/displaytabs/notetab.py b/gramps/gui/editors/displaytabs/notetab.py index fd9c2941c..3ee45f6ad 100644 --- a/gramps/gui/editors/displaytabs/notetab.py +++ b/gramps/gui/editors/displaytabs/notetab.py @@ -45,7 +45,7 @@ from gramps.gen.lib import Note from ...dbguielement import DbGUIElement from ...selectors import SelectorFactory from .notemodel import NoteModel -from .embeddedlist import EmbeddedList +from .embeddedlist import EmbeddedList, TEXT_COL, MARKUP_COL, ICON_COL from ...ddtargets import DdTargets #------------------------------------------------------------------------- @@ -75,8 +75,8 @@ class NoteTab(EmbeddedList, DbGUIElement): #index = column in model. Value = # (name, sortcol in model, width, markup/text, weigth_col _column_names = [ - (_('Type'), 0, 100, 0, -1), - (_('Preview'), 1, 200, 0, -1), + (_('Type'), 0, 100, TEXT_COL, -1, None), + (_('Preview'), 1, 200, TEXT_COL, -1, None), ] def __init__(self, dbstate, uistate, track, data, callertitle=None, diff --git a/gramps/gui/editors/displaytabs/personrefembedlist.py b/gramps/gui/editors/displaytabs/personrefembedlist.py index fd64f1153..e9edb770b 100644 --- a/gramps/gui/editors/displaytabs/personrefembedlist.py +++ b/gramps/gui/editors/displaytabs/personrefembedlist.py @@ -38,7 +38,7 @@ from gramps.gen.lib import PersonRef from gramps.gen.errors import WindowActiveError from ...ddtargets import DdTargets from .personrefmodel import PersonRefModel -from .embeddedlist import EmbeddedList +from .embeddedlist import EmbeddedList, TEXT_COL, MARKUP_COL, ICON_COL #------------------------------------------------------------------------- # @@ -61,9 +61,9 @@ class PersonRefEmbedList(EmbeddedList): #index = column in model. Value = # (name, sortcol in model, width, markup/text _column_names = [ - (_('Name'), 0, 250, 0, -1), - (_('ID'), 1, 100, 0, -1), - (_('Association'), 2, 100, 0, -1), + (_('Name'), 0, 250, TEXT_COL, -1, None), + (_('ID'), 1, 100, TEXT_COL, -1, None), + (_('Association'), 2, 100, TEXT_COL, -1, None), ] def __init__(self, dbstate, uistate, track, data): diff --git a/gramps/gui/editors/displaytabs/repoembedlist.py b/gramps/gui/editors/displaytabs/repoembedlist.py index d7bab7e31..10ff104d9 100644 --- a/gramps/gui/editors/displaytabs/repoembedlist.py +++ b/gramps/gui/editors/displaytabs/repoembedlist.py @@ -40,7 +40,7 @@ from ...selectors import SelectorFactory from gramps.gen.errors import WindowActiveError from ...ddtargets import DdTargets from .reporefmodel import RepoRefModel -from .embeddedlist import EmbeddedList +from .embeddedlist import EmbeddedList, TEXT_COL, MARKUP_COL, ICON_COL #------------------------------------------------------------------------- # @@ -65,10 +65,10 @@ class RepoEmbedList(EmbeddedList, DbGUIElement): #index = column in model. Value = # (name, sortcol in model, width, markup/text, weigth_col _column_names = [ - (_('ID'), 0, 75, 0, -1), - (_('Title'), 1, 200, 0, -1), - (_('Call Number'), 2, 125, 0, -1), - (_('Type'), 3, 100, 0, -1), + (_('ID'), 0, 75, TEXT_COL, -1, None), + (_('Title'), 1, 200, TEXT_COL, -1, None), + (_('Call Number'), 2, 125, TEXT_COL, -1, None), + (_('Type'), 3, 100, TEXT_COL, -1, None), ] def __init__(self, dbstate, uistate, track, obj): diff --git a/gramps/gui/editors/displaytabs/srcattrembedlist.py b/gramps/gui/editors/displaytabs/srcattrembedlist.py index 853bc8041..c302e82ca 100644 --- a/gramps/gui/editors/displaytabs/srcattrembedlist.py +++ b/gramps/gui/editors/displaytabs/srcattrembedlist.py @@ -38,7 +38,7 @@ from gramps.gen.lib import SrcAttribute from gramps.gen.errors import WindowActiveError from ...ddtargets import DdTargets from .attrmodel import AttrModel -from .embeddedlist import EmbeddedList +from .embeddedlist import EmbeddedList, TEXT_COL, MARKUP_COL, ICON_COL #------------------------------------------------------------------------- # @@ -47,7 +47,7 @@ from .embeddedlist import EmbeddedList #------------------------------------------------------------------------- class SrcAttrEmbedList(EmbeddedList): - _HANDLE_COL = 2 + _HANDLE_COL = 3 _DND_TYPE = DdTargets.SRCATTRIBUTE _MSG = { @@ -59,10 +59,11 @@ class SrcAttrEmbedList(EmbeddedList): } #index = column in model. Value = - # (name, sortcol in model, width, markup/text, weigth_col + # (name, sortcol in model, width, markup/text, weigth_col, icon _column_names = [ - (_('Type'), 0, 250, 0, -1), - (_('Value'), 1, 200, 0, -1), + (_('Type'), 0, 250, TEXT_COL, -1, None), + (_('Value'), 1, 200, TEXT_COL, -1, None), + (_('Private'), 2, 30, ICON_COL, -1, 'gramps-lock') ] def __init__(self, dbstate, uistate, track, data): @@ -90,7 +91,7 @@ class SrcAttrEmbedList(EmbeddedList): return self.data def column_order(self): - return ((1, 0), (1, 1)) + return ((1, 2), (1, 0), (1, 1)) def add_button_clicked(self, obj): pname = '' diff --git a/gramps/gui/editors/displaytabs/surnametab.py b/gramps/gui/editors/displaytabs/surnametab.py index 166d7bac0..93ef7203e 100644 --- a/gramps/gui/editors/displaytabs/surnametab.py +++ b/gramps/gui/editors/displaytabs/surnametab.py @@ -47,7 +47,7 @@ _ENTER = Gdk.keyval_from_name("Enter") # #------------------------------------------------------------------------- from .surnamemodel import SurnameModel -from .embeddedlist import EmbeddedList +from .embeddedlist import EmbeddedList, TEXT_COL, MARKUP_COL, ICON_COL from ...ddtargets import DdTargets from gramps.gen.lib import Surname, NameOriginType from gramps.gen.constfunc import conv_to_unicode @@ -73,9 +73,9 @@ class SurnameTab(EmbeddedList): #index = column in model. Value = # (name, sortcol in model, width, markup/text _column_names = [ - (_('Prefix'), -1, 150, 0, -1), - (_('Surname'), -1, 250, 0, -1), - (_('Connector'), -1, 100, 0, -1), + (_('Prefix'), -1, 150, TEXT_COL, -1, None), + (_('Surname'), -1, 250, TEXT_COL, -1, None), + (_('Connector'), -1, 100, TEXT_COL, -1, None), ] _column_combo = (_('Origin'), -1, 150, 3) # name, sort, width, modelcol _column_toggle = (_('Name|Primary'), -1, 80, 4) diff --git a/gramps/gui/editors/displaytabs/webembedlist.py b/gramps/gui/editors/displaytabs/webembedlist.py index d2d58166d..ca9fb82ba 100644 --- a/gramps/gui/editors/displaytabs/webembedlist.py +++ b/gramps/gui/editors/displaytabs/webembedlist.py @@ -39,7 +39,7 @@ from gramps.gen.lib import Url from gramps.gen.errors import WindowActiveError from ...ddtargets import DdTargets from .webmodel import WebModel -from .embeddedlist import EmbeddedList +from .embeddedlist import EmbeddedList, TEXT_COL, MARKUP_COL, ICON_COL #------------------------------------------------------------------------- # @@ -63,9 +63,9 @@ class WebEmbedList(EmbeddedList): #index = column in model. Value = # (name, sortcol in model, width, markup/text, weigth_col _column_names = [ - (_('Type') , 0, 100, 0, -1), - (_('Path') , 1, 200, 0, -1), - (_('Description'), 2, 150, 0, -1), + (_('Type') , 0, 100, TEXT_COL, -1, None), + (_('Path') , 1, 200, TEXT_COL, -1, None), + (_('Description'), 2, 150, TEXT_COL, -1, None), ] def __init__(self, dbstate, uistate, track, data):