Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add group UI wrapper #8

Merged
merged 6 commits into from
Dec 18, 2023
Merged

Add group UI wrapper #8

merged 6 commits into from
Dec 18, 2023

Conversation

yangbobo2021
Copy link
Contributor

@yangbobo2021 yangbobo2021 commented Dec 14, 2023

Purpose: To support multiple control interactions in a single UI interaction.

Example usage:

import sys

sys.path.append(os.path.join(os.path.dirname(__file__), "..", "libs"))
sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..", "libs"))

from ui_utils import CheckboxOption,  RadioOption, ui_group, make_checkbox_control, make_editor_control, make_radio_control  # noqa: E402 

def main():
    print("hello")
    checkbox_data = make_checkbox_control("checkbox ui message", [
        CheckboxOption("id1", "checkout 1", "checkbox"),
        CheckboxOption("id2", "checkout 2", "checkbox")
    ])
    radio_data = make_radio_control("radio ui message", [
        RadioOption("id3", "radio 1"),
        RadioOption("id4", "radio 2")
    ])
    editor_data = make_editor_control("id5", "editor ui message", "old message")
    (checkbox_result, radio_result, editor_result) = ui_group([checkbox_data, radio_data, editor_data])
    print(checkbox_result, radio_result, editor_result)


if __name__ == "__main__":
    main()

截屏2023-12-18 21 00 44

libs/ui_utils/group.py Outdated Show resolved Hide resolved
Comment on lines +17 to +20
"make_checkbox_control",
"make_radio_control",
"make_editor_control",
"ui_group",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

新增暴露make_*_control系列接口 跟前面的 ui_*的区别是什么?像commit.py里仍用的ui_*系列,新暴露的函数并没有在外使用,那么他们应该什么时候被用到?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

大概是这样使用:
(check_result, edit_result) = ui_group(
make_check_control(...),
make_editor_control(...)
)
make_checkbox_control用于生成复合UI规范的描述字符串。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

把使用示例和效果截图补充到PR description里吧

@kagami-l kagami-l force-pushed the add_group_ui_wrapper branch from e795d50 to d2aaa48 Compare December 18, 2023 13:06
@kagami-l kagami-l merged commit b477974 into main Dec 18, 2023
1 check passed
@kagami-l kagami-l deleted the add_group_ui_wrapper branch December 18, 2023 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants