def init(self): with flx.HBox(): with flx.VBox(flex=0, minsize=150): self.b1 = flx.RadioButton(text='Linear') self.b2 = flx.RadioButton(text='Basis') self.b3 = flx.RadioButton(text='Cardinal', checked=True) self.b4 = flx.RadioButton(text='Catmull Rom') self.b5 = flx.RadioButton(text='Lagrange') self.b6 = flx.RadioButton(text='Lanczos') flx.Widget(minsize=10) closed = flx.CheckBox(text='Closed') flx.Widget(minsize=10) self.tension = flx.Slider(min=-0.5, max=1, value=0.5, text=lambda: 'Tension: {value}') flx.Widget(flex=1) with flx.VBox(flex=1): flx.Label(text=GENERAL_TEXT, wrap=True, style='font-size: 12px;') self.explanation = flx.Label(text=CARDINAL_TEXT, wrap=True, style='font-size: 12px;') self.spline = SplineWidget(flex=1, closed=lambda: closed.checked, tension=lambda: self.tension.value)
def init(self, topic): self.server_name = topic.split("/")[1] self.service_name = "/" + self.server_name + "/start_stop" self.nodes = {} self.subscribe(topic, "rosmon_msgs/State", self.callback) self.list_container = flx.VBox(flex=1) with self.list_container: with flx.HBox(flex=1): self.expand = flx.Button(flex=0, text=">") self.label = flx.Label(flex=0, text=self.server_name + ":") self.launch_state = flx.Label(flex=0, text="IDLE", style='color: #F00;') #self.expand = flx.Button(text="Expand") flx.Widget(flex=1) self.start_stop = flx.Button(flex=0, text="Stop") self.base_layout = flx.VBox(flex=1, style='border:1px solid #777;') with self.base_layout: with flx.HFix(): flx.Label(text="Name") flx.Label(text="State") flx.Label(text="CPU") flx.Label(text="Memory") flx.Label(text="Restarts") flx.Label(text="Action") self.base_layout.set_parent(None)
def init(self): with flx.VBox(): flx.Label( style='background:#cfc;', wrap=1, text='Here is some content at the top for which we want to ' 'use minimal size. Thus the use of a VBox. ' 'Below is a splitter, with a box layout on the left ' 'and a fix layout on the right.') with flx.HSplit(flex=1): with flx.VBox(style='border:1px solid #777;'): flx.Label(text='Flex 0 0 0') with flx.HBox(flex=0): self.b1 = flx.Button(text='Hi') self.b2 = flx.Button(text='Helloooo world!') self.b3 = flx.Button(text='Foo bar') flx.Label(text='Flex 1 1 1') with flx.HBox(flex=0): self.b1 = flx.Button(flex=1, text='Hi') self.b2 = flx.Button(flex=1, text='Helloooo world!') self.b3 = flx.Button(flex=1, text='Foo bar') flx.Label(text='Flex 1 0 3') with flx.HBox(flex=0): self.b1 = flx.Button(flex=1, text='Hi') self.b2 = flx.Button(flex=0, text='Helloooo world!') self.b3 = flx.Button(flex=3, text='Foo bar') # flx.Widget(flex=1) # spacer widget with flx.VFix(style='border:1px solid #777;'): flx.Label(text='Flex 0 0 0 (space divided equally)', style='') with flx.HFix(): self.b1 = flx.Button(text='Hi') self.b2 = flx.Button(text='Helloooo world!') self.b3 = flx.Button(text='Foo bar') flx.Label(text='Flex 1 1 1', style='') with flx.HFix(): self.b1 = flx.Button(flex=1, text='Hi') self.b2 = flx.Button(flex=1, text='Helloooo world!') self.b3 = flx.Button(flex=1, text='Foo bar') flx.Label( text='Flex 1 0 3 (the widget with zero collapses') with flx.HFix(): self.b1 = flx.Button(flex=1, text='Hi') self.b2 = flx.Button(flex=0, text='Helloooo world!') self.b3 = flx.Button(flex=3, text='Foo bar')
def init(self): # Put a label and some sliders deep in the hierarchy with flx.VBox(): self.label = flx.Label() with flx.HFix(flex=1): for j in range(2): with flx.VBox(flex=1): for i in range(5): flx.Slider(value=i / 5)
def init(self): with flx.VBox( style='border:2px solid gray;border-radius: 5px; align:left'): with flx.VBox(style='border:2px solid gray;border-radius: 5px'): with flx.HSplit(flex=1, style='text-align:left;'): ui.Label(text='vxlan encap data:') ui.Label(text='eth src:') self.eth_src = ui.LineEdit(text='0') ui.Label(text='eth dst:') self.eth_dst = ui.LineEdit(text='0') ui.Label(text='eth type:') self.eth_type = ui.LineEdit(text='0x0800') ui.Label(text='ip src:') self.ip_src = ui.LineEdit(text='0') ui.Label(text='ip dst:') self.ip_dst = ui.LineEdit(text='0') ui.Label(text='udp src:') self.udp_src = ui.LineEdit(text='0') ui.Label(text='udp dst:') self.udp_dst = ui.LineEdit(text='4789') ui.Label(text='vni:') self.vni = ui.LineEdit(text='123') with flx.HBox(): self.encap_disp = ui.Label(text='encap_data:') with flx.HSplit(): self.smacs = flx.CheckBox(text="set_mac_src", flex=2) self.smacs_v = ui.LineEdit(text='192.168.1.2', flex=2) self.smacd = flx.CheckBox(text="set_mac_dst", flex=2) self.smacd_v = ui.LineEdit(text='192.168.1.5', flex=2) self.sip4s = flx.CheckBox(text="set_ipv4_src", flex=2) self.sip4s_v = ui.LineEdit(text='192.168.1.2', flex=2) self.sip4d = flx.CheckBox(text="set_ipv4_dst", flex=2) self.sip4d_v = ui.LineEdit(text='192.168.1.5', flex=2) self.stps = flx.CheckBox(text="set_tp_src", flex=2) self.stps_v = ui.LineEdit(text='3456', flex=1) self.stpd = flx.CheckBox(text="set_tp_dst", flex=2) self.stpd_v = ui.LineEdit(text='3446', flex=1) with flx.HBox(): self.cnt = flx.CheckBox(text="count") self.decap = flx.CheckBox(text="vxlan_decap") self.encap = flx.CheckBox(text="vxlan_encap") self.stag = flx.CheckBox(text="set_tag") self.stag_v = ui.LineEdit(text='12') self.fate = ui.ComboBox(editable=True, selected_key='jump', options=('jump', 'drop', 'rss', 'queue', 'port id')) self.fate_v = ui.LineEdit(text='2') self.add = flx.Button(text='add') with flx.HBox(): self.flow_detail = ui.Label(text="Flow to be added")
def init(self): with flx.VBox(): with flx.VBox(style='border:1px solid #777;'): flx.Label(text='zhibo8数据采集') for i in range(10): with flx.HFix( flex=1, style= 'border-bottom:1px solid #ddd; font-size: 14px;'): self.b1 = flx.Label(flex=1, text='数据采集' + str(i)) self.b2 = flx.Label(flex=1, text='数据采集 world!' + str(i)) self.b3 = flx.Label(flex=1, text='Foo 数据采集' + str(i))
def init(self): with flx.HSplit(): with flx.VBox(flex=1): flx.Label(html='<b>Box mode</b> (aware of natural size)') flx.Label(text='flex: 1, sub-flexes: 0, 0, 0') with flx.HBox(flex=1): Panel(text='A', flex=0) Panel(text='B', flex=0) Panel(text='C is a bit longer', flex=0) flx.Label(text='flex: 0, sub-flexes: 1, 1, 1') with flx.HBox(flex=0): Panel(text='A', flex=1) Panel(text='B', flex=1) Panel(text='C is a bit longer', flex=1) flx.Label(text='flex: 1, sub-flexes: 1, 0, 2') with flx.HBox(flex=1): Panel(text='A', flex=1) Panel(text='B', flex=0) Panel(text='C is a bit longer', flex=2) flx.Label(text='flex: 2, sub-flexes: 1, 2, 3') with flx.HBox(flex=2): Panel(text='A', flex=1) Panel(text='B', flex=2) Panel(text='C is a bit longer', flex=3) with flx.VBox(flex=1): flx.Label(html='<b>Fix mode</b> (high level layout)') flx.Label(text='flex: 1, sub-flexes: 0, 0, 0') with flx.HFix(flex=1): Panel(text='A', flex=0) Panel(text='B', flex=0) Panel(text='C is a bit longer', flex=0) flx.Label(text='flex: 0 (collapses), sub-flexes: 1, 1, 1') with flx.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) flx.Label(text='flex: 1, sub-flexes: 1, 0, 2') with flx.HFix(flex=1): Panel(text='A', flex=1) Panel(text='B', flex=0) Panel(text='C is a bit longer', flex=2) flx.Label(text='flex: 2, sub-flexes: 1, 2, 3') with flx.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 flx.VBox(flex=0): with flx.VBox(flex=0): src = str(que[0]) self.img = flx.ImageWidget(flex=0, stretch=False, source=src) self.img.set_minsize(500, 500) self.img.set_maxsize(500, 500) with flx.HBox(flex=1): self.b1 = flx.Button(text="Yes") self.void = flx.Label() self.b2 = flx.Button(text="No") self.b1.set_maxsize(40, 40) self.b2.set_maxsize(40, 40) self.void.set_maxsize(420, 40)
def init(self): self.set_title("Openlayers example") with flx.VBox(): with flx.HBox(): self.map = Ol(flex=1) self.btn = flx.Button(text="", disabled=True) with flx.VBox(): self.btnosm = flx.Button(text='Load Openstreetmap') self.btna = flx.Button(text='Load GEOJSON') self.btnr = flx.Button(text='Remove GEOJSON') self.btndraw = flx.Button(text='Draw Points') self.btn_stop_draw = flx.Button(text='Stop Drawing') flx.Widget(flex=1) self.coords = flx.Label(flex=1)
def init(self): with flx.VBox(flex=0): with flx.VBox(flex=0): src = "https://www.designyourway.net/blog/wp-content/uploads/2019/05/iPad-Pro-wallpaper-54-700x700.jpg" self.img = flx.ImageWidget(flex=0, stretch=False, source=src) self.img.set_minsize(500, 500) self.img.set_maxsize(500, 500) with flx.HBox(flex=1): self.b1 = flx.Button(text="Yes") self.void = flx.Label() self.b2 = flx.Button(text="No") self.b1.set_maxsize(40, 40) self.b2.set_maxsize(40, 40) self.void.set_maxsize(420, 40)
def init(self): self.box = [] with flx.HSplit(flex=1, style='border:2px solid gray;border-radius: 5px'): with flx.VBox(flex=1): flx.Label(text=' ', flex=1) flx.Label(text='Device List', flex=1) flx.Label(text=' ', flex=1) with flx.VBox(flex=3): for i, dev in enumerate(self.root.interface_list): txt = " PCI_ID: " + self.root.pci_list[ i] + " mac: " + self.root.mac_list[i].upper( ) + "Interface: " + dev self.box.append(flx.CheckBox(text=txt))
def init(self): with flx.HBox(title='Flexx chatroom demo'): flx.Widget(flex=1) with flx.VBox(): self.name_edit = flx.LineEdit(placeholder_text='your name') self.people_label = flx.Label(flex=1, minsize=250) with flx.VBox(minsize=450): self.messages = MessageBox(flex=1) with flx.HBox(): self.msg_edit = flx.LineEdit( flex=1, placeholder_text='enter message') self.ok = flx.Button(text='Send') flx.Widget(flex=1) self._update_participants()
def init(self): self.pci_list = [] self.interface_list = [] self.mac_list = [] self.dev_arg = [] self.get_dev_info() with flx.VBox(flex=1, style='border:2px solid gray;border-radius: 5px', tabindex=0): with flx.VBox(flex=1): self.db = DeviceBox(flex=0) self.eb = EALBox(flex=0) self.ab = APPBox(flex=0) self.fb = FlowBox(flex=0) self.show = ShowBox(flex=1)
def init(self): self.nsamples = 200 self.start_time = time() self.status = flx.Label(text='...') self.plot_num = 3 self.plot = [] self.plot_combobox = [] self.plot_label = [] self.plot_latest_val = [] self.latest_params_names = {} self.latest_params_values = {} with flx.HSplit(flex=1): with flx.GroupWidget(flex=1, title="Plot options", minsize=(270,0)): with flx.VBox(): self.buttons = {} button_list = list(SolarData.commands.keys()) for button_name in button_list: with flx.HBox(): self.buttons[button_name] = flx.Button(text=button_name) setattr(self.buttons[button_name],'button_action', button_name) self.buttons[button_name].reaction(self._on_button_pressed, 'pointer_click') self.buttons[button_name].reaction(self._on_button_down, 'pointer_down') self.buttons[button_name].reaction(self._on_button_up, 'pointer_up') flx.Widget(flex=1) for i in range(0, self.plot_num): with flx.HBox(): self.plot_combobox[i] = flx.ComboBox(options=list(SolarData.params.keys()), editable=False, selected_index=i) self.plot_combobox[i].reaction(self.combobox_changed, 'user_selected') self.plot_label[i] = flx.Label(text='Value:') self.plot_latest_val[i] = flx.Label(text='') flx.Widget(flex=1) for i in range(0, len(SolarData.params.keys())): with flx.HBox(): name = list(SolarData.params.keys())[i] self.latest_params_names[name] = flx.Label(text='{0}:'.format(name)) self.latest_params_values[name] = flx.Label(text='NaN') flx.Widget(flex=1) flx.Widget(flex=1) with flx.VBox(flex=4): for i in range(0, self.plot_num): self.plot[i] = flx.PlotWidget(flex=1, minsize=(270,0), style='width: 640px; height: 320px;',xdata=[], yrange=(0, 100),ylabel='Plot ' + str(i+1)) self.update_plot_range(i)
def init(self): super().init() with flx.VBox(): flx.Label(text='You should see 5 pairs of buttons') with flx.HFix(): # Use minsize in CSS of button widget with flx.GroupWidget(title='asdas'): with flx.HFix(): flx.Button(text='foo') flx.Button(text='bar') with flx.HFix(minsize=50): # Set minsize prop on container flx.Button(text='foo') flx.Button(text='bar') with flx.HFix(): # Set minsize prop on widget flx.Button(text='foo', minsize=50) flx.Button(text='bar') with flx.HFix(): # Old school setting of style flx.Button(text='foo', style='min-height:50px;') flx.Button(text='bar', ) with flx.Widget(): # Singleton widgets (e.g. custom classes) with flx.HFix(): flx.Button(text='foo') flx.Button(text='bar') flx.Widget(flex=1, style='background:#f99;') # spacer
def init(self): self.box = [] with flx.VBox( flex=1, style='border:2px solid gray;border-radius: 5px;text-align:left' ): with flx.HFix(flex=1, style='text-align:left'): flx.Label(text='Testpmd args:') self.cb_as = flx.CheckBox(text="auto-start") self.cb_crc = flx.CheckBox(text="disable-crc-strip") self.cb_fia = flx.CheckBox(text="flow-isolate-all") with flx.HBox(flex=1): ui.Label(text='--rxq:', flex=0) self.rxq = ui.LineEdit(text='1', flex=1) ui.Label(flex=1, text='') ui.Label(text='--rxd:', flex=0) self.rxd = ui.LineEdit(text='64', flex=1) ui.Label(flex=1, text='') ui.Label(text='--txq:', flex=0) self.txq = ui.LineEdit(text='1', flex=1) ui.Label(flex=1, text='') ui.Label(text='--txd:', flex=0) self.txd = ui.LineEdit(text='64', flex=1) ui.Label(flex=1, text='') ui.Label(text='--hairpin:', flex=0) self.hairpin = ui.LineEdit(text='0', flex=1) with flx.HFix(flex=1, style=' text-align:left'): self.cmdline = ui.Label(text='testpmd cmdline:', flex=10) self.start = flx.Button(text='start', flex=1)
def init(self, retico_widget): self.retico_widget = retico_widget self.l_title = flx.Label(text="", css_class="title-label") self.close_button = flx.Button(text="X", css_class="close-button") with flx.VBox( style= "cursor: default; padding-bottom: 30px; padding-left: 20px; padding-right:20px; padding-top: 30px;" ) as self.content_box: self.content_box.set_padding("20px") self.out_button_l = flx.Button(text="◀", css_class="out-button left-button") self.out_button_r = flx.Button(text="▶", css_class="out-button right-button") self.in_button_l = flx.Button(text="▶", css_class="in-button left-button") self.in_button_r = flx.Button(text="◀", css_class="in-button right-button") self.enable_button = flx.Button(text="enabled", css_class="enable-button") self.trigger_edit = flx.LineEdit(self.content_box) self.trigger_button = flx.Button(parent=self.content_box, text="Trigger") self.trigger_edit.set_parent(None) self.trigger_button.set_parent(None) self.trigger_button.set_disabled(True) self.set_active(True) self.set_position()
def init(self): report = re.Report() report.init( 123, 42, "pepe", 28, "juan", 2019, fileDescriptor= "<fo:block ><fo:image ></fo:image><fo:block >Value of Variable: $Variable1$</fo:block></fo:block><fo:block ></fo:block>" ) with flx.VBox(): with flx.HBox(): with flx.HBox(): self.new = flx.Button(text='Create New Template', flex=0) self.save = flx.Button(text='Save Template', flex=1) self.load = flx.Button(text='Load Template', flex=2) self.download = flx.Button(text='Get_XML_File', flex=3) with flx.HBox(): self.region = flx.Button(text='Add Region Container', flex=4) self.text = flx.Button(text='Add Text Container', flex=5) self.image = flx.Button(text='Add Image Container', flex=6) self.XML = flx.Label(text="No XML Available Yet", flex=7)
def init(self): flx.Widget(flex=1) with flx.VBox(): with flx.HBox(): self.b1 = flx.Button(text='Hello', css_class="border-red", flex=1) self.b2 = flx.Button(text='World', css_class="border-green", flex=1) flx.Widget(flex=1)
def init(self): with flx.VBox(): self.b1 = flx.Button(text='apple') self.b2 = flx.Button(text='banana') self.b3 = flx.Button(text='pear') self.buttonlabel = flx.Label(text='...') with flx.VBox(): self.r1 = flx.RadioButton(text='apple') self.r2 = flx.RadioButton(text='banana') self.r3 = flx.RadioButton(text='pear') self.radiolabel = flx.Label(text='...') with flx.VBox(): self.c1 = flx.ToggleButton(text='apple') self.c2 = flx.ToggleButton(text='banana') self.c3 = flx.ToggleButton(text='pear') self.checklabel = flx.Label(text='...')
def init(self): with flx.GroupWidget(title='A silly panel'): with flx.VBox(): self.progress = flx.ProgressBar(min=0, max=9, text='Clicked {value} times') self.but = flx.Button(text='click me')
def init(self): with flx.VBox(): flx.Label(style="text-align:center", text="Networking") with flx.HBox(): with flx.VBox(): flx.Label(style="text-align:right", text="AP Name:") flx.Label(style="text-align:right", text="Password:"******"background-color:#BBBBBB;text-align:center", placeholder_text="ssid") self.fieldPassword = flx.LineEdit( style="background-color:#BBBBBB;text-align:center", placeholder_text="psk") self.submitButton = flx.Button(text='Submit') flx.Widget(flex=1)
def init(self, retico_widget, mpane, module_list, file_list): self.retico_widget = retico_widget self.mpane = mpane with flx.VBox(css_class="stupid-vbox") as stupid_vbox: stupid_vbox.set_padding("20px") with flx.TreeWidget(max_selected=1, style="height: 300px;", flex=1) as self.module_tree: for k in module_list.keys(): with flx.TreeItem(text=k, checked=None): for m in module_list[k]: flx.TreeItem(text=m, checked=None) self.add_module_button = flx.Button(text="Add Module") flx.Widget(style="min-height:50px;") self.run_button = flx.Button(text="Run", css_class="menu-button") self.stop_button = flx.Button(text="Stop", css_class="menu-button") self.stop_button.set_disabled(True) flx.Widget(style="min-height:50px;") self.file_tree = flx.TreeWidget(max_selected=1, style="height:300px;", flex=1) self.update_file_tree(file_list) self.load_button = flx.Button(text="Load") self.filename_edit = flx.LineEdit() self.save_button = flx.Button(text="Save") self.clear_button = flx.Button(text="Clear") flx.Widget(flex=1)
def init(self): super().init() self.label = {} with flx.VBox() as self.wmain: self.label['above'] = flx.Label(text='Text above', flex=1) with flx.HBox(): self.winput = MyLineEdit(flex=1) with flx.VBox(): self.dots_above = MyDots(text='···') with flx.VBox() as self.woptions_box: pass self.dots_below = MyDots(text='···') self.woptions = [] self.show_more = 0 self.index = 0 self.shift = 0 self.focus_element = self.winput
def init(self): with flx.HBox(): actuator_bar = SamActuatorBar() #flx.Widget(flex=1) with flx.VBox(flex=1): launch_dashboard = ROSMonDashboardWidget(flex=1) info_dash = SamInfoDash(flex=0)
def init(self, parent, descs): super().init(descs) self._parent = parent with flx.VBox(flex=1): self.lbl_title = flx.Label(css_class="center", text="protocol") with flx.VSplit(flex=1): self._cont = flx.FormLayout() self.pnl_dump = PanelDump(flex=1)
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 flx.VBox(): flx.Label(html='<h3>Server monitor</h3>') if flx.current_server().serving[0] == 'localhost': # Don't do this for a public server self.button = flx.Button(text='Do some work') self.button.reaction(self._do_work, 'pointer_down') self.view = MonitorView(flex=1)
def init(self): with flx.HBox(): self.leaflet = LeafletWidget( flex=1, center=(52, 4.1), zoom=12, show_scale=lambda: self.cbs.checked, show_layers=lambda: self.cbl.checked, ) with flx.VBox(): self.btna = flx.Button(text='Add SeaMap') self.btnr = flx.Button(text='Remove SeaMap') self.cbs = flx.CheckBox(text='Show scale') self.cbl = flx.CheckBox(text='Show layers') self.list = flx.VBox() flx.Widget(flex=1) self.leaflet.add_layer('http://a.tile.openstreetmap.org/', 'OpenStreetMap')
def init(self): self.layer_list = [] with ui.VFix(flex=18): PanelLayers(css_class="title") with ui.VSplit(flex=1): with flx.VBox() as self.__cont: self._cont = flx.VFix(flex=1) self.pnl_dump = PanelDump(0, flex=1) self.pnl_send = PanelSend()