2018-12-24 12:37:51 -08:00
|
|
|
from manimlib.utils.config_ops import digest_config
|
2018-01-29 13:37:17 -08:00
|
|
|
|
2018-05-09 14:03:53 -07:00
|
|
|
# Currently, this is only used by both Scene and Mobject.
|
2018-01-29 13:37:17 -08:00
|
|
|
# Still, we abstract its functionality here, albeit purely nominally.
|
|
|
|
# All actual implementation has to be handled by derived classes for now.
|
|
|
|
#
|
2018-05-09 14:03:53 -07:00
|
|
|
# Note that although the prototypical instances add and remove Mobjects,
|
2018-04-06 13:58:59 -07:00
|
|
|
# there is also the possibility to add ContinualAnimations to Scenes. Thus,
|
|
|
|
# in the Container class in general, we do not make any presumptions about
|
2018-01-29 13:37:17 -08:00
|
|
|
# what types of objects may be added; this is again dependent on the specific
|
|
|
|
# derived instance.
|
|
|
|
|
2018-05-09 14:03:53 -07:00
|
|
|
# TODO: Move the "remove" functionality of Scene to this class
|
|
|
|
|
2018-04-06 13:58:59 -07:00
|
|
|
|
2018-01-29 13:37:17 -08:00
|
|
|
class Container(object):
|
|
|
|
def __init__(self, *submobjects, **kwargs):
|
|
|
|
digest_config(self, kwargs)
|
|
|
|
|
|
|
|
def add(self, *items):
|
2018-04-06 13:58:59 -07:00
|
|
|
raise Exception(
|
|
|
|
"Container.add is not implemented; it is up to derived classes to implement")
|
2018-01-29 13:37:17 -08:00
|
|
|
|
|
|
|
def remove(self, *items):
|
2018-04-06 13:58:59 -07:00
|
|
|
raise Exception(
|
|
|
|
"Container.remove is not implemented; it is up to derived classes to implement")
|