From d1647d32efb6cd05b9978eced0b577a084762845 Mon Sep 17 00:00:00 2001 From: Sridhar Ramesh Date: Mon, 29 Jan 2018 13:37:17 -0800 Subject: [PATCH] Whoops, forgot to actually add Container files to last commit, but this is the purely virtual Container class from which MObject and Scene now derive --- container/__init__.py | 1 + container/container.py | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 container/__init__.py create mode 100644 container/container.py diff --git a/container/__init__.py b/container/__init__.py new file mode 100644 index 00000000..de599d96 --- /dev/null +++ b/container/__init__.py @@ -0,0 +1 @@ +from container import * diff --git a/container/container.py b/container/container.py new file mode 100644 index 00000000..2cb3325e --- /dev/null +++ b/container/container.py @@ -0,0 +1,21 @@ +from helpers import * + +# Currently, this is only used by both Scene and MOBject. +# Still, we abstract its functionality here, albeit purely nominally. +# All actual implementation has to be handled by derived classes for now. +# +# Note that although the prototypical instances add and remove MObjects, +# there is also the possibility to add ContinualAnimations to Scenes. Thus, +# in the Container class in general, we do not make any presumptions about +# what types of objects may be added; this is again dependent on the specific +# derived instance. + +class Container(object): + def __init__(self, *submobjects, **kwargs): + digest_config(self, kwargs) + + def add(self, *items): + raise Exception("Container.add is not implemented; it is up to derived classes to implement") + + def remove(self, *items): + raise Exception("Container.remove is not implemented; it is up to derived classes to implement") \ No newline at end of file