#!/usr/bin/env python3

from .easymain import log, create_instance, BaseObject


class LODocument(BaseObject):

    def __init__(self, obj):
        super().__init__(obj)
        self._cc = obj.getCurrentController()
        self._undo = True

    def __exit__(self, exc_type, exc_value, traceback):
        self.close()

    @property
    def type(self):
        """Get type document"""
        return self._type

    @property
    def frame(self):
        """Get frame document"""
        return self._cc.getFrame()

    def _create_instance(self, name):
        obj = self.obj.createInstance(name)
        return obj
