Remove column config from db, move to the plugins
Start with reuse of preferences for all configuration Allow all view plugins to set configuration dialog TODO: activate the column reorder in config of listviews svn: r14176
This commit is contained in:
@@ -195,13 +195,6 @@ class DbReadBase(object):
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def get_event_column_order(self):
|
||||
"""
|
||||
Return the Event display common information stored in the database's
|
||||
metadata.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def get_event_cursor(self):
|
||||
"""
|
||||
Return a reference to a cursor over Family objects
|
||||
@@ -289,13 +282,6 @@ class DbReadBase(object):
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def get_family_list_column_order(self):
|
||||
"""
|
||||
Return the Person display common information stored in the database's
|
||||
metadata.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def get_family_relation_types(self):
|
||||
"""
|
||||
Return a list of all relationship types associated with Family
|
||||
@@ -334,13 +320,6 @@ class DbReadBase(object):
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def get_media_column_order(self):
|
||||
"""
|
||||
Return the MediaObject display common information stored in the
|
||||
database's metadata.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def get_media_cursor(self):
|
||||
"""
|
||||
Return a reference to a cursor over Media objects
|
||||
@@ -387,13 +366,6 @@ class DbReadBase(object):
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def get_note_column_order(self):
|
||||
"""
|
||||
Return the Note display common information stored in the database's
|
||||
metadata.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def get_note_cursor(self):
|
||||
"""
|
||||
Return a reference to a cursor over Note objects
|
||||
@@ -503,13 +475,6 @@ class DbReadBase(object):
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def get_person_column_order(self):
|
||||
"""
|
||||
Return the Person display common information stored in the database's
|
||||
metadata.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def get_person_cursor(self):
|
||||
"""
|
||||
Return a reference to a cursor over Person objects
|
||||
@@ -555,13 +520,6 @@ class DbReadBase(object):
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def get_place_column_order(self):
|
||||
"""
|
||||
Return the Place display common information stored in thedatabase's
|
||||
metadata.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def get_place_cursor(self):
|
||||
"""
|
||||
Return a reference to a cursor over Place objects
|
||||
@@ -666,13 +624,6 @@ class DbReadBase(object):
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def get_repository_column_order(self):
|
||||
"""
|
||||
Return the Repository display common information stored in the
|
||||
database's metadata.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def get_repository_cursor(self):
|
||||
"""
|
||||
Return a reference to a cursor over Repository objects
|
||||
@@ -729,13 +680,6 @@ class DbReadBase(object):
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def get_source_column_order(self):
|
||||
"""
|
||||
Return the Source display common information stored in the database's
|
||||
metadata.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def get_source_cursor(self):
|
||||
"""
|
||||
Return a reference to a cursor over Source objects
|
||||
@@ -1072,74 +1016,6 @@ class DbReadBase(object):
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def get_child_column_order(self):
|
||||
"""
|
||||
Return the Person display common information stored in the database's
|
||||
metadata.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def set_child_column_order(self, col_list):
|
||||
"""
|
||||
Store the Person display common information in the database's metadata.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def set_column_order(self, col_list, name):
|
||||
"""
|
||||
Store the display information in the database's metadata.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def set_event_column_order(self, col_list):
|
||||
"""
|
||||
Store the Event display common information in the database's metadata.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def set_family_list_column_order(self, col_list):
|
||||
"""
|
||||
Store the Person display common information in the database's metadata.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def set_media_column_order(self, col_list):
|
||||
"""
|
||||
Store the Media display common information in the database's metadata.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def set_note_column_order(self, col_list):
|
||||
"""
|
||||
Store the Note display common information in the database's metadata.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def set_person_column_order(self, col_list):
|
||||
"""
|
||||
Store the Person display common information in the database's metadata.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def set_place_column_order(self, col_list):
|
||||
"""
|
||||
Store the Place display common information in the database's metadata.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def set_repository_column_order(self, col_list):
|
||||
"""
|
||||
Store the Repository display common information in the database's
|
||||
metadata.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def set_source_column_order(self, col_list):
|
||||
"""
|
||||
Store the Source display common information in the database's metadata.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def set_mediapath(self, path):
|
||||
"""
|
||||
Set the default media path for database, path should be utf-8.
|
||||
|
@@ -43,13 +43,7 @@ __all__ = (
|
||||
|
||||
('PERSON_KEY', 'FAMILY_KEY', 'SOURCE_KEY', 'EVENT_KEY',
|
||||
'MEDIA_KEY', 'PLACE_KEY', 'REPOSITORY_KEY', 'NOTE_KEY',
|
||||
'REFERENCE_KEY', 'PERSON_COL_KEY', 'FAMILY_COL_KEY',
|
||||
'CHILD_COL_KEY'
|
||||
) +
|
||||
|
||||
('PERSON_COL_KEY', 'FAMILY_COL_KEY', 'CHILD_COL_KEY',
|
||||
'PLACE_COL_KEY', 'SOURCE_COL_KEY', 'MEDIA_COL_KEY',
|
||||
'EVENT_COL_KEY', 'REPOSITORY_COL_KEY', 'NOTE_COL_KEY'
|
||||
'REFERENCE_KEY'
|
||||
) +
|
||||
|
||||
('TXNADD', 'TXNUPD', 'TXNDEL')
|
||||
@@ -84,14 +78,4 @@ REPOSITORY_KEY = 6
|
||||
REFERENCE_KEY = 7
|
||||
NOTE_KEY = 8
|
||||
|
||||
PERSON_COL_KEY = 'person-view.columns'
|
||||
CHILD_COL_KEY = 'child-view.columns'
|
||||
PLACE_COL_KEY = 'place-view.columns'
|
||||
SOURCE_COL_KEY = 'source-view.columns'
|
||||
MEDIA_COL_KEY = 'media-view.columns'
|
||||
REPOSITORY_COL_KEY = 'repository-view.columns'
|
||||
EVENT_COL_KEY = 'event-view.columns'
|
||||
FAMILY_COL_KEY = 'family-view.columns'
|
||||
NOTE_COL_KEY = 'note-view.columns'
|
||||
|
||||
TXNADD, TXNUPD, TXNDEL = 0, 1, 2
|
||||
|
@@ -52,7 +52,6 @@ from gen.utils.callback import Callback
|
||||
from gen.db import (GrampsCursor, DbReadBase)
|
||||
from Utils import create_id
|
||||
import Errors
|
||||
import config
|
||||
|
||||
LOG = logging.getLogger(DBLOGNAME)
|
||||
#-------------------------------------------------------------------------
|
||||
@@ -157,16 +156,8 @@ class DbBsddbRead(DbReadBase, Callback):
|
||||
|
||||
returns a list of all Event types assocated with instances of <object>
|
||||
in the database.
|
||||
|
||||
.. method:: get_<object>_column_order()
|
||||
|
||||
returns the object's display common information.
|
||||
|
||||
"""
|
||||
|
||||
# This holds a reference to the gramps Config module if
|
||||
# it is available, it is setup by the factory methods.
|
||||
__config__ = None
|
||||
__signals__ = {}
|
||||
# If this is True logging will be turned on.
|
||||
try:
|
||||
@@ -1369,150 +1360,6 @@ class DbBsddbRead(DbReadBase, Callback):
|
||||
return self.metadata.get('mediapath', None)
|
||||
return None
|
||||
|
||||
def set_column_order(self, col_list, name):
|
||||
if (self.metadata is not None) and (not self.readonly):
|
||||
self.metadata[name] = col_list
|
||||
|
||||
def set_person_column_order(self, col_list):
|
||||
"""
|
||||
Store the Person display common information in the database's metadata.
|
||||
"""
|
||||
self.set_column_order(col_list, PERSON_COL_KEY)
|
||||
|
||||
def set_family_list_column_order(self, col_list):
|
||||
"""
|
||||
Store the Person display common information in the database's metadata.
|
||||
"""
|
||||
self.set_column_order(col_list, FAMILY_COL_KEY)
|
||||
|
||||
def set_child_column_order(self, col_list):
|
||||
"""
|
||||
Store the Person display common information in the database's metadata.
|
||||
"""
|
||||
self.set_column_order(col_list, CHILD_COL_KEY)
|
||||
|
||||
def set_place_column_order(self, col_list):
|
||||
"""
|
||||
Store the Place display common information in the database's metadata.
|
||||
"""
|
||||
self.set_column_order(col_list, PLACE_COL_KEY)
|
||||
|
||||
def set_source_column_order(self, col_list):
|
||||
"""
|
||||
Store the Source display common information in the database's metadata.
|
||||
"""
|
||||
self.set_column_order(col_list, SOURCE_COL_KEY)
|
||||
|
||||
def set_media_column_order(self, col_list):
|
||||
"""
|
||||
Store the Media display common information in the database's metadata.
|
||||
"""
|
||||
self.set_column_order(col_list, MEDIA_COL_KEY)
|
||||
|
||||
def set_event_column_order(self, col_list):
|
||||
"""
|
||||
Store the Event display common information in the database's metadata.
|
||||
"""
|
||||
self.set_column_order(col_list, EVENT_COL_KEY)
|
||||
|
||||
def set_repository_column_order(self, col_list):
|
||||
"""
|
||||
Store the Repository display common information in the database's
|
||||
metadata.
|
||||
"""
|
||||
self.set_column_order(col_list, REPOSITORY_COL_KEY)
|
||||
|
||||
def set_note_column_order(self, col_list):
|
||||
"""
|
||||
Store the Note display common information in the database's metadata.
|
||||
"""
|
||||
self.set_column_order(col_list, NOTE_COL_KEY)
|
||||
|
||||
def __get_column_order(self, name):
|
||||
default = config.get_default(name)
|
||||
cols = config.get(name)
|
||||
if len(cols) != len(default):
|
||||
return cols + default[len(cols):]
|
||||
else:
|
||||
return cols
|
||||
|
||||
def get_person_column_order(self):
|
||||
"""
|
||||
Return the Person display common information stored in the database's
|
||||
metadata.
|
||||
"""
|
||||
return self.__get_column_order(PERSON_COL_KEY)
|
||||
|
||||
def __get_columns(self, key):
|
||||
default = config.get_default(key)
|
||||
values = self.__get_column_order(key)
|
||||
new = []
|
||||
for val in values:
|
||||
if len(val) == 2:
|
||||
for x in default:
|
||||
if val[1] == x[1]:
|
||||
new.append((val[0], val[1], x[2]))
|
||||
break
|
||||
else:
|
||||
new.append(val)
|
||||
return new
|
||||
|
||||
def get_family_list_column_order(self):
|
||||
"""
|
||||
Return the Person display common information stored in the database's
|
||||
metadata.
|
||||
"""
|
||||
return self.__get_columns(FAMILY_COL_KEY)
|
||||
|
||||
def get_child_column_order(self):
|
||||
"""
|
||||
Return the Person display common information stored in the database's
|
||||
metadata.
|
||||
"""
|
||||
return self.__get_column_order(CHILD_COL_KEY)
|
||||
|
||||
def get_place_column_order(self):
|
||||
"""
|
||||
Return the Place display common information stored in thedatabase's
|
||||
metadata.
|
||||
"""
|
||||
return self.__get_columns(PLACE_COL_KEY)
|
||||
|
||||
def get_source_column_order(self):
|
||||
"""
|
||||
Return the Source display common information stored in the database's
|
||||
metadata.
|
||||
"""
|
||||
return self.__get_columns(SOURCE_COL_KEY)
|
||||
|
||||
def get_media_column_order(self):
|
||||
"""
|
||||
Return the MediaObject display common information stored in the
|
||||
database's metadata.
|
||||
"""
|
||||
return self.__get_columns(MEDIA_COL_KEY)
|
||||
|
||||
def get_event_column_order(self):
|
||||
"""
|
||||
Return the Event display common information stored in the database's
|
||||
metadata.
|
||||
"""
|
||||
return self.__get_columns(EVENT_COL_KEY)
|
||||
|
||||
def get_repository_column_order(self):
|
||||
"""
|
||||
Return the Repository display common information stored in the
|
||||
database's metadata.
|
||||
"""
|
||||
return self.__get_columns(REPOSITORY_COL_KEY)
|
||||
|
||||
def get_note_column_order(self):
|
||||
"""
|
||||
Return the Note display common information stored in the database's
|
||||
metadata.
|
||||
"""
|
||||
return self.__get_columns(NOTE_COL_KEY)
|
||||
|
||||
def find_backlink_handles(self, handle, include_classes=None):
|
||||
"""
|
||||
Find all objects that hold a reference to the object handle.
|
||||
|
@@ -20,12 +20,10 @@ class DbTest(object):
|
||||
"find_next_repository_gramps_id",
|
||||
"find_next_source_gramps_id",
|
||||
"get_bookmarks",
|
||||
"get_child_column_order",
|
||||
"get_child_reference_types",
|
||||
"get_default_handle",
|
||||
"get_default_person",
|
||||
"get_event_bookmarks",
|
||||
"get_event_column_order",
|
||||
"get_event_cursor",
|
||||
"get_event_from_gramps_id",
|
||||
"get_event_from_handle",
|
||||
@@ -38,14 +36,12 @@ class DbTest(object):
|
||||
"get_family_from_gramps_id",
|
||||
"get_family_from_handle",
|
||||
"get_family_handles",
|
||||
"get_family_list_column_order",
|
||||
"get_family_relation_types",
|
||||
"get_from_handle",
|
||||
"get_gramps_ids",
|
||||
"get_marker_types",
|
||||
"get_media_attribute_types",
|
||||
"get_media_bookmarks",
|
||||
"get_media_column_order",
|
||||
"get_media_cursor",
|
||||
"get_media_object_handles",
|
||||
"get_mediapath",
|
||||
@@ -53,7 +49,6 @@ class DbTest(object):
|
||||
"get_name_group_mapping",
|
||||
"get_name_types",
|
||||
"get_note_bookmarks",
|
||||
"get_note_column_order",
|
||||
"get_note_cursor",
|
||||
"get_note_from_gramps_id",
|
||||
"get_note_from_handle",
|
||||
@@ -70,14 +65,12 @@ class DbTest(object):
|
||||
"get_object_from_gramps_id",
|
||||
"get_object_from_handle",
|
||||
"get_person_attribute_types",
|
||||
"get_person_column_order",
|
||||
"get_person_cursor",
|
||||
"get_person_event_types",
|
||||
"get_person_from_gramps_id",
|
||||
"get_person_from_handle",
|
||||
"get_person_handles",
|
||||
"get_place_bookmarks",
|
||||
"get_place_column_order",
|
||||
"get_place_cursor",
|
||||
"get_place_from_gramps_id",
|
||||
"get_place_from_handle",
|
||||
@@ -94,7 +87,6 @@ class DbTest(object):
|
||||
"get_reference_map_primary_cursor",
|
||||
"get_reference_map_referenced_cursor",
|
||||
"get_repo_bookmarks",
|
||||
"get_repository_column_order",
|
||||
"get_repository_cursor",
|
||||
"get_repository_from_gramps_id",
|
||||
"get_repository_from_handle",
|
||||
@@ -103,7 +95,6 @@ class DbTest(object):
|
||||
"get_researcher",
|
||||
"get_save_path",
|
||||
"get_source_bookmarks",
|
||||
"get_source_column_order",
|
||||
"get_source_cursor",
|
||||
"get_source_from_gramps_id",
|
||||
"get_source_from_handle",
|
||||
@@ -152,17 +143,6 @@ class DbTest(object):
|
||||
"set_prefixes",
|
||||
"set_repository_id_prefix",
|
||||
"set_source_id_prefix",
|
||||
# Column order:
|
||||
"set_child_column_order",
|
||||
"set_column_order",
|
||||
"set_event_column_order",
|
||||
"set_family_list_column_order",
|
||||
"set_media_column_order",
|
||||
"set_note_column_order",
|
||||
"set_person_column_order",
|
||||
"set_place_column_order",
|
||||
"set_repository_column_order",
|
||||
"set_source_column_order",
|
||||
# Other set methods:
|
||||
"set_mediapath",
|
||||
"set_redo_callback",
|
||||
|
Reference in New Issue
Block a user