def construct_ui(u: Declarative.DeclarativeUI) -> Declarative.UIDescription: hello1_line_edit = u.create_line_edit(placeholder_text="Enter Text", on_editing_finished="hello1_updated") hello1_label = u.create_label(name="hello1_label", text="Hello World One") hello1 = u.create_column(hello1_label, hello1_line_edit) hello2_line_edit = u.create_line_edit(placeholder_text="Enter Text", text="@binding(hello2_text)") hello2_label = u.create_label(name="hello2_label", text="@binding(hello2_text)") hello2 = u.create_column(hello2_label, hello2_line_edit) hello3_line_edit = u.create_line_edit(placeholder_text="Enter Text", text="@binding(hello3_model.value)") hello3_label = u.create_label(text="@binding(hello3_model.value)") hello3 = u.create_column(hello3_label, hello3_line_edit) hello4_line_edit = u.create_line_edit(placeholder_text="Enter Text", text="@binding(hello3_model.value)") hello4_label = u.create_label(text="@binding(hello4_text)") hello4 = u.create_column(hello4_label, hello4_line_edit) hellos = u.create_column(hello1, hello2, hello3, hello4, spacing=12) return hellos
def construct_ui(u: Declarative.DeclarativeUI) -> Declarative.UIDescription: label = u.create_label(text="@binding(slider_value_model.value)") button = u.create_push_button(text="Reset to 50", on_clicked="reset") content = u.create_column(label, button, spacing=8) left = u.create_label(text="LEFT") right = u.create_label(text="RIGHT") group_row = u.create_row(left, u.create_stretch(), right, spacing=8) status_bar = u.create_group(group_row) return u.create_column(content, u.create_stretch(), status_bar, spacing=8)
def construct_ui(ui: Declarative.DeclarativeUI) -> Declarative.UIDescription: stack0 = ui.create_column(ui.create_label(text="111"), ui.create_label(text="ONE")) stack1 = ui.create_column(ui.create_label(text="222"), ui.create_label(text="TWO")) stack2 = ui.create_column(ui.create_label(text="333"), ui.create_label(text="THREE")) stack = ui.create_stack(stack0, stack1, stack2, current_index="@binding(stack_index_model.value)") chooser = ui.create_combo_box(items=["One", "Two", "Three"], current_index="@binding(stack_index_model.value)") return ui.create_column(stack, chooser, spacing=8)
def __create_ui_view(self, ui: Declarative.DeclarativeUI, title: str = None, file_ext: str = 'hdf5', params: dict = None, **kwargs) -> dict: ui_objects = [] for i, param in enumerate(params): converter = '' if param.get('converter'): converter = ', converter=' + param['converter'] if (param['type'] == 'text_box'): ui_objects.append(ui.create_label(text=param['text'])) ui_objects.append( ui.create_line_edit( text=f'@binding(params_{i}{converter})')) elif (param['type'] == 'check_box'): ui_objects.append( ui.create_check_box( text=param['text'], checked=f'@binding(params_{i}{converter})')) ui_objects.append( ui.create_row( ui.create_push_button(text='Load', on_clicked='on_load'), ui.create_stretch())) content = ui.create_column(*ui_objects, ui.create_stretch(), spacing=8, margin=4) return ui.create_modeless_dialog(content, title=title + ' - ' + file_ext.title(), margin=4)
def construct_ui(u: Declarative.DeclarativeUI) -> Declarative.UIDescription: all_cb = u.create_check_box(text="Enable All", name="all_cb", tristate=True, check_state="partial", on_check_state_changed="check_state_changed") gain_cb = u.create_check_box(text="Gain Normalize", name="gain_cb", checked="gain_enabled", on_checked_changed="checked") dark_cb = u.create_check_box(text="Dark Subtract", name="dark_cb", on_checked_changed="checked") extra_cb = u.create_check_box(text="Extra", checked="@binding(extra_model.value)") extra_extra_cb = u.create_check_box(text="Extra2", enabled=False) label = u.create_label(text="Label", visible="@binding(extra_model.value)", tool_tip="A tool tip.") cb_group = u.create_column(gain_cb, dark_cb, spacing=8, enabled="@binding(extra_model.value)") cb_row = u.create_row(u.create_spacing(12), cb_group) all_group = u.create_column(all_cb, cb_row, extra_cb, extra_extra_cb, label, spacing=8) return all_group
def construct_ui(ui: Declarative.DeclarativeUI) -> Declarative.UIDescription: text_only_button = ui.create_push_button(text="Change Button Icon", on_clicked="click") icon_only_button = ui.create_push_button(icon="@binding(icon2)") text_and_icon_button = ui.create_push_button(text="Text", icon="@binding(icon1)") image_button = ui.create_image(image="@binding(image_model.value)", height=16, width=16, on_clicked="image_click") hellos = ui.create_column(ui.create_row(text_only_button, ui.create_stretch()), ui.create_row(icon_only_button, ui.create_stretch()), ui.create_row(text_and_icon_button, ui.create_stretch()), ui.create_row( ui.create_label(text="Image (click me):"), image_button, ui.create_stretch(), spacing=8), ui.create_stretch(), spacing=12) return hellos
def construct_ui(u: Declarative.DeclarativeUI) -> Declarative.UIDescription: slider = u.create_slider(value="@binding(slider_value_model.value)") progress_bar = u.create_progress_bar( value="@binding(slider_value_model.value)") label = u.create_label(text="@binding(slider_value_model.value)") button = u.create_push_button(text="Reset to 50", on_clicked="reset") return u.create_column(progress_bar, slider, label, button, spacing=8)
def construct_ui(u: Declarative.DeclarativeUI) -> Declarative.UIDescription: field_label = u.create_label(text="Favorite Color?") field_line_edit = u.create_line_edit(placeholder_text="Color", name="color_line_edit", on_editing_finished="color_updated", on_return_pressed="return_pressed", on_key_pressed="key_pressed") field_line_edit2 = u.create_line_edit(text="@binding(model.value)") return u.create_column( u.create_row(field_label, field_line_edit, spacing=8), u.create_row(u.create_label(text="Another Color?"), field_line_edit2, u.create_stretch(), spacing=8), u.create_stretch(), spacing=8, )
def construct_ui(u: Declarative.DeclarativeUI) -> Declarative.UIDescription: hello3_line_edit = u.create_line_edit( placeholder_text="Enter Text", text="@binding(hello3_model.value, converter=hello3_converter)") hello3_label = u.create_label( text="@binding(hello3_model.value, converter=hello3_converter)") hello3 = u.create_column(hello3_label, hello3_line_edit, spacing=8) return hello3
def construct_ui(u: Declarative.DeclarativeUI) -> Declarative.UIDescription: slider = u.create_slider(value="@binding(slider_value_model.value)") slider2 = u.create_slider(name="slider2", value="vv", on_value_changed="value_changed", on_slider_moved="slider_moved") label = u.create_label(text="@binding(slider_value_model.value)") button = u.create_push_button(text="Reset to 50", on_clicked="reset") return u.create_column(slider, slider2, label, button, spacing=8)
def construct_ui(u: Declarative.DeclarativeUI) -> Declarative.UIDescription: radio0 = u.create_radio_button( text="One", value=1, group_value="@binding(radio_button_value.value)") radio1 = u.create_radio_button( text="Two", value=2, group_value="@binding(radio_button_value.value)") radio2 = u.create_radio_button( text="Three", value=3, group_value="@binding(radio_button_value.value)") label = u.create_label(text="@binding(radio_button_value.value)") button = u.create_push_button(text="Reset", on_clicked="reset_clicked") return u.create_column(radio0, radio1, radio2, label, button, spacing=8)