hspylib-clitt 0.9.119__py3-none-any.whl → 0.9.121__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/__init__.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/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/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/tui/__init__.py +3 -3
- clitt/core/tui/line_input/__init__.py +3 -3
- clitt/core/tui/line_input/keyboard_input.py +85 -78
- clitt/core/tui/mchoose/__init__.py +3 -3
- clitt/core/tui/mdashboard/__init__.py +3 -3
- clitt/core/tui/menu/__init__.py +3 -3
- clitt/core/tui/minput/__init__.py +3 -3
- clitt/core/tui/minput/menu_input.py +7 -15
- clitt/core/tui/mselect/__init__.py +3 -3
- clitt/core/tui/table/__init__.py +3 -3
- clitt/utils/__init__.py +3 -3
- {hspylib_clitt-0.9.119.dist-info → hspylib_clitt-0.9.121.dist-info}/METADATA +2 -2
- hspylib_clitt-0.9.121.dist-info/RECORD +97 -0
- {hspylib_clitt-0.9.119.dist-info → hspylib_clitt-0.9.121.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 -19
- 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 -106
- build/lib/build/lib/build/lib/build/lib/clitt/core/term/cursor.py +0 -174
- build/lib/build/lib/build/lib/build/lib/clitt/core/term/screen.py +0 -106
- build/lib/build/lib/build/lib/build/lib/clitt/core/term/terminal.py +0 -202
- 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 -229
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/line_input/line_input.py +0 -31
- 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 -43
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/mchoose/menu_choose.py +0 -192
- 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 -148
- 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 -170
- 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 -52
- build/lib/build/lib/build/lib/build/lib/clitt/core/tui/tui_component.py +0 -154
- 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 -19
- 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 -106
- build/lib/build/lib/build/lib/clitt/core/term/cursor.py +0 -174
- build/lib/build/lib/build/lib/clitt/core/term/screen.py +0 -106
- build/lib/build/lib/build/lib/clitt/core/term/terminal.py +0 -202
- 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 -229
- build/lib/build/lib/build/lib/clitt/core/tui/line_input/line_input.py +0 -31
- 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 -43
- build/lib/build/lib/build/lib/clitt/core/tui/mchoose/menu_choose.py +0 -192
- 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 -148
- 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 -170
- 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 -52
- build/lib/build/lib/build/lib/clitt/core/tui/tui_component.py +0 -154
- 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 -19
- 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 -106
- build/lib/build/lib/clitt/core/term/cursor.py +0 -174
- build/lib/build/lib/clitt/core/term/screen.py +0 -106
- build/lib/build/lib/clitt/core/term/terminal.py +0 -202
- 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 -229
- build/lib/build/lib/clitt/core/tui/line_input/line_input.py +0 -31
- build/lib/build/lib/clitt/core/tui/mchoose/__init__.py +0 -12
- build/lib/build/lib/clitt/core/tui/mchoose/mchoose.py +0 -43
- build/lib/build/lib/clitt/core/tui/mchoose/menu_choose.py +0 -192
- 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 -148
- 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 -170
- 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 -52
- build/lib/build/lib/clitt/core/tui/tui_component.py +0 -154
- 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 -19
- 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 -106
- build/lib/clitt/core/term/cursor.py +0 -174
- build/lib/clitt/core/term/screen.py +0 -106
- build/lib/clitt/core/term/terminal.py +0 -202
- 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 -229
- build/lib/clitt/core/tui/line_input/line_input.py +0 -31
- build/lib/clitt/core/tui/mchoose/__init__.py +0 -12
- build/lib/clitt/core/tui/mchoose/mchoose.py +0 -43
- build/lib/clitt/core/tui/mchoose/menu_choose.py +0 -192
- 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 -148
- 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 -170
- 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 -52
- build/lib/clitt/core/tui/tui_component.py +0 -154
- 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.119.dist-info/RECORD +0 -413
- {hspylib_clitt-0.9.119.dist-info → hspylib_clitt-0.9.121.dist-info}/WHEEL +0 -0
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
|
-
"""
|
|
5
|
-
@project: HsPyLib
|
|
6
|
-
@package: hspylib.modules.cli.vt100
|
|
7
|
-
@file: terminal.py
|
|
8
|
-
@created: Tue, 11 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.exception.exceptions import NotATerminalError
|
|
16
|
-
from clitt.core.term.commons import is_a_tty
|
|
17
|
-
from clitt.core.term.cursor import Cursor
|
|
18
|
-
from clitt.core.term.screen import Screen
|
|
19
|
-
from hspylib.core.enums.charset import Charset
|
|
20
|
-
from hspylib.core.metaclass.singleton import Singleton
|
|
21
|
-
from hspylib.core.tools.commons import sysout
|
|
22
|
-
from hspylib.modules.application.exit_status import ExitStatus
|
|
23
|
-
from hspylib.modules.cli.keyboard import Keyboard
|
|
24
|
-
from hspylib.modules.cli.vt100.vt_100 import Vt100
|
|
25
|
-
from subprocess import CalledProcessError, PIPE, Popen
|
|
26
|
-
from typing import Any, Iterable, List, Optional, Tuple
|
|
27
|
-
|
|
28
|
-
import atexit
|
|
29
|
-
import logging as log
|
|
30
|
-
import os
|
|
31
|
-
import platform
|
|
32
|
-
import select
|
|
33
|
-
import shlex
|
|
34
|
-
import signal
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
class Terminal(metaclass=Singleton):
|
|
38
|
-
"""Utility class to provide terminal features."""
|
|
39
|
-
|
|
40
|
-
INSTANCE = None
|
|
41
|
-
|
|
42
|
-
@staticmethod
|
|
43
|
-
def is_a_tty() -> bool:
|
|
44
|
-
return is_a_tty()
|
|
45
|
-
|
|
46
|
-
@staticmethod
|
|
47
|
-
def _chain_pipes(cmd_list: Iterable, **kwargs) -> Popen:
|
|
48
|
-
"""Run commands in PIPE, return the last process in chain.
|
|
49
|
-
:param cmd_list: the command list to be executed.
|
|
50
|
-
"""
|
|
51
|
-
if "stdout" in kwargs:
|
|
52
|
-
del kwargs["stdout"]
|
|
53
|
-
if "stderr" in kwargs:
|
|
54
|
-
del kwargs["stderr"]
|
|
55
|
-
if "stdin" in kwargs:
|
|
56
|
-
del kwargs["stdin"]
|
|
57
|
-
commands = map(shlex.split, cmd_list) if "shell" not in kwargs else cmd_list
|
|
58
|
-
first_cmd, *rest_cmds = commands
|
|
59
|
-
if len(rest_cmds) > 0:
|
|
60
|
-
procs: List[Popen] = [Popen(first_cmd, stdout=PIPE, stderr=PIPE, **kwargs)]
|
|
61
|
-
for cmd in rest_cmds:
|
|
62
|
-
last_stdout = procs[-1].stdout
|
|
63
|
-
procs.append(Popen(cmd, stdin=last_stdout, stdout=PIPE, stderr=PIPE, **kwargs))
|
|
64
|
-
return procs[-1]
|
|
65
|
-
return Popen(first_cmd, stdout=PIPE, stderr=PIPE, **kwargs)
|
|
66
|
-
|
|
67
|
-
@staticmethod
|
|
68
|
-
def shell_exec(cmd_line: str, **kwargs) -> Tuple[Optional[str], ExitStatus]:
|
|
69
|
-
"""Execute command with arguments and return it's run status.
|
|
70
|
-
:param cmd_line: the command line to be executed.
|
|
71
|
-
"""
|
|
72
|
-
proc = Terminal._chain_pipes(cmd_line.split("|"), **kwargs)
|
|
73
|
-
log.info("Executing shell command: %s", cmd_line)
|
|
74
|
-
output, err_out = proc.communicate()
|
|
75
|
-
ret_code = ExitStatus.FAILED if err_out else ExitStatus.SUCCESS
|
|
76
|
-
log.info("Execution result: %s", ret_code)
|
|
77
|
-
return output.decode(Charset.UTF_8.val) if output else err_out.decode(Charset.UTF_8.val), ret_code
|
|
78
|
-
|
|
79
|
-
@staticmethod
|
|
80
|
-
def shell_poll(cmd_line: str, **kwargs) -> None:
|
|
81
|
-
"""Execute command with arguments and continuously poll it's output.
|
|
82
|
-
:param cmd_line: the command line to be executed.
|
|
83
|
-
"""
|
|
84
|
-
if "stdout" in kwargs:
|
|
85
|
-
del kwargs["stdout"] # Deleted because it's forbidden
|
|
86
|
-
if "stderr" in kwargs:
|
|
87
|
-
del kwargs["stderr"] # Deleted because it's forbidden
|
|
88
|
-
if "shell" in kwargs:
|
|
89
|
-
del kwargs["shell"] # Deleted because we don't want to use it
|
|
90
|
-
try:
|
|
91
|
-
log.info("Polling shell command: %s", cmd_line)
|
|
92
|
-
cmd_args = list(filter(None, shlex.split(cmd_line)))
|
|
93
|
-
with Popen(cmd_args, stdout=PIPE, stderr=PIPE, **kwargs) as proc:
|
|
94
|
-
process = select.poll()
|
|
95
|
-
process.register(proc.stdout)
|
|
96
|
-
process.register(proc.stderr)
|
|
97
|
-
while not Keyboard.kbhit():
|
|
98
|
-
if poll_obj := process.poll(0.5):
|
|
99
|
-
line = proc.stdout.readline()
|
|
100
|
-
sysout(line.decode(Charset.UTF_8.val) if isinstance(line, bytes) else line.strip(), end="")
|
|
101
|
-
log.debug("Polling returned: %s", str(poll_obj))
|
|
102
|
-
os.killpg(os.getpgid(proc.pid), signal.SIGTERM)
|
|
103
|
-
except (InterruptedError, KeyboardInterrupt):
|
|
104
|
-
log.warning("Polling process has been interrupted command='%s'", cmd_line)
|
|
105
|
-
except CalledProcessError as err:
|
|
106
|
-
log.error("Command failed: %s => %s", cmd_line, err)
|
|
107
|
-
|
|
108
|
-
@staticmethod
|
|
109
|
-
def open(filename: str) -> None:
|
|
110
|
-
"""Open the specified file using the default editor."""
|
|
111
|
-
my_os = os.environ.get("HHS_MY_OS", platform.system())
|
|
112
|
-
if "Darwin" == my_os:
|
|
113
|
-
Terminal.shell_exec(f"open {filename}")
|
|
114
|
-
elif "Linux" == my_os:
|
|
115
|
-
Terminal.shell_exec(f"xdg-open {filename}")
|
|
116
|
-
else:
|
|
117
|
-
raise NotImplementedError(f"OS '{my_os}' is not supported")
|
|
118
|
-
|
|
119
|
-
@classmethod
|
|
120
|
-
def restore(cls) -> None:
|
|
121
|
-
"""Clear the terminal and restore default attributes [wrap,cursor,echo]."""
|
|
122
|
-
cls.set_attributes(show_cursor=True, auto_wrap=True, enable_echo=True)
|
|
123
|
-
cls.alternate_screen(False)
|
|
124
|
-
sysout("%MOD(0)%", end="")
|
|
125
|
-
|
|
126
|
-
@classmethod
|
|
127
|
-
def set_enable_echo(cls, enabled: bool = True) -> None:
|
|
128
|
-
"""Enable echo in the terminal.
|
|
129
|
-
:param enabled: whether is enabled or not.
|
|
130
|
-
"""
|
|
131
|
-
if not cls.is_a_tty():
|
|
132
|
-
log.warning(NotATerminalError("set_enable_echo:: Requires a terminal (TTY)"))
|
|
133
|
-
return
|
|
134
|
-
|
|
135
|
-
os.popen(f"stty {'echo -raw' if enabled else 'raw -echo min 0'}").read()
|
|
136
|
-
|
|
137
|
-
@classmethod
|
|
138
|
-
def set_auto_wrap(cls, auto_wrap: bool = True) -> None:
|
|
139
|
-
"""Set auto-wrap mode in the terminal.
|
|
140
|
-
:param auto_wrap: whether auto_wrap is set or not.
|
|
141
|
-
"""
|
|
142
|
-
if not cls.is_a_tty():
|
|
143
|
-
log.warning(NotATerminalError("set_auto_wrap:: Requires a terminal (TTY)"))
|
|
144
|
-
return
|
|
145
|
-
|
|
146
|
-
sysout(Vt100.set_auto_wrap(auto_wrap), end="")
|
|
147
|
-
|
|
148
|
-
@classmethod
|
|
149
|
-
def set_show_cursor(cls, show_cursor: bool = True) -> None:
|
|
150
|
-
"""Show or hide cursor in the terminal.
|
|
151
|
-
:param show_cursor: whether to show or hide he cursor.
|
|
152
|
-
"""
|
|
153
|
-
if not cls.is_a_tty():
|
|
154
|
-
log.warning(NotATerminalError("set_show_cursor:: Requires a terminal (TTY)"))
|
|
155
|
-
return
|
|
156
|
-
|
|
157
|
-
sysout(Vt100.set_show_cursor(show_cursor), end="")
|
|
158
|
-
|
|
159
|
-
@classmethod
|
|
160
|
-
def set_attributes(cls, **attrs) -> None:
|
|
161
|
-
"""Wrapper to set all terminal attributes at once."""
|
|
162
|
-
# fmt: off
|
|
163
|
-
enable_echo = attrs['enable_echo']
|
|
164
|
-
auto_wrap = attrs['auto_wrap']
|
|
165
|
-
show_cursor = attrs['show_cursor']
|
|
166
|
-
# fmt: on
|
|
167
|
-
if enable_echo is not None:
|
|
168
|
-
cls.set_enable_echo(enable_echo)
|
|
169
|
-
if auto_wrap is not None:
|
|
170
|
-
cls.set_auto_wrap(auto_wrap)
|
|
171
|
-
if show_cursor is not None:
|
|
172
|
-
cls.set_show_cursor(show_cursor)
|
|
173
|
-
|
|
174
|
-
@classmethod
|
|
175
|
-
def clear(cls) -> None:
|
|
176
|
-
"""Clear terminal and move the cursor to HOME position (0, 0)."""
|
|
177
|
-
cls.INSTANCE.screen.clear()
|
|
178
|
-
|
|
179
|
-
@classmethod
|
|
180
|
-
def echo(cls, obj: Any, end: str = os.linesep) -> None:
|
|
181
|
-
"""Write the string representation of the object to the screen."""
|
|
182
|
-
cls.INSTANCE.screen.cursor.write(obj, end=end)
|
|
183
|
-
|
|
184
|
-
@classmethod
|
|
185
|
-
def alternate_screen(cls, enable: bool) -> None:
|
|
186
|
-
"""Switch to the alternate screen buffer on/off."""
|
|
187
|
-
cls.INSTANCE.screen.alternate = enable
|
|
188
|
-
|
|
189
|
-
def __init__(self):
|
|
190
|
-
self._screen = Screen.INSTANCE or Screen()
|
|
191
|
-
atexit.register(self.restore)
|
|
192
|
-
|
|
193
|
-
@property
|
|
194
|
-
def screen(self) -> Screen:
|
|
195
|
-
return self._screen
|
|
196
|
-
|
|
197
|
-
@property
|
|
198
|
-
def cursor(self) -> Cursor:
|
|
199
|
-
return self.screen.cursor
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
assert (terminal := Terminal().INSTANCE) is not None, "Failed to create Terminal instance"
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# _*_ coding: utf-8 _*_
|
|
2
|
-
#
|
|
3
|
-
# hspylib-clitt v0.9.119
|
|
4
|
-
#
|
|
5
|
-
# Package: main.build.lib.build.lib.clitt.core.tui
|
|
6
|
-
"""Package initialization."""
|
|
7
|
-
|
|
8
|
-
__all__ = [
|
|
9
|
-
'line_input',
|
|
10
|
-
'mchoose',
|
|
11
|
-
'mdashboard',
|
|
12
|
-
'menu',
|
|
13
|
-
'minput',
|
|
14
|
-
'mselect',
|
|
15
|
-
'table',
|
|
16
|
-
'tui_application',
|
|
17
|
-
'tui_component',
|
|
18
|
-
'tui_preferences'
|
|
19
|
-
]
|
|
20
|
-
__version__ = '0.9.119'
|
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
|
-
"""
|
|
5
|
-
@project: HsPyLib-AskAI
|
|
6
|
-
@package: main.clitt.core.tui.line_input
|
|
7
|
-
@file: keyboard_input.py
|
|
8
|
-
@created: Wed, 17 Jan 2024
|
|
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 clitt.core.term.commons import Direction
|
|
17
|
-
from clitt.core.term.terminal import Terminal
|
|
18
|
-
from clitt.core.tui.tui_component import TUIComponent
|
|
19
|
-
from hspylib.modules.cli.keyboard import Keyboard
|
|
20
|
-
from hspylib.modules.cli.vt100.vt_color import VtColor
|
|
21
|
-
from typing import Dict, List, Optional
|
|
22
|
-
|
|
23
|
-
import pyperclip
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
class KeyboardInput(TUIComponent):
|
|
27
|
-
"""Provides a keyboard input for terminal UIs with undo and history."""
|
|
28
|
-
|
|
29
|
-
# Current history index.
|
|
30
|
-
_HIST_INDEX: int = 0
|
|
31
|
-
|
|
32
|
-
# Dict containing all previously accepted inputs.
|
|
33
|
-
_HISTORY: Dict[int, str] = {0: ""}
|
|
34
|
-
|
|
35
|
-
# Stack containing current input changes.
|
|
36
|
-
_UNDO_HISTORY: List[str] = []
|
|
37
|
-
|
|
38
|
-
# Stack containing current input reverts.
|
|
39
|
-
_REDO_HISTORY: List[str] = []
|
|
40
|
-
|
|
41
|
-
@staticmethod
|
|
42
|
-
def preload_history(history: List[str]) -> None:
|
|
43
|
-
"""Preload the input with the provided dictionary."""
|
|
44
|
-
rev_history = reversed(history)
|
|
45
|
-
for entry in rev_history:
|
|
46
|
-
KeyboardInput._add_history(entry)
|
|
47
|
-
KeyboardInput._HIST_INDEX = 0
|
|
48
|
-
|
|
49
|
-
@staticmethod
|
|
50
|
-
def forget_history() -> None:
|
|
51
|
-
"""Forget all input history entries."""
|
|
52
|
-
tmp: str = KeyboardInput._HISTORY[0]
|
|
53
|
-
KeyboardInput._HISTORY.clear()
|
|
54
|
-
KeyboardInput._HISTORY[0] = tmp
|
|
55
|
-
|
|
56
|
-
@staticmethod
|
|
57
|
-
def history() -> List[str]:
|
|
58
|
-
"""Return the actual input history."""
|
|
59
|
-
return list(filter(lambda v: v, KeyboardInput._HISTORY.values()))
|
|
60
|
-
|
|
61
|
-
@staticmethod
|
|
62
|
-
def _add_history(input_text: str) -> None:
|
|
63
|
-
"""Add the following input to the history set.
|
|
64
|
-
:param input_text: The input text to add to the history.
|
|
65
|
-
"""
|
|
66
|
-
if input_text and input_text not in list(KeyboardInput._HISTORY.values())[1:]:
|
|
67
|
-
idx: int = max(1, len(KeyboardInput._HISTORY))
|
|
68
|
-
KeyboardInput._HISTORY[idx] = input_text
|
|
69
|
-
KeyboardInput._HIST_INDEX = idx
|
|
70
|
-
|
|
71
|
-
@classmethod
|
|
72
|
-
def _next_in_history(cls) -> Optional[str]:
|
|
73
|
-
index = min(len(cls._HISTORY) - 1, cls._HIST_INDEX + 1)
|
|
74
|
-
text = cls._HISTORY.get(index, "")
|
|
75
|
-
cls._HIST_INDEX = index
|
|
76
|
-
return text or cls._HISTORY[0]
|
|
77
|
-
|
|
78
|
-
@classmethod
|
|
79
|
-
def _prev_in_history(cls) -> Optional[str]:
|
|
80
|
-
index = max(0, cls._HIST_INDEX - 1)
|
|
81
|
-
text = cls._HISTORY.get(index, "")
|
|
82
|
-
cls._HIST_INDEX = index
|
|
83
|
-
return text or cls._HISTORY[0]
|
|
84
|
-
|
|
85
|
-
@classmethod
|
|
86
|
-
def _undo(cls) -> Optional[str]:
|
|
87
|
-
text = cls._UNDO_HISTORY.pop() if cls._UNDO_HISTORY else None
|
|
88
|
-
if cls._HISTORY[0] not in cls._REDO_HISTORY:
|
|
89
|
-
cls._REDO_HISTORY.append(cls._HISTORY[0])
|
|
90
|
-
return text
|
|
91
|
-
|
|
92
|
-
@classmethod
|
|
93
|
-
def _redo(cls) -> Optional[str]:
|
|
94
|
-
text = cls._REDO_HISTORY.pop() if cls._REDO_HISTORY else None
|
|
95
|
-
if cls._HISTORY[0] not in cls._UNDO_HISTORY:
|
|
96
|
-
cls._UNDO_HISTORY.append(cls._HISTORY[0])
|
|
97
|
-
return text
|
|
98
|
-
|
|
99
|
-
def __init__(
|
|
100
|
-
self,
|
|
101
|
-
prompt: str = "",
|
|
102
|
-
prompt_color: VtColor = VtColor.NC,
|
|
103
|
-
text_color: VtColor = VtColor.NC,
|
|
104
|
-
navbar_enable: bool = False,
|
|
105
|
-
):
|
|
106
|
-
super().__init__(prompt)
|
|
107
|
-
self._prompt_color = prompt_color
|
|
108
|
-
self._text_color = text_color
|
|
109
|
-
self._navbar_enable = navbar_enable
|
|
110
|
-
self._input_index = 0
|
|
111
|
-
self._input_text: str = ""
|
|
112
|
-
self._HISTORY[0] = ""
|
|
113
|
-
|
|
114
|
-
@property
|
|
115
|
-
def length(self) -> int:
|
|
116
|
-
return len(self._input_text) if self._input_text else 0
|
|
117
|
-
|
|
118
|
-
def _prepare_render(self, auto_wrap: bool = True, show_cursor: bool = True) -> None:
|
|
119
|
-
Terminal.set_auto_wrap(auto_wrap)
|
|
120
|
-
Terminal.set_show_cursor(show_cursor)
|
|
121
|
-
self.cursor.save()
|
|
122
|
-
|
|
123
|
-
def _loop(self, break_keys: List[Keyboard] = None) -> Keyboard:
|
|
124
|
-
break_keys = break_keys or Keyboard.break_keys()
|
|
125
|
-
keypress = Keyboard.VK_NONE
|
|
126
|
-
|
|
127
|
-
# Wait for user interaction
|
|
128
|
-
while not self._done and keypress and keypress not in break_keys:
|
|
129
|
-
# Menu Renderization
|
|
130
|
-
if self._re_render:
|
|
131
|
-
self.render()
|
|
132
|
-
# Navigation input
|
|
133
|
-
keypress = self.handle_keypress()
|
|
134
|
-
|
|
135
|
-
return keypress
|
|
136
|
-
|
|
137
|
-
def execute(self) -> Optional[str | Keyboard]:
|
|
138
|
-
self.write(f"{self._prompt_color.placeholder}{self.title}{self._text_color.placeholder}")
|
|
139
|
-
self._prepare_render()
|
|
140
|
-
keypress = self._loop() or Keyboard.VK_ESC
|
|
141
|
-
|
|
142
|
-
if keypress.isEnter():
|
|
143
|
-
self._add_history(self._input_text)
|
|
144
|
-
self._UNDO_HISTORY.clear()
|
|
145
|
-
self._REDO_HISTORY.clear()
|
|
146
|
-
elif keypress == Keyboard.VK_ESC:
|
|
147
|
-
self._input_text = None
|
|
148
|
-
|
|
149
|
-
self.writeln("%NC%")
|
|
150
|
-
|
|
151
|
-
return self._input_text
|
|
152
|
-
|
|
153
|
-
def render(self) -> None:
|
|
154
|
-
Terminal.set_show_cursor(False)
|
|
155
|
-
self.cursor.restore()
|
|
156
|
-
self.write(self._input_text)
|
|
157
|
-
self._terminal.cursor.erase(Direction.RIGHT)
|
|
158
|
-
self._re_render = False
|
|
159
|
-
self._set_cursor_pos()
|
|
160
|
-
Terminal.set_show_cursor()
|
|
161
|
-
|
|
162
|
-
def navbar(self, **kwargs) -> str:
|
|
163
|
-
pass
|
|
164
|
-
|
|
165
|
-
def handle_keypress(self) -> Keyboard:
|
|
166
|
-
if keypress := Keyboard.wait_keystroke():
|
|
167
|
-
match keypress:
|
|
168
|
-
case Keyboard.VK_BACKSPACE:
|
|
169
|
-
if self._input_index > 0:
|
|
170
|
-
self._input_index = max(0, self._input_index - 1)
|
|
171
|
-
self._update_input(
|
|
172
|
-
self._input_text[: self._input_index] + self._input_text[1 + self._input_index :]
|
|
173
|
-
)
|
|
174
|
-
case Keyboard.VK_DELETE:
|
|
175
|
-
self._update_input(
|
|
176
|
-
self._input_text[: self._input_index] + self._input_text[1 + self._input_index :]
|
|
177
|
-
)
|
|
178
|
-
case Keyboard.VK_CTRL_F: # Forget history
|
|
179
|
-
self.forget_history()
|
|
180
|
-
case Keyboard.VK_CTRL_P: # Paste from clipboard
|
|
181
|
-
text = (pyperclip.paste() or "").replace("\n", "↵")
|
|
182
|
-
self._update_input(
|
|
183
|
-
self._input_text[: self._input_index] + text + self._input_text[self._input_index :]
|
|
184
|
-
)
|
|
185
|
-
self._input_index += len(text)
|
|
186
|
-
case Keyboard.VK_CTRL_R: # Reset contents
|
|
187
|
-
self._input_index = 0
|
|
188
|
-
self._update_input("")
|
|
189
|
-
case Keyboard.VK_LEFT:
|
|
190
|
-
self._input_index = max(0, self._input_index - 1)
|
|
191
|
-
case Keyboard.VK_RIGHT:
|
|
192
|
-
self._input_index = min(self.length, self._input_index + 1)
|
|
193
|
-
case Keyboard.VK_UP:
|
|
194
|
-
self._input_text = self._next_in_history()
|
|
195
|
-
self._input_index = self.length
|
|
196
|
-
case Keyboard.VK_DOWN:
|
|
197
|
-
self._input_text = self._prev_in_history()
|
|
198
|
-
self._input_index = self.length
|
|
199
|
-
case Keyboard.VK_HOME:
|
|
200
|
-
self._input_index = 0
|
|
201
|
-
case Keyboard.VK_END:
|
|
202
|
-
self._input_index = self.length
|
|
203
|
-
case _ as key if key.val.isprintable():
|
|
204
|
-
self._update_input(
|
|
205
|
-
self._input_text[: self._input_index] + key.val + self._input_text[self._input_index :]
|
|
206
|
-
)
|
|
207
|
-
self._input_index += 1
|
|
208
|
-
case _ as key if key in Keyboard.break_keys():
|
|
209
|
-
self._done = True
|
|
210
|
-
case _:
|
|
211
|
-
self._input_text = keypress
|
|
212
|
-
self._done = True
|
|
213
|
-
self._re_render = True
|
|
214
|
-
|
|
215
|
-
return keypress
|
|
216
|
-
|
|
217
|
-
def _set_cursor_pos(self):
|
|
218
|
-
"""Set the cursor position on the input."""
|
|
219
|
-
index_offset = max(0, self.length - self._input_index)
|
|
220
|
-
self.screen.cursor.move(index_offset, Direction.LEFT)
|
|
221
|
-
|
|
222
|
-
def _update_input(self, text: str) -> str:
|
|
223
|
-
"""Update the value of the input.
|
|
224
|
-
:param text: The text to be set.
|
|
225
|
-
"""
|
|
226
|
-
self._UNDO_HISTORY.append(self._input_text)
|
|
227
|
-
self._HISTORY[0] = text if text not in self._HISTORY else self._input_text
|
|
228
|
-
self._input_text = text
|
|
229
|
-
return text
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
|
-
"""
|
|
5
|
-
@project: HsPyLib-AskAI
|
|
6
|
-
@package: main.clitt.core.tui.line_input
|
|
7
|
-
@file: line_input.py
|
|
8
|
-
@created: Wed, 17 Jan 2024
|
|
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.line_input.keyboard_input import KeyboardInput
|
|
16
|
-
from hspylib.modules.cli.keyboard import Keyboard
|
|
17
|
-
from hspylib.modules.cli.vt100.vt_color import VtColor
|
|
18
|
-
from typing import Optional
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def line_input(
|
|
22
|
-
prompt: str = "", prompt_color: VtColor = VtColor.NC, text_color: VtColor = VtColor.NC, navbar_enable: bool = False
|
|
23
|
-
) -> Optional[str | Keyboard]:
|
|
24
|
-
"""Read a string from standard input.
|
|
25
|
-
:param prompt: The message to be displayed to the user.
|
|
26
|
-
:param prompt_color: The color of the prompt text.
|
|
27
|
-
:param text_color: The color of the input text.
|
|
28
|
-
:param navbar_enable: Whether to display the navbar or not.
|
|
29
|
-
"""
|
|
30
|
-
ptt = KeyboardInput(prompt, prompt_color, text_color, navbar_enable)
|
|
31
|
-
return ptt.execute()
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
|
-
"""
|
|
5
|
-
@project: HsPyLib
|
|
6
|
-
@package: clitt.core.tui.mchoose
|
|
7
|
-
@file: mchoose.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.tui.mchoose.menu_choose import MenuChoose
|
|
16
|
-
from hspylib.core.enums.charset import Charset
|
|
17
|
-
from typing import List, Optional, TypeVar
|
|
18
|
-
|
|
19
|
-
T = TypeVar("T")
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def mchoose(
|
|
23
|
-
items: List[T],
|
|
24
|
-
checked: bool | List[bool] = False,
|
|
25
|
-
title: str = "Please choose among the options",
|
|
26
|
-
output: str = None,
|
|
27
|
-
) -> Optional[List[T]]:
|
|
28
|
-
"""
|
|
29
|
-
Terminal UI menu choose input method.
|
|
30
|
-
:param items: the provided items to choose from.
|
|
31
|
-
:param checked: whether all items ate initially marked or not.
|
|
32
|
-
:param title: the title to be displayed before the options.
|
|
33
|
-
:param output: optional output file containing the marked items.
|
|
34
|
-
:return: the list of marked items.
|
|
35
|
-
"""
|
|
36
|
-
|
|
37
|
-
result = MenuChoose(title, items, checked).execute()
|
|
38
|
-
|
|
39
|
-
if result and output:
|
|
40
|
-
with open(output, "w", encoding=Charset.UTF_8.val) as f_out:
|
|
41
|
-
f_out.write(" ".join(result))
|
|
42
|
-
|
|
43
|
-
return result
|