def construct_ui(u: Declarative.DeclarativeUI) -> Declarative.UIDescription: title_field = u.create_line_edit(text="@binding(title_model.value)") add_button = u.create_push_button(text="Add", on_clicked="add_mode") modes_menu = u.create_combo_box(name="modes_menu", items_ref="@binding(mode_titles_model.value)", current_index="@binding(model.mode_index)") modes_stack = u.create_stack(items="model.modes", item_component_id="mode", current_index="@binding(model.mode_index)") modes_group = u.create_group(modes_stack) return u.create_column(title_field, add_button, modes_menu, modes_group, spacing=8, margin=12)
def construct_ui(ui: Declarative.DeclarativeUI): shape_choice = ui.create_combo_box( items=["Rectangle", "Circle", "Interval"], current_index="@binding(shape_index_model.value)") shape_component = ui.create_component_instance( "@binding(shape_page.value)") return ui.create_column(shape_choice, shape_component, spacing=8, margin=12)
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 construct_ui(u: Declarative.DeclarativeUI) -> Declarative.UIDescription: cb1 = u.create_combo_box( name="cb1", items=["Red", "Green", "Blue"], on_current_index_changed="cb1_current_index_changed") cb2 = u.create_combo_box( items=["Sheriff", "Astronaut", "Scientist"], current_index="@binding(cb2_current_index_model.value)") cb3 = u.create_combo_box( items_ref="numbers", current_index="@binding(cb2_current_index_model.value)") cb4 = u.create_combo_box( items_ref="@binding(numeros.value)", current_index="@binding(cb2_current_index_model.value)") button = u.create_push_button(text="Change Items", on_clicked="change_items") cb_group = u.create_column(cb1, cb2, cb3, cb4, button, spacing=12) return cb_group