hspylib-clitt 0.9.116__py3-none-any.whl → 0.9.118__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of hspylib-clitt might be problematic. Click here for more details.
- clitt/.version +1 -1
- clitt/__classpath__.py +2 -2
- clitt/__init__.py +3 -3
- clitt/__main__.py +3 -3
- clitt/addons/__init__.py +3 -3
- clitt/addons/appman/__init__.py +3 -3
- clitt/addons/appman/templates/__init__.py +3 -3
- clitt/addons/appman/templates/main_qt_view.py.tpl +1 -1
- clitt/addons/widman/__init__.py +3 -3
- clitt/addons/widman/widgets/__init__.py +3 -3
- clitt/core/__init__.py +3 -3
- clitt/core/exception/__init__.py +3 -3
- clitt/core/exception/exceptions.py +1 -0
- clitt/core/icons/__init__.py +3 -3
- clitt/core/icons/emojis/__init__.py +3 -3
- clitt/core/icons/font_awesome/__init__.py +3 -3
- clitt/core/term/__init__.py +3 -3
- clitt/core/term/commons.py +33 -8
- clitt/core/term/cursor.py +19 -4
- clitt/core/term/screen.py +16 -1
- clitt/core/term/terminal.py +16 -17
- clitt/core/tui/__init__.py +3 -3
- clitt/core/tui/line_input/__init__.py +3 -3
- clitt/core/tui/line_input/keyboard_input.py +36 -35
- clitt/core/tui/line_input/line_input.py +5 -17
- clitt/core/tui/mchoose/__init__.py +3 -3
- clitt/core/tui/mchoose/mchoose.py +2 -3
- clitt/core/tui/mchoose/menu_choose.py +6 -14
- clitt/core/tui/mdashboard/__init__.py +3 -3
- clitt/core/tui/mdashboard/menu_dashboard.py +2 -8
- clitt/core/tui/menu/__init__.py +3 -3
- clitt/core/tui/minput/__init__.py +3 -3
- clitt/core/tui/mselect/__init__.py +3 -3
- clitt/core/tui/mselect/menu_select.py +2 -3
- clitt/core/tui/table/__init__.py +3 -3
- clitt/core/tui/tui_application.py +8 -21
- clitt/core/tui/tui_component.py +4 -5
- clitt/core/tui/tui_preferences.py +1 -1
- clitt/utils/__init__.py +3 -3
- {hspylib_clitt-0.9.116.dist-info → hspylib_clitt-0.9.118.dist-info}/METADATA +2 -2
- hspylib_clitt-0.9.118.dist-info/RECORD +97 -0
- {hspylib_clitt-0.9.116.dist-info → hspylib_clitt-0.9.118.dist-info}/WHEEL +1 -1
- {hspylib_clitt-0.9.116.dist-info → hspylib_clitt-0.9.118.dist-info}/top_level.txt +0 -1
- build/lib/build/lib/build/lib/build/lib/clitt/__classpath__.py +0 -28
- build/lib/build/lib/build/lib/build/lib/clitt/__init__.py +0 -13
- build/lib/build/lib/build/lib/build/lib/clitt/__main__.py +0 -139
- build/lib/build/lib/build/lib/build/lib/clitt/addons/__init__.py +0 -12
- build/lib/build/lib/build/lib/build/lib/clitt/addons/appman/__init__.py +0 -13
- build/lib/build/lib/build/lib/build/lib/clitt/addons/appman/appman.py +0 -305
- build/lib/build/lib/build/lib/build/lib/clitt/addons/appman/appman_enums.py +0 -39
- build/lib/build/lib/build/lib/build/lib/clitt/addons/appman/templates/__init__.py +0 -11
- build/lib/build/lib/build/lib/build/lib/clitt/addons/widman/__init__.py +0 -14
- build/lib/build/lib/build/lib/build/lib/clitt/addons/widman/widget.py +0 -70
- build/lib/build/lib/build/lib/build/lib/clitt/addons/widman/widget_entry.py +0 -54
- build/lib/build/lib/build/lib/build/lib/clitt/addons/widman/widgets/__init__.py +0 -14
- build/lib/build/lib/build/lib/build/lib/clitt/addons/widman/widgets/widget_free.py +0 -110
- build/lib/build/lib/build/lib/build/lib/clitt/addons/widman/widgets/widget_punch.py +0 -246
- build/lib/build/lib/build/lib/build/lib/clitt/addons/widman/widgets/widget_send_msg.py +0 -272
- build/lib/build/lib/build/lib/build/lib/clitt/addons/widman/widgets/widget_time_calc.py +0 -146
- build/lib/build/lib/build/lib/build/lib/clitt/addons/widman/widman.py +0 -123
- build/lib/build/lib/build/lib/build/lib/clitt/core/__init__.py +0 -15
- build/lib/build/lib/build/lib/build/lib/clitt/core/exception/__init__.py +0 -11
- build/lib/build/lib/build/lib/build/lib/clitt/core/exception/exceptions.py +0 -18
- build/lib/build/lib/build/lib/build/lib/clitt/core/icons/__init__.py +0 -12
- build/lib/build/lib/build/lib/build/lib/clitt/core/icons/emojis/__init__.py +0 -12
- build/lib/build/lib/build/lib/build/lib/clitt/core/icons/emojis/emojis.py +0 -41
- build/lib/build/lib/build/lib/build/lib/clitt/core/icons/emojis/face_smiling.py +0 -40
- build/lib/build/lib/build/lib/build/lib/clitt/core/icons/font_awesome/__init__.py +0 -18
- build/lib/build/lib/build/lib/build/lib/clitt/core/icons/font_awesome/app_icons.py +0 -55
- build/lib/build/lib/build/lib/build/lib/clitt/core/icons/font_awesome/awesome.py +0 -76
- build/lib/build/lib/build/lib/build/lib/clitt/core/icons/font_awesome/dashboard_icons.py +0 -93
- build/lib/build/lib/build/lib/build/lib/clitt/core/icons/font_awesome/form_icons.py +0 -69
- build/lib/build/lib/build/lib/build/lib/clitt/core/icons/font_awesome/game_icons.py +0 -59
- build/lib/build/lib/build/lib/build/lib/clitt/core/icons/font_awesome/nav_icons.py +0 -42
- build/lib/build/lib/build/lib/build/lib/clitt/core/icons/font_awesome/trickplay_icons.py +0 -39
- build/lib/build/lib/build/lib/build/lib/clitt/core/icons/font_awesome/widget_icons.py +0 -37
- build/lib/build/lib/build/lib/build/lib/clitt/core/preferences.py +0 -87
- build/lib/build/lib/build/lib/build/lib/clitt/core/term/__init__.py +0 -14
- build/lib/build/lib/build/lib/build/lib/clitt/core/term/commons.py +0 -82
- build/lib/build/lib/build/lib/build/lib/clitt/core/term/cursor.py +0 -159
- build/lib/build/lib/build/lib/build/lib/clitt/core/term/screen.py +0 -91
- build/lib/build/lib/build/lib/build/lib/clitt/core/term/terminal.py +0 -203
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/__init__.py +0 -20
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/line_input/__init__.py +0 -12
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/line_input/keyboard_input.py +0 -228
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/line_input/line_input.py +0 -43
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/mchoose/__init__.py +0 -12
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/mchoose/mchoose.py +0 -44
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/mchoose/menu_choose.py +0 -200
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/mdashboard/__init__.py +0 -14
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/mdashboard/dashboard_builder.py +0 -54
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/mdashboard/dashboard_item.py +0 -31
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/mdashboard/mdashboard.py +0 -26
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/mdashboard/menu_dashboard.py +0 -154
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/menu/__init__.py +0 -16
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/menu/tui_menu.py +0 -111
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/menu/tui_menu_action.py +0 -47
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/menu/tui_menu_factory.py +0 -117
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/menu/tui_menu_item.py +0 -196
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/menu/tui_menu_ui.py +0 -98
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/menu/tui_menu_view.py +0 -57
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/minput/__init__.py +0 -19
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/minput/access_type.py +0 -26
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/minput/field_builder.py +0 -117
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/minput/form_builder.py +0 -72
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/minput/form_field.py +0 -180
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/minput/input_type.py +0 -30
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/minput/input_validator.py +0 -98
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/minput/menu_input.py +0 -292
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/minput/minput.py +0 -44
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/minput/minput_utils.py +0 -156
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/mselect/__init__.py +0 -12
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/mselect/menu_select.py +0 -171
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/mselect/mselect.py +0 -36
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/table/__init__.py +0 -12
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/table/table_enums.py +0 -47
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/table/table_renderer.py +0 -339
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/tui_application.py +0 -65
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/tui_component.py +0 -155
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/tui_preferences.py +0 -103
- build/lib/build/lib/build/lib/build/lib/clitt/utils/__init__.py +0 -11
- build/lib/build/lib/build/lib/build/lib/clitt/utils/git_utils.py +0 -66
- build/lib/build/lib/build/lib/clitt/__classpath__.py +0 -28
- build/lib/build/lib/build/lib/clitt/__init__.py +0 -13
- build/lib/build/lib/build/lib/clitt/__main__.py +0 -139
- build/lib/build/lib/build/lib/clitt/addons/__init__.py +0 -12
- build/lib/build/lib/build/lib/clitt/addons/appman/__init__.py +0 -13
- build/lib/build/lib/build/lib/clitt/addons/appman/appman.py +0 -305
- build/lib/build/lib/build/lib/clitt/addons/appman/appman_enums.py +0 -39
- build/lib/build/lib/build/lib/clitt/addons/appman/templates/__init__.py +0 -11
- build/lib/build/lib/build/lib/clitt/addons/widman/__init__.py +0 -14
- build/lib/build/lib/build/lib/clitt/addons/widman/widget.py +0 -70
- build/lib/build/lib/build/lib/clitt/addons/widman/widget_entry.py +0 -54
- build/lib/build/lib/build/lib/clitt/addons/widman/widgets/__init__.py +0 -14
- build/lib/build/lib/build/lib/clitt/addons/widman/widgets/widget_free.py +0 -110
- build/lib/build/lib/build/lib/clitt/addons/widman/widgets/widget_punch.py +0 -246
- build/lib/build/lib/build/lib/clitt/addons/widman/widgets/widget_send_msg.py +0 -272
- build/lib/build/lib/build/lib/clitt/addons/widman/widgets/widget_time_calc.py +0 -146
- build/lib/build/lib/build/lib/clitt/addons/widman/widman.py +0 -123
- build/lib/build/lib/build/lib/clitt/core/__init__.py +0 -15
- build/lib/build/lib/build/lib/clitt/core/exception/__init__.py +0 -11
- build/lib/build/lib/build/lib/clitt/core/exception/exceptions.py +0 -18
- build/lib/build/lib/build/lib/clitt/core/icons/__init__.py +0 -12
- build/lib/build/lib/build/lib/clitt/core/icons/emojis/__init__.py +0 -12
- build/lib/build/lib/build/lib/clitt/core/icons/emojis/emojis.py +0 -41
- build/lib/build/lib/build/lib/clitt/core/icons/emojis/face_smiling.py +0 -40
- build/lib/build/lib/build/lib/clitt/core/icons/font_awesome/__init__.py +0 -18
- build/lib/build/lib/build/lib/clitt/core/icons/font_awesome/app_icons.py +0 -55
- build/lib/build/lib/build/lib/clitt/core/icons/font_awesome/awesome.py +0 -76
- build/lib/build/lib/build/lib/clitt/core/icons/font_awesome/dashboard_icons.py +0 -93
- build/lib/build/lib/build/lib/clitt/core/icons/font_awesome/form_icons.py +0 -69
- build/lib/build/lib/build/lib/clitt/core/icons/font_awesome/game_icons.py +0 -59
- build/lib/build/lib/build/lib/clitt/core/icons/font_awesome/nav_icons.py +0 -42
- build/lib/build/lib/build/lib/clitt/core/icons/font_awesome/trickplay_icons.py +0 -39
- build/lib/build/lib/build/lib/clitt/core/icons/font_awesome/widget_icons.py +0 -37
- build/lib/build/lib/build/lib/clitt/core/preferences.py +0 -87
- build/lib/build/lib/build/lib/clitt/core/term/__init__.py +0 -14
- build/lib/build/lib/build/lib/clitt/core/term/commons.py +0 -82
- build/lib/build/lib/build/lib/clitt/core/term/cursor.py +0 -159
- build/lib/build/lib/build/lib/clitt/core/term/screen.py +0 -91
- build/lib/build/lib/build/lib/clitt/core/term/terminal.py +0 -203
- build/lib/build/lib/build/lib/clitt/core/tui/__init__.py +0 -20
- build/lib/build/lib/build/lib/clitt/core/tui/line_input/__init__.py +0 -12
- build/lib/build/lib/build/lib/clitt/core/tui/line_input/keyboard_input.py +0 -228
- build/lib/build/lib/build/lib/clitt/core/tui/line_input/line_input.py +0 -43
- build/lib/build/lib/build/lib/clitt/core/tui/mchoose/__init__.py +0 -12
- build/lib/build/lib/build/lib/clitt/core/tui/mchoose/mchoose.py +0 -44
- build/lib/build/lib/build/lib/clitt/core/tui/mchoose/menu_choose.py +0 -200
- build/lib/build/lib/build/lib/clitt/core/tui/mdashboard/__init__.py +0 -14
- build/lib/build/lib/build/lib/clitt/core/tui/mdashboard/dashboard_builder.py +0 -54
- build/lib/build/lib/build/lib/clitt/core/tui/mdashboard/dashboard_item.py +0 -31
- build/lib/build/lib/build/lib/clitt/core/tui/mdashboard/mdashboard.py +0 -26
- build/lib/build/lib/build/lib/clitt/core/tui/mdashboard/menu_dashboard.py +0 -154
- build/lib/build/lib/build/lib/clitt/core/tui/menu/__init__.py +0 -16
- build/lib/build/lib/build/lib/clitt/core/tui/menu/tui_menu.py +0 -111
- build/lib/build/lib/build/lib/clitt/core/tui/menu/tui_menu_action.py +0 -47
- build/lib/build/lib/build/lib/clitt/core/tui/menu/tui_menu_factory.py +0 -117
- build/lib/build/lib/build/lib/clitt/core/tui/menu/tui_menu_item.py +0 -196
- build/lib/build/lib/build/lib/clitt/core/tui/menu/tui_menu_ui.py +0 -98
- build/lib/build/lib/build/lib/clitt/core/tui/menu/tui_menu_view.py +0 -57
- build/lib/build/lib/build/lib/clitt/core/tui/minput/__init__.py +0 -19
- build/lib/build/lib/build/lib/clitt/core/tui/minput/access_type.py +0 -26
- build/lib/build/lib/build/lib/clitt/core/tui/minput/field_builder.py +0 -117
- build/lib/build/lib/build/lib/clitt/core/tui/minput/form_builder.py +0 -72
- build/lib/build/lib/build/lib/clitt/core/tui/minput/form_field.py +0 -180
- build/lib/build/lib/build/lib/clitt/core/tui/minput/input_type.py +0 -30
- build/lib/build/lib/build/lib/clitt/core/tui/minput/input_validator.py +0 -98
- build/lib/build/lib/build/lib/clitt/core/tui/minput/menu_input.py +0 -292
- build/lib/build/lib/build/lib/clitt/core/tui/minput/minput.py +0 -44
- build/lib/build/lib/build/lib/clitt/core/tui/minput/minput_utils.py +0 -156
- build/lib/build/lib/build/lib/clitt/core/tui/mselect/__init__.py +0 -12
- build/lib/build/lib/build/lib/clitt/core/tui/mselect/menu_select.py +0 -171
- build/lib/build/lib/build/lib/clitt/core/tui/mselect/mselect.py +0 -36
- build/lib/build/lib/build/lib/clitt/core/tui/table/__init__.py +0 -12
- build/lib/build/lib/build/lib/clitt/core/tui/table/table_enums.py +0 -47
- build/lib/build/lib/build/lib/clitt/core/tui/table/table_renderer.py +0 -339
- build/lib/build/lib/build/lib/clitt/core/tui/tui_application.py +0 -65
- build/lib/build/lib/build/lib/clitt/core/tui/tui_component.py +0 -155
- build/lib/build/lib/build/lib/clitt/core/tui/tui_preferences.py +0 -103
- build/lib/build/lib/build/lib/clitt/utils/__init__.py +0 -11
- build/lib/build/lib/build/lib/clitt/utils/git_utils.py +0 -66
- build/lib/build/lib/clitt/__classpath__.py +0 -28
- build/lib/build/lib/clitt/__init__.py +0 -13
- build/lib/build/lib/clitt/__main__.py +0 -139
- build/lib/build/lib/clitt/addons/__init__.py +0 -12
- build/lib/build/lib/clitt/addons/appman/__init__.py +0 -13
- build/lib/build/lib/clitt/addons/appman/appman.py +0 -305
- build/lib/build/lib/clitt/addons/appman/appman_enums.py +0 -39
- build/lib/build/lib/clitt/addons/appman/templates/__init__.py +0 -11
- build/lib/build/lib/clitt/addons/widman/__init__.py +0 -14
- build/lib/build/lib/clitt/addons/widman/widget.py +0 -70
- build/lib/build/lib/clitt/addons/widman/widget_entry.py +0 -54
- build/lib/build/lib/clitt/addons/widman/widgets/__init__.py +0 -14
- build/lib/build/lib/clitt/addons/widman/widgets/widget_free.py +0 -110
- build/lib/build/lib/clitt/addons/widman/widgets/widget_punch.py +0 -246
- build/lib/build/lib/clitt/addons/widman/widgets/widget_send_msg.py +0 -272
- build/lib/build/lib/clitt/addons/widman/widgets/widget_time_calc.py +0 -146
- build/lib/build/lib/clitt/addons/widman/widman.py +0 -123
- build/lib/build/lib/clitt/core/__init__.py +0 -15
- build/lib/build/lib/clitt/core/exception/__init__.py +0 -11
- build/lib/build/lib/clitt/core/exception/exceptions.py +0 -18
- build/lib/build/lib/clitt/core/icons/__init__.py +0 -12
- build/lib/build/lib/clitt/core/icons/emojis/__init__.py +0 -12
- build/lib/build/lib/clitt/core/icons/emojis/emojis.py +0 -41
- build/lib/build/lib/clitt/core/icons/emojis/face_smiling.py +0 -40
- build/lib/build/lib/clitt/core/icons/font_awesome/__init__.py +0 -18
- build/lib/build/lib/clitt/core/icons/font_awesome/app_icons.py +0 -55
- build/lib/build/lib/clitt/core/icons/font_awesome/awesome.py +0 -76
- build/lib/build/lib/clitt/core/icons/font_awesome/dashboard_icons.py +0 -93
- build/lib/build/lib/clitt/core/icons/font_awesome/form_icons.py +0 -69
- build/lib/build/lib/clitt/core/icons/font_awesome/game_icons.py +0 -59
- build/lib/build/lib/clitt/core/icons/font_awesome/nav_icons.py +0 -42
- build/lib/build/lib/clitt/core/icons/font_awesome/trickplay_icons.py +0 -39
- build/lib/build/lib/clitt/core/icons/font_awesome/widget_icons.py +0 -37
- build/lib/build/lib/clitt/core/preferences.py +0 -87
- build/lib/build/lib/clitt/core/term/__init__.py +0 -14
- build/lib/build/lib/clitt/core/term/commons.py +0 -82
- build/lib/build/lib/clitt/core/term/cursor.py +0 -159
- build/lib/build/lib/clitt/core/term/screen.py +0 -91
- build/lib/build/lib/clitt/core/term/terminal.py +0 -203
- build/lib/build/lib/clitt/core/tui/__init__.py +0 -20
- build/lib/build/lib/clitt/core/tui/line_input/__init__.py +0 -12
- build/lib/build/lib/clitt/core/tui/line_input/keyboard_input.py +0 -228
- build/lib/build/lib/clitt/core/tui/line_input/line_input.py +0 -43
- build/lib/build/lib/clitt/core/tui/mchoose/__init__.py +0 -12
- build/lib/build/lib/clitt/core/tui/mchoose/mchoose.py +0 -44
- build/lib/build/lib/clitt/core/tui/mchoose/menu_choose.py +0 -200
- build/lib/build/lib/clitt/core/tui/mdashboard/__init__.py +0 -14
- build/lib/build/lib/clitt/core/tui/mdashboard/dashboard_builder.py +0 -54
- build/lib/build/lib/clitt/core/tui/mdashboard/dashboard_item.py +0 -31
- build/lib/build/lib/clitt/core/tui/mdashboard/mdashboard.py +0 -26
- build/lib/build/lib/clitt/core/tui/mdashboard/menu_dashboard.py +0 -154
- build/lib/build/lib/clitt/core/tui/menu/__init__.py +0 -16
- build/lib/build/lib/clitt/core/tui/menu/tui_menu.py +0 -111
- build/lib/build/lib/clitt/core/tui/menu/tui_menu_action.py +0 -47
- build/lib/build/lib/clitt/core/tui/menu/tui_menu_factory.py +0 -117
- build/lib/build/lib/clitt/core/tui/menu/tui_menu_item.py +0 -196
- build/lib/build/lib/clitt/core/tui/menu/tui_menu_ui.py +0 -98
- build/lib/build/lib/clitt/core/tui/menu/tui_menu_view.py +0 -57
- build/lib/build/lib/clitt/core/tui/minput/__init__.py +0 -19
- build/lib/build/lib/clitt/core/tui/minput/access_type.py +0 -26
- build/lib/build/lib/clitt/core/tui/minput/field_builder.py +0 -117
- build/lib/build/lib/clitt/core/tui/minput/form_builder.py +0 -72
- build/lib/build/lib/clitt/core/tui/minput/form_field.py +0 -180
- build/lib/build/lib/clitt/core/tui/minput/input_type.py +0 -30
- build/lib/build/lib/clitt/core/tui/minput/input_validator.py +0 -98
- build/lib/build/lib/clitt/core/tui/minput/menu_input.py +0 -292
- build/lib/build/lib/clitt/core/tui/minput/minput.py +0 -44
- build/lib/build/lib/clitt/core/tui/minput/minput_utils.py +0 -156
- build/lib/build/lib/clitt/core/tui/mselect/__init__.py +0 -12
- build/lib/build/lib/clitt/core/tui/mselect/menu_select.py +0 -171
- build/lib/build/lib/clitt/core/tui/mselect/mselect.py +0 -36
- build/lib/build/lib/clitt/core/tui/table/__init__.py +0 -12
- build/lib/build/lib/clitt/core/tui/table/table_enums.py +0 -47
- build/lib/build/lib/clitt/core/tui/table/table_renderer.py +0 -339
- build/lib/build/lib/clitt/core/tui/tui_application.py +0 -65
- build/lib/build/lib/clitt/core/tui/tui_component.py +0 -155
- build/lib/build/lib/clitt/core/tui/tui_preferences.py +0 -103
- build/lib/build/lib/clitt/utils/__init__.py +0 -11
- build/lib/build/lib/clitt/utils/git_utils.py +0 -66
- build/lib/clitt/__classpath__.py +0 -28
- build/lib/clitt/__init__.py +0 -13
- build/lib/clitt/__main__.py +0 -139
- build/lib/clitt/addons/__init__.py +0 -12
- build/lib/clitt/addons/appman/__init__.py +0 -13
- build/lib/clitt/addons/appman/appman.py +0 -305
- build/lib/clitt/addons/appman/appman_enums.py +0 -39
- build/lib/clitt/addons/appman/templates/__init__.py +0 -11
- build/lib/clitt/addons/widman/__init__.py +0 -14
- build/lib/clitt/addons/widman/widget.py +0 -70
- build/lib/clitt/addons/widman/widget_entry.py +0 -54
- build/lib/clitt/addons/widman/widgets/__init__.py +0 -14
- build/lib/clitt/addons/widman/widgets/widget_free.py +0 -110
- build/lib/clitt/addons/widman/widgets/widget_punch.py +0 -246
- build/lib/clitt/addons/widman/widgets/widget_send_msg.py +0 -272
- build/lib/clitt/addons/widman/widgets/widget_time_calc.py +0 -146
- build/lib/clitt/addons/widman/widman.py +0 -123
- build/lib/clitt/core/__init__.py +0 -15
- build/lib/clitt/core/exception/__init__.py +0 -11
- build/lib/clitt/core/exception/exceptions.py +0 -18
- build/lib/clitt/core/icons/__init__.py +0 -12
- build/lib/clitt/core/icons/emojis/__init__.py +0 -12
- build/lib/clitt/core/icons/emojis/emojis.py +0 -41
- build/lib/clitt/core/icons/emojis/face_smiling.py +0 -40
- build/lib/clitt/core/icons/font_awesome/__init__.py +0 -18
- build/lib/clitt/core/icons/font_awesome/app_icons.py +0 -55
- build/lib/clitt/core/icons/font_awesome/awesome.py +0 -76
- build/lib/clitt/core/icons/font_awesome/dashboard_icons.py +0 -93
- build/lib/clitt/core/icons/font_awesome/form_icons.py +0 -69
- build/lib/clitt/core/icons/font_awesome/game_icons.py +0 -59
- build/lib/clitt/core/icons/font_awesome/nav_icons.py +0 -42
- build/lib/clitt/core/icons/font_awesome/trickplay_icons.py +0 -39
- build/lib/clitt/core/icons/font_awesome/widget_icons.py +0 -37
- build/lib/clitt/core/preferences.py +0 -87
- build/lib/clitt/core/term/__init__.py +0 -14
- build/lib/clitt/core/term/commons.py +0 -82
- build/lib/clitt/core/term/cursor.py +0 -159
- build/lib/clitt/core/term/screen.py +0 -91
- build/lib/clitt/core/term/terminal.py +0 -203
- build/lib/clitt/core/tui/__init__.py +0 -20
- build/lib/clitt/core/tui/line_input/__init__.py +0 -12
- build/lib/clitt/core/tui/line_input/keyboard_input.py +0 -228
- build/lib/clitt/core/tui/line_input/line_input.py +0 -43
- build/lib/clitt/core/tui/mchoose/__init__.py +0 -12
- build/lib/clitt/core/tui/mchoose/mchoose.py +0 -44
- build/lib/clitt/core/tui/mchoose/menu_choose.py +0 -200
- build/lib/clitt/core/tui/mdashboard/__init__.py +0 -14
- build/lib/clitt/core/tui/mdashboard/dashboard_builder.py +0 -54
- build/lib/clitt/core/tui/mdashboard/dashboard_item.py +0 -31
- build/lib/clitt/core/tui/mdashboard/mdashboard.py +0 -26
- build/lib/clitt/core/tui/mdashboard/menu_dashboard.py +0 -154
- build/lib/clitt/core/tui/menu/__init__.py +0 -16
- build/lib/clitt/core/tui/menu/tui_menu.py +0 -111
- build/lib/clitt/core/tui/menu/tui_menu_action.py +0 -47
- build/lib/clitt/core/tui/menu/tui_menu_factory.py +0 -117
- build/lib/clitt/core/tui/menu/tui_menu_item.py +0 -196
- build/lib/clitt/core/tui/menu/tui_menu_ui.py +0 -98
- build/lib/clitt/core/tui/menu/tui_menu_view.py +0 -57
- build/lib/clitt/core/tui/minput/__init__.py +0 -19
- build/lib/clitt/core/tui/minput/access_type.py +0 -26
- build/lib/clitt/core/tui/minput/field_builder.py +0 -117
- build/lib/clitt/core/tui/minput/form_builder.py +0 -72
- build/lib/clitt/core/tui/minput/form_field.py +0 -180
- build/lib/clitt/core/tui/minput/input_type.py +0 -30
- build/lib/clitt/core/tui/minput/input_validator.py +0 -98
- build/lib/clitt/core/tui/minput/menu_input.py +0 -292
- build/lib/clitt/core/tui/minput/minput.py +0 -44
- build/lib/clitt/core/tui/minput/minput_utils.py +0 -156
- build/lib/clitt/core/tui/mselect/__init__.py +0 -12
- build/lib/clitt/core/tui/mselect/menu_select.py +0 -171
- build/lib/clitt/core/tui/mselect/mselect.py +0 -36
- build/lib/clitt/core/tui/table/__init__.py +0 -12
- build/lib/clitt/core/tui/table/table_enums.py +0 -47
- build/lib/clitt/core/tui/table/table_renderer.py +0 -339
- build/lib/clitt/core/tui/tui_application.py +0 -65
- build/lib/clitt/core/tui/tui_component.py +0 -155
- build/lib/clitt/core/tui/tui_preferences.py +0 -103
- build/lib/clitt/utils/__init__.py +0 -11
- build/lib/clitt/utils/git_utils.py +0 -66
- hspylib_clitt-0.9.116.dist-info/RECORD +0 -413
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
|
-
"""
|
|
5
|
-
@project: HsPyLib
|
|
6
|
-
@package: clitt.core.tui.menu
|
|
7
|
-
@file: tui_menu_ui.py
|
|
8
|
-
@created: Tue, 4 May 2021
|
|
9
|
-
@author: <B>H</B>ugo <B>S</B>aporetti <B>J</B>unior"
|
|
10
|
-
@site: https://github.com/yorevs/hspylib
|
|
11
|
-
@license: MIT - Please refer to <https://opensource.org/licenses/MIT>
|
|
12
|
-
|
|
13
|
-
Copyright·(c)·2024,·HSPyLib
|
|
14
|
-
"""
|
|
15
|
-
from clitt.core.term.terminal import Terminal
|
|
16
|
-
from clitt.core.tui.menu.tui_menu import TUIMenu
|
|
17
|
-
from clitt.core.tui.tui_preferences import TUIPreferences
|
|
18
|
-
from hspylib.core.metaclass.singleton import Singleton
|
|
19
|
-
from hspylib.core.preconditions import check_not_none
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class TUIMenuUi(metaclass=Singleton):
|
|
23
|
-
"""Provide a menu for terminal UIs. Each sub-item must belong to the TUIMenu class and can be an instance of
|
|
24
|
-
TUIMenuItem, TUIMenuAction or TUIMenuView.
|
|
25
|
-
"""
|
|
26
|
-
|
|
27
|
-
APP_TITLE = "Main Menu"
|
|
28
|
-
|
|
29
|
-
# fmt: off
|
|
30
|
-
PREFS = TUIPreferences.INSTANCE
|
|
31
|
-
|
|
32
|
-
SCREEN = Terminal.INSTANCE.screen
|
|
33
|
-
|
|
34
|
-
MENU_LINE = f"{'--' * PREFS.title_line_length}"
|
|
35
|
-
|
|
36
|
-
MENU_TITLE_FMT = (
|
|
37
|
-
f"{PREFS.title_color}"
|
|
38
|
-
f"+{MENU_LINE}+%EOL%"
|
|
39
|
-
"|{title:^" + str(2 * PREFS.title_line_length) + "s}|%EOL%"
|
|
40
|
-
f"+{MENU_LINE}+%EOL%%NC%"
|
|
41
|
-
)
|
|
42
|
-
# fmt: on
|
|
43
|
-
|
|
44
|
-
@classmethod
|
|
45
|
-
def render_app_title(cls, app_title: str = None) -> None:
|
|
46
|
-
"""Render the application title."""
|
|
47
|
-
cls.SCREEN.clear()
|
|
48
|
-
cls.SCREEN.cursor.writeln(cls.MENU_TITLE_FMT.format(title=app_title or cls.APP_TITLE))
|
|
49
|
-
|
|
50
|
-
@staticmethod
|
|
51
|
-
def back(source: TUIMenu) -> TUIMenu:
|
|
52
|
-
"""Return the parent menu from the source of the event.
|
|
53
|
-
:param source: the source menu of the event.
|
|
54
|
-
"""
|
|
55
|
-
return source.parent
|
|
56
|
-
|
|
57
|
-
def __init__(self, main_menu: TUIMenu, title: str = "Main Menu"):
|
|
58
|
-
check_not_none(main_menu)
|
|
59
|
-
super().__init__()
|
|
60
|
-
TUIMenuUi.APP_TITLE = title
|
|
61
|
-
self._done: bool = False
|
|
62
|
-
self._curr_menu: TUIMenu = main_menu
|
|
63
|
-
self._prev_menu = None
|
|
64
|
-
self._next_menu = None
|
|
65
|
-
|
|
66
|
-
def execute(self) -> None:
|
|
67
|
-
"""Execute the terminal menu UI flow."""
|
|
68
|
-
|
|
69
|
-
self._prepare_render()
|
|
70
|
-
|
|
71
|
-
while not self._done:
|
|
72
|
-
if self._curr_menu:
|
|
73
|
-
self._next_menu = self._curr_menu.execute()
|
|
74
|
-
if self._next_menu:
|
|
75
|
-
self._change_menu(
|
|
76
|
-
self._next_menu
|
|
77
|
-
if isinstance(self._next_menu, TUIMenu)
|
|
78
|
-
else next((menu for menu in self._next_menu if menu), None)
|
|
79
|
-
)
|
|
80
|
-
else:
|
|
81
|
-
self._done = True
|
|
82
|
-
else:
|
|
83
|
-
self._done = True
|
|
84
|
-
|
|
85
|
-
def _prepare_render(self, auto_wrap: bool = True, show_cursor: bool = False, clear_screen: bool = True) -> None:
|
|
86
|
-
"""Prepare the screen for renderization."""
|
|
87
|
-
Terminal.set_auto_wrap(auto_wrap)
|
|
88
|
-
Terminal.set_show_cursor(show_cursor)
|
|
89
|
-
if clear_screen:
|
|
90
|
-
self.SCREEN.clear()
|
|
91
|
-
self.SCREEN.cursor.save()
|
|
92
|
-
|
|
93
|
-
def _change_menu(self, new_menu: TUIMenu) -> None:
|
|
94
|
-
"""Change the current menu and keep track about the previous one.
|
|
95
|
-
:param new_menu: the menu to be changed to.
|
|
96
|
-
"""
|
|
97
|
-
self._prev_menu = self._curr_menu
|
|
98
|
-
self._curr_menu = new_menu
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
|
-
"""
|
|
5
|
-
@project: HsPyLib
|
|
6
|
-
@package: clitt.core.tui.menu
|
|
7
|
-
@file: tui_menu_view.py
|
|
8
|
-
@created: Tue, 4 May 2021
|
|
9
|
-
@author: <B>H</B>ugo <B>S</B>aporetti <B>J</B>unior"
|
|
10
|
-
@site: https://github.com/yorevs/hspylib
|
|
11
|
-
@license: MIT - Please refer to <https://opensource.org/licenses/MIT>
|
|
12
|
-
|
|
13
|
-
Copyright·(c)·2024,·HSPyLib
|
|
14
|
-
"""
|
|
15
|
-
from clitt.core.term.commons import Direction
|
|
16
|
-
from clitt.core.tui.menu.tui_menu import OnTrigger_Cb, TUIMenu
|
|
17
|
-
from clitt.core.tui.menu.tui_menu_ui import TUIMenuUi
|
|
18
|
-
from typing import Callable, Optional
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
class TUIMenuView(TUIMenu):
|
|
22
|
-
"""Represent a menu view without submenus. Each view can have a view to be displayed. If no view is provided, it
|
|
23
|
-
will behave like an action.
|
|
24
|
-
"""
|
|
25
|
-
|
|
26
|
-
def __init__(
|
|
27
|
-
self,
|
|
28
|
-
parent: TUIMenu,
|
|
29
|
-
title: Optional[str] = None,
|
|
30
|
-
tooltip: Optional[str] = None,
|
|
31
|
-
display_text: Optional[str] = None,
|
|
32
|
-
):
|
|
33
|
-
super().__init__(parent, title or "Menu View", tooltip or f"Access the '{title}' view")
|
|
34
|
-
self._on_render: OnTrigger_Cb = self._display_content
|
|
35
|
-
self._content: str = display_text or f"%ED0%This is a view: {self.title}"
|
|
36
|
-
|
|
37
|
-
def on_render(self, on_render: str | OnTrigger_Cb) -> None:
|
|
38
|
-
if isinstance(on_render, str):
|
|
39
|
-
self._content = on_render
|
|
40
|
-
self._on_render = self._display_content
|
|
41
|
-
elif isinstance(on_render, Callable):
|
|
42
|
-
self._on_render = on_render
|
|
43
|
-
self._content = f"This is a view: {self.title}"
|
|
44
|
-
|
|
45
|
-
def execute(self) -> Optional[TUIMenu]:
|
|
46
|
-
self.render()
|
|
47
|
-
return self._on_trigger(self)
|
|
48
|
-
|
|
49
|
-
def render(self) -> None:
|
|
50
|
-
TUIMenuUi.render_app_title()
|
|
51
|
-
self._on_render()
|
|
52
|
-
self.draw_navbar(self.navbar())
|
|
53
|
-
|
|
54
|
-
def _display_content(self) -> None:
|
|
55
|
-
self.cursor.erase(Direction.DOWN)
|
|
56
|
-
self.writeln(self._content)
|
|
57
|
-
self.wait_keystroke()
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# _*_ coding: utf-8 _*_
|
|
2
|
-
#
|
|
3
|
-
# hspylib-clitt v0.9.116
|
|
4
|
-
#
|
|
5
|
-
# Package: main.build.lib.build.lib.build.lib.build.lib.clitt.core.tui.minput
|
|
6
|
-
"""Package initialization."""
|
|
7
|
-
|
|
8
|
-
__all__ = [
|
|
9
|
-
'access_type',
|
|
10
|
-
'field_builder',
|
|
11
|
-
'form_builder',
|
|
12
|
-
'form_field',
|
|
13
|
-
'input_type',
|
|
14
|
-
'input_validator',
|
|
15
|
-
'menu_input',
|
|
16
|
-
'minput',
|
|
17
|
-
'minput_utils'
|
|
18
|
-
]
|
|
19
|
-
__version__ = '0.9.116'
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
|
-
"""
|
|
5
|
-
@project: HsPyLib
|
|
6
|
-
@package: clitt.core.tui.minput
|
|
7
|
-
@file: access_type.py
|
|
8
|
-
@created: Thu, 20 May 2021
|
|
9
|
-
@author: <B>H</B>ugo <B>S</B>aporetti <B>J</B>unior"
|
|
10
|
-
@site: https://github.com/yorevs/hspylib
|
|
11
|
-
@license: MIT - Please refer to <https://opensource.org/licenses/MIT>
|
|
12
|
-
|
|
13
|
-
Copyright·(c)·2024,·HSPyLib
|
|
14
|
-
"""
|
|
15
|
-
|
|
16
|
-
from hspylib.core.enums.enumeration import Enumeration
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
class AccessType(Enumeration):
|
|
20
|
-
"""MenuInput input field access types."""
|
|
21
|
-
|
|
22
|
-
# fmt: off
|
|
23
|
-
NO_ACCESS = "no-access"
|
|
24
|
-
READ_ONLY = "read-only"
|
|
25
|
-
READ_WRITE = "read-write"
|
|
26
|
-
# fmt: on
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
|
-
"""
|
|
5
|
-
@project: HsPyLib
|
|
6
|
-
@package: clitt.core.tui.minput
|
|
7
|
-
@file: field_builder.py
|
|
8
|
-
@created: Thu, 20 May 2021
|
|
9
|
-
@author: <B>H</B>ugo <B>S</B>aporetti <B>J</B>unior"
|
|
10
|
-
@site: https://github.com/yorevs/hspylib
|
|
11
|
-
@license: MIT - Please refer to <https://opensource.org/licenses/MIT>
|
|
12
|
-
|
|
13
|
-
Copyright·(c)·2024,·HSPyLib
|
|
14
|
-
"""
|
|
15
|
-
from clitt.core.tui.minput.access_type import AccessType
|
|
16
|
-
from clitt.core.tui.minput.form_field import FieldValidator_Fn, FormField
|
|
17
|
-
from clitt.core.tui.minput.input_type import InputType
|
|
18
|
-
from clitt.core.tui.minput.input_validator import InputValidator
|
|
19
|
-
from clitt.core.tui.minput.minput_utils import get_selected, MASK_SYMBOLS, unpack_masked, VALUE_SEPARATORS
|
|
20
|
-
from functools import reduce
|
|
21
|
-
from hspylib.core.preconditions import check_argument
|
|
22
|
-
from hspylib.core.tools.commons import to_bool
|
|
23
|
-
from hspylib.core.tools.text_tools import snakecase
|
|
24
|
-
from operator import add
|
|
25
|
-
from typing import Any
|
|
26
|
-
|
|
27
|
-
import re
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
class FieldBuilder:
|
|
31
|
-
"""MenuInput form field builder."""
|
|
32
|
-
|
|
33
|
-
@staticmethod
|
|
34
|
-
def _validate_field(field: FormField) -> bool:
|
|
35
|
-
match field.itype:
|
|
36
|
-
case InputType.MASKED:
|
|
37
|
-
value, mask = unpack_masked(field.value)
|
|
38
|
-
valid = reduce(add, list(map(mask[len(value) :].count, MASK_SYMBOLS))) == 0
|
|
39
|
-
case InputType.CHECKBOX:
|
|
40
|
-
valid = isinstance(field.value, bool)
|
|
41
|
-
case InputType.SELECT:
|
|
42
|
-
_, value = get_selected(field.value)
|
|
43
|
-
length = len(str(value or ""))
|
|
44
|
-
valid = field.min_length <= length <= field.max_length
|
|
45
|
-
case _:
|
|
46
|
-
length = len(str(field.value or ""))
|
|
47
|
-
valid = field.min_length <= length <= field.max_length
|
|
48
|
-
return valid
|
|
49
|
-
|
|
50
|
-
def __init__(self, parent: Any):
|
|
51
|
-
self._parent = parent
|
|
52
|
-
self._label = "Label"
|
|
53
|
-
self._dest = None
|
|
54
|
-
self._itype = InputType.TEXT
|
|
55
|
-
self._access_type = AccessType.READ_WRITE
|
|
56
|
-
self._min_max_length = 5, 30
|
|
57
|
-
self._value = ""
|
|
58
|
-
self._validator = InputValidator.anything(), self._validate_field
|
|
59
|
-
|
|
60
|
-
def label(self, label: str) -> "FieldBuilder":
|
|
61
|
-
self._label = label
|
|
62
|
-
return self
|
|
63
|
-
|
|
64
|
-
def dest(self, dest: str) -> "FieldBuilder":
|
|
65
|
-
self._dest = dest
|
|
66
|
-
return self
|
|
67
|
-
|
|
68
|
-
def itype(self, itype: str) -> "FieldBuilder":
|
|
69
|
-
self._itype = InputType.of_value(itype)
|
|
70
|
-
return self
|
|
71
|
-
|
|
72
|
-
def min_max_length(self, min_length: int, max_length: int) -> "FieldBuilder":
|
|
73
|
-
check_argument(max_length >= min_length, "Invalid field length: ({}-{})", min_length, max_length)
|
|
74
|
-
check_argument(max_length > 0 and min_length >= 0, "Invalid field length: ({}-{})", min_length, max_length)
|
|
75
|
-
self._min_max_length = min_length, max_length
|
|
76
|
-
return self
|
|
77
|
-
|
|
78
|
-
def access_type(self, access_type: str) -> "FieldBuilder":
|
|
79
|
-
self._access_type = AccessType.of_value(access_type)
|
|
80
|
-
return self
|
|
81
|
-
|
|
82
|
-
def value(self, value: Any | None) -> "FieldBuilder":
|
|
83
|
-
self._value = value
|
|
84
|
-
return self
|
|
85
|
-
|
|
86
|
-
def validator(
|
|
87
|
-
self, input_validator: InputValidator = None, field_validator: FieldValidator_Fn = None
|
|
88
|
-
) -> "FieldBuilder":
|
|
89
|
-
self._validator = input_validator, field_validator or self._validate_field
|
|
90
|
-
return self
|
|
91
|
-
|
|
92
|
-
def build(self) -> Any:
|
|
93
|
-
if self._itype == InputType.CHECKBOX:
|
|
94
|
-
self._value = to_bool(str(self._value))
|
|
95
|
-
elif self._itype == InputType.SELECT:
|
|
96
|
-
parts = re.split(VALUE_SEPARATORS, re.sub("[<>]", "", str(self._value or "")))
|
|
97
|
-
self._min_max_length = len(min(parts, key=len)), len(max(parts, key=len))
|
|
98
|
-
elif self._itype == InputType.MASKED:
|
|
99
|
-
_, mask = unpack_masked(str(self._value))
|
|
100
|
-
min_max = reduce(add, list(map(mask.count, MASK_SYMBOLS)))
|
|
101
|
-
self._min_max_length = min_max, min_max
|
|
102
|
-
self._dest = self._dest or snakecase(self._label)
|
|
103
|
-
self._parent.fields.append(
|
|
104
|
-
FormField(
|
|
105
|
-
self._label,
|
|
106
|
-
self._dest,
|
|
107
|
-
self._itype,
|
|
108
|
-
self._min_max_length[0],
|
|
109
|
-
self._min_max_length[1],
|
|
110
|
-
self._access_type,
|
|
111
|
-
self._value,
|
|
112
|
-
self._validator[0],
|
|
113
|
-
self._validator[1],
|
|
114
|
-
)
|
|
115
|
-
)
|
|
116
|
-
|
|
117
|
-
return self._parent
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
|
-
"""
|
|
5
|
-
@project: HsPyLib
|
|
6
|
-
@package: clitt.core.tui.minput
|
|
7
|
-
@file: form_builder.py
|
|
8
|
-
@created: Thu, 20 May 2021
|
|
9
|
-
@author: <B>H</B>ugo <B>S</B>aporetti <B>J</B>unior"
|
|
10
|
-
@site: https://github.com/yorevs/hspylib
|
|
11
|
-
@license: MIT - Please refer to <https://opensource.org/licenses/MIT>
|
|
12
|
-
|
|
13
|
-
Copyright·(c)·2024,·HSPyLib
|
|
14
|
-
"""
|
|
15
|
-
from clitt.core.tui.minput.field_builder import FieldBuilder
|
|
16
|
-
from clitt.core.tui.minput.form_field import FormField
|
|
17
|
-
from clitt.core.tui.minput.input_validator import InputValidator
|
|
18
|
-
from hspylib.core.tools.dict_tools import get_or_default
|
|
19
|
-
from typing import Any, List
|
|
20
|
-
|
|
21
|
-
import re
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class FormBuilder:
|
|
25
|
-
"""MenuInput form builder."""
|
|
26
|
-
|
|
27
|
-
def __init__(self) -> None:
|
|
28
|
-
self.fields = []
|
|
29
|
-
self._fn_validate = None
|
|
30
|
-
|
|
31
|
-
@staticmethod
|
|
32
|
-
def get_attr(parts: List[str], index: int, default_value: Any = None) -> str:
|
|
33
|
-
return get_or_default(parts, index, default_value) or default_value
|
|
34
|
-
|
|
35
|
-
def from_tokenized(self, minput_tokens: List[str], separator: chr = "|") -> "FormBuilder":
|
|
36
|
-
"""Construct the forms based on string tokens.
|
|
37
|
-
|
|
38
|
-
Field tokens (in-order):
|
|
39
|
-
<Label> : The field label. Consisting only of alphanumeric characters and under‐scores.
|
|
40
|
-
[Mode] : The input mode. One of {[text]|password|checkbox|select}.
|
|
41
|
-
[Type] : The input type. One of {letters|numbers|words|[anything]}.
|
|
42
|
-
[Min/Max len] : The minimum and maximum length of characters allowed. Defaults to [0/30].
|
|
43
|
-
[Perm] : The field permissions. One of {r|[rw]}. Where \"r\" for Read Only ; \"rw\" for Read & Write.
|
|
44
|
-
[Value] : The initial value of the field. This field may not be blank if the field is read only.
|
|
45
|
-
"""
|
|
46
|
-
for tk_field in minput_tokens:
|
|
47
|
-
parts = list(map(str.strip, tk_field.split(separator)))
|
|
48
|
-
validator_fn = getattr(InputValidator, self.get_attr(parts, 2, "anything"))
|
|
49
|
-
min_max = list(map(int, map(str.strip, self.get_attr(parts, 3, "5/30").split("/"))))
|
|
50
|
-
access = re.sub("^rw$", "read-write", self.get_attr(parts, 4, "rw"))
|
|
51
|
-
access = re.sub("^r$", "read-only", access)
|
|
52
|
-
# fmt: off
|
|
53
|
-
self.field() \
|
|
54
|
-
.label(self.get_attr(parts, 0, 'Label')) \
|
|
55
|
-
.itype(self.get_attr(parts, 1, 'text')) \
|
|
56
|
-
.min_max_length(
|
|
57
|
-
get_or_default(min_max, 0, 5),
|
|
58
|
-
get_or_default(min_max, 1, 30)
|
|
59
|
-
) \
|
|
60
|
-
.access_type(access) \
|
|
61
|
-
.validator(validator_fn()) \
|
|
62
|
-
.value(self.get_attr(parts, 5, None)) \
|
|
63
|
-
.build()
|
|
64
|
-
# fmt: on
|
|
65
|
-
|
|
66
|
-
return self
|
|
67
|
-
|
|
68
|
-
def field(self) -> Any:
|
|
69
|
-
return FieldBuilder(self)
|
|
70
|
-
|
|
71
|
-
def build(self) -> List[FormField]:
|
|
72
|
-
return self.fields
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
|
-
"""
|
|
5
|
-
@project: HsPyLib
|
|
6
|
-
@package: clitt.core.tui.minput
|
|
7
|
-
@file: form_field.py
|
|
8
|
-
@created: Thu, 20 May 2021
|
|
9
|
-
@author: <B>H</B>ugo <B>S</B>aporetti <B>J</B>unior"
|
|
10
|
-
@site: https://github.com/yorevs/hspylib
|
|
11
|
-
@license: MIT - Please refer to <https://opensource.org/licenses/MIT>
|
|
12
|
-
|
|
13
|
-
Copyright·(c)·2024,·HSPyLib
|
|
14
|
-
"""
|
|
15
|
-
from clitt.core.icons.font_awesome.form_icons import FormIcons
|
|
16
|
-
from clitt.core.tui.minput.access_type import AccessType
|
|
17
|
-
from clitt.core.tui.minput.input_type import InputType
|
|
18
|
-
from clitt.core.tui.minput.input_validator import InputValidator
|
|
19
|
-
from clitt.core.tui.minput.minput_utils import get_selected, MASK_SYMBOLS, toggle_selected, unpack_masked
|
|
20
|
-
from hspylib.core.exception.exceptions import InvalidInputError
|
|
21
|
-
from hspylib.core.tools.text_tools import xstr
|
|
22
|
-
from typing import Any, Callable, Optional, TypeAlias
|
|
23
|
-
|
|
24
|
-
FieldValidator_Fn: TypeAlias = Callable[["FormField"], bool]
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
class FormField:
|
|
28
|
-
"""Represent a MenuInput form field."""
|
|
29
|
-
|
|
30
|
-
def __init__(
|
|
31
|
-
self,
|
|
32
|
-
label: str = None,
|
|
33
|
-
dest: str = None,
|
|
34
|
-
itype: InputType = InputType.TEXT,
|
|
35
|
-
min_length: int = 5,
|
|
36
|
-
max_length: int = 30,
|
|
37
|
-
access_type: AccessType = AccessType.READ_WRITE,
|
|
38
|
-
value: Any = "",
|
|
39
|
-
input_validator: InputValidator = InputValidator.anything(),
|
|
40
|
-
field_validator: FieldValidator_Fn = None,
|
|
41
|
-
tooltip: str = None,
|
|
42
|
-
):
|
|
43
|
-
self._label = label
|
|
44
|
-
self._tooltip = tooltip
|
|
45
|
-
self._dest = dest
|
|
46
|
-
self._itype = itype
|
|
47
|
-
self._min_length = min_length
|
|
48
|
-
self._max_length = max_length
|
|
49
|
-
self._access_type = access_type
|
|
50
|
-
self.input_validator = input_validator
|
|
51
|
-
self.field_validator = field_validator
|
|
52
|
-
self._value = self.assign(value)
|
|
53
|
-
|
|
54
|
-
def __str__(self) -> str:
|
|
55
|
-
return (
|
|
56
|
-
f"[{self.label}, {self.itype.name}({self.min_length}/{self.max_length})"
|
|
57
|
-
f"<{self.access_type}> = '{self.value or ''}']"
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
def __repr__(self):
|
|
61
|
-
return str(self)
|
|
62
|
-
|
|
63
|
-
@property
|
|
64
|
-
def label(self) -> str:
|
|
65
|
-
return self._label
|
|
66
|
-
|
|
67
|
-
@property
|
|
68
|
-
def tooltip(self) -> str:
|
|
69
|
-
return self._tooltip
|
|
70
|
-
|
|
71
|
-
@property
|
|
72
|
-
def dest(self) -> str:
|
|
73
|
-
return self._dest
|
|
74
|
-
|
|
75
|
-
@property
|
|
76
|
-
def itype(self) -> InputType:
|
|
77
|
-
return self._itype
|
|
78
|
-
|
|
79
|
-
@property
|
|
80
|
-
def min_length(self) -> int:
|
|
81
|
-
return self._min_length
|
|
82
|
-
|
|
83
|
-
@property
|
|
84
|
-
def max_length(self) -> int:
|
|
85
|
-
return self._max_length
|
|
86
|
-
|
|
87
|
-
@property
|
|
88
|
-
def access_type(self) -> AccessType:
|
|
89
|
-
return self._access_type
|
|
90
|
-
|
|
91
|
-
@property
|
|
92
|
-
def value(self) -> Optional[Any]:
|
|
93
|
-
return self._value
|
|
94
|
-
|
|
95
|
-
@value.setter
|
|
96
|
-
def value(self, new_value: Any) -> None:
|
|
97
|
-
self._value = self.assign(new_value)
|
|
98
|
-
|
|
99
|
-
@property
|
|
100
|
-
def length(self) -> int:
|
|
101
|
-
"""Get the field real length, depending on the field type."""
|
|
102
|
-
real_value = str(self.value or "")
|
|
103
|
-
match self.itype:
|
|
104
|
-
case InputType.CHECKBOX:
|
|
105
|
-
real_value = "1"
|
|
106
|
-
case InputType.SELECT:
|
|
107
|
-
_, real_value = get_selected(str(self.value))
|
|
108
|
-
case InputType.MASKED:
|
|
109
|
-
real_value, mask = unpack_masked(str(self.value))
|
|
110
|
-
idx = len(real_value)
|
|
111
|
-
while idx < len(mask) and mask[idx] not in MASK_SYMBOLS:
|
|
112
|
-
idx += 1
|
|
113
|
-
return idx
|
|
114
|
-
|
|
115
|
-
return len(real_value)
|
|
116
|
-
|
|
117
|
-
@property
|
|
118
|
-
def icon(self) -> FormIcons:
|
|
119
|
-
if self.access_type == AccessType.READ_ONLY:
|
|
120
|
-
return FormIcons.LOCKED
|
|
121
|
-
match self.itype:
|
|
122
|
-
case InputType.PASSWORD:
|
|
123
|
-
icon = FormIcons.HIDDEN
|
|
124
|
-
case InputType.CHECKBOX:
|
|
125
|
-
icon = FormIcons.MARKED
|
|
126
|
-
case InputType.SELECT:
|
|
127
|
-
icon = FormIcons.SELECTABLE
|
|
128
|
-
case InputType.MASKED:
|
|
129
|
-
icon = FormIcons.MASKED
|
|
130
|
-
case InputType.TEXT:
|
|
131
|
-
if self.input_validator.pattern_type == InputValidator.PatternType.NUMBERS:
|
|
132
|
-
icon = FormIcons.NUMBERS
|
|
133
|
-
elif self.input_validator.pattern_type == InputValidator.PatternType.LETTERS:
|
|
134
|
-
icon = FormIcons.LETTERS
|
|
135
|
-
elif self.input_validator.pattern_type == InputValidator.PatternType.WORDS:
|
|
136
|
-
icon = FormIcons.WORDS
|
|
137
|
-
elif self.input_validator.pattern_type == InputValidator.PatternType.CUSTOM:
|
|
138
|
-
icon = FormIcons.CUSTOM
|
|
139
|
-
else:
|
|
140
|
-
icon = FormIcons.EDITABLE
|
|
141
|
-
case _:
|
|
142
|
-
icon = FormIcons.QUESTION_CIRCLE
|
|
143
|
-
return icon
|
|
144
|
-
|
|
145
|
-
def can_write(self) -> bool:
|
|
146
|
-
"""Whether this field value can be set or not."""
|
|
147
|
-
return self.access_type == AccessType.READ_WRITE
|
|
148
|
-
|
|
149
|
-
def assign(self, value: Any) -> Any:
|
|
150
|
-
"""Assign a value for this field. Must match the input validator, otherwise an exception will be thrown.
|
|
151
|
-
:param value: TODO
|
|
152
|
-
"""
|
|
153
|
-
valid = True
|
|
154
|
-
if value is not None and self.input_validator:
|
|
155
|
-
match self.itype:
|
|
156
|
-
case InputType.MASKED:
|
|
157
|
-
unpack_masked(value)
|
|
158
|
-
case InputType.SELECT:
|
|
159
|
-
toggle_selected(value)
|
|
160
|
-
case InputType.CHECKBOX:
|
|
161
|
-
valid = isinstance(value, bool)
|
|
162
|
-
case _:
|
|
163
|
-
valid = all(self.validate_input(val) for val in xstr(value))
|
|
164
|
-
|
|
165
|
-
if not valid:
|
|
166
|
-
raise InvalidInputError(f"Value {value} is invalid!")
|
|
167
|
-
|
|
168
|
-
self._value = value
|
|
169
|
-
|
|
170
|
-
return self._value
|
|
171
|
-
|
|
172
|
-
def validate_input(self, value: Any = None) -> bool:
|
|
173
|
-
"""Validate the input using the assigned validator.
|
|
174
|
-
:param value: the value to validate against.
|
|
175
|
-
"""
|
|
176
|
-
return self.input_validator(str(value)) if self.input_validator else True
|
|
177
|
-
|
|
178
|
-
def validate_field(self) -> bool:
|
|
179
|
-
"""Validate the field using the assigned validator function."""
|
|
180
|
-
return self.field_validator(self) if self.field_validator else False
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
|
-
"""
|
|
5
|
-
@project: HsPyLib
|
|
6
|
-
@package: clitt.core.tui.minput
|
|
7
|
-
@file: input_type.py
|
|
8
|
-
@created: Thu, 20 May 2021
|
|
9
|
-
@author: <B>H</B>ugo <B>S</B>aporetti <B>J</B>unior"
|
|
10
|
-
@site: https://github.com/yorevs/hspylib
|
|
11
|
-
@license: MIT - Please refer to <https://opensource.org/licenses/MIT>
|
|
12
|
-
|
|
13
|
-
Copyright·(c)·2024,·HSPyLib
|
|
14
|
-
"""
|
|
15
|
-
from hspylib.core.enums.enumeration import Enumeration
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class InputType(Enumeration):
|
|
19
|
-
"""MenuInput input field types."""
|
|
20
|
-
|
|
21
|
-
# fmt: off
|
|
22
|
-
TEXT = "text"
|
|
23
|
-
PASSWORD = "password"
|
|
24
|
-
CHECKBOX = "checkbox"
|
|
25
|
-
SELECT = "select"
|
|
26
|
-
MASKED = "masked"
|
|
27
|
-
# fmt: on
|
|
28
|
-
|
|
29
|
-
def __repr__(self):
|
|
30
|
-
return str(self)
|