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.VFix(): ui.Widget(flex=1) with ui.HFix(flex=2): ui.Widget(flex=1) Drawing(flex=2) ui.Widget(flex=1) ui.Widget(flex=1)
def init(self): with MyHBox(): with MyVBox(flex=2): with MyVBox(flex=4, spacing=30): ui.Widget(flex=1, css_class='white') ui.Widget(flex=1, css_class='white') with MyVBox(flex=2, css_class='blue'): ui.Widget(flex=1, css_class='edge') ui.Widget(flex=1, css_class='edge') with MyVBox(flex=6): with MyVBox(flex=4, spacing=30, css_class='red'): ui.Widget(flex=1, css_class='edge') ui.Widget(flex=1, css_class='edge') with MyHBox(flex=2): ui.Widget(flex=6, css_class='white') with MyVBox(flex=1): ui.Widget(flex=1, css_class='white') ui.Widget(flex=1, css_class='yellow')
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(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(): 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(): 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, 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): with ui.DockPanel(): 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) # Add some colorful panels just for fun ui.Label(title='Info', text='Source is <a href="%s">%s</a>' % (src, src)) ui.Widget(style='background:#0a0;', title='green') ui.Widget(style='background:#00a;', title='blue')
def init(self): with MyLayout('v') as self.s: self.w1 = MyWidget(text=text) with MyLayout('h') as self.s: self.w2 = MyWidget(text='hello world!') with MyLayout('v'): self.w3 = MyWidget(text='hi') self.w4 = MyWidget(text='hello world! ' * 4) with MyLayout('v'): self.w5 = MyWidget(text='min-size: 50', style='min-width:50px; min-height:50px') self.w6 = MyWidget( text='min-size: 100', style='min-width:100px; min-height:100px') self.w7 = MyWidget( text='min-size: 150', style='min-width:150px; min-height:150px') with ui.Widget(flex=1): with MyLayout('h'): self.w8 = MyWidget() self.w9 = MyWidget(style='min-width:250px;') self.w8 = MyWidget()
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): # Two ways to add assets if True: # The client will load these assets from the URL's. Good for web apps. self.session.use_remote_asset( "http://code.jquery.com/jquery-1.10.2.js") self.session.use_remote_asset( "http://code.jquery.com/ui/1.11.4/jquery-ui.js") self.session.use_remote_asset( "http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" ) else: # Flexx will download the assets and serve them to the client. Good for desktop/exported apps. self.session.add_global_asset( "jquery.js", "http://code.jquery.com/jquery-1.10.2.js") self.session.add_global_asset( "jquery-ui.js", "http://code.jquery.com/ui/1.11.4/jquery-ui.js") self.session.add_global_asset( "jquery-ui.css", "http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" ) with ui.FormLayout(): self.start = DatePicker(title='Start date') self.end = DatePicker(title='End date') ui.Widget(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): # 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): 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): 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.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.Widget(): ui.Label(text='Refreshing the page should ' 'maintain the value of the line edit.') self.edit = ui.LineEdit(placeholder_text='username', text=self.session.get_cookie( 'username', ''))
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.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, 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.HSplit(style='min-height:300px') as self.widget: self.plot1 = ui.BokehWidget.from_plot(p1, title='Scatter') with ui.VFix(title='Sine'): Controls() with ui.Widget(style='overflow-y:auto;', flex=1): self.plot2 = ui.BokehWidget.from_plot(p2) self.plot3 = ui.BokehWidget.from_plot(p3)
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.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.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): self.udr = uart.UartDriver() self.uartfd = None self.mDevList = [] with ui.VBoxPanel() as self.vboxs: with ui.PinboardLayout(flex = 0,base_size=100,style="background:#777;color:#0ff"): self.mDevNameLab = ui.Label(flex=0,text="目前没有打开的串口",pos=(10,10),base_size=(600,32)) self.mDevTypeLab = ui.Label(flex=0,text="设备规格:",pos=(10,40),base_size=(600,32)) self.mMenuBar = MenuBarView(flex=0,menuBtnFunc=self._menuBtnHandler) self.mBottomArea = ui.Widget(flex=1)
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.HBox(): ui.Label(text='Widget in a hbox in a widget in a hbox') with ui.HBox(flex=1): with ui.Widget(flex=1): with ui.HBox(): ui.Label(text='|||') Red(flex=1)
def init(self): with ui.VBox(): ui.Label(text='Widget in a vbox in a widget in a vbox') with ui.VBox(flex=1): with ui.Widget(flex=1): with ui.VBox(): ui.Label(text='---') Red(flex=1)