3731: Add place name column to place tree view
svn: r14950
This commit is contained in:
parent
fb93619c6e
commit
097200d512
@ -128,8 +128,8 @@ class ColumnOrder(gtk.VBox):
|
||||
self.apply_button.connect('clicked', self.__on_apply)
|
||||
|
||||
#obtain the columns from config file
|
||||
self.oldorder = self.config.get('columns.order')
|
||||
self.oldsize = self.config.get('columns.sizecol')
|
||||
self.oldorder = self.config.get('columns.rank')
|
||||
self.oldsize = self.config.get('columns.size')
|
||||
self.oldvis = self.config.get('columns.visible')
|
||||
colord = []
|
||||
for val, size in zip(self.oldorder, self.oldsize):
|
||||
@ -166,8 +166,8 @@ class ColumnOrder(gtk.VBox):
|
||||
newvis.append(index)
|
||||
neworder.append(index)
|
||||
newsize.append(size)
|
||||
self.config.set('columns.order', neworder)
|
||||
self.config.set('columns.sizecol', newsize)
|
||||
self.config.set('columns.rank', neworder)
|
||||
self.config.set('columns.size', newsize)
|
||||
self.config.set('columns.visible', newvis)
|
||||
self.config.save()
|
||||
if self.on_apply:
|
||||
|
@ -81,8 +81,8 @@ class ListView(NavigationView):
|
||||
#listview config settings that are always present related to the columns
|
||||
CONFIGSETTINGS = (
|
||||
('columns.visible', []),
|
||||
('columns.order', []),
|
||||
('columns.sizecol', [])
|
||||
('columns.rank', []),
|
||||
('columns.size', [])
|
||||
)
|
||||
ADD_MSG = ""
|
||||
EDIT_MSG = ""
|
||||
@ -472,8 +472,8 @@ class ListView(NavigationView):
|
||||
modelcol: column in the datamodel this column is build of
|
||||
size: size the column should have
|
||||
"""
|
||||
order = self._config.get('columns.order')
|
||||
size = self._config.get('columns.sizecol')
|
||||
order = self._config.get('columns.rank')
|
||||
size = self._config.get('columns.size')
|
||||
vis = self._config.get('columns.visible')
|
||||
colord = []
|
||||
for val, size in zip(order, size):
|
||||
@ -1055,7 +1055,7 @@ class ListView(NavigationView):
|
||||
"""
|
||||
#func = self.config_callback(self.build_tree)
|
||||
#self._config.connect('columns.visible', func)
|
||||
#self._config.connect('columns.order', func)
|
||||
#self._config.connect('columns.rank', func)
|
||||
pass
|
||||
|
||||
def _get_configure_page_funcs(self):
|
||||
|
@ -77,7 +77,7 @@ COUNTRYLEVELS = {
|
||||
#-------------------------------------------------------------------------
|
||||
class PlaceBaseModel(object):
|
||||
|
||||
HANDLE_COL = 12
|
||||
HANDLE_COL = 13
|
||||
|
||||
def __init__(self, db):
|
||||
self.gen_cursor = db.get_place_cursor
|
||||
@ -95,6 +95,7 @@ class PlaceBaseModel(object):
|
||||
self.column_longitude,
|
||||
self.column_change,
|
||||
self.column_street,
|
||||
self.column_place_name,
|
||||
self.column_handle,
|
||||
self.column_tooltip
|
||||
]
|
||||
@ -111,6 +112,7 @@ class PlaceBaseModel(object):
|
||||
self.sort_longitude,
|
||||
self.sort_change,
|
||||
self.column_street,
|
||||
self.column_place_name,
|
||||
self.column_handle,
|
||||
]
|
||||
|
||||
@ -120,7 +122,7 @@ class PlaceBaseModel(object):
|
||||
def column_handle(self, data):
|
||||
return unicode(data[0])
|
||||
|
||||
def column_name(self, data):
|
||||
def column_place_name(self, data):
|
||||
return unicode(data[2])
|
||||
|
||||
def __format_degrees(self, angle, sign_str):
|
||||
@ -238,9 +240,12 @@ class PlaceListModel(PlaceBaseModel, FlatBaseModel):
|
||||
skip=set(), sort_map=None):
|
||||
|
||||
PlaceBaseModel.__init__(self, db)
|
||||
FlatBaseModel.__init__(self, db, scol, order, tooltip_column=13,
|
||||
FlatBaseModel.__init__(self, db, scol, order, tooltip_column=14,
|
||||
search=search, skip=skip, sort_map=sort_map)
|
||||
|
||||
def column_name(self, data):
|
||||
return unicode(data[2])
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# PlaceTreeModel
|
||||
@ -255,7 +260,7 @@ class PlaceTreeModel(PlaceBaseModel, TreeBaseModel):
|
||||
|
||||
PlaceBaseModel.__init__(self, db)
|
||||
TreeBaseModel.__init__(self, db, scol=scol, order=order,
|
||||
tooltip_column=13,
|
||||
tooltip_column=14,
|
||||
search=search, skip=skip, sort_map=sort_map,
|
||||
nrgroups = 3,
|
||||
group_can_have_handle = True)
|
||||
@ -265,7 +270,7 @@ class PlaceTreeModel(PlaceBaseModel, TreeBaseModel):
|
||||
PlaceBaseModel
|
||||
"""
|
||||
self.number_items = self.db.get_number_of_places
|
||||
self.hmap = [self.column_header] + [None]*12
|
||||
self.hmap = [self.column_header] + [None]*13
|
||||
|
||||
def get_tree_levels(self):
|
||||
"""
|
||||
|
@ -101,9 +101,9 @@ class BasePersonView(ListView):
|
||||
# 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.order', [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_CHAN]),
|
||||
('columns.sizecol', [250, 75, 75, 100, 175, 100, 175, 100, 100])
|
||||
('columns.size', [250, 75, 75, 100, 175, 100, 175, 100, 100])
|
||||
)
|
||||
ADD_MSG = _("Add a new person")
|
||||
EDIT_MSG = _("Edit the selected person")
|
||||
|
@ -105,10 +105,10 @@ class PlaceBaseView(ListView):
|
||||
CONFIGSETTINGS = (
|
||||
('columns.visible', [COL_NAME, COL_ID, COL_STREET, COL_CITY, COL_STATE
|
||||
]),
|
||||
('columns.order', [COL_NAME, COL_ID, COL_STREET, COL_ZIP, COL_CITY,
|
||||
('columns.rank', [COL_NAME, COL_ID, COL_STREET, COL_ZIP, COL_CITY,
|
||||
COL_COUNTY, COL_STATE, COL_COUNTRY, COL_LAT,
|
||||
COL_LON, COL_PARISH, COL_CHAN]),
|
||||
('columns.sizecol', [250, 75, 100, 100, 100, 100, 150, 150, 150,
|
||||
('columns.size', [250, 75, 100, 100, 100, 100, 150, 150, 150,
|
||||
150, 150, 100])
|
||||
)
|
||||
ADD_MSG = _("Add a new place")
|
||||
@ -136,8 +136,8 @@ class PlaceBaseView(ListView):
|
||||
self.mapservicedata = {}
|
||||
|
||||
ListView.__init__(
|
||||
self, title, dbstate, uistate, PlaceBaseView.COLUMN_NAMES,
|
||||
len(PlaceBaseView.COLUMN_NAMES),
|
||||
self, title, dbstate, uistate, self.COLUMN_NAMES,
|
||||
len(self.COLUMN_NAMES),
|
||||
model, signal_map,
|
||||
dbstate.db.get_place_bookmarks(),
|
||||
Bookmarks.PlaceBookmarks, nav_group,
|
||||
|
@ -78,11 +78,11 @@ class RelCalc(Tool.Tool, ManagedWindow.ManagedWindow):
|
||||
|
||||
#set the columns to see
|
||||
for data in BasePersonView.CONFIGSETTINGS:
|
||||
if data[0] == 'columns.order':
|
||||
if data[0] == 'columns.rank':
|
||||
colord = data[1]
|
||||
elif data[0] == 'columns.visible':
|
||||
colvis = data[1]
|
||||
elif data[0] == 'columns.sizecol':
|
||||
elif data[0] == 'columns.size':
|
||||
colsize = data[1]
|
||||
self.colord = []
|
||||
for col, size in zip(colord, colsize):
|
||||
|
@ -89,9 +89,9 @@ class EventView(ListView):
|
||||
# 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.order', [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_CHAN]),
|
||||
('columns.sizecol', [200, 75, 100, 230, 150, 200, 100])
|
||||
('columns.size', [200, 75, 100, 230, 150, 200, 100])
|
||||
)
|
||||
ADD_MSG = _("Add a new event")
|
||||
EDIT_MSG = _("Edit the selected event")
|
||||
|
@ -81,9 +81,9 @@ class FamilyView(ListView):
|
||||
CONFIGSETTINGS = (
|
||||
('columns.visible', [COL_ID, COL_FATHER, COL_MOTHER, COL_REL,
|
||||
COL_MARDATE]),
|
||||
('columns.order', [COL_ID, COL_FATHER, COL_MOTHER, COL_REL,
|
||||
('columns.rank', [COL_ID, COL_FATHER, COL_MOTHER, COL_REL,
|
||||
COL_MARDATE, COL_CHAN]),
|
||||
('columns.sizecol', [75, 200, 200, 100, 100, 100])
|
||||
('columns.size', [75, 200, 200, 100, 100, 100])
|
||||
)
|
||||
|
||||
ADD_MSG = _("Add a new family")
|
||||
|
@ -96,9 +96,9 @@ class MediaView(ListView):
|
||||
CONFIGSETTINGS = (
|
||||
('columns.visible', [COL_TITLE, COL_ID, COL_TYPE, COL_PATH,
|
||||
COL_DATE]),
|
||||
('columns.order', [COL_TITLE, COL_ID, COL_TYPE, COL_PATH,
|
||||
('columns.rank', [COL_TITLE, COL_ID, COL_TYPE, COL_PATH,
|
||||
COL_DATE, COL_CHAN]),
|
||||
('columns.sizecol', [200, 75, 100, 200, 150, 150])
|
||||
('columns.size', [200, 75, 100, 200, 150, 150])
|
||||
)
|
||||
|
||||
ADD_MSG = _("Add a new media object")
|
||||
|
@ -81,9 +81,9 @@ class NoteView(ListView):
|
||||
# default setting with visible columns, order of the col, and their size
|
||||
CONFIGSETTINGS = (
|
||||
('columns.visible', [COL_PREVIEW, COL_ID, COL_TYPE, COL_MARKER]),
|
||||
('columns.order', [COL_PREVIEW, COL_ID, COL_TYPE, COL_MARKER,
|
||||
('columns.rank', [COL_PREVIEW, COL_ID, COL_TYPE, COL_MARKER,
|
||||
COL_CHAN]),
|
||||
('columns.sizecol', [350, 75, 100, 100, 100]))
|
||||
('columns.size', [350, 75, 100, 100, 100]))
|
||||
|
||||
ADD_MSG = _("Add a new note")
|
||||
EDIT_MSG = _("Edit the selected note")
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2009 Nick Hall
|
||||
# Copyright (C) 2009-2010 Nick Hall
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -51,6 +51,45 @@ class PlaceTreeView(PlaceBaseView):
|
||||
"""
|
||||
A hierarchical view of the top three levels of places.
|
||||
"""
|
||||
COL_PLACE = 0
|
||||
COL_ID = 1
|
||||
COL_PARISH = 2
|
||||
COL_ZIP = 3
|
||||
COL_CITY = 4
|
||||
COL_COUNTY = 5
|
||||
COL_STATE = 6
|
||||
COL_COUNTRY = 7
|
||||
COL_LAT = 8
|
||||
COL_LON = 9
|
||||
COL_CHAN = 10
|
||||
COL_STREET = 11
|
||||
COL_NAME = 12
|
||||
# name of the columns
|
||||
COLUMN_NAMES = [
|
||||
_('Place'),
|
||||
_('ID'),
|
||||
_('Church Parish'),
|
||||
_('ZIP/Postal Code'),
|
||||
_('City'),
|
||||
_('County'),
|
||||
_('State'),
|
||||
_('Country'),
|
||||
_('Latitude'),
|
||||
_('Longitude'),
|
||||
_('Last Changed'),
|
||||
_('Street'),
|
||||
_('Place Name'),
|
||||
]
|
||||
# default setting with visible columns, order of the col, and their size
|
||||
CONFIGSETTINGS = (
|
||||
('columns.visible', [COL_PLACE, COL_ID, COL_STREET, COL_CITY, COL_STATE
|
||||
]),
|
||||
('columns.rank', [COL_PLACE, COL_ID, COL_STREET, COL_ZIP, COL_CITY,
|
||||
COL_COUNTY, COL_STATE, COL_COUNTRY, COL_LAT,
|
||||
COL_LON, COL_PARISH, COL_CHAN, COL_NAME]),
|
||||
('columns.size', [250, 75, 100, 100, 100, 100, 150, 150, 150,
|
||||
150, 150, 100, 150])
|
||||
)
|
||||
|
||||
def __init__(self, dbstate, uistate):
|
||||
PlaceBaseView.__init__(self, dbstate, uistate,
|
||||
|
@ -96,11 +96,11 @@ class RepositoryView(ListView):
|
||||
CONFIGSETTINGS = (
|
||||
('columns.visible', [COL_NAME, COL_ID, COL_TYPE, COL_URL, COL_STREET,
|
||||
]),
|
||||
('columns.order', [COL_NAME, COL_ID, COL_ZIP, COL_CITY, COL_TYPE,
|
||||
('columns.rank', [COL_NAME, COL_ID, COL_ZIP, COL_CITY, COL_TYPE,
|
||||
COL_URL, COL_STREET, COL_COUNTY, COL_STATE,
|
||||
COL_COUNTRY, COL_EMAIL, COL_SURL,
|
||||
COL_CHAN]),
|
||||
('columns.sizecol', [200, 75, 100, 100, 100, 250, 100, 100, 100,
|
||||
('columns.size', [200, 75, 100, 100, 100, 250, 100, 100, 100,
|
||||
100, 100, 100, 100])
|
||||
)
|
||||
ADD_MSG = _("Add a new repository")
|
||||
|
@ -83,9 +83,9 @@ class SourceView(ListView):
|
||||
# default setting with visible columns, order of the col, and their size
|
||||
CONFIGSETTINGS = (
|
||||
('columns.visible', [COL_TITLE, COL_ID, COL_AUTH, COL_PINFO]),
|
||||
('columns.order', [COL_TITLE, COL_ID, COL_AUTH, COL_ABBR, COL_PINFO,
|
||||
('columns.rank', [COL_TITLE, COL_ID, COL_AUTH, COL_ABBR, COL_PINFO,
|
||||
COL_CHAN]),
|
||||
('columns.sizecol', [200, 75, 150, 100, 150, 100])
|
||||
('columns.size', [200, 75, 150, 100, 150, 100])
|
||||
)
|
||||
ADD_MSG = _("Add a new source")
|
||||
EDIT_MSG = _("Edit the selected source")
|
||||
|
Loading…
x
Reference in New Issue
Block a user