def update(self, event): with self.vbox: with ui.GroupWidget(): btn = ui.Button(title=event['name'], text=event['name']) delete = ui.Button(title=event['name'], text='del') ui.Label(text=event['description']) btn.connect('mouse_click', self.wdg) delete.connect('mouse_click', self.delete)
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.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.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.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.fields = {} self.radio_buttons = {} self.result_property = {} self.slider_to_textfield = {} self.textfield_to_slider = {} self.int_sliders = set() self.sliders = [] with ui.GroupWidget(title="Simulation parameter"): ui.Label(text="scroll down to start", style="float: right; color: steelblue", wrap=True) for parameter, value in list(parameter_mask.items()): try: title = names[parameter] except KeyError: title = parameter if isinstance(value, bool): self.fields[parameter] = ui.CheckBox(text=title) self.result_property[parameter] = 'checked' elif isinstance(value, list): self.radio_buttons[parameter] = {} with ui.GroupWidget(title=title, style="width:fit-content;"): for option in value: self.radio_buttons[parameter][option] = \ ui.RadioButton(text=option) self.radio_buttons[parameter][value[0]].checked = True else: if isinstance(value, tuple): min_value, default, max_value = sorted(value) elif isinstance(value, (int, float)): min_value, default, max_value = 0, value, value * 2 is_integer = False if isinstance(value, (int, float, tuple)): if (isinstance(default, int) and isinstance(max_value, int)): step = 1 is_integer = True # if default is float, type is float if isinstance(default, float): step = (max_value - min_value) / 100 else: step = (max_value - min_value) / 100 with ui.Widget(): ui.Label(text=title, wrap=True) slider = ui.Slider(min=min_value, max=max_value, value=default, step=step) lineeditor = ui.LineEdit(title=title, text=default) self.sliders.append((slider, lineeditor)) self.fields[parameter] = slider self.result_property[parameter] = 'value' slider.connect('value', self.stt) lineeditor.connect('submit', self.tts) self.slider_to_textfield[slider] = lineeditor self.textfield_to_slider[lineeditor] = slider if is_integer: self.int_sliders.add(slider) elif isinstance(value, str): with ui.Widget(): ui.Label(text=title, wrap=True, style="width: 80%") self.fields[parameter] = \ ui.LineEdit(title=title, text=value, style='width: 95%;') self.result_property[parameter] = 'text' elif value is None: ui.Label(text=title, wrap=True) else: # field print(str(value) + "not recognized") with ui.VBox(): self.btn = ui.Button(text="start simulation") with ui.GroupWidget(title="Save"): with ui.HBox(): self.name = ui.LineEdit(title="Name:", placeholder_text='name') self.save = ui.Button(text="Save Parameters") self.description = ui.LineEdit( title="Description", text='', style='width: 95%;', placeholder_text='description')
def init(self): with ui.GroupWidget(title='A silly panel'): with ui.VBox(): self.progress = ui.ProgressBar(min=0, max=9, text='Clicked {value} times') self.but = ui.Button(text='click me')