1
from twisted.python import util
2
from nevow import rend, loaders, inevow, livepage
5
getValue = livepage.js('getValue')
6
changeLabel = livepage.js('changeLabel')
9
def onCommand(client, text):
10
client.sendScript(changeLabel(text))
13
class XulApp(livepage.LivePage):
15
docFactory = loaders.xmlfile(util.sibpath(__file__, 'xul_example.xul'))
17
def locateChild(self, ctx, segments):
18
inevow.IRequest(ctx).setHeader("Content-Type", "application/vnd.mozilla.xul+xml; charset=UTF-8")
19
return rend.Page.locateChild(self, ctx, segments)
21
def render_btn(self, ctx, data):
22
return ctx.tag(oncommand=livepage.server.handle('onCommand', getValue('some-text')))
24
def handle_onCommand(self, ctx, text):
25
return changeLabel(text)