How to use the awe.view.Root function in awe

To help you get started, we’ve selected a few awe examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dankilman / awe / awe / registry.py View on Github external
def _get_id_and_store(self, obj, obj_id):
        obj_id = obj_id or getattr(obj, 'id', str(id(obj)))
        if isinstance(obj, view.Root):
            store = self.roots
        elif isinstance(obj, view.Element):
            store = self.elements
        elif isinstance(obj, type) and issubclass(obj, view.CustomElement):
            store = self.element_types
        elif isinstance(obj, variables.Variable):
            store = self.variables
        elif callable(obj):
            store = self.functions
        else:
            raise RuntimeError('No registry is defined for objects of type {}'.format(type(obj).__name__))
        return obj_id, store
github dankilman / awe / awe / page.py View on Github external
from . import export
from . import custom
from . import parser
from . import element_updater
from . import api_client

global_page = None

DEFAULT_WIDTH = 1200
DEFAULT_TITLE = 'Awe'
DEFAULT_HOST = api_client.DEFAULT_HOST
DEFAULT_PORT = api_client.DEFAULT_PORT
DEFAULT_WEBSOCKET_PORT = api_client.DEFAULT_WEBSOCKET_PORT


class Page(view.Root):

    def __init__(
            self,
            title=DEFAULT_TITLE,
            host=DEFAULT_HOST,
            port=DEFAULT_PORT,
            websocket_port=DEFAULT_WEBSOCKET_PORT,
            width=None,
            style=None,
            export_fn=None,
            offline=False,
            serializers=None):
        """
        :param title: Page title.
        :param host: Webserver/Websocket host.
        :param port: Webserver port.
github dankilman / awe / awe / view.py View on Github external
def _new_root(self):
        assert not self._removed
        self._increase_version()
        result = Root(owner=self.root)
        self._register(result)
        return result
github dankilman / awe / awe / view.py View on Github external
def __init__(self, owner, element_id=None):
        super(Root, self).__init__(
            root=self,
            parent=None,
            element_id=element_id,
            props=None,
            style=None,
            stack=[self]
        )
        self._owner = owner  # type: Element