예제 #1
0
    def init(self):

        with flx.VBox():
            flx.Label(html='<h3>Server monitor</h3>')
            if flx.current_server().serving[0] == 'localhost':
                # Don't do this for a public server
                self.button = flx.Button(text='Do some work')
                self.button.reaction(self._do_work, 'pointer_down')
            self.view = MonitorView(flex=1)
예제 #2
0
파일: monitor.py 프로젝트: zoofIO/flexx
    def init(self):

        with flx.VBox():
            flx.Label(html='<h3>Server monitor</h3>')
            if flx.current_server().serving[0] == 'localhost':
                # Don't do this for a public server
                self.button = flx.Button(text='Do some work')
                self.button.reaction(self._do_work, 'pointer_down')
            self.view = MonitorView(flex=1)
예제 #3
0
# Serve some web apps, just for fun
flx.serve(Drawing)
flx.serve(ChatRoom)


class MyAboutHandler(tornado.web.RequestHandler):
    def get(self):
        self.write('<html>This is just an <i>example</i>.</html>')


class MyAPIHandler(tornado.web.RequestHandler):
    def get(self, path):
        # self.request.path -> full path
        # path -> the regexp group specified in add_handlers
        self.write('echo ' + path)


# Get a ref to the tornado.web.Application object
tornado_app = flx.current_server().app

# Add our handler
tornado_app.add_handlers(r".*", [(r"/about", MyAboutHandler),
                                 (r"/api/(.*)", MyAPIHandler)])

# Note: Tornado tries to match handlers in order, but the handlers
# specified in the constructor come last. Therefore we can easily add
# specific handlers here even though Flexx' main handler is very
# generic.

flx.start()
예제 #4
0
flx.serve(ChatRoom)


class MyAboutHandler(tornado.web.RequestHandler):

    def get(self):
        self.write('<html>This is just an <i>example</i>.</html>')


class MyAPIHandler(tornado.web.RequestHandler):

    def get(self, path):
        # self.request.path -> full path
        # path -> the regexp group specified in add_handlers
        self.write('echo ' + path)


# Get a ref to the tornado.web.Application object
tornado_app = flx.current_server().app

# Add our handler
tornado_app.add_handlers(r".*", [(r"/about", MyAboutHandler),
                                 (r"/api/(.*)", MyAPIHandler)])

# Note: Tornado tries to match handlers in order, but the handlers
# specified in the constructor come last. Therefore we can easily add
# specific handlers here even though Flexx' main handler is very
# generic.

flx.start()