def init(self): with ui.VBox(): ui.HBox(flex=1) with ui.HBox(flex=0): self.gcode_line = ui.LineEdit( flex=3, placeholder_text='e.g. G01 Y10 Y2 Z-1') ui.HBox(flex=4)
def init(self): with ui.VBox(): with ui.HFix(flex=1): with ui.VBox(flex=2): ui.Label(text='Resolution (dpi): ') ui.Label(text='Serial port: ') ui.Label(text='Serial baudrate: ') ui.Label(text='Steps per mm (x, y): ') ui.Label(text='Speed in mm/s (fast, engrave): ') ui.Label(text='Burnin time in ms: ') with ui.VBox(flex=1): self.resolution_widget = ui.LineEdit(title='resolution') self.serial_port_widget = ui.LineEdit(title='serial_port') self.serial_baudrate_widget = ui.LineEdit( title='serial_baudrate') with ui.HBox(): self.x_steps_widget = ui.LineEdit( title='x_steps_per_mm') self.y_steps_widget = ui.LineEdit( title='y_steps_per_mm') with ui.HBox(): self.fast_speed_widget = ui.LineEdit( title='fast_movement_speed') self.engrave_speed_widget = ui.LineEdit( title='engraving_movement_speed') self.burnin_time_widget = ui.LineEdit(title='burnin_time') ui.Widget(flex=1)
def init(self): with ui.VBox(): ui.HBox(flex=1) with ui.HBox(flex=0): self.raw_command = ui.LineEdit(flex=3, placeholder_text='e.g. XA1000') ui.HBox(flex=4)
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(): ui.Label(text='Widget in a hbox in a hbox in a hbox') with ui.HBox(flex=1): with ui.HBox(flex=1): ui.Label(text='|||') Red(flex=1)
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.HSplit(): with ui.VBox(flex=1): ui.Label(html='<b>Box mode</b> (aware of natural size)') ui.Label(text='flex: 1, sub-flexes: 0, 0, 0') with ui.HBox(flex=1): Panel(text='A', flex=0) Panel(text='B', flex=0) Panel(text='C is a bit longer', flex=0) ui.Label(text='flex: 0, sub-flexes: 1, 1, 1') with ui.HBox(flex=0): Panel(text='A', flex=1) Panel(text='B', flex=1) Panel(text='C is a bit longer', flex=1) ui.Label(text='flex: 1, sub-flexes: 1, 0, 2') with ui.HBox(flex=1): Panel(text='A', flex=1) Panel(text='B', flex=0) Panel(text='C is a bit longer', flex=2) ui.Label(text='flex: 2, sub-flexes: 1, 2, 3') with ui.HBox(flex=2): Panel(text='A', flex=1) Panel(text='B', flex=2) Panel(text='C is a bit longer', flex=3) with ui.VBox(flex=1): ui.Label(html='<b>Fix mode</b> (high level layout)') ui.Label(text='flex: 1, sub-flexes: 0, 0, 0') with ui.HFix(flex=1): Panel(text='A', flex=0) Panel(text='B', flex=0) Panel(text='C is a bit longer', flex=0) ui.Label(text='flex: 0 (collapses), sub-flexes: 1, 1, 1') with ui.HFix(flex=0): Panel(text='A', flex=1, style='min-height:5px;') Panel(text='B', flex=1) Panel(text='C is a bit longer', flex=1) ui.Label(text='flex: 1, sub-flexes: 1, 0, 2') with ui.HFix(flex=1): Panel(text='A', flex=1) Panel(text='B', flex=0) Panel(text='C is a bit longer', flex=2) ui.Label(text='flex: 2, sub-flexes: 1, 2, 3') with ui.HFix(flex=2): Panel(text='A', flex=1) Panel(text='B', flex=2) Panel(text='C is a bit longer', flex=3)
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.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.HBox(): with ui.VBox(flex=0): self.b1 = ui.RadioButton(text='Linear') self.b2 = ui.RadioButton(text='Basis') self.b3 = ui.RadioButton(text='Cardinal', checked=True) self.b4 = ui.RadioButton(text='Catmull Rom') self.b5 = ui.RadioButton(text='Lagrange') self.b6 = ui.RadioButton(text='Lanczos') ui.Widget(style='min-height:10px') self.closed = ui.CheckBox(text='Closed') ui.Widget(style='min-height:10px') self.tension_label = ui.Label(text='Tension: 0.5') self.tension = ui.Slider(min=-0.5, max=1, value=0.5) ui.Widget(flex=1) with ui.VBox(flex=1): ui.Label(text=GENERAL_TEXT, wrap=True, style='font-size: 12px;') self.explanation = ui.Label(text=CARDINAL_TEXT, wrap=True, style='font-size: 12px;') self.spline = SplineWidget(flex=1)
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')
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): # Put a label and some sliders deep in the hierarchy with ui.HBox(): with ui.VBox(flex=1) as self.box: self.label = ui.Label() for i in range(5): ui.Slider(value=i / 5)
def init(self): with ui.VBox(): ui.Widget(flex=1) with ui.HBox(flex=2): ui.Widget(flex=1) Drawing(flex=2) ui.Widget(flex=1) 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) # Pipe messages send by the relay into this app relay.connect(self._push_info, 'new_message:' + self.id) self._update_participants()
def init(self): with ui.VBox(): with ui.HBox(): self.first_edit = ui.LineEdit(placeholder_text='first name', text='Jane') self.last_edit = ui.LineEdit(placeholder_text='last name', text='Doe') ui.Widget(flex=1) # spacer with ui.HBox(): ui.Label(text=lambda: self.root.first_name, style='border:1px solid red') ui.Label(text=lambda: self.root.last_name, style='border:1px solid red') ui.Widget(flex=1) # spacer MyPersonLabel(style='border:1px solid blue') 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.HBox(): with ui.VBox(flex=1, orientation='vertical'): ui.Label(text='<b>BoxLayout</b> (aware of natural size)') ui.Label(text='flex: 1, sub-flexes: 0, 0, 0') with ui.BoxLayout(flex=1, orientation='horizontal'): Panel(text='A', flex=0) Panel(text='B', flex=0) Panel(text='C is a bit longer', flex=0) ui.Label(text='flex: 0, sub-flexes: 1, 1, 1') with ui.BoxLayout(flex=0, orientation='horizontal'): Panel(text='A', flex=1) Panel(text='B', flex=1) Panel(text='C is a bit longer', flex=1) ui.Label(text='flex: 1, sub-flexes: 1, 0, 2') with ui.BoxLayout(flex=1, orientation='horizontal'): Panel(text='A', flex=1) Panel(text='B', flex=0) Panel(text='C is a bit longer', flex=2) ui.Label(text='flex: 2, sub-flexes: 1, 2, 3') with ui.BoxLayout(flex=2, orientation='horizontal'): Panel(text='A', flex=1) Panel(text='B', flex=2) Panel(text='C is a bit longer', flex=3) ui.Widget(flex=0, style='min-width:20px') with ui.VBox(flex=1, orientation='vertical'): ui.Label(text='<b>BoxPanel</b> (high level layout)') ui.Label(text='flex: 1, sub-flexes: 0, 0, 0') with ui.BoxPanel(flex=1, orientation='horizontal'): Panel(text='A', flex=0) Panel(text='B', flex=0) Panel(text='C is a bit longer', flex=0) ui.Label(text='flex: 0 (collapses), sub-flexes: 1, 1, 1') with ui.BoxPanel(flex=0, orientation='horizontal'): Panel(text='A', flex=1, style='min-height:5px;') Panel(text='B', flex=1) Panel(text='C is a bit longer', flex=1) ui.Label(text='flex: 1, sub-flexes: 1, 0, 2') with ui.BoxPanel(flex=1, orientation='horizontal'): Panel(text='A', flex=1) Panel(text='B', flex=0) Panel(text='C is a bit longer', flex=2) ui.Label(text='flex: 2, sub-flexes: 1, 2, 3') with ui.BoxPanel(flex=2, orientation='horizontal'): Panel(text='A', flex=1) Panel(text='B', flex=2) Panel(text='C is a bit longer', flex=3)
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(): ui.Widget(flex=1) ui.Label(flex=0, text='Select a gcode file here:') #with ui.HBox(flex=0): #self.path_label = ui.LineEdit(flex=3, text='C:/Path/to/Gcode/File.gcode', disabled=True) #self.open_button = ui.Button(flex=1, text='Open...', title='open') self.open_gcode_widget = OpenFileWidget() ui.Widget(flex=1) with ui.HBox(flex=0): self.use_gcode_speeds_button = ui.ToggleButton( flex=0, text='Use gcode speeds', title='use_gcode_speed') ui.Widget(flex=1) ui.Widget(flex=8)
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, v=0): self.pkt = None with ui.VBox(): with ui.HBox(): self.lbl_repr = flx.LineEdit(flex=1, css_class="pkt_dump", disabled=1) self.btn_toggle = flx.Button(text="-") self.btn_save = flx.Button(text='save pcap') with ui.VBox(flex=1) as self._cont: with ui.VSplit(flex=1, parent=None) as self.splt_v: pass with ui.HSplit(flex=1) as self.splt_h: self.txt_show = ui.MultiLineEdit(css_class="pkt_dump", flex=4) self.txt_hex = ui.MultiLineEdit(css_class="pkt_dump", flex=6) self.splt = self.splt_h self.toggle_layout(v)
def init(self): with ui.HBox(): with ui.VBox(): with ui.HBox(flex=1): ui.Button(text='Box A', flex=0) ui.Button(text='Box B', flex=0) ui.Button(text='Box C is a bit longer', flex=0) with ui.HBox(flex=0): ui.Button(text='Box A', flex=1) ui.Button(text='Box B', flex=1) ui.Button(text='Box C is a bit longer', flex=1) with ui.HBox(flex=1): ui.Button(text='Box A', flex=1) ui.Button(text='Box B', flex=0) ui.Button(text='Box C is a bit longer', flex=2) with ui.HBox(flex=2): ui.Button(text='Box A', flex=1) ui.Button(text='Box B', flex=2) ui.Button(text='Box C is a bit longer', flex=3) with ui.VBox(): with ui.HBox(flex=1): ui.Button(text='Box A', flex=0) ui.Button(text='Box B', flex=0) ui.Button(text='Box C is a bit longer', flex=0) with ui.HBox(flex=0): ui.Button(text='Box A', flex=1) ui.Button(text='Box B', flex=1) ui.Button(text='Box C is a bit longer', flex=1) with ui.HBox(flex=1): ui.Button(text='Box A', flex=1) ui.Button(text='Box B', flex=0) ui.Button(text='Box C is a bit longer', flex=2) with ui.HBox(flex=2): ui.Button(text='Box A', flex=1) ui.Button(text='Box B', flex=2) ui.Button(text='Box C is a bit longer', flex=3)
def init(self): with ui.HBox(style='width: 480px'): with ui.VBox(style='height: 200px'): with ui.HBox(): self.temps = [ ui.Label( text='??°', style='font-weight: bold; font-size: xx-large'), ui.Label( text='??°', style='font-weight: bold; font-size: xx-large') ] with ui.HBox(): ui.Label(text="{} <= ".format(self.min_duty)) self.duty_edit = ui.LineEdit(text=self.init_duty) ui.Label(text=" <= {}".format(self.max_duty)) with ui.HBox(): self.duty_slider = ui.Slider(flex=1, min=self.min_duty, max=self.max_duty, step=10) # Relay global info into this app relay.connect(self.push_info, 'system_info:' + self.id)
def init(self): combo_options = ['Paris', 'New York', 'Enschede', 'Tokio'] with ui.HBox(): self.tree = TreeWithControls(flex=1, max_selected=1) self.combo = ui.ComboBox(flex=1, options=combo_options, editable=True) with self.tree: for cat in ('foo', 'bar', 'spam'): with ui.TreeItem(text=cat): for name in ('Martin', 'Kees', 'Hans'): item = ui.TreeItem(title=name) item.checked = cat == 'foo' or None
def init(self, model): super().init() self.model = model # App layout with ui.VBox(): ui.Label(flex=0, text=lambda: model.status) ui.Widget(flex=1) with ui.HBox(flex=2): ui.Widget(flex=1) self.canvas = ui.CanvasWidget(flex=0) ui.Widget(flex=1) ui.Widget(flex=1) # Init context to draw to self._ctx = self.canvas.node.getContext('2d')
def init(self): # Select random color self.color = random.choice(COLORS) # App layout with ui.VBox(): self.people = ui.Label(flex=0) ui.Widget(flex=1) with ui.HBox(flex=2): ui.Widget(flex=1) self.canvas = ui.CanvasWidget(flex=0) ui.Widget(flex=1) ui.Widget(flex=1) # Start people-count-updater self._update_participants()
def init(self, pycomp): self.pycomp = pycomp self._start_time = 0 self._start_times = [] with ui.VBox(): with ui.HBox() as self.buttons: ui.Button(text='1 x 1 MiB roundtrip') ui.Button(text='1 x 5 MiB roundtrip') ui.Button(text='10 x 1 MiB roundtrip') ui.Button(text='10 x 5 MiB roundtrip') ui.Button(text='100 x 1 MiB roundtrip') ui.Button(text='100 x 5 MiB roundtrip') self.progress = ui.ProgressBar() self.status = ui.Label(text='Status: waiting for button press ...', wrap=1, flex=1, style='overflow-y:scroll;')