Merge pull request #140 from tecknicaltom/fix-EditMedia

make EditPrimary, empty_object abstract
This commit is contained in:
Doug Blank 2016-05-10 06:56:31 -04:00
commit 5a72efc387

View File

@ -26,6 +26,7 @@
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext _ = glocale.translation.gettext
import abc
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -49,7 +50,7 @@ from ..dialog import SaveDialog
from gramps.gen.lib import PrimaryObject from gramps.gen.lib import PrimaryObject
from ..dbguielement import DbGUIElement from ..dbguielement import DbGUIElement
class EditPrimary(ManagedWindow, DbGUIElement): class EditPrimary(ManagedWindow, DbGUIElement, metaclass=abc.ABCMeta):
QR_CATEGORY = -1 QR_CATEGORY = -1
@ -245,12 +246,9 @@ class EditPrimary(ManagedWindow, DbGUIElement):
self._do_close() self._do_close()
return False return False
@abc.abstractmethod
def empty_object(self): def empty_object(self):
#empty_object should be overridden in base class and will throw an """ empty_object should be overridden in child class """
#exception if it is not because self.empty_object().serialize() is
#called and PrimaryObject does not implement serialize(). See
#BaseObject.serialize()
return PrimaryObject
def data_has_changed(self): def data_has_changed(self):
if self.db.readonly: if self.db.readonly: