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): 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): 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, server_name): self.is_init = False self.react = self.reaction(self._callback, "!root." + server_name.replace("/", "_")) with flx.GroupWidget(title=server_name): self.vbox = flx.FormLayout(flex=1) self.root.announce_reconfig(server_name)
def init(self): self.cfg_name = '.scapy-ui' self.lst_names = [] with flx.VBox(): self.lst_config = flx.GroupWidget(title="Recent:", flex=1, css_class="list") self.btn_load = flx.Button(text='Load Pcap...') self.btn_sniff = flx.Button(text='S(n)iff...') self.load_names()
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, server_name, server_type): self.is_init = False self.server_name = server_name with flx.GroupWidget(title=server_name, flex=1): with flx.FormLayout(flex=1): self.arguments = flx.LineEdit(title="Args", text="") self.feedback = flx.LineEdit(title="Feedback", text="") self.result = flx.LineEdit(title="Result", text="") self.send_goal = flx.Button(text="Send goal") flx.Widget(minsize=40) self.reaction(self._prototype_callback, "!root." + server_name.replace("/", "_") + "_prototype") self.announce_action_client(server_name, server_type)
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, name, topic, topic_type, actuator_settings): self.topic = topic with flx.GroupWidget(title=name, flex=1): with flx.FormLayout(flex=1): self.sliders = [] self.members = [] for settings in actuator_settings: self.sliders.append( flx.Slider(title=settings["name"], min=settings["min"], max=settings["max"], value=0)) if "type" in settings: self.members.append( (settings["member"], settings["type"])) else: self.members.append((settings["member"], "float")) #flx.Widget(minsize=10) self.announce_publish(topic, topic_type) self.subscribe(topic, topic_type, self._setpoint_callback)
def init(self): with flx.HFix(): flx.Widget(flex=1) with flx.VBox(flex=0, style='min-width:200px'): with flx.GroupWidget(title='Plot options'): flx.Label(text='Month') self.month = flx.ComboBox(options=months, selected_index=12, style='width: 100%') self.smoothing_label = flx.Label(text='Smoothing') self.smoothing = flx.Slider(max=20, step=2, text='{value} samples') flx.Widget(flex=3) with flx.VBox(flex=4): self.plot = flx.PlotWidget(flex=1, xdata=years, yrange=(-5, 20), title='Average monthly temperature', xlabel='year', ylabel=u'temperature (°C)') flx.Widget(flex=1)