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): self.selectedImages = [] with flx.TabLayout() as self.tabs: with flx.HFix(title="selection", flex=1) as self.selector_view: with flx.VFix() as self.images: flx.Label(text="Images", flex=(1, 1)) self.imageGrid = ImageGrid( 4, 4, path_provider, lambda o, idx, idy: self.image_click_handler( o, idx, idy), flex=(1, 9)) self.images.node.style.backgroundColor = "#88888888" with flx.VFix() as self.selected: flx.Label(text="Selected", flex=(1, 1)) self.selectedGrid = ImageGrid( 4, 4, self.selected_provider, lambda o, idx, idy: self.selected_click_handler( o, idx, idy), flex=(1, 9)) with flx.HFix(title="results", flex=1) as self.result_view: self.resultGrid = ImageGrid(8, 4, path_provider, flex=(1, 1))
def init(self): super().init() with flx.VBox(): with flx.HBox(): self.wtitle = flx.Label(flex=1) self.wversion = flx.Label(text='v0.0.0') self.wprompt = MyPrompt() self.wconsole = MyConsole(flex=1) self._init_focus() self._init_ready() return
def init(self): super().init() with flx.VBox(): with flx.HBox(): self.title = flx.Label(flex=1,text='山东宝帅电力铁芯计算') with flx.HBox(): self.firstname_lable = flx.Label("输入截面积:") self.firstname = flx.LineEdit(placeholder_text='First name') self.lastname = flx.LineEdit(placeholder_text='Last name') with flx.HBox(): self.but = flx.Button(text='Reset') self.label = flx.Label(flex=1)
def init(self): with flx.HSplit(): with flx.VBox(flex=1): self.summary = flx.TreeWidget(flex=1, max_selected=1) with flx.VSplit(flex=1): with flx.GroupWidget(css_class="list", flex=6, title="Detail"): self.detail = flx.Label(flex=1, css_class="detail") self.detail.set_wrap(2) with flx.GroupWidget(css_class="list", flex=4, title="hexdump"): self.hexdump = flx.Label(flex=1, css_class="detail") self.hexdump.set_wrap(1)
def init(self): time = [i / 100 for i in range(100)] with flx.VBox(): with flx.HBox(): flx.Label(text='Frequency:') self.slider1 = flx.Slider(min=1, max=10, value=5, flex=1) flx.Label(text='Phase:') self.slider2 = flx.Slider(min=0, max=6, value=0, flex=1) self.plot = flx.PlotWidget(flex=1, xdata=time, xlabel='time', ylabel='amplitude', title='a sinusoid')
def init(self): with flx.VBox(): with flx.HBox(flex=1): flx.Label(text='Tree') self.tree = LeoTree(flex=1) flx.Label(text='Log') self.log = LeoLog(flex=1) flx.Label(text='Body') LeoBody(flex=1) flx.Label(text='Minibuffer') LeoMiniBuffer() flx.Label(text='Status Line') LeoStatusLine()
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, service_name): self.service_name = service_name self.node_name = "" self.node_ns = "" with flx.HFix(): self.name = flx.Label(text="AA") self.state = flx.Label(text="BB") self.user_load = flx.Label(text="CC") self.memory = flx.Label(text="DD") self.restarts = flx.Label(text="EE") self.start_stop = flx.Button(text="Stop")
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): 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, 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): 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): 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): 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): 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, 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, parameters, mpane, module_type, mod_parent): flx.Label(text="Parameters for this module:", style="color: #fff;") self.params = flx.LineEdit(text=parameters, style="width: 500px;") self.okbtn = flx.Button(text="OK") self.mpane = mpane self.module_type = module_type self.mod_parent = mod_parent
def init(self): with flx.Widget(): flx.Label(text='Refreshing the page should ' 'maintain the value of the line edit.') self.edit = flx.LineEdit(placeholder_text='username', text=self.session.get_cookie('username', ''))
def init(self): super().init() with flx.HBox(): self.but1 = flx.Button(text='reset') self.but2 = flx.Button(text='increase') self.label = flx.Label(text='', flex=1) # take all remaining space
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): 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, name, actuator_type, setpoint_topic, feedback_topic, cont_enable_topic, cont_setpoint_topic, cont_min, cont_max, is_angles=False): self.setpoint_topic = setpoint_topic self.cont_setpoint_topic = cont_setpoint_topic self.cont_enable_topic = cont_enable_topic self.is_angles = is_angles with flx.GroupWidget(title=name, flex=1): with flx.FormLayout(flex=1): flx.Label(text="Actuator setpoint") if is_angles: self.set_slider = flx.Slider(title="0", min=-1.6, max=1.6) self.set_slider2 = flx.Slider(title="0", min=-1.6, max=1.6) else: self.set_slider = flx.Slider(title="50", min=0, max=100, value=50) flx.Label(text="Controller setpoint") self.enable_cont = flx.CheckBox(title="Enabled") self.enable_cont.set_checked(True) self.cont_slider = flx.Slider(title="0", min=cont_min, max=cont_max, value=0) flx.Widget(minsize=20) self.announce_publish(setpoint_topic, actuator_type) self.announce_publish(cont_setpoint_topic, "std_msgs/Float64") self.announce_publish(cont_enable_topic, "std_msgs/Bool") self.subscribe(setpoint_topic, actuator_type, self._setpoint_callback) self.subscribe(cont_setpoint_topic, "std_msgs/Float64", self._cont_callback) self.subscribe(cont_enable_topic, "std_msgs/Bool", self._enable_callback) if is_angles: self.reaction(self._setpoint_slider, "set_slider2.user_done")
def init(self): super().init() # self._mutate_sercon(SerialConnection('/dev/ttyACM1')) self.sercon = SerialConnection('/dev/sensor_0') # self._mutate_serconChiller(SerialConnectionChiller('/dev/ttyUSB0')) self.serconChiller = SerialConnectionChiller('/dev/ttyUSB0') # self._mutate_serconSensirion(SerialConnectionSensirion('/dev/ttyACM0')) self.serconSensirion = SerialConnectionSensirion('/dev/sensor_1') # self._mutate_ledcon(LedPulser()) self.ledcon = LedPulser() self.hvcon = SerialConnectionHV('/dev/ttyUSB4') self.t0 = datetime.now() #Always start in inhbit mode reply=self.sercon.sendCommand('i') if (reply!='INH'): print('Please check serial connection') reply=self.sercon.sendCommand('0') if (reply!='V0'): print('Please check serial connection') ret=self.ledcon.ledSwitch(0) if (ret!=0): print('Please check led pulser connection') # with flx.HBox(flex=0, spacing=10): with flx.PinboardLayout(): self.tempText = flx.Label(text='T: XX.XX H: YY.YY',style='left:10px; top:120px; width:300px;height:20px;') self.sensirionText = flx.Label(text='T_EXT:XXX.XX H_EXT:YYY.YY DEW_EXT:ZZZ.ZZ',style='left:10px; top:140px; width:400px;height:20px;') self.hvText = flx.Label(text='VSET:XXX.XX VMON:XXX.XX',style='left:10px; top:180px; width:300px;height:20px;') self.chillerText = flx.Label(text='CHILLER TBATH:XXX.XX TSET:YYY.YY PUMP:ZZ',style='left:10px; top:160px; width:400px;height:20px;') self.but1 = flx.Button(text='Led Pulser',css_class="border-black",style='left:10px; top:10px; width:180px;height:100px;') self.but2 = flx.Button(text='HV',css_class="border-black",style='left:200px; top:10px; width:150px;height:100px;') self.but3 = flx.Button(text='VSEL',css_class="border-black",style='left:360px; top:10px; width:100px;height:100px;') self.chillerStatus = flx.Button(text='COOLING OK',css_class="border-black",style='left:470px; top:10px; width:250px;height:100px;') # self.label = flx.Label(text='', flex=1) # take all remaining space self.refreshTemperature() self.refreshChiller() self.refreshSensirion() self.refreshHV() #upload to things speak (every 60s) self.refreshThingSpeak() self.initialised=1
def init(self, descs, cls_detail=PanelProtocolDetail): super().init(descs) self.cls_detail = cls_detail with flx.HFix(): self.lbl_title = flx.Label(flex=4) self._cont = flx.HFix(flex=42) self.btn_detail = flx.Button(text="...", flex=2, disabled = not cls_detail) self.btn_remove = flx.Button(text="-", flex=1)
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.FormLayout(flex=1, maxsize=400): self.type_message = flx.LineEdit(title="Message to send:", text="") self.send_message = flx.Button(text="Publish message") self.receive_message = flx.Label(title="Received message:", text="Waiting for message...") self.announce_publish("/test_topic", "std_msgs/String") self.subscribe("/test_topic", "std_msgs/String", self.callback)
def init(self): self.start_time = time() self.status = flx.Label(text='...') self.cpu_plot = flx.PlotWidget(flex=1, style='width: 640px; height: 320px;', xdata=[], yrange=(0, 100), ylabel='CPU usage (%)') self.mem_plot = flx.PlotWidget(flex=1, style='width: 640px; height: 320px;', xdata=[], yrange=(0, 100), ylabel='Mem usage (%)')