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 0b2ccdee6d
commit aa021c36c8
14 changed files with 224 additions and 278 deletions

View File

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

View File

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

View File

@ -47,7 +47,7 @@ from gi.repository import Gtk
#
#-------------------------------------------------------------------------
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.gen.errors import WindowActiveError
from gramps.gui.views.bookmarks import PlaceBookmarks
@ -90,26 +90,23 @@ class PlaceBaseView(ListView):
COL_LON = 11
COL_PRIV = 12
COL_CHAN = 13
# name of the columns
COLUMN_NAMES = [
_('Place Name'),
_('ID'),
_('Street'),
_('Locality'),
_('City'),
_('County'),
_('State'),
_('Country'),
_('ZIP/Postal Code'),
_('Church Parish'),
_('Latitude'),
_('Longitude'),
_('Private'),
_('Last Changed'),
# column definitions
COLUMNS = [
(_('Place Name'), MARKUP, None),
(_('ID'), TEXT, None),
(_('Street'), TEXT, None),
(_('Locality'), TEXT, None),
(_('City'), TEXT, None),
(_('County'), TEXT, None),
(_('State'), TEXT, None),
(_('Country'), TEXT, None),
(_('ZIP/Postal Code'), TEXT, None),
(_('Church Parish'), TEXT, None),
(_('Latitude'), TEXT, None),
(_('Longitude'), TEXT, None),
(_('Private'), ICON, 'gramps-lock'),
(_('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
CONFIGSETTINGS = (
('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_PARISH, COL_LAT, COL_LON, COL_PRIV, COL_CHAN]),
('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")
EDIT_MSG = _("Edit the selected place")
@ -141,14 +138,12 @@ class PlaceBaseView(ListView):
ListView.__init__(
self, title, pdata, dbstate, uistate,
self.COLUMN_NAMES, 15,
15,
model, signal_map,
dbstate.db.get_place_bookmarks(),
PlaceBookmarks, nav_group,
multiple=True,
filter_class=PlaceSidebarFilter,
markup=PlaceBaseView.MARKUP_COLS,
pixbuf=PlaceBaseView.PIXBUF_COLS)
filter_class=PlaceSidebarFilter)
self.func_list.update({
'<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.gen.plug import CATEGORY_QR_CITATION
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.gui.views.bookmarks import CitationBookmarks
from gramps.gen.errors import WindowActiveError
@ -93,25 +93,22 @@ class CitationListView(ListView):
COL_SRC_PINFO = 10
COL_SRC_PRIV = 11
COL_SRC_CHAN = 12
# name of the columns
COLUMN_NAMES = [
_('Volume/Page'),
_('ID'),
_('Date'),
_('Confidence'),
_('Private'),
_('Last Changed'),
_('Source: Title'),
_('Source: ID'),
_('Source: Author'),
_('Source: Abbreviation'),
_('Source: Publication Information'),
_('Source: Private'),
_('Source: Last Changed'),
# column definitions
COLUMNS = [
(_('Volume/Page'), TEXT, None),
(_('ID'), TEXT, None),
(_('Date'), MARKUP, None),
(_('Confidence'), TEXT, None),
(_('Private'), ICON, 'gramps-lock'),
(_('Last Changed'), TEXT, None),
(_('Source: Title'), TEXT, None),
(_('Source: ID'), TEXT, None),
(_('Source: Author'), TEXT, None),
(_('Source: Abbreviation'), TEXT, None),
(_('Source: Publication Information'), TEXT, None),
(_('Source: Private'), ICON, 'gramps-lock'),
(_('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
CONFIGSETTINGS = (
('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_SRC_AUTH, COL_SRC_ABBR, COL_SRC_PINFO,
COL_SRC_PRIV, COL_SRC_CHAN]),
('columns.size', [200, 75, 100, 100, 50, 100, 200, 75, 75, 100, 150,
50, 100])
('columns.size', [200, 75, 100, 100, 40, 100, 200, 75, 75, 100, 150,
40, 100])
)
ADD_MSG = _("Add a new citation and a new source")
ADD_SOURCE_MSG = _("Add a new source")
@ -143,14 +140,12 @@ class CitationListView(ListView):
ListView.__init__(
self, _('Citation View'), pdata, dbstate, uistate,
self.COLUMN_NAMES, len(self.COLUMN_NAMES),
len(self.COLUMNS),
CitationListModel, signal_map,
dbstate.db.get_citation_bookmarks(),
CitationBookmarks, nav_group,
multiple=True,
filter_class=CitationSidebarFilter,
markup = CitationListView.MARKUP_COLS,
pixbuf = CitationListView.PIXBUF_COLS)
filter_class=CitationSidebarFilter)
self.func_list.update({
'<PRIMARY>J' : self.jump,

View File

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

View File

@ -47,7 +47,7 @@ from gi.repository import Gtk
#
#-------------------------------------------------------------------------
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.gen.errors import WindowActiveError
from gramps.gui.views.bookmarks import EventBookmarks
@ -77,26 +77,23 @@ class EventView(ListView):
COL_PRIV = 5
COL_CHAN = 6
COL_PARTIC = 7
# name of the columns
COLUMN_NAMES = [
_('Description'),
_('ID'),
_('Type'),
_('Date'),
_('Place'),
_('Private'),
_('Last Changed'),
_('Main Participants'),
# column definitions
COLUMNS = [
(_('Description'), TEXT, None),
(_('ID'), TEXT, None),
(_('Type'), TEXT, None),
(_('Date'), MARKUP, None),
(_('Place'), TEXT, None),
(_('Private'), ICON, 'gramps-lock'),
(_('Last Changed'), TEXT, None),
(_('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
CONFIGSETTINGS = (
('columns.visible', [COL_DESCR, COL_ID, COL_TYPE, COL_DATE, COL_PLACE]),
('columns.rank', [COL_DESCR, COL_ID, COL_TYPE, COL_PARTIC, COL_DATE,
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")
EDIT_MSG = _("Edit the selected event")
@ -118,14 +115,12 @@ class EventView(ListView):
ListView.__init__(
self, _('Events'), pdata, dbstate, uistate,
EventView.COLUMN_NAMES, len(EventView.COLUMN_NAMES),
len(EventView.COLUMNS),
EventModel,
signal_map, dbstate.db.get_event_bookmarks(),
EventBookmarks, nav_group,
multiple=True,
filter_class=EventSidebarFilter,
markup = EventView.MARKUP_COLS,
pixbuf = EventView.PIXBUF_COLS)
filter_class=EventSidebarFilter)
self.func_list.update({
'<PRIMARY>J' : self.jump,

View File

@ -46,7 +46,7 @@ from gi.repository import Gtk
#
#-------------------------------------------------------------------------
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.editors import EditFamily
from gramps.gui.views.bookmarks import FamilyBookmarks
@ -75,18 +75,16 @@ class FamilyView(ListView):
COL_PRIV = 5
COL_TAGS = 6
COL_CHAN = 7
# name of the columns
MARKUP_COLS = [COL_MARDATE]
PIXBUF_COLS = [COL_PRIV]
COLUMN_NAMES = [
_('ID'),
_('Father'),
_('Mother'),
_('Relationship'),
_('Marriage Date'),
_('Private'),
_('Tags'),
_('Last Changed'),
# column definitions
COLUMNS = [
(_('ID'), TEXT, None),
(_('Father'), TEXT, None),
(_('Mother'), TEXT, None),
(_('Relationship'), TEXT, None),
(_('Marriage Date'), MARKUP, None),
(_('Private'), ICON, 'gramps-lock'),
(_('Tags'), TEXT, None),
(_('Last Changed'), TEXT, None),
]
#default setting with visible columns, order of the col, and their size
CONFIGSETTINGS = (
@ -94,7 +92,7 @@ class FamilyView(ListView):
COL_MARDATE]),
('columns.rank', [COL_ID, COL_FATHER, COL_MOTHER, COL_REL,
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")
@ -116,14 +114,12 @@ class FamilyView(ListView):
ListView.__init__(
self, _('Families'), pdata, dbstate, uistate,
FamilyView.COLUMN_NAMES, len(FamilyView.COLUMN_NAMES),
len(FamilyView.COLUMNS),
FamilyModel,
signal_map, dbstate.db.get_family_bookmarks(),
FamilyBookmarks, nav_group,
multiple=True,
filter_class=FamilySidebarFilter,
markup=FamilyView.MARKUP_COLS,
pixbuf=FamilyView.PIXBUF_COLS)
filter_class=FamilySidebarFilter)
self.func_list.update({
'<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.views.listview import ListView
from gramps.gui.views.listview import ListView, TEXT, MARKUP, ICON
from gramps.gui.views.treemodels import MediaModel
from gramps.gen.constfunc import win, cuni
from gramps.gen.config import config
@ -98,18 +98,16 @@ class MediaView(ListView):
COL_TAGS = 6
COL_CHAN = 7
PIXBUF_COLS = [COL_PRIV]
#name of the columns
COLUMN_NAMES = [
_('Title'),
_('ID'),
_('Type'),
_('Path'),
_('Date'),
_('Private'),
_('Tags'),
_('Last Changed'),
# column definitions
COLUMNS = [
(_('Title'), TEXT, None),
(_('ID'), TEXT, None),
(_('Type'), TEXT, None),
(_('Path'), TEXT, None),
(_('Date'), TEXT, None),
(_('Private'), ICON, 'gramps-lock'),
(_('Tags'), TEXT, None),
(_('Last Changed'), TEXT, None),
]
# default setting with visible columns, order of the col, and their size
CONFIGSETTINGS = (
@ -117,7 +115,7 @@ class MediaView(ListView):
COL_DATE]),
('columns.rank', [COL_TITLE, COL_ID, COL_TYPE, COL_PATH,
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")
@ -139,13 +137,12 @@ class MediaView(ListView):
ListView.__init__(
self, _('Media'), pdata, dbstate, uistate,
MediaView.COLUMN_NAMES, len(MediaView.COLUMN_NAMES),
len(MediaView.COLUMNS),
MediaModel,
signal_map, dbstate.db.get_media_bookmarks(),
MediaBookmarks, nav_group,
filter_class=MediaSidebarFilter,
multiple=True,
pixbuf=MediaView.PIXBUF_COLS)
multiple=True)
self.func_list.update({
'<PRIMARY>J' : self.jump,

View File

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

View File

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

View File

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

View File

@ -30,7 +30,7 @@ from __future__ import unicode_literals
# 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.gui.views.treemodels.placemodel import PlaceTreeModel, COUNTRYLEVELS
from gramps.gen.lib import Place
@ -68,23 +68,23 @@ class PlaceTreeView(PlaceBaseView):
COL_PRIV = 12
COL_CHAN = 13
COL_NAME = 14
# name of the columns
COLUMN_NAMES = [
_('Place'),
_('ID'),
_('Street'),
_('Locality'),
_('City'),
_('County'),
_('State'),
_('Country'),
_('ZIP/Postal Code'),
_('Church Parish'),
_('Latitude'),
_('Longitude'),
_('Private'),
_('Last Changed'),
_('Place Name'),
# column definitions
COLUMNS = [
(_('Place'), MARKUP, None),
(_('ID'), TEXT, None),
(_('Street'), TEXT, None),
(_('Locality'), TEXT, None),
(_('City'), TEXT, None),
(_('County'), TEXT, None),
(_('State'), TEXT, None),
(_('Country'), TEXT, None),
(_('ZIP/Postal Code'), TEXT, None),
(_('Church Parish'), TEXT, None),
(_('Latitude'), TEXT, None),
(_('Longitude'), TEXT, None),
(_('Private'), ICON, 'gramps-lock'),
(_('Last Changed'), TEXT, None),
(_('Place Name'), TEXT, None),
]
# default setting with visible columns, order of the col, and their size
CONFIGSETTINGS = (
@ -95,7 +95,7 @@ class PlaceTreeView(PlaceBaseView):
COL_PARISH, COL_LAT, COL_LON, COL_PRIV, COL_CHAN,
COL_NAME]),
('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):
@ -103,12 +103,6 @@ class PlaceTreeView(PlaceBaseView):
_('Place Tree View'), PlaceTreeModel,
nav_group=0)
def type_list(self):
"""
set the listtype, this governs eg keybinding
"""
return LISTTREE
def get_viewtype_stock(self):
"""
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.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.bookmarks import RepoBookmarks
from gramps.gen.errors import WindowActiveError
@ -80,23 +80,22 @@ class RepositoryView(ListView):
COL_PRIV = 12
COL_CHAN = 13
PIXBUF_COLS = [COL_PRIV]
COLUMN_NAMES = [
_('Name'),
_('ID'),
_('Type'),
_('Home URL'),
_('Street'),
_('Locality'),
_('City'),
_('State/County'),
_('Country'),
_('ZIP/Postal Code'),
_('Email'),
_('Search URL'),
_('Private'),
_('Last Changed'),
# column definitions
COLUMNS = [
(_('Name'), TEXT, None),
(_('ID'), TEXT, None),
(_('Type'), TEXT, None),
(_('Home URL'), TEXT, None),
(_('Street'), TEXT, None),
(_('Locality'), TEXT, None),
(_('City'), TEXT, None),
(_('State/County'), TEXT, None),
(_('Country'), TEXT, None),
(_('ZIP/Postal Code'), TEXT, None),
(_('Email'), TEXT, None),
(_('Search URL'), TEXT, None),
(_('Private'), ICON, 'gramps-lock'),
(_('Last Changed'), TEXT, None),
]
# default setting with visible columns, order of the col, and their size
CONFIGSETTINGS = (
@ -106,7 +105,7 @@ class RepositoryView(ListView):
COL_LOCALITY, COL_CITY, COL_STATE, COL_COUNTRY,
COL_ZIP, COL_EMAIL, COL_SURL, COL_PRIV, COL_CHAN]),
('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")
EDIT_MSG = _("Edit the selected repository")
@ -126,13 +125,12 @@ class RepositoryView(ListView):
ListView.__init__(
self, _('Repositories'), pdata, dbstate, uistate,
RepositoryView.COLUMN_NAMES, len(RepositoryView.COLUMN_NAMES),
len(RepositoryView.COLUMNS),
RepositoryModel, signal_map,
dbstate.db.get_repo_bookmarks(),
RepoBookmarks, nav_group,
multiple=True,
filter_class=RepoSidebarFilter,
pixbuf=RepositoryView.PIXBUF_COLS)
filter_class=RepoSidebarFilter)
self.func_list.update({
'<PRIMARY>J' : self.jump,

View File

@ -41,7 +41,7 @@ LOG = logging.getLogger(".citation")
#-------------------------------------------------------------------------
from gramps.gen.lib import Source
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.gen.utils.db import get_source_and_citation_referents
from gramps.gui.views.bookmarks import SourceBookmarks
@ -77,24 +77,22 @@ class SourceView(ListView):
COL_PRIV = 5
COL_CHAN = 6
PIXBUF_COLS = [COL_PRIV]
# name of the columns
COLUMN_NAMES = [
_('Title'),
_('ID'),
_('Author'),
_('Abbreviation'),
_('Publication Information'),
_('Private'),
_('Last Changed'),
# column definitions
COLUMNS = [
(_('Title'), TEXT, None),
(_('ID'), TEXT, None),
(_('Author'), TEXT, None),
(_('Abbreviation'), TEXT, None),
(_('Publication Information'), TEXT, None),
(_('Private'), ICON, 'gramps-lock'),
(_('Last Changed'), TEXT, None),
]
# default setting with visible columns, order of the col, and their size
CONFIGSETTINGS = (
('columns.visible', [COL_TITLE, COL_ID, COL_AUTH, COL_PINFO]),
('columns.rank', [COL_TITLE, COL_ID, COL_AUTH, COL_ABBR, COL_PINFO,
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")
EDIT_MSG = _("Edit the selected source")
@ -114,13 +112,12 @@ class SourceView(ListView):
ListView.__init__(
self, _('Sources'), pdata, dbstate, uistate,
SourceView.COLUMN_NAMES, len(SourceView.COLUMN_NAMES),
len(SourceView.COLUMNS),
SourceModel, signal_map,
dbstate.db.get_source_bookmarks(),
SourceBookmarks, nav_group,
multiple=True,
filter_class=SourceSidebarFilter,
pixbuf=SourceView.PIXBUF_COLS)
filter_class=SourceSidebarFilter)
self.func_list.update({
'<PRIMARY>J' : self.jump,