def __create_ui_view(self,
                         ui: Declarative.DeclarativeUI,
                         title: str = None,
                         **kwargs) -> dict:
        elabftw_text_field = ui.create_text_edit(editable=False,
                                                 text='elabftw_data',
                                                 width=400,
                                                 height=500)
        elabftw_tab = ui.create_tab(label='Elabftw',
                                    content=elabftw_text_field)

        nion_text_field = ui.create_text_edit(editable=False,
                                              text='nion_data',
                                              width=400,
                                              height=500)
        nion_tab = ui.create_tab(label='Nion Swift', content=nion_text_field)
        tabs = ui.create_tabs(elabftw_tab, nion_tab)

        overwrite_button = ui.create_push_button(
            text='Overwrite', on_clicked='on_overwrite_clicked')
        merge_button = ui.create_push_button(text='Merge',
                                             on_clicked='on_merge_clicked')
        buttons_row = ui.create_row(overwrite_button,
                                    merge_button,
                                    spacing=8,
                                    margin=4)
        content = ui.create_column(tabs,
                                   buttons_row,
                                   ui.create_stretch(),
                                   spacing=8,
                                   margin=4)
        return ui.create_modeless_dialog(content, title=title, margin=4)
コード例 #2
0
def construct_ui(u: Declarative.DeclarativeUI) -> Declarative.UIDescription:
    def create_tab_content(tab_label: str, text: str, check_text: str,
                           button_text: str) -> Declarative.UIDescription:
        label = u.create_label(text=text)
        check_box = u.create_check_box(text=check_text)
        button = u.create_push_button(text=button_text)
        return u.create_tab(
            tab_label,
            u.create_column(label, check_box, button, spacing=8, margin=4))

    tab0 = create_tab_content("First", "ONE", "Check 1", "Push ONE")
    tab1 = create_tab_content("Second", "TWO", "Check 2", "Push TWO")
    tab2 = create_tab_content("Third", "THREE", "Check 3", "Push THREE")
    tabs = u.create_tabs(tab0,
                         tab1,
                         tab2,
                         current_index="@binding(tab_index_model.value)")
    button = u.create_push_button(text="3", on_clicked="switch3")
    return u.create_column(tabs, button)