def init(self, py): self.py = py self.file_name = flx.StringProp('') self.file_input = FileInput() with flx.VBox(): flx.Label(style="background:#cfc;", wrap=1, text="") with flx.HSplit(flex=1): with flx.VBox(style="border:1px solid #777;", ): flx.Label(text="Properties Tree") self.tree = TreeWithControls(py, flex=1, max_selected=1) with flx.VBox(style="border:1px solid #777;"): flx.Label(text="Property", style="") with flx.VBox(flex=1): with flx.VBox(flex=1, style=""): self.combo = ui.ComboBox(editable=True, options=()) self.field = ui.LineEdit( placeholder_text="type here") with flx.HBox(flex=1, style="max-height: 20px;"): self.pick_file = ui.Button(text='...') self.do_upload = ui.Button(text='Upload', disabled=True) with flx.VBox(flex=5): flx.Label(text="Info", style="") self.info = flx.Label( text="", style="white-space: pre-line;") with flx.VBox(style="border:1px solid #777;", flex=1): flx.Label(text="Raw", style="") self.rawLabel = flx.Label( text="", style="white-space: pre-line;") self.update_btn = ui.Button(text="Apply", style="width: 100px;")
def init(self): with ui.HSplitter() as self.l1: ui.Button(text='Right A') with ui.VSplitter() as self.l2: ui.Button(text='Right B') ui.Button(text='Right C') ui.Button(text='Right D')
def showDeviceListUi(self): self.mBottomArea.children=[] with self.mBottomArea: with ui.HBoxPanel(flex=1): with ui.VBoxPanel(flex=0,base_size=200,style='background:#aaa;color:#0f0;min-width:200px'): self.b1 = ui.Button(text="功能1") self.b2 = ui.Button(text='功能2') self.hist = HistoryListUi(flex=1,style="overflow-y:scroll")
def update(self, event): with self.vbox: with ui.GroupWidget(): btn = ui.Button(title=event['name'], text=event['name']) delete = ui.Button(title=event['name'], text='del') ui.Label(text=event['description']) btn.connect('mouse_click', self.wdg) delete.connect('mouse_click', self.delete)
def init(self): with ui.VBox(): self.b1 = ui.Button(text='Raise error in JS property setter') self.b2 = ui.Button(text='Raise error in JS event handler') self.b3 = ui.Button(text='Raise error in Python property setter') self.b4 = ui.Button(text='Raise error in Python event handler') ui.Widget(flex=1) # spacer
def init(self, pycomponent): self.py = pycomponent with ui.VBox(): self.b1 = ui.Button(text='Raise error in JS action') self.b2 = ui.Button(text='Raise error in JS reaction') self.b3 = ui.Button(text='Raise error in Python action') self.b4 = ui.Button(text='Raise error in Python reaction') ui.Widget(flex=1) # spacer
def init(self): with ui.VBox(): with ui.HBox(): self.buta = ui.Button(text='red') self.butb = ui.Button(text='green') self.butc = ui.Button(text='blue') ui.Widget(flex=1) # space filler with ui.StackLayout(flex=1) as self.stack: self.buta.w = ui.Widget(style='background:#a00;') self.butb.w = ui.Widget(style='background:#0a0;') self.butc.w = ui.Widget(style='background:#00a;')
def init(self): with ui.VBoxLayout(): with ui.FormLayout(spacing=1): ui.Label(self, 'Name') self._name = ui.TextInput(self) ui.Label(self, 'Age') self._age = ui.IntInput(self) with ui.HBoxLayout(): ui.Widget(self, flex=1) # spacer ui.Button(self, 'Cancel', on_click=self.close, flex=0) ui.Button(self, 'Ok', on_click=self.process, flex=0)
def init(self): with ui.Widget(style="overflow-y: scroll"): with ui.VBox(style="overflow-y: scroll") as self.vbox: name_descriptions = [(d['name'], d['description']) for d in abce.parameter_database.all()] for name, desc in name_descriptions: with ui.GroupWidget(): btn = ui.Button(title=name, text=name) delete = ui.Button(title=name, text='(del)') ui.Label(text=desc) btn.connect('mouse_click', self.wdg) delete.connect('mouse_click', self.delete)
def init(self): with ui.HFix(): with ui.FormLayout() as self.form: self.b1 = ui.LineEdit(title='Name:', text='Hola') self.b2 = ui.LineEdit(title='Age:', text='Hello world') self.b3 = ui.LineEdit(title='Favorite color:', text='Foo bar') ui.Button(text='Submit') with ui.FormLayout() as self.form: self.b4 = ui.LineEdit(title='Name:', text='Hola') self.b5 = ui.LineEdit(title='Age:', text='Hello world') self.b6 = ui.LineEdit(title='Favorite color:', text='Foo bar') ui.Button(text='Submit') ui.Widget(flex=1) # Add a spacer
def init(self): with ui.VSplit(): with ui.HFix(flex=0): self.previous = ui.Button(text="<-", disabled=True, flex=1) self.content = ui.Label(flex=0) self.next = ui.Button(text="->", disabled=True, flex=1) with ui.HSplit(flex=1, spacing=20): self.configure = flx.Widget(css_class="configure", flex=0) with ui.HFix(flex=1): self.visjs = VisJS( style="background-color: #dddddd;", flex=1, ) self.refresh()
def init(self): with ui.HBox(): with ui.VBox(): ui.Label(text='<h3>Server monitor</h3>') self.info = ui.Label(text='...') if app.current_server().serving[0] == 'localhost': # Don't do this for a public server self.button = ui.Button(text='Do some work') self.button.connect('mouse_down', self._do_work) self.cpu_plot = ui.PlotWidget( style='width: 640px; height: 320px;', xdata=[], yrange=(0, 100), ylabel='CPU usage (%)', sync_props=False) self.mem_plot = ui.PlotWidget( style='width: 640px; height: 320px;', xdata=[], yrange=(0, 100), ylabel='Mem usage (%)', sync_props=False) ui.Widget(flex=1) # Relay global info into this app relay.connect(self._push_info, 'system_info:' + self.id)
def init(self): with ui.VBox(): ui.Label(html='<h3>Server monitor</h3>') if app.current_server().serving[0] == 'localhost': # Don't do this for a public server self.button = ui.Button(text='Do some work') self.view = MonitorView(flex=1)
def init(self): self.buttonNames = ["打开串口","中电485主机协议测试","中电485客户机协议测试"] self.menuButtons=[] with ui.HBox(flex=0,base_size=60,style='background:#eee;color:#000;min-height:60px'): for btnName in self.buttonNames: btnObj = ui.Button(flex=0,text=btnName,css_class="button button-tiny") self.menuButtons.append(btnObj) ui.Widget(flex=1)
def init(self): with ui.VBox(): self.reset = ui.Button(text='Reset event system') with ui.HFix(flex=1): SyncedSlidersWrong(flex=1) SyncedSlidersRight(flex=1) ui.Widget(flex=1) # spacer
def init(self): with ui.HBox(flex=1): with ui.Widget(flex=1,style="overflow-y:scroll"): with ui.VBoxPanel(flex=0) as self.leftView: with ui.HBox(flex=0,style="background:#ee0;min-height:40px;max-height:40px"): ui.Label(text="<b>主设备</b>") ui.Label(text="<b>从设备</b>") with ui.PinboardLayout(flex=0,style="background:#eee;color:#000;min-width:200px"): self.btnStartPolling = ui.Button(flex=0,text="发起一次轮询",css_class="button button-primary button-rounded button-small",pos=(10,10),base_size=(160,32))
def init(self): with ui.HBox(): with ui.VBox(): ui.Label(text='<h3>Server monitor</h3>') self.info = ui.Label(text='...') self.button = ui.Button(text='Do some work') self.plot = ui.PlotWidget(size=(640, 480), xdata=[], yrange=(0, 100), ylabel='CPU usage (%)') ui.Widget(flex=1)
def init(self): # # Confirmation type, if confirm dialog shown # self.confirm_type = '' with ui.HBox(): with ui.VBox(flex=1): with ui.VBox(): with ui.GroupWidget(title='Deployment options'): self.alphaname_label = ui.Label( text=Swarm.get_name(self.strategy_context, suffix=self.strategy_suffix), ) with ui.VBox(style='background-color: #ff8787;' ) as self.confirm_panel: self.confirm_label = ui.Label( text='We need your confirmation') with ui.HBox(): self.confirm_ok = ui.Button(text='OK') self.confirm_cancel = ui.Button(text='Cancel') self.confirm_panel.style = 'display: none;' self.btnrun = ui.Button(text='Deploy', style='display: inline;') ui.Widget(flex=1) with ui.VBox(flex=3): with ui.GroupWidget(flex=3, title='Deployment progress information'): self.log_message = ui.Label(wrap=True, text='', style='''overflow-y: scroll; height: 500px; padding: 10px; ''') self.btnrun.visible = False
def init(self): with ui.VBox(): with ui.HBox(flex=0): self.connect_button = ui.Button(flex=1, text='Connect to plotter', title='connect') ui.Widget(flex=1) self.abort_button = ui.Button(flex=1, text='Abort plot', title='abort') self.start_button = ui.Button(flex=1, text='Start plot', title='start') ui.Widget(flex=1) self.only_simulate_checkbox = ui.ToggleButton(flex=0, text='Simulate', title='simulate') self.live_view_checkbox = ui.ToggleButton(flex=0, text='Live view', title='live') self.info_label = ui.Label(flex=1, wrap=True, text='')
def init(self): with ui.HBox(flex=1): with ui.Widget(flex=1,style="overflow-y:scroll"): with ui.VBoxPanel(flex=0) as self.leftView: with ui.HBox(flex=0,style="background:#ee0;min-height:40px;max-height:40px"): ui.Label(text="<b>主设备</b>") ui.Label(text="<b>从设备</b>") with ui.VBox(flex=0,padding=6,style="background:#eee;color:#000;min-width:200px"): self.listenMode = ui.RadioButton(text="CEV485监听模式",checked=True) self.simuAllClient = ui.RadioButton(text="模拟所有客户端响应") self.simuOneKeyModClient = ui.RadioButton(text="模拟一键报警") self.btnStart = ui.Button(text="模拟启动",css_class="button button-primary button-rounded button-small",pos=(10,10),base_size=(160,32)) ui.Widget(flex=1)
def init(self): with ui.VBox(): with ui.HFix(): ui.Label(text="Port:", flex=2) iface = self.root.pnl_config.get_section_config("common", "iface", "lo") self.lst_ifnames = ui.ComboBox(editable=False, options=ifnames, selected_key=iface, flex=2) ui.Label(text=" ", flex=3) ui.Label(text='Count:', flex=2) self.txt_count = ui.LineEdit(text='1', flex=2) ui.Label(text=" ", flex=3) ui.Label(text='Interval(ms):', flex=3) self.txt_interval = ui.LineEdit(text='0', flex=2) ui.Label(text=" ", flex=3) self.btn_send = ui.Button(text='(S)end', flex=2)
def init(self): with ui.VBox(): with ui.HBox(flex=0): self.zoom_in_button = ui.Button(flex=0, text='+', title='zoom_in') self.zoom_label = ui.Label( flex=0, text='1x', title='zoom_label', style='min-width:40px;text-align:center;') self.zoom_out_button = ui.Button(flex=0, text='-', title='zoom_out') self.clear_button = ui.Button(flex=0, text='clear', title='clear') ui.Widget(flex=1) with ui.VSplit(flex=1) as self.vsplit: self.drawing = Drawing(flex=3) ui.Widget(flex=1) self.drawing.set_transform()
def init(self): with ui.HBox(): with ui.VBox(): ui.Label(text='<h3>Server monitor</h3>') self.info = ui.Label(text='...') if os.getenv('FLEXX_HOSTNAME', 'localhost') == 'localhost': self.button = ui.Button(text='Do some work') self.cpu_plot = ui.PlotWidget(style='width: 640px; height: 320px;', xdata=[], yrange=(0, 100), ylabel='CPU usage (%)') self.mem_plot = ui.PlotWidget(style='width: 640px; height: 320px;', xdata=[], yrange=(0, 100), ylabel='Mem usage (%)') ui.Widget(flex=1)
def init(self): with ui.HBox(): ui.Widget(flex=1) with ui.VBox(): self.name = ui.LineEdit(placeholder_text='your name') self.people = ui.Label(flex=1, base_size=(250, 0)) with ui.VBox(): self.messages = MessageBox(flex=1) with ui.HBox(): self.message = ui.LineEdit( flex=1, placeholder_text='enter message') self.ok = ui.Button(text='Send') ui.Widget(flex=1) self._update_participants()
def init(self): with ui.HBox(title='Flexx chatroom demo'): ui.Widget(flex=1) with ui.VBox(): self.name_edit = ui.LineEdit(placeholder_text='your name') self.people_label = ui.Label(flex=1, style='min-width: 250px') with ui.VBox(style='min-width: 450px'): self.messages = MessageBox(flex=1) with ui.HBox(): self.msg_edit = ui.LineEdit( flex=1, placeholder_text='enter message') self.ok = ui.Button(text='Send') ui.Widget(flex=1) self._update_participants()
def init(self): with ui.BoxPanel(): with ui.FormLayout() as self.form: self.b1 = ui.Button(title='Name:', text='Hola') self.b2 = ui.Button(title='Age:', text='Hello world') self.b3 = ui.Button(title='Favorite color:', text='Foo bar') with ui.FormLayout() as self.form: self.b4 = ui.Button(title='Name:', text='Hola') self.b5 = ui.Button(title='Age:', text='Hello world') self.b6 = ui.Button(title='Favorite color:', text='Foo bar') ui.Widget(flex=1) # Add a flexer
def init(self): with ui.HBox(): ui.Widget(flex=1) with ui.VBox(): self.name = ui.LineEdit(placeholder_text='your name') self.people = ui.Label(flex=1, base_size=(250, 0)) with ui.VBox(): self.messages = MessageBox(flex=1) with ui.HBox(): self.message = ui.LineEdit( flex=1, placeholder_text='enter message') self.ok = ui.Button(text='Send') ui.Widget(flex=1) # Pipe messages send by the relay into this app relay.connect(self._push_info, 'new_message:' + self.id) self._update_participants()
def init(self): self.btnArray = [] self.portMap = {} self.style="min-height:150px" udr = uart.UartDriver() comInfoList = udr.findAllUartDev() with ui.HBox(flex=0,padding=10,base_size=52,style='background:#ddd'): if len(comInfoList) <= 0: ui.Label(flex=1,text="没有发现任何可用串口设备!",base_size=(400,32)) else: for iPort in comInfoList: str = "串口名称:%s ----- 端口:%s " % (iPort.description, iPort.device) ui.Label(flex=0,text=str,style='height:32px;line-height:32px') ui.Widget(flex=1) btn = ui.Button(flex=0,text="打开串口",css_class="button button-primary button-rounded button-small", base_size=(100,32)) self.btnArray.append(btn) self.portMap[btn.id] = iPort self.connect(self.__openserial_clicked,'btnArray*.mouse_click') ui.Widget(flex=1)
def init(self): with ui.TabLayout(): self.encrypt = ui.Widget(title='加密') with self.encrypt: with ui.FormLayout(): self.l1 = ui.Label(text='请输入需加密的文本:') self.e1 = ui.LineEdit(title='', text='') self.l2 = ui.Label(text='请输入加密密匙:') self.e2 = ui.LineEdit(title='', text='', password_mode=True) self.l3 = ui.Label(text='请再输入一次加密密匙:') self.e3 = ui.LineEdit(title='', text='', password_mode=True) self.b1 = ui.Button(text='提交') self.l4 = ui.Label(text='') self.l5 = ui.Label(text='') ui.Widget(flex=1) self.decrypt = ui.Widget(title='解密') with self.decrypt: pass
def init(self): with ui.BoxLayout(orientation='v'): ui.Label(text='Flex 0 0 0') with ui.HBox(flex=0): self.b1 = ui.Button(text='Hola', flex=0) self.b2 = ui.Button(text='Hello world', flex=0) self.b3 = ui.Button(text='Foo bar', flex=0) ui.Label(text='Flex 1 0 3') with ui.HBox(flex=0): self.b1 = ui.Button(text='Hola', flex=1) self.b2 = ui.Button(text='Hello world', flex=0) self.b3 = ui.Button(text='Foo bar', flex=3) ui.Widget(flex=1) ui.Label(text='Note the spacer Widget above')