Convert gen.db to use abstract base classes
This commit is contained in:
parent
fe9af29bf5
commit
f0210825de
File diff suppressed because it is too large
Load Diff
@ -3,11 +3,12 @@
|
||||
# Standard python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from abc import ABCMeta, abstractmethod
|
||||
import time
|
||||
import pickle
|
||||
from collections import deque
|
||||
|
||||
class DbUndo:
|
||||
class DbUndo(metaclass=ABCMeta):
|
||||
"""
|
||||
Base class for the Gramps undo/redo manager. Needs to be subclassed
|
||||
for use with a real backend.
|
||||
@ -65,56 +66,56 @@ class DbUndo:
|
||||
self.close()
|
||||
return exc_type is None
|
||||
|
||||
@abstractmethod
|
||||
def open(self, value):
|
||||
"""
|
||||
Open the backing storage. Needs to be overridden in the derived
|
||||
class.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@abstractmethod
|
||||
def close(self):
|
||||
"""
|
||||
Close the backing storage. Needs to be overridden in the derived
|
||||
class.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@abstractmethod
|
||||
def append(self, value):
|
||||
"""
|
||||
Add a new entry on the end. Needs to be overridden in the derived
|
||||
class.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@abstractmethod
|
||||
def __getitem__(self, index):
|
||||
"""
|
||||
Returns an entry by index number. Needs to be overridden in the
|
||||
derived class.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@abstractmethod
|
||||
def __setitem__(self, index, value):
|
||||
"""
|
||||
Set an entry to a value. Needs to be overridden in the derived class.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@abstractmethod
|
||||
def __len__(self):
|
||||
"""
|
||||
Returns the number of entries. Needs to be overridden in the derived
|
||||
class.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def __redo(self, update_history):
|
||||
@abstractmethod
|
||||
def _redo(self, update_history):
|
||||
"""
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def __undo(self, update_history):
|
||||
@abstractmethod
|
||||
def _undo(self, update_history):
|
||||
"""
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def commit(self, txn, msg):
|
||||
"""
|
||||
|
@ -2014,3 +2014,60 @@ class DBAPI(DbGeneric):
|
||||
summary = super().get_summary()
|
||||
summary.update(self.dbapi.__class__.get_summary())
|
||||
return summary
|
||||
|
||||
# TODO: The following abstract methods need implementing.
|
||||
# See bug #9547.
|
||||
|
||||
def add_family_event(event, transaction):
|
||||
pass
|
||||
|
||||
def add_person_event(event, transaction):
|
||||
pass
|
||||
|
||||
def all_handles(table):
|
||||
pass
|
||||
|
||||
def commit_base(obj, data_map, key, transaction, change_time):
|
||||
pass
|
||||
|
||||
def commit_family_event(event, transaction, change_time):
|
||||
pass
|
||||
|
||||
def commit_personal_event(event, transaction, change_time):
|
||||
pass
|
||||
|
||||
def delete_primary_from_reference_map(handle, transaction):
|
||||
pass
|
||||
|
||||
def get_from_handle(handle, class_type, data_map):
|
||||
pass
|
||||
|
||||
def get_reference_map_cursor():
|
||||
pass
|
||||
|
||||
def get_reference_map_primary_cursor():
|
||||
pass
|
||||
|
||||
def get_reference_map_referenced_cursor():
|
||||
pass
|
||||
|
||||
def gramps_upgrade():
|
||||
pass
|
||||
|
||||
def need_schema_upgrade():
|
||||
pass
|
||||
|
||||
def set_auto_remove():
|
||||
pass
|
||||
|
||||
def set_redo_callback(callback):
|
||||
pass
|
||||
|
||||
def set_undo_callback(callback):
|
||||
pass
|
||||
|
||||
def sort_surname_list():
|
||||
pass
|
||||
|
||||
def update_reference_map(obj, transaction):
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user