Example #1
0
def _exists(guid):
    """Checks if an element with the given guid exists."""
    template = _resources.get_data(__name__, 'js/_proxy.js')
    if six.PY3:
        # pkgutil.get_data returns bytes, but we want a str.
        template = template.decode('utf8')
    return _call_js_function(template, guid, {'method': 'exists'}, False)
Example #2
0
def _proxy(guid, msg):
    """Makes a proxy call on an element."""
    template = _resources.get_data(__name__, 'js/_proxy.js')
    if six.PY3:
        # pkgutil.get_data returns bytes, but we want a str.
        template = template.decode('utf8')
    return _call_js_function(template, guid, msg)
Example #3
0
def _utils_url():
    """Return the url to the utils script."""
    global _utils_ref
    if not _utils_ref:
        src = _resources.get_data(__name__, 'js/_html.js')
        if six.PY3:
            # pkgutil.get_data returns bytes, but we want a str.
            src = src.decode('utf8')
        _utils_ref = _provide.create(content=src, extension='js')
    return _utils_ref.url
Example #4
0
def _exists(guid):
    """Checks if an element with the given guid exists."""
    template = _resources.get_data(__name__, 'js/_proxy.js')
    return _call_js_function(template, guid, {'method': 'exists'}, False)
Example #5
0
def _proxy(guid, msg):
    """Makes a proxy call on an element."""
    template = _resources.get_data(__name__, 'js/_proxy.js')
    return _call_js_function(template, guid, msg)
Example #6
0
 def _repr_html_(self):
     """Converts element to HTML string."""
     self._could_exist = True
     view = _ElementView(self)
     template = _resources.get_data(__name__, 'templates/_element.mustache')
     return pystache.render(template, view)