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.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): # Put a label and some sliders deep in the hierarchy with ui.VBox(): self.label = ui.Label() with ui.HFix(flex=1): for j in range(2): with ui.VBox(flex=1): for i in range(5): ui.Slider(value=i / 5)
def init(self): with ui.VBox(): ui.Label(text='Widget in a vbox in a vbox in a vbox') with ui.VBox(flex=1): with ui.VBox(flex=1): ui.Label(text='---') Red(flex=1)
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.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(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(): 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, 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.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.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.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(): self.line = ui.LineEdit(flex=(0.5, 0.5), placeholder_text='type here', autocomp=['foo', 'bar']) ui.Label(flex=0, text='copy:') self.label = ui.Label(flex=1)
def init(self): with ui.HFix(): ui.Widget(flex=1) with ui.VBox(flex=0, style='min-width:200px'): with ui.GroupWidget(title='Plot options'): ui.Label(text='Month') self.month = ui.ComboBox(options=months, selected_index=12, style='width: 100%') self.smoothing_label = ui.Label(text='Smoothing') self.smoothing = ui.Slider(max=20, step=2, text='{value} samples') ui.Widget(flex=3) with ui.VBox(flex=4): self.plot = ui.PlotWidget(flex=1, xdata=years, yrange=(-5, 20), title='Average monthly temperature', xlabel='year', ylabel=u'temperature (°C)') ui.Widget(flex=1)
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): 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): with ui.VBox(): ui.Label(text=self.TITLE) self.slider1 = ui.Slider() self.slider2 = ui.Slider() 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(): 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.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, 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.HBox(): ui.Widget(flex=1) with ui.VBox(flex=0): with ui.GroupWidget(title='Plot options'): with ui.VBox(): self.month_label = ui.Label(text='Month') self.month = ui.Slider(max=12, step=1) self.smoothing_label = ui.Label(text='Smoothing') self.smoothing = ui.Slider(max=20, step=2) ui.Widget(flex=1) with ui.VBox(flex=4): self.plot = ui.PlotWidget(flex=1, xdata=years, yrange=(-5, 20), title='Average monthly temperature', xlabel='year', ylabel=u'temperature (°C)') ui.Widget(flex=0, style='height:30px') ui.Widget(flex=1)
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(): 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.SplitPanel(): self.plot1 = ui.BokehWidget(plot=p1, title='Scatter') with ui.VBox(title='Sine'): with ui.FormLayout(): self.amp = ui.Slider(title='Amplitude', max=2, value=1) self.freq = ui.Slider(title='Frequency', max=10, value=5) self.phase = ui.Slider(title='Phase', max=3, value=1) with ui.Widget(style='overflow-y:auto;', flex=1): self.plot2 = ui.BokehWidget(plot=p2) self.plot3 = ui.BokehWidget(plot=p3)
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.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.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.VBox(): ui.Label(text='Widgets in BoxPanels in a widget in a vbox') with ui.Widget(flex=1): with ui.BoxPanel(orientation='v'): with ui.BoxPanel(orientation='h'): Red(flex=1) Red(flex=1) with ui.BoxPanel(orientation='h'): Red(flex=1) Red(flex=1)