def start_flexx(): """ Used by init_and_spin to launch flexx """ flx.create_server(loop=asyncio.new_event_loop()) flx.start()
def main(file, open): IGraph.file = file app = flx.App(IGraph) app.serve() if open: app.launch() flx.start()
def start_flexx(loop): #circlesApp = flx.App(CirclesViewController, title='Circles') ##circlesApp.test() #circlesApp.serve() flx.App(Circles, title='Circles').serve() flx.create_server(host='0.0.0.0', port=80, loop=loop) flx.start()
def render(): class View(flx.PyWidget): def init(self): # Not a fan of using a label's `innerHTML` to set the HTML, but it works flx.Label(text='...') # Associate assets to load styling and scripts flx.assets.associate_asset(__name__, 'script.js', f'document.location.replace("{api.HOME_URL}")') app = flx.App(View) # Launch as a standalone application app.launch('app') logger.debug('Launching standalone application window') # Run under the main loop flx.start()
def update_info(self, info): # Set connections n = info.sessions, info.total_sessions self.status.set_html('There are %i connected clients.<br />' % n[0] + 'And in total we served %i connections.<br />' % n[1]) # Prepare plots times = list(self.cpu_plot.xdata) times.append(time() - self.start_time) times = times[-self.nsamples:] # cpu data usage = list(self.cpu_plot.ydata) usage.append(info.cpu) usage = usage[-self.nsamples:] self.cpu_plot.set_data(times, usage) # mem data usage = list(self.mem_plot.ydata) usage.append(info.mem) usage = usage[-self.nsamples:] self.mem_plot.set_data(times, usage) if __name__ == '__main__': a = flx.App(Monitor) a.serve() # m = a.launch('browser') # for use during development flx.start()
if (self.led==0): self.but1.set_text('LED OFF') self.but1.apply_style('background:yellow;') if (self.chillerSwitch==0): self.chillerStatus.set_text('COOLING OFF') self.chillerStatus.apply_style('background:yellow;') if (self.chillerSwitch==1 and self.chillerStat==0): self.chillerStatus.set_text('COOLING ON') self.chillerStatus.apply_style('background:orange;') if (self.chillerSwitch==1 and self.chillerStat==1): self.chillerStatus.set_text('COOLING OK') self.chillerStatus.apply_style('background:green;') if (self.vsel==1): self.but3.set_text('V1') if (self.vsel==0): self.but3.set_text('V0') from optparse import OptionParser parser = OptionParser() parser.add_option("-l","--log") parser.add_option("-p","--port") (options,args)=parser.parse_args() flx.config.port = options.port logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%Y-%m-%d %H:%M:%S',filename=options.log,level=logging.DEBUG) app = flx.App(SlowControlGUI) #app.launch('browser') # show it now in a browser app.serve('') flx.start() # enter the mainloop
flx.Widget(flex=1) # Init context to draw to self._ctx = self.canvas.node.getContext('2d') @flx.reaction def __update_color(self): self.canvas.apply_style('border: 10px solid ' + self.model.color.hex) @flx.reaction('canvas.pointer_down') def __on_click(self, *events): for ev in events: self.model.add_paint(ev.pos) @flx.action def add_paint_to_canvas(self, pos, color): """ Actually draw a dot on the canvas. """ self._ctx.globalAlpha = 0.8 self._ctx.beginPath() self._ctx.fillStyle = color self._ctx.arc(pos[0], pos[1], 5, 0, 6.2831) self._ctx.fill() if __name__ == '__main__': a = flx.App(ColabPainting) a.serve() # m = a.launch('browser') # for use during development flx.start()
def main(): resourceserver.run_server() a = flx.App(ReticoBuilder) a.launch(runtime="chrome-browser", title="ReTiCo Builder") flx.start() # Or .run() if the App should terminate after closing. resourceserver.stop_server()
def start_flexx(): flx.create_server(loop=asyncio.new_event_loop()) flx.start()
for fir in [(fir2_file, "fir2"), (fir1_file, "fir1")]: with open(fir[0], "r") as fil: filedata = fil.read() data = [ min(2**23 - 1, (max(-2**23, int(float(f.replace("\r", "")) * 2**23)))) for f in filedata.split("\n") if len(f) > 0 ] mapper.fir_update(data, fir[1]) if __name__ == "__main__": import_defaults_active = True lock_settings = [("Mixing, Serial Data and Automute Configuration", "*")] mappers = [DAC_9038Q2M_Control(0x48), DAC_9038Q2M_Control(0x49)] defaults = os.path.join(os.path.dirname(__file__), "configs", "default") for m in mappers: m.i2c_init() if import_defaults_active: import_defaults(defaults, m) # m.importYaml( # r"C:\Users\webco\Documents\Projects\SABRE_I2C_Controller\configs\device_0x48_config_std.yml" # ) pass flx_app = flx.App(ControlApp, mappers, lock_settings) # app.launch("app", title="ES9038Control") # to run as a desktop app app.create_server(host="", port=5000, backend="tornado") flx_app.launch("browser") # to open in the browser flx.start() # mainloop will exit when the
def start_flexx(): flx.create_server(loop=asyncio.new_event_loop()) flx.start()