Allow icons as column headings in listviews

svn: r21134
This commit is contained in:
Nick Hall 2013-01-15 18:46:18 +00:00
parent b6136261aa
commit cb268dac1f
14 changed files with 224 additions and 278 deletions

View File

@ -79,8 +79,9 @@ from ..utils import is_right_click
# Constants # Constants
# #
#---------------------------------------------------------------- #----------------------------------------------------------------
LISTFLAT = 0 TEXT = 1
LISTTREE = 1 MARKUP = 2
ICON = 3
#---------------------------------------------------------------- #----------------------------------------------------------------
# #
@ -88,7 +89,7 @@ LISTTREE = 1
# #
#---------------------------------------------------------------- #----------------------------------------------------------------
class ListView(NavigationView): class ListView(NavigationView):
COLUMN_NAMES = [] COLUMNS = []
#listview config settings that are always present related to the columns #listview config settings that are always present related to the columns
CONFIGSETTINGS = ( CONFIGSETTINGS = (
('columns.visible', []), ('columns.visible', []),
@ -102,9 +103,9 @@ class ListView(NavigationView):
FILTER_TYPE = None # Set in inheriting class FILTER_TYPE = None # Set in inheriting class
QR_CATEGORY = -1 QR_CATEGORY = -1
def __init__(self, title, pdata, dbstate, uistate, columns, handle_col, def __init__(self, title, pdata, dbstate, uistate, handle_col,
make_model, signal_map, get_bookmarks, bm_type, nav_group, make_model, signal_map, get_bookmarks, bm_type, nav_group,
multiple=False, filter_class=None, markup=None, pixbuf=None): multiple=False, filter_class=None):
NavigationView.__init__(self, title, pdata, dbstate, uistate, NavigationView.__init__(self, title, pdata, dbstate, uistate,
get_bookmarks, bm_type, nav_group) get_bookmarks, bm_type, nav_group)
#default is listviews keep themself in sync with database #default is listviews keep themself in sync with database
@ -117,15 +118,12 @@ class ListView(NavigationView):
self.sort_col = 0 self.sort_col = 0
self.sort_order = Gtk.SortType.ASCENDING self.sort_order = Gtk.SortType.ASCENDING
self.columns = [] self.columns = []
self.colinfo = columns
self.handle_col = handle_col self.handle_col = handle_col
self.make_model = make_model self.make_model = make_model
self.model = None self.model = None
self.signal_map = signal_map self.signal_map = signal_map
self.multiple_selection = multiple self.multiple_selection = multiple
self.generic_filter = None self.generic_filter = None
self.markup_columns = markup or []
self.pixbuf_columns = pixbuf or []
dbstate.connect('database-changed', self.change_db) dbstate.connect('database-changed', self.change_db)
self.connect_signals() self.connect_signals()
@ -138,12 +136,6 @@ class ListView(NavigationView):
self.model = None self.model = None
self.build_tree() self.build_tree()
def type_list(self):
"""
set the listtype, this governs eg keybinding
"""
return LISTFLAT
#################################################################### ####################################################################
# Build interface # Build interface
#################################################################### ####################################################################
@ -167,13 +159,8 @@ class ListView(NavigationView):
self.list.set_headers_clickable(True) self.list.set_headers_clickable(True)
self.list.set_fixed_height_mode(True) self.list.set_fixed_height_mode(True)
self.list.connect('button-press-event', self._button_press) self.list.connect('button-press-event', self._button_press)
if self.type_list() == LISTFLAT: self.list.connect('key-press-event', self._key_press)
# Flat list
self.list.connect('key-press-event', self._key_press)
else:
# Tree
self.list.connect('key-press-event', self._key_press_tree)
if self.drag_info(): if self.drag_info():
self.list.connect('drag_data_get', self.drag_data_get) self.list.connect('drag_data_get', self.drag_data_get)
self.list.connect('drag_begin', self.drag_begin) self.list.connect('drag_begin', self.drag_begin)
@ -248,17 +235,24 @@ class ListView(NavigationView):
index = 0 index = 0
for pair in self.column_order(): for pair in self.column_order():
if not pair[0]: continue if not pair[0]: continue
name = self.colinfo[pair[1]] col_name, col_type, col_icon = self.COLUMNS[pair[1]]
if pair[1] in self.pixbuf_columns: if col_type == ICON:
column = Gtk.TreeViewColumn(name, self.pb_renderer) column = Gtk.TreeViewColumn(col_name, self.pb_renderer)
column.set_cell_data_func(self.pb_renderer, self.icon, pair[1]) column.set_cell_data_func(self.pb_renderer, self.icon, pair[1])
else: else:
column = Gtk.TreeViewColumn(name, self.renderer) column = Gtk.TreeViewColumn(col_name, self.renderer)
if pair[1] in self.markup_columns: if col_type == MARKUP:
column.add_attribute(self.renderer, 'markup', pair[1]) column.add_attribute(self.renderer, 'markup', pair[1])
else: else:
column.add_attribute(self.renderer, 'text', pair[1]) column.add_attribute(self.renderer, 'text', pair[1])
if col_icon is not None:
image = Gtk.Image()
image.set_from_stock(col_icon, Gtk.IconSize.MENU)
image.set_tooltip_text(col_name)
image.show()
column.set_widget(image)
if self.model and self.model.color_column() is not None: if self.model and self.model.color_column() is not None:
column.set_cell_data_func(self.renderer, self.foreground_color) column.set_cell_data_func(self.renderer, self.foreground_color)
@ -375,7 +369,7 @@ class ListView(NavigationView):
def setup_filter(self): def setup_filter(self):
"""Build the default filters and add them to the filter menu.""" """Build the default filters and add them to the filter menu."""
self.search_bar.setup_filter( self.search_bar.setup_filter(
[(self.colinfo[pair[1]], pair[1], pair[1] in self.exact_search()) [(self.COLUMNS[pair[1]][0], pair[1], pair[1] in self.exact_search())
for pair in self.column_order() if pair[0]]) for pair in self.column_order() if pair[0]])
def sidebar_toggled(self, active, data=None): def sidebar_toggled(self, active, data=None):
@ -410,7 +404,7 @@ class ListView(NavigationView):
if not handle or handle in self.selected_handles(): if not handle or handle in self.selected_handles():
return return
if self.type_list() == LISTFLAT: if self.model.get_flags() & Gtk.TreeModelFlags.LIST_ONLY:
# Flat # Flat
path = self.model.node_map.get_path_from_handle(handle) path = self.model.node_map.get_path_from_handle(handle)
else: else:
@ -810,7 +804,7 @@ class ListView(NavigationView):
if not self.dbstate.open: if not self.dbstate.open:
return False return False
if event.type == Gdk.EventType._2BUTTON_PRESS and event.button == 1: if event.type == Gdk.EventType._2BUTTON_PRESS and event.button == 1:
if self.type_list() == LISTFLAT: if self.model.get_flags() & Gtk.TreeModelFlags.LIST_ONLY:
self.edit(obj) self.edit(obj)
return True return True
else: else:
@ -867,14 +861,25 @@ class ListView(NavigationView):
menu.show() menu.show()
else: else:
menu.hide() menu.hide()
def _key_press(self, obj, event): def _key_press(self, obj, event):
"""
Called when a key is pressed on a listview
"""
if not self.dbstate.open:
return False
if self.model.get_flags() & Gtk.TreeModelFlags.LIST_ONLY:
# Flat list
self._key_press_flat(obj, event)
else:
# Tree
self._key_press_tree(obj, event)
def _key_press_flat(self, obj, event):
""" """
Called when a key is pressed on a flat listview Called when a key is pressed on a flat listview
ENTER --> edit selection ENTER --> edit selection
""" """
if not self.dbstate.open:
return False
if event.keyval in (Gdk.KEY_Return, Gdk.KEY_KP_Enter): if event.keyval in (Gdk.KEY_Return, Gdk.KEY_KP_Enter):
self.edit(obj) self.edit(obj)
return True return True
@ -886,9 +891,7 @@ class ListView(NavigationView):
ENTER --> edit selection or open group node ENTER --> edit selection or open group node
SHIFT+ENTER --> open group node and all children nodes SHIFT+ENTER --> open group node and all children nodes
""" """
if not self.dbstate.open: if event.get_state() & Gdk.ModifierType.SHIFT_MASK:
return False
elif event.get_state() & Gdk.ModifierType.SHIFT_MASK:
if event.keyval in (Gdk.KEY_Return, Gdk.KEY_KP_Enter): if event.keyval in (Gdk.KEY_Return, Gdk.KEY_KP_Enter):
store, paths = self.selection.get_selected_rows() store, paths = self.selection.get_selected_rows()
if paths: if paths:
@ -909,7 +912,6 @@ class ListView(NavigationView):
else: else:
self.edit(obj) self.edit(obj)
return True return True
return False return False
def expand_collapse_tree(self): def expand_collapse_tree(self):
@ -1031,7 +1033,7 @@ class ListView(NavigationView):
ofile = None ofile = None
data_cols = [pair[1] for pair in self.column_order() if pair[0]] data_cols = [pair[1] for pair in self.column_order() if pair[0]]
column_names = [self.colinfo[i] for i in data_cols] column_names = [self.COLUMNS[i][0] for i in data_cols]
if type == 0: if type == 0:
ofile = CSVTab(len(column_names)) ofile = CSVTab(len(column_names))
else: else:
@ -1201,8 +1203,10 @@ class ListView(NavigationView):
:return: list of functions :return: list of functions
""" """
def columnpage(configdialog): def columnpage(configdialog):
return _('Columns'), ColumnOrder(self._config, self.COLUMN_NAMES, flat = self.model.get_flags() & Gtk.TreeModelFlags.LIST_ONLY
column_names = [col[0] for col in self.COLUMNS]
return _('Columns'), ColumnOrder(self._config, column_names,
self.get_column_widths(), self.get_column_widths(),
self.set_column_order, self.set_column_order,
tree=self.type_list()==LISTTREE) tree=not flat)
return [columnpage] return [columnpage]

View File

@ -49,7 +49,7 @@ _LOG = logging.getLogger(".gui.personview")
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gramps.gen.lib import Person, Surname from gramps.gen.lib import Person, Surname
from gramps.gen.db import DbTxn from gramps.gen.db import DbTxn
from gramps.gui.views.listview import ListView from gramps.gui.views.listview import ListView, TEXT, MARKUP, ICON
from gramps.gen.utils.string import data_recover_msg from gramps.gen.utils.string import data_recover_msg
from gramps.gen.display.name import displayer as name_displayer from gramps.gen.display.name import displayer as name_displayer
from gramps.gui.dialog import ErrorDialog, QuestionDialog from gramps.gui.dialog import ErrorDialog, QuestionDialog
@ -89,30 +89,27 @@ class BasePersonView(ListView):
COL_PRIV = 8 COL_PRIV = 8
COL_TAGS = 9 COL_TAGS = 9
COL_CHAN = 10 COL_CHAN = 10
#name of the columns # column definitions
COLUMN_NAMES = [ COLUMNS = [
_('Name'), (_('Name'), TEXT, None),
_('ID'), (_('ID'), TEXT, None),
_('Gender'), (_('Gender'), TEXT, None),
_('Birth Date'), (_('Birth Date'), MARKUP, None),
_('Birth Place'), (_('Birth Place'), MARKUP, None),
_('Death Date'), (_('Death Date'), MARKUP, None),
_('Death Place'), (_('Death Place'), MARKUP, None),
_('Spouse'), (_('Spouse'), TEXT, None),
_('Private'), (_('Private'), ICON, 'gramps-lock'),
_('Tags'), (_('Tags'), TEXT, None),
_('Last Changed'), (_('Last Changed'), TEXT, None),
] ]
# columns that contain markup
MARKUP_COLS = [COL_BDAT, COL_BPLAC, COL_DDAT, COL_DPLAC]
PIXBUF_COLS = [COL_PRIV]
# 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_NAME, COL_ID, COL_GEN, COL_BDAT, COL_DDAT]), ('columns.visible', [COL_NAME, COL_ID, COL_GEN, COL_BDAT, COL_DDAT]),
('columns.rank', [COL_NAME, COL_ID, COL_GEN, COL_BDAT, COL_BPLAC, ('columns.rank', [COL_NAME, COL_ID, COL_GEN, COL_BDAT, COL_BPLAC,
COL_DDAT, COL_DPLAC, COL_SPOUSE, COL_PRIV, COL_TAGS, COL_DDAT, COL_DPLAC, COL_SPOUSE, COL_PRIV, COL_TAGS,
COL_CHAN]), COL_CHAN]),
('columns.size', [250, 75, 75, 100, 175, 100, 175, 100, 50, 100, 100]) ('columns.size', [250, 75, 75, 100, 175, 100, 175, 100, 40, 100, 100])
) )
ADD_MSG = _("Add a new person") ADD_MSG = _("Add a new person")
EDIT_MSG = _("Edit the selected person") EDIT_MSG = _("Edit the selected person")
@ -137,13 +134,11 @@ class BasePersonView(ListView):
ListView.__init__( ListView.__init__(
self, title, pdata, dbstate, uistate, self, title, pdata, dbstate, uistate,
BasePersonView.COLUMN_NAMES, len(BasePersonView.COLUMN_NAMES), len(BasePersonView.COLUMNS),
model, signal_map, dbstate.db.get_bookmarks(), model, signal_map, dbstate.db.get_bookmarks(),
PersonBookmarks, nav_group, PersonBookmarks, nav_group,
multiple=True, multiple=True,
filter_class=PersonSidebarFilter, filter_class=PersonSidebarFilter)
markup=BasePersonView.MARKUP_COLS,
pixbuf=BasePersonView.PIXBUF_COLS)
self.func_list.update({ self.func_list.update({
'<PRIMARY>J' : self.jump, '<PRIMARY>J' : self.jump,

View File

@ -47,7 +47,7 @@ from gi.repository import Gtk
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gramps.gen.lib import Place from gramps.gen.lib import Place
from gramps.gui.views.listview import ListView from gramps.gui.views.listview import ListView, TEXT, MARKUP, ICON
from gramps.gui.widgets.menuitem import add_menuitem from gramps.gui.widgets.menuitem import add_menuitem
from gramps.gen.errors import WindowActiveError from gramps.gen.errors import WindowActiveError
from gramps.gui.views.bookmarks import PlaceBookmarks from gramps.gui.views.bookmarks import PlaceBookmarks
@ -90,26 +90,23 @@ class PlaceBaseView(ListView):
COL_LON = 11 COL_LON = 11
COL_PRIV = 12 COL_PRIV = 12
COL_CHAN = 13 COL_CHAN = 13
# name of the columns # column definitions
COLUMN_NAMES = [ COLUMNS = [
_('Place Name'), (_('Place Name'), MARKUP, None),
_('ID'), (_('ID'), TEXT, None),
_('Street'), (_('Street'), TEXT, None),
_('Locality'), (_('Locality'), TEXT, None),
_('City'), (_('City'), TEXT, None),
_('County'), (_('County'), TEXT, None),
_('State'), (_('State'), TEXT, None),
_('Country'), (_('Country'), TEXT, None),
_('ZIP/Postal Code'), (_('ZIP/Postal Code'), TEXT, None),
_('Church Parish'), (_('Church Parish'), TEXT, None),
_('Latitude'), (_('Latitude'), TEXT, None),
_('Longitude'), (_('Longitude'), TEXT, None),
_('Private'), (_('Private'), ICON, 'gramps-lock'),
_('Last Changed'), (_('Last Changed'), TEXT, None),
] ]
# columns that contain markup
MARKUP_COLS = [COL_NAME]
PIXBUF_COLS = [COL_PRIV]
# 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_NAME, COL_ID, COL_STREET, COL_LOCALITY, ('columns.visible', [COL_NAME, COL_ID, COL_STREET, COL_LOCALITY,
@ -118,7 +115,7 @@ class PlaceBaseView(ListView):
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_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, 50, 100]) 100, 150, 150, 40, 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")
@ -141,14 +138,12 @@ class PlaceBaseView(ListView):
ListView.__init__( ListView.__init__(
self, title, pdata, dbstate, uistate, self, title, pdata, dbstate, uistate,
self.COLUMN_NAMES, 15, 15,
model, signal_map, model, signal_map,
dbstate.db.get_place_bookmarks(), dbstate.db.get_place_bookmarks(),
PlaceBookmarks, nav_group, PlaceBookmarks, nav_group,
multiple=True, multiple=True,
filter_class=PlaceSidebarFilter, filter_class=PlaceSidebarFilter)
markup=PlaceBaseView.MARKUP_COLS,
pixbuf=PlaceBaseView.PIXBUF_COLS)
self.func_list.update({ self.func_list.update({
'<PRIMARY>J' : self.jump, '<PRIMARY>J' : self.jump,

View File

@ -48,7 +48,7 @@ from gi.repository import Gtk
from gramps.gui.views.treemodels.citationlistmodel import CitationListModel from gramps.gui.views.treemodels.citationlistmodel import CitationListModel
from gramps.gen.plug import CATEGORY_QR_CITATION from gramps.gen.plug import CATEGORY_QR_CITATION
from gramps.gen.lib import Citation, Source from gramps.gen.lib import Citation, Source
from gramps.gui.views.listview import ListView from gramps.gui.views.listview import ListView, TEXT, MARKUP, ICON
from gramps.gen.utils.db import get_citation_referents from gramps.gen.utils.db import get_citation_referents
from gramps.gui.views.bookmarks import CitationBookmarks from gramps.gui.views.bookmarks import CitationBookmarks
from gramps.gen.errors import WindowActiveError from gramps.gen.errors import WindowActiveError
@ -93,25 +93,22 @@ class CitationListView(ListView):
COL_SRC_PINFO = 10 COL_SRC_PINFO = 10
COL_SRC_PRIV = 11 COL_SRC_PRIV = 11
COL_SRC_CHAN = 12 COL_SRC_CHAN = 12
# name of the columns # column definitions
COLUMN_NAMES = [ COLUMNS = [
_('Volume/Page'), (_('Volume/Page'), TEXT, None),
_('ID'), (_('ID'), TEXT, None),
_('Date'), (_('Date'), MARKUP, None),
_('Confidence'), (_('Confidence'), TEXT, None),
_('Private'), (_('Private'), ICON, 'gramps-lock'),
_('Last Changed'), (_('Last Changed'), TEXT, None),
_('Source: Title'), (_('Source: Title'), TEXT, None),
_('Source: ID'), (_('Source: ID'), TEXT, None),
_('Source: Author'), (_('Source: Author'), TEXT, None),
_('Source: Abbreviation'), (_('Source: Abbreviation'), TEXT, None),
_('Source: Publication Information'), (_('Source: Publication Information'), TEXT, None),
_('Source: Private'), (_('Source: Private'), ICON, 'gramps-lock'),
_('Source: Last Changed'), (_('Source: Last Changed'), TEXT, None),
] ]
# columns that contain markup
MARKUP_COLS = [COL_DATE]
PIXBUF_COLS = [COL_PRIV, COL_SRC_PRIV]
# 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_PAGE, COL_ID, COL_DATE, ('columns.visible', [COL_TITLE_PAGE, COL_ID, COL_DATE,
@ -120,8 +117,8 @@ class CitationListView(ListView):
COL_PRIV, COL_CHAN, COL_SRC_TITLE, COL_SRC_ID, COL_PRIV, COL_CHAN, COL_SRC_TITLE, COL_SRC_ID,
COL_SRC_AUTH, COL_SRC_ABBR, COL_SRC_PINFO, 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, 50, 100, 200, 75, 75, 100, 150, ('columns.size', [200, 75, 100, 100, 40, 100, 200, 75, 75, 100, 150,
50, 100]) 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")
@ -143,14 +140,12 @@ class CitationListView(ListView):
ListView.__init__( ListView.__init__(
self, _('Citation View'), pdata, dbstate, uistate, self, _('Citation View'), pdata, dbstate, uistate,
self.COLUMN_NAMES, len(self.COLUMN_NAMES), len(self.COLUMNS),
CitationListModel, signal_map, CitationListModel, signal_map,
dbstate.db.get_citation_bookmarks(), dbstate.db.get_citation_bookmarks(),
CitationBookmarks, nav_group, CitationBookmarks, nav_group,
multiple=True, multiple=True,
filter_class=CitationSidebarFilter, filter_class=CitationSidebarFilter)
markup = CitationListView.MARKUP_COLS,
pixbuf = CitationListView.PIXBUF_COLS)
self.func_list.update({ self.func_list.update({
'<PRIMARY>J' : self.jump, '<PRIMARY>J' : self.jump,

View File

@ -45,7 +45,7 @@ from gi.repository import Gtk
# Gramps modules # Gramps modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gramps.gui.views.listview import LISTTREE from gramps.gui.views.listview import TEXT, MARKUP, ICON
from gramps.gui.views.treemodels.citationtreemodel import CitationTreeModel from gramps.gui.views.treemodels.citationtreemodel import CitationTreeModel
from gramps.gen.plug import CATEGORY_QR_SOURCE_OR_CITATION from gramps.gen.plug import CATEGORY_QR_SOURCE_OR_CITATION
from gramps.gen.lib import Citation, Source from gramps.gen.lib import Citation, Source
@ -88,17 +88,17 @@ class CitationTreeView(ListView):
COL_SRC_AUTH = 6 COL_SRC_AUTH = 6
COL_SRC_ABBR = 7 COL_SRC_ABBR = 7
COL_SRC_PINFO = 8 COL_SRC_PINFO = 8
# name of the columns # column definitions
COLUMN_NAMES = [ COLUMNS = [
_('Title or Page'), (_('Title or Page'), TEXT, None),
_('ID'), (_('ID'), TEXT, None),
_('Date'), (_('Date'), MARKUP, None),
_('Confidence'), (_('Confidence'), TEXT, None),
_('Private'), (_('Private'), ICON, 'gramps-lock'),
_('Last Changed'), (_('Last Changed'), TEXT, None),
_('Source: Author'), (_('Source: Author'), TEXT, None),
_('Source: Abbreviation'), (_('Source: Abbreviation'), TEXT, None),
_('Source: Publication Information'), (_('Source: Publication Information'), TEXT, None),
] ]
COLUMN_FILTERABLE = [ COLUMN_FILTERABLE = [
COL_TITLE_PAGE, COL_TITLE_PAGE,
@ -108,9 +108,6 @@ class CitationTreeView(ListView):
COL_SRC_ABBR, COL_SRC_ABBR,
COL_SRC_PINFO COL_SRC_PINFO
] ]
# columns that contain markup
MARKUP_COLS = [COL_DATE]
PIXBUF_COLS = [COL_PRIV]
# 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_PAGE, COL_ID, COL_SRC_AUTH, ('columns.visible', [COL_TITLE_PAGE, COL_ID, COL_SRC_AUTH,
@ -118,7 +115,7 @@ class CitationTreeView(ListView):
('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_CHAN, COL_SRC_AUTH,
COL_SRC_ABBR, COL_SRC_PINFO]), COL_SRC_ABBR, COL_SRC_PINFO]),
('columns.size', [200, 75, 100, 75, 50, 100, 150, 100, 150]) ('columns.size', [200, 75, 100, 75, 40, 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")
@ -144,14 +141,12 @@ class CitationTreeView(ListView):
ListView.__init__( ListView.__init__(
self, _('Citation Tree View'), pdata, dbstate, uistate, self, _('Citation Tree View'), pdata, dbstate, uistate,
self.COLUMN_NAMES, len(self.COLUMN_NAMES), len(self.COLUMNS),
CitationTreeModel, signal_map, CitationTreeModel, signal_map,
dbstate.db.get_citation_bookmarks(), dbstate.db.get_citation_bookmarks(),
CitationBookmarks, nav_group, CitationBookmarks, nav_group,
multiple=True, multiple=True,
filter_class=SourceSidebarFilter, filter_class=SourceSidebarFilter)
markup = CitationTreeView.MARKUP_COLS,
pixbuf = CitationTreeView.PIXBUF_COLS)
self.func_list.update({ self.func_list.update({
'<PRIMARY>J' : self.jump, '<PRIMARY>J' : self.jump,
@ -170,7 +165,7 @@ class CitationTreeView(ListView):
if i == 0: if i == 0:
return _('Title') return _('Title')
else: else:
return self.colinfo[i] return self.COLUMNS[i][0]
self.search_bar.setup_filter( self.search_bar.setup_filter(
[(name(pair[1]), pair[1], pair[1] in self.exact_search()) [(name(pair[1]), pair[1], pair[1] in self.exact_search())
@ -248,12 +243,6 @@ class CitationTreeView(ListView):
else: else:
return DdTargets.CITATION_LINK return DdTargets.CITATION_LINK
def type_list(self):
"""
set the listtype, this governs eg keybinding
"""
return LISTTREE
def get_stock(self): def get_stock(self):
return 'gramps-citation' return 'gramps-citation'

View File

@ -47,7 +47,7 @@ from gi.repository import Gtk
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gramps.gen.lib import Event from gramps.gen.lib import Event
from gramps.gui.views.listview import ListView from gramps.gui.views.listview import ListView, TEXT, MARKUP, ICON
from gramps.gui.views.treemodels import EventModel from gramps.gui.views.treemodels import EventModel
from gramps.gen.errors import WindowActiveError from gramps.gen.errors import WindowActiveError
from gramps.gui.views.bookmarks import EventBookmarks from gramps.gui.views.bookmarks import EventBookmarks
@ -77,26 +77,23 @@ class EventView(ListView):
COL_PRIV = 5 COL_PRIV = 5
COL_CHAN = 6 COL_CHAN = 6
COL_PARTIC = 7 COL_PARTIC = 7
# name of the columns # column definitions
COLUMN_NAMES = [ COLUMNS = [
_('Description'), (_('Description'), TEXT, None),
_('ID'), (_('ID'), TEXT, None),
_('Type'), (_('Type'), TEXT, None),
_('Date'), (_('Date'), MARKUP, None),
_('Place'), (_('Place'), TEXT, None),
_('Private'), (_('Private'), ICON, 'gramps-lock'),
_('Last Changed'), (_('Last Changed'), TEXT, None),
_('Main Participants'), (_('Main Participants'), TEXT, None),
] ]
# columns that contain markup
MARKUP_COLS = [COL_DATE]
PIXBUF_COLS = [COL_PRIV]
# 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_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_CHAN]),
('columns.size', [200, 75, 100, 230, 150, 200, 50, 100]) ('columns.size', [200, 75, 100, 230, 150, 200, 40, 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")
@ -118,14 +115,12 @@ class EventView(ListView):
ListView.__init__( ListView.__init__(
self, _('Events'), pdata, dbstate, uistate, self, _('Events'), pdata, dbstate, uistate,
EventView.COLUMN_NAMES, len(EventView.COLUMN_NAMES), len(EventView.COLUMNS),
EventModel, EventModel,
signal_map, dbstate.db.get_event_bookmarks(), signal_map, dbstate.db.get_event_bookmarks(),
EventBookmarks, nav_group, EventBookmarks, nav_group,
multiple=True, multiple=True,
filter_class=EventSidebarFilter, filter_class=EventSidebarFilter)
markup = EventView.MARKUP_COLS,
pixbuf = EventView.PIXBUF_COLS)
self.func_list.update({ self.func_list.update({
'<PRIMARY>J' : self.jump, '<PRIMARY>J' : self.jump,

View File

@ -46,7 +46,7 @@ from gi.repository import Gtk
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gramps.gen.lib import Family from gramps.gen.lib import Family
from gramps.gui.views.listview import ListView from gramps.gui.views.listview import ListView, TEXT, MARKUP, ICON
from gramps.gui.views.treemodels import FamilyModel from gramps.gui.views.treemodels import FamilyModel
from gramps.gui.editors import EditFamily from gramps.gui.editors import EditFamily
from gramps.gui.views.bookmarks import FamilyBookmarks from gramps.gui.views.bookmarks import FamilyBookmarks
@ -75,18 +75,16 @@ class FamilyView(ListView):
COL_PRIV = 5 COL_PRIV = 5
COL_TAGS = 6 COL_TAGS = 6
COL_CHAN = 7 COL_CHAN = 7
# name of the columns # column definitions
MARKUP_COLS = [COL_MARDATE] COLUMNS = [
PIXBUF_COLS = [COL_PRIV] (_('ID'), TEXT, None),
COLUMN_NAMES = [ (_('Father'), TEXT, None),
_('ID'), (_('Mother'), TEXT, None),
_('Father'), (_('Relationship'), TEXT, None),
_('Mother'), (_('Marriage Date'), MARKUP, None),
_('Relationship'), (_('Private'), ICON, 'gramps-lock'),
_('Marriage Date'), (_('Tags'), TEXT, None),
_('Private'), (_('Last Changed'), TEXT, None),
_('Tags'),
_('Last Changed'),
] ]
#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 = (
@ -94,7 +92,7 @@ class FamilyView(ListView):
COL_MARDATE]), COL_MARDATE]),
('columns.rank', [COL_ID, COL_FATHER, COL_MOTHER, COL_REL, ('columns.rank', [COL_ID, COL_FATHER, COL_MOTHER, COL_REL,
COL_MARDATE, COL_PRIV, COL_TAGS, COL_CHAN]), COL_MARDATE, COL_PRIV, COL_TAGS, COL_CHAN]),
('columns.size', [75, 200, 200, 100, 100, 50, 100, 100]) ('columns.size', [75, 200, 200, 100, 100, 40, 100, 100])
) )
ADD_MSG = _("Add a new family") ADD_MSG = _("Add a new family")
@ -116,14 +114,12 @@ class FamilyView(ListView):
ListView.__init__( ListView.__init__(
self, _('Families'), pdata, dbstate, uistate, self, _('Families'), pdata, dbstate, uistate,
FamilyView.COLUMN_NAMES, len(FamilyView.COLUMN_NAMES), len(FamilyView.COLUMNS),
FamilyModel, FamilyModel,
signal_map, dbstate.db.get_family_bookmarks(), signal_map, dbstate.db.get_family_bookmarks(),
FamilyBookmarks, nav_group, FamilyBookmarks, nav_group,
multiple=True, multiple=True,
filter_class=FamilySidebarFilter, filter_class=FamilySidebarFilter)
markup=FamilyView.MARKUP_COLS,
pixbuf=FamilyView.PIXBUF_COLS)
self.func_list.update({ self.func_list.update({
'<PRIMARY>J' : self.jump, '<PRIMARY>J' : self.jump,

View File

@ -57,7 +57,7 @@ from gi.repository import Gtk
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gramps.gui.utils import open_file_with_default_application from gramps.gui.utils import open_file_with_default_application
from gramps.gui.views.listview import ListView from gramps.gui.views.listview import ListView, TEXT, MARKUP, ICON
from gramps.gui.views.treemodels import MediaModel from gramps.gui.views.treemodels import MediaModel
from gramps.gen.constfunc import win, cuni from gramps.gen.constfunc import win, cuni
from gramps.gen.config import config from gramps.gen.config import config
@ -98,18 +98,16 @@ class MediaView(ListView):
COL_TAGS = 6 COL_TAGS = 6
COL_CHAN = 7 COL_CHAN = 7
PIXBUF_COLS = [COL_PRIV] # column definitions
COLUMNS = [
#name of the columns (_('Title'), TEXT, None),
COLUMN_NAMES = [ (_('ID'), TEXT, None),
_('Title'), (_('Type'), TEXT, None),
_('ID'), (_('Path'), TEXT, None),
_('Type'), (_('Date'), TEXT, None),
_('Path'), (_('Private'), ICON, 'gramps-lock'),
_('Date'), (_('Tags'), TEXT, None),
_('Private'), (_('Last Changed'), TEXT, None),
_('Tags'),
_('Last Changed'),
] ]
# 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 = (
@ -117,7 +115,7 @@ class MediaView(ListView):
COL_DATE]), COL_DATE]),
('columns.rank', [COL_TITLE, COL_ID, COL_TYPE, COL_PATH, ('columns.rank', [COL_TITLE, COL_ID, COL_TYPE, COL_PATH,
COL_DATE, COL_PRIV, COL_TAGS, COL_CHAN]), COL_DATE, COL_PRIV, COL_TAGS, COL_CHAN]),
('columns.size', [200, 75, 100, 200, 150, 50, 100, 150]) ('columns.size', [200, 75, 100, 200, 150, 40, 100, 150])
) )
ADD_MSG = _("Add a new media object") ADD_MSG = _("Add a new media object")
@ -139,13 +137,12 @@ class MediaView(ListView):
ListView.__init__( ListView.__init__(
self, _('Media'), pdata, dbstate, uistate, self, _('Media'), pdata, dbstate, uistate,
MediaView.COLUMN_NAMES, len(MediaView.COLUMN_NAMES), len(MediaView.COLUMNS),
MediaModel, MediaModel,
signal_map, dbstate.db.get_media_bookmarks(), signal_map, dbstate.db.get_media_bookmarks(),
MediaBookmarks, nav_group, MediaBookmarks, nav_group,
filter_class=MediaSidebarFilter, filter_class=MediaSidebarFilter,
multiple=True, multiple=True)
pixbuf=MediaView.PIXBUF_COLS)
self.func_list.update({ self.func_list.update({
'<PRIMARY>J' : self.jump, '<PRIMARY>J' : self.jump,

View File

@ -45,7 +45,7 @@ from gi.repository import Gtk
# gramps modules # gramps modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gramps.gui.views.listview import ListView from gramps.gui.views.listview import ListView, TEXT, MARKUP, ICON
from gramps.gui.views.treemodels import NoteModel from gramps.gui.views.treemodels import NoteModel
from gramps.gen.utils.db import get_note_referents from gramps.gen.utils.db import get_note_referents
from gramps.gen.errors import WindowActiveError from gramps.gen.errors import WindowActiveError
@ -75,22 +75,21 @@ class NoteView(ListView):
COL_TAGS = 4 COL_TAGS = 4
COL_CHAN = 5 COL_CHAN = 5
PIXBUF_COLS = [COL_PRIV] # column definitions
COLUMNS = [
COLUMN_NAMES = [ (_('Preview'), TEXT, None),
_('Preview'), (_('ID'), TEXT, None),
_('ID'), (_('Type'), TEXT, None),
_('Type'), (_('Private'), ICON, 'gramps-lock'),
_('Private'), (_('Tags'), TEXT, None),
_('Tags'), (_('Last Changed'), TEXT, None),
_('Last Changed')
] ]
# 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_PREVIEW, COL_ID, COL_TYPE]), ('columns.visible', [COL_PREVIEW, COL_ID, COL_TYPE]),
('columns.rank', [COL_PREVIEW, COL_ID, COL_TYPE, COL_PRIV, COL_TAGS, ('columns.rank', [COL_PREVIEW, COL_ID, COL_TYPE, COL_PRIV, COL_TAGS,
COL_CHAN]), COL_CHAN]),
('columns.size', [350, 75, 100, 50, 100, 100])) ('columns.size', [350, 75, 100, 40, 100, 100]))
ADD_MSG = _("Add a new note") ADD_MSG = _("Add a new note")
EDIT_MSG = _("Edit the selected note") EDIT_MSG = _("Edit the selected note")
@ -110,13 +109,12 @@ class NoteView(ListView):
} }
ListView.__init__( ListView.__init__(
self, _('Notes'), pdata, dbstate, uistate, NoteView.COLUMN_NAMES, self, _('Notes'), pdata, dbstate, uistate,
len(NoteView.COLUMN_NAMES), NoteModel, signal_map, len(NoteView.COLUMNS), NoteModel, signal_map,
dbstate.db.get_note_bookmarks(), dbstate.db.get_note_bookmarks(),
NoteBookmarks, nav_group, NoteBookmarks, nav_group,
filter_class=NoteSidebarFilter, filter_class=NoteSidebarFilter,
multiple=True, multiple=True)
pixbuf=NoteView.PIXBUF_COLS)
self.func_list.update({ self.func_list.update({
'<PRIMARY>J' : self.jump, '<PRIMARY>J' : self.jump,

View File

@ -31,7 +31,6 @@ Person list View
# Gramps modules # Gramps modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gramps.gui.views.listview import LISTTREE
from gramps.plugins.lib.libpersonview import BasePersonView from gramps.plugins.lib.libpersonview import BasePersonView
from gramps.gui.views.treemodels.peoplemodel import PersonListModel from gramps.gui.views.treemodels.peoplemodel import PersonListModel

View File

@ -38,7 +38,7 @@ from gi.repository import Gtk
# Gramps modules # Gramps modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gramps.gui.views.listview import LISTTREE from gramps.gui.views.listview import TEXT, MARKUP, ICON
from gramps.plugins.lib.libpersonview import BasePersonView from gramps.plugins.lib.libpersonview import BasePersonView
from gramps.gui.views.treemodels.peoplemodel import PersonTreeModel from gramps.gui.views.treemodels.peoplemodel import PersonTreeModel
from gramps.gen.lib import Name, Person, Surname from gramps.gen.lib import Name, Person, Surname
@ -67,12 +67,6 @@ class PersonTreeView(BasePersonView):
_('People Tree View'), PersonTreeModel, _('People Tree View'), PersonTreeModel,
nav_group=nav_group) nav_group=nav_group)
def type_list(self):
"""
set the listtype, this governs eg keybinding
"""
return LISTTREE
def get_viewtype_stock(self): def get_viewtype_stock(self):
""" """
Override the default icon. Set for hierarchical view. Override the default icon. Set for hierarchical view.

View File

@ -30,7 +30,7 @@ from __future__ import unicode_literals
# Gramps modules # Gramps modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gramps.gui.views.listview import LISTTREE from gramps.gui.views.listview import TEXT, MARKUP, ICON
from gramps.plugins.lib.libplaceview import PlaceBaseView from gramps.plugins.lib.libplaceview import PlaceBaseView
from gramps.gui.views.treemodels.placemodel import PlaceTreeModel, COUNTRYLEVELS from gramps.gui.views.treemodels.placemodel import PlaceTreeModel, COUNTRYLEVELS
from gramps.gen.lib import Place from gramps.gen.lib import Place
@ -68,23 +68,23 @@ class PlaceTreeView(PlaceBaseView):
COL_PRIV = 12 COL_PRIV = 12
COL_CHAN = 13 COL_CHAN = 13
COL_NAME = 14 COL_NAME = 14
# name of the columns # column definitions
COLUMN_NAMES = [ COLUMNS = [
_('Place'), (_('Place'), MARKUP, None),
_('ID'), (_('ID'), TEXT, None),
_('Street'), (_('Street'), TEXT, None),
_('Locality'), (_('Locality'), TEXT, None),
_('City'), (_('City'), TEXT, None),
_('County'), (_('County'), TEXT, None),
_('State'), (_('State'), TEXT, None),
_('Country'), (_('Country'), TEXT, None),
_('ZIP/Postal Code'), (_('ZIP/Postal Code'), TEXT, None),
_('Church Parish'), (_('Church Parish'), TEXT, None),
_('Latitude'), (_('Latitude'), TEXT, None),
_('Longitude'), (_('Longitude'), TEXT, None),
_('Private'), (_('Private'), ICON, 'gramps-lock'),
_('Last Changed'), (_('Last Changed'), TEXT, None),
_('Place Name'), (_('Place Name'), 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 = (
@ -95,7 +95,7 @@ class PlaceTreeView(PlaceBaseView):
COL_PARISH, COL_LAT, COL_LON, COL_PRIV, COL_CHAN, COL_PARISH, COL_LAT, COL_LON, COL_PRIV, COL_CHAN,
COL_NAME]), 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, 50, 100, 150]) 100, 150, 150, 40, 100, 150])
) )
def __init__(self, pdata, dbstate, uistate): def __init__(self, pdata, dbstate, uistate):
@ -103,12 +103,6 @@ class PlaceTreeView(PlaceBaseView):
_('Place Tree View'), PlaceTreeModel, _('Place Tree View'), PlaceTreeModel,
nav_group=0) nav_group=0)
def type_list(self):
"""
set the listtype, this governs eg keybinding
"""
return LISTTREE
def get_viewtype_stock(self): def get_viewtype_stock(self):
""" """
Override the default icon. Set for hierarchical view. Override the default icon. Set for hierarchical view.

View File

@ -37,7 +37,7 @@ from gi.repository import Gtk
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gramps.gen.lib import Repository from gramps.gen.lib import Repository
from gramps.gui.views.listview import ListView from gramps.gui.views.listview import ListView, TEXT, MARKUP, ICON
from gramps.gui.views.treemodels import RepositoryModel from gramps.gui.views.treemodels import RepositoryModel
from gramps.gui.views.bookmarks import RepoBookmarks from gramps.gui.views.bookmarks import RepoBookmarks
from gramps.gen.errors import WindowActiveError from gramps.gen.errors import WindowActiveError
@ -80,23 +80,22 @@ class RepositoryView(ListView):
COL_PRIV = 12 COL_PRIV = 12
COL_CHAN = 13 COL_CHAN = 13
PIXBUF_COLS = [COL_PRIV] # column definitions
COLUMNS = [
COLUMN_NAMES = [ (_('Name'), TEXT, None),
_('Name'), (_('ID'), TEXT, None),
_('ID'), (_('Type'), TEXT, None),
_('Type'), (_('Home URL'), TEXT, None),
_('Home URL'), (_('Street'), TEXT, None),
_('Street'), (_('Locality'), TEXT, None),
_('Locality'), (_('City'), TEXT, None),
_('City'), (_('State/County'), TEXT, None),
_('State/County'), (_('Country'), TEXT, None),
_('Country'), (_('ZIP/Postal Code'), TEXT, None),
_('ZIP/Postal Code'), (_('Email'), TEXT, None),
_('Email'), (_('Search URL'), TEXT, None),
_('Search URL'), (_('Private'), ICON, 'gramps-lock'),
_('Private'), (_('Last Changed'), TEXT, None),
_('Last Changed'),
] ]
# 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 = (
@ -106,7 +105,7 @@ class RepositoryView(ListView):
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_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, 50, 100]) 100, 100, 100, 40, 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")
@ -126,13 +125,12 @@ class RepositoryView(ListView):
ListView.__init__( ListView.__init__(
self, _('Repositories'), pdata, dbstate, uistate, self, _('Repositories'), pdata, dbstate, uistate,
RepositoryView.COLUMN_NAMES, len(RepositoryView.COLUMN_NAMES), len(RepositoryView.COLUMNS),
RepositoryModel, signal_map, RepositoryModel, signal_map,
dbstate.db.get_repo_bookmarks(), dbstate.db.get_repo_bookmarks(),
RepoBookmarks, nav_group, RepoBookmarks, nav_group,
multiple=True, multiple=True,
filter_class=RepoSidebarFilter, filter_class=RepoSidebarFilter)
pixbuf=RepositoryView.PIXBUF_COLS)
self.func_list.update({ self.func_list.update({
'<PRIMARY>J' : self.jump, '<PRIMARY>J' : self.jump,

View File

@ -41,7 +41,7 @@ LOG = logging.getLogger(".citation")
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gramps.gen.lib import Source from gramps.gen.lib import Source
from gramps.gen.config import config from gramps.gen.config import config
from gramps.gui.views.listview import ListView from gramps.gui.views.listview import ListView, TEXT, MARKUP, ICON
from gramps.gui.views.treemodels import SourceModel from gramps.gui.views.treemodels import SourceModel
from gramps.gen.utils.db import get_source_and_citation_referents from gramps.gen.utils.db import get_source_and_citation_referents
from gramps.gui.views.bookmarks import SourceBookmarks from gramps.gui.views.bookmarks import SourceBookmarks
@ -77,24 +77,22 @@ class SourceView(ListView):
COL_PRIV = 5 COL_PRIV = 5
COL_CHAN = 6 COL_CHAN = 6
PIXBUF_COLS = [COL_PRIV] # column definitions
COLUMNS = [
# name of the columns (_('Title'), TEXT, None),
COLUMN_NAMES = [ (_('ID'), TEXT, None),
_('Title'), (_('Author'), TEXT, None),
_('ID'), (_('Abbreviation'), TEXT, None),
_('Author'), (_('Publication Information'), TEXT, None),
_('Abbreviation'), (_('Private'), ICON, 'gramps-lock'),
_('Publication Information'), (_('Last Changed'), TEXT, None),
_('Private'),
_('Last Changed'),
] ]
# 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_CHAN]),
('columns.size', [200, 75, 150, 100, 150, 50, 100]) ('columns.size', [200, 75, 150, 100, 150, 40, 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")
@ -114,13 +112,12 @@ class SourceView(ListView):
ListView.__init__( ListView.__init__(
self, _('Sources'), pdata, dbstate, uistate, self, _('Sources'), pdata, dbstate, uistate,
SourceView.COLUMN_NAMES, len(SourceView.COLUMN_NAMES), len(SourceView.COLUMNS),
SourceModel, signal_map, SourceModel, signal_map,
dbstate.db.get_source_bookmarks(), dbstate.db.get_source_bookmarks(),
SourceBookmarks, nav_group, SourceBookmarks, nav_group,
multiple=True, multiple=True,
filter_class=SourceSidebarFilter, filter_class=SourceSidebarFilter)
pixbuf=SourceView.PIXBUF_COLS)
self.func_list.update({ self.func_list.update({
'<PRIMARY>J' : self.jump, '<PRIMARY>J' : self.jump,