Esempio n. 1
0
class BrowserDOMAgent(Agent):
    def __init__(self, name=None):
        super().__init__(name=name)
        self.document = get_document()
        self.document.head.appendChild(Style(style))
        self.ul = Ul(class_='zen-log')
        self.document.body.appendChild(self.ul)

    @on_event('*')
    @on_message('*')
    def every_frame(self, frame):
        li = Li()
        prefix = FRAME_PREFIX[frame.kind]
        text = frame_template.format(prefix=prefix,
                                     source=frame.source,
                                     name=frame.name)
        data = frame.data
        if data and not (len(data.keys()) == 1 and 'text' in data):
            text += data_template.format(data=pformat(data))

        li.innerHTML = text
        self.ul.appendChild(li)
Esempio n. 2
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from wdom.tag import Ul, Li

ul = Ul()
li1 = Li('item1')
li2 = Li('item2')
...

ul.appendChild(li1)
ul.appendChild(li2)
...
print(ul.html_noid)

# by append
ul2 = Ul()
ul2.append(Li('item1'), Li('item2'))
print(ul2.html_noid)
Esempio n. 3
0
from wdom.tag import Ul, Li

ul = Ul()
li1 = Li('item1')
li2 = Li('item2')
...

ul.appendChild(li1)
ul.appendChild(li2)
...
print(ul.html_noid)

# by append
ul2 = Ul()
ul2.append(Li('item1'), Li('item2'))
print(ul2.html_noid)