3339: [Patch] Views get their column display data from db (meta); should get from config ini
svn: r13709
This commit is contained in:
parent
b876023812
commit
785184e74f
@ -637,6 +637,31 @@ register('preferences.sprefix', 'S%04d')
|
|||||||
register('preferences.todo-color', '#ff0000')
|
register('preferences.todo-color', '#ff0000')
|
||||||
register('preferences.use-last-view', True)
|
register('preferences.use-last-view', True)
|
||||||
|
|
||||||
|
register('person-view.columns', [(1, 0, 250), (1, 1, 50), (1, 2, 75),
|
||||||
|
(1, 3, 100), (1, 4, 175), (1, 5, 100),
|
||||||
|
(1, 6, 175), (1, 7, 100), (0, 8, 100)])
|
||||||
|
register('child-view.columns', [(1, 0), (1, 1), (1, 2), (1, 3), (1, 4),
|
||||||
|
(1, 5), (0, 6), (0, 7)])
|
||||||
|
register('place-view.columns', [(1, 0, 250), (1, 1, 75), (1, 11, 100),
|
||||||
|
(0, 3, 100), (1, 4, 100, ), (0, 5, 150),
|
||||||
|
(1, 6, 150), (0, 7, 150), (0, 8, 150),
|
||||||
|
(0, 9, 150), (0, 10, 150),(0,2,100)])
|
||||||
|
register('source-view.columns', [(1, 0, 200), (1, 1, 75), (1, 2, 150),
|
||||||
|
(0, 3, 100), (1, 4, 150), (0, 5, 100)])
|
||||||
|
register('media-view.columns', [(1, 0, 200, ), (1, 1, 75), (1, 2, 100),
|
||||||
|
(1, 3, 200), (1, 5, 150), (0, 4, 150)])
|
||||||
|
register('repository-view.columns', [(1, 0, 200), (1, 1, 75), (0, 5, 100),
|
||||||
|
(0, 6, 100), (1, 2, 100), (1, 3, 250),
|
||||||
|
(1, 4, 100), (0, 7, 100), (0, 8, 100),
|
||||||
|
(0, 9, 100), (0, 10, 100), (0, 12, 100)])
|
||||||
|
register('event-view.columns', [(1, 0, 200), (1, 1, 75), (1, 2, 100),
|
||||||
|
(0, 6, 230), (1, 3, 150),
|
||||||
|
(1, 4, 200), (0, 5, 100)])
|
||||||
|
register('family-view.columns', [(1, 0, 75), (1, 1, 200), (1, 2, 200),
|
||||||
|
(1, 3, 100), (0, 4, 100)])
|
||||||
|
register('note-view.columns', [(1, 0, 350), (1, 1, 75), (1, 2, 100),
|
||||||
|
(1, 3, 100)])
|
||||||
|
|
||||||
register('researcher.researcher-addr', '')
|
register('researcher.researcher-addr', '')
|
||||||
register('researcher.researcher-city', '')
|
register('researcher.researcher-city', '')
|
||||||
register('researcher.researcher-country', '')
|
register('researcher.researcher-country', '')
|
||||||
|
@ -84,14 +84,14 @@ REPOSITORY_KEY = 6
|
|||||||
REFERENCE_KEY = 7
|
REFERENCE_KEY = 7
|
||||||
NOTE_KEY = 8
|
NOTE_KEY = 8
|
||||||
|
|
||||||
PERSON_COL_KEY = 'columns'
|
PERSON_COL_KEY = 'person-view.columns'
|
||||||
CHILD_COL_KEY = 'child_columns'
|
CHILD_COL_KEY = 'child-view.columns'
|
||||||
PLACE_COL_KEY = 'place_columns'
|
PLACE_COL_KEY = 'place-view.columns'
|
||||||
SOURCE_COL_KEY = 'source_columns'
|
SOURCE_COL_KEY = 'source-view.columns'
|
||||||
MEDIA_COL_KEY = 'media_columns'
|
MEDIA_COL_KEY = 'media-view.columns'
|
||||||
REPOSITORY_COL_KEY = 'repository_columns'
|
REPOSITORY_COL_KEY = 'repository-view.columns'
|
||||||
EVENT_COL_KEY = 'event_columns'
|
EVENT_COL_KEY = 'event-view.columns'
|
||||||
FAMILY_COL_KEY = 'family_columns'
|
FAMILY_COL_KEY = 'family-view.columns'
|
||||||
NOTE_COL_KEY = 'note_columns'
|
NOTE_COL_KEY = 'note-view.columns'
|
||||||
|
|
||||||
TXNADD, TXNUPD, TXNDEL = 0, 1, 2
|
TXNADD, TXNUPD, TXNDEL = 0, 1, 2
|
||||||
|
@ -52,6 +52,7 @@ from gen.utils.callback import Callback
|
|||||||
from gen.db import (GrampsCursor, GrampsDbBase)
|
from gen.db import (GrampsCursor, GrampsDbBase)
|
||||||
from Utils import create_id
|
from Utils import create_id
|
||||||
import Errors
|
import Errors
|
||||||
|
import config
|
||||||
|
|
||||||
LOG = logging.getLogger(DBLOGNAME)
|
LOG = logging.getLogger(DBLOGNAME)
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -1389,28 +1390,24 @@ class GrampsDbRead(GrampsDbBase, Callback):
|
|||||||
"""
|
"""
|
||||||
self.set_column_order(col_list, NOTE_COL_KEY)
|
self.set_column_order(col_list, NOTE_COL_KEY)
|
||||||
|
|
||||||
def __get_column_order(self, name, default):
|
def __get_column_order(self, name):
|
||||||
if self.metadata is None:
|
default = config.get_default(name)
|
||||||
return default
|
cols = config.get(name)
|
||||||
|
if len(cols) != len(default):
|
||||||
|
return cols + default[len(cols):]
|
||||||
else:
|
else:
|
||||||
cols = self.metadata.get(name, default)
|
return cols
|
||||||
if len(cols) != len(default):
|
|
||||||
return cols + default[len(cols):]
|
|
||||||
else:
|
|
||||||
return cols
|
|
||||||
|
|
||||||
def get_person_column_order(self):
|
def get_person_column_order(self):
|
||||||
"""
|
"""
|
||||||
Return the Person display common information stored in the database's
|
Return the Person display common information stored in the database's
|
||||||
metadata.
|
metadata.
|
||||||
"""
|
"""
|
||||||
default = [(1, 0, 250), (1, 1, 50), (1, 2, 75), (1, 3, 100),
|
return self.__get_column_order(PERSON_COL_KEY)
|
||||||
(1, 4, 175), (1, 5, 100), (1, 6, 175), (1, 7, 100),
|
|
||||||
(0, 8, 100)]
|
|
||||||
return self.__get_column_order(PERSON_COL_KEY, default)
|
|
||||||
|
|
||||||
def __get_columns(self, key, default):
|
def __get_columns(self, key):
|
||||||
values = self.__get_column_order(key, default)
|
default = config.get_default(key)
|
||||||
|
values = self.__get_column_order(key)
|
||||||
new = []
|
new = []
|
||||||
for val in values:
|
for val in values:
|
||||||
if len(val) == 2:
|
if len(val) == 2:
|
||||||
@ -1427,77 +1424,56 @@ class GrampsDbRead(GrampsDbBase, Callback):
|
|||||||
Return the Person display common information stored in the database's
|
Return the Person display common information stored in the database's
|
||||||
metadata.
|
metadata.
|
||||||
"""
|
"""
|
||||||
default = [(1, 0, 75), (1, 1, 200), (1, 2, 200), (1, 3, 100),
|
return self.__get_columns(FAMILY_COL_KEY)
|
||||||
(0, 4, 100)]
|
|
||||||
return self.__get_columns(FAMILY_COL_KEY, default)
|
|
||||||
|
|
||||||
def get_child_column_order(self):
|
def get_child_column_order(self):
|
||||||
"""
|
"""
|
||||||
Return the Person display common information stored in the database's
|
Return the Person display common information stored in the database's
|
||||||
metadata.
|
metadata.
|
||||||
"""
|
"""
|
||||||
default = [(1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (1, 5),
|
return self.__get_column_order(CHILD_COL_KEY)
|
||||||
(0, 6), (0, 7)]
|
|
||||||
return self.__get_column_order(CHILD_COL_KEY, default)
|
|
||||||
|
|
||||||
def get_place_column_order(self):
|
def get_place_column_order(self):
|
||||||
"""
|
"""
|
||||||
Return the Place display common information stored in thedatabase's
|
Return the Place display common information stored in thedatabase's
|
||||||
metadata.
|
metadata.
|
||||||
"""
|
"""
|
||||||
default = [(1, 0, 250), (1, 1, 75), (1, 11, 100), (0, 3, 100),
|
return self.__get_columns(PLACE_COL_KEY)
|
||||||
(1, 4, 100, ), (0, 5, 150), (1, 6, 150), (0, 7, 150),
|
|
||||||
(0, 8, 150), (0, 9, 150), (0, 10, 150),(0,2,100)]
|
|
||||||
return self.__get_columns(PLACE_COL_KEY, default)
|
|
||||||
|
|
||||||
def get_source_column_order(self):
|
def get_source_column_order(self):
|
||||||
"""
|
"""
|
||||||
Return the Source display common information stored in the database's
|
Return the Source display common information stored in the database's
|
||||||
metadata.
|
metadata.
|
||||||
"""
|
"""
|
||||||
default = [(1, 0, 200), (1, 1, 75), (1, 2, 150), (0, 3, 100),
|
return self.__get_columns(SOURCE_COL_KEY)
|
||||||
(1, 4, 150), (0, 5, 100)]
|
|
||||||
return self.__get_columns(SOURCE_COL_KEY, default)
|
|
||||||
|
|
||||||
def get_media_column_order(self):
|
def get_media_column_order(self):
|
||||||
"""
|
"""
|
||||||
Return the MediaObject display common information stored in the
|
Return the MediaObject display common information stored in the
|
||||||
database's metadata.
|
database's metadata.
|
||||||
"""
|
"""
|
||||||
default = [(1, 0, 200, ), (1, 1, 75), (1, 2, 100), (1, 3, 200),
|
return self.__get_columns(MEDIA_COL_KEY)
|
||||||
(1, 5, 150), (0, 4, 150)]
|
|
||||||
return self.__get_columns(MEDIA_COL_KEY, default)
|
|
||||||
|
|
||||||
def get_event_column_order(self):
|
def get_event_column_order(self):
|
||||||
"""
|
"""
|
||||||
Return the Event display common information stored in the database's
|
Return the Event display common information stored in the database's
|
||||||
metadata.
|
metadata.
|
||||||
"""
|
"""
|
||||||
default = [(1, 0, 200), (1, 1, 75), (1, 2, 100), (1, 3, 150),
|
return self.__get_columns(EVENT_COL_KEY)
|
||||||
(1, 4, 200), (0, 5, 100)]
|
|
||||||
# Benny's new column order
|
|
||||||
default = [(1, 0, 200), (1, 1, 75), (1, 2, 100),
|
|
||||||
(0, 6, 230), (1, 3, 150),
|
|
||||||
(1, 4, 200), (0, 5, 100)]
|
|
||||||
return self.__get_columns(EVENT_COL_KEY, default)
|
|
||||||
|
|
||||||
def get_repository_column_order(self):
|
def get_repository_column_order(self):
|
||||||
"""
|
"""
|
||||||
Return the Repository display common information stored in the
|
Return the Repository display common information stored in the
|
||||||
database's metadata.
|
database's metadata.
|
||||||
"""
|
"""
|
||||||
default = [(1, 0, 200), (1, 1, 75), (0, 5, 100), (0, 6, 100),
|
return self.__get_columns(REPOSITORY_COL_KEY)
|
||||||
(1, 2, 100), (1, 3, 250), (1, 4, 100), (0, 7, 100),
|
|
||||||
(0, 8, 100), (0, 9, 100), (0, 10, 100), (0, 12, 100)]
|
|
||||||
return self.__get_columns(REPOSITORY_COL_KEY, default)
|
|
||||||
|
|
||||||
def get_note_column_order(self):
|
def get_note_column_order(self):
|
||||||
"""
|
"""
|
||||||
Return the Note display common information stored in the database's
|
Return the Note display common information stored in the database's
|
||||||
metadata.
|
metadata.
|
||||||
"""
|
"""
|
||||||
default = [(1, 0, 350), (1, 1, 75), (1, 2, 100), (1, 3, 100)]
|
return self.__get_columns(NOTE_COL_KEY)
|
||||||
return self.__get_columns(NOTE_COL_KEY, default)
|
|
||||||
|
|
||||||
def delete_primary_from_reference_map(self, handle, transaction):
|
def delete_primary_from_reference_map(self, handle, transaction):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user