hspylib-clitt 0.9.116__py3-none-any.whl → 0.9.117__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/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/cursor.py +1 -1
- clitt/core/term/screen.py +1 -1
- clitt/core/term/terminal.py +1 -1
- clitt/core/tui/__init__.py +3 -3
- clitt/core/tui/line_input/__init__.py +3 -3
- clitt/core/tui/line_input/keyboard_input.py +34 -34
- clitt/core/tui/line_input/line_input.py +5 -13
- 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/mselect/__init__.py +3 -3
- clitt/core/tui/table/__init__.py +3 -3
- clitt/core/tui/tui_application.py +11 -23
- 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.117.dist-info}/METADATA +2 -2
- hspylib_clitt-0.9.117.dist-info/RECORD +97 -0
- {hspylib_clitt-0.9.116.dist-info → hspylib_clitt-0.9.117.dist-info}/WHEEL +1 -1
- {hspylib_clitt-0.9.116.dist-info → hspylib_clitt-0.9.117.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,82 +0,0 @@
|
|
|
1
|
-
from clitt.core.exception.exceptions import NotATerminalError
|
|
2
|
-
from hspylib.core.enums.enumeration import Enumeration
|
|
3
|
-
from hspylib.core.tools.commons import is_debugging
|
|
4
|
-
from hspylib.modules.cli.vt100.vt_100 import Vt100
|
|
5
|
-
from shutil import get_terminal_size
|
|
6
|
-
from typing import Callable, Tuple, TypeAlias, Union
|
|
7
|
-
|
|
8
|
-
import logging as log
|
|
9
|
-
import re
|
|
10
|
-
import sys
|
|
11
|
-
import termios
|
|
12
|
-
import tty
|
|
13
|
-
|
|
14
|
-
# fmt: off
|
|
15
|
-
Dimension : TypeAlias = Tuple[int, int]
|
|
16
|
-
Position : TypeAlias = Tuple[int, int]
|
|
17
|
-
Resize_Cb : TypeAlias = Callable[[], None]
|
|
18
|
-
MoveDirection : TypeAlias = "Direction"
|
|
19
|
-
EraseDirection : TypeAlias = Union["Direction", "Portion"]
|
|
20
|
-
# fmt: on
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class Direction(Enumeration):
|
|
24
|
-
"""Provide a base class for the cursor direction."""
|
|
25
|
-
|
|
26
|
-
# fmt: off
|
|
27
|
-
UP = '%ED1%', '%CUU({n})%' # Cursor up (line)
|
|
28
|
-
RIGHT = '%EL0%', '%CUF({n})%' # Cursor right (forward)
|
|
29
|
-
DOWN = '%ED0%', '%CUD({n})%' # Cursor down (line)
|
|
30
|
-
LEFT = '%EL1%', '%CUB({n})%' # Cursor left (backward)
|
|
31
|
-
# fmt: on
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
class Portion(Enumeration):
|
|
35
|
-
"""Provide a base class for the portions of the screen."""
|
|
36
|
-
|
|
37
|
-
# fmt: off
|
|
38
|
-
SCREEN = '%ED2%', '' # Entire screen (screen)
|
|
39
|
-
LINE = '%EL2%', '' # Entire line (line)
|
|
40
|
-
# fmt: on
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
def get_dimensions(fallback: Tuple[int, int] = (24, 80)) -> Tuple[int, int]:
|
|
44
|
-
"""Retrieve the size of the terminal.
|
|
45
|
-
:return lines, columns
|
|
46
|
-
"""
|
|
47
|
-
if not sys.stdout.isatty():
|
|
48
|
-
log.warning(NotATerminalError("get_dimensions:: Requires a terminal (TTY)"))
|
|
49
|
-
return fallback
|
|
50
|
-
dim = get_terminal_size((fallback[1], fallback[0]))
|
|
51
|
-
return dim.lines, dim.columns
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def get_cursor_position(fallback: Tuple[int, int] = (0, 0)) -> Tuple[int, int]:
|
|
55
|
-
"""Get the terminal cursor position.
|
|
56
|
-
:return line, column
|
|
57
|
-
"""
|
|
58
|
-
pos, buf, re_query_resp = fallback, "", r"^\x1b\[(\d*);(\d*)R"
|
|
59
|
-
|
|
60
|
-
if not sys.stdout.isatty():
|
|
61
|
-
log.warning(NotATerminalError("get_cursor_position:: Requires a terminal (TTY)"))
|
|
62
|
-
return pos
|
|
63
|
-
|
|
64
|
-
if is_debugging():
|
|
65
|
-
return pos
|
|
66
|
-
|
|
67
|
-
stdin = sys.stdin.fileno() # Get the stdin file descriptor.
|
|
68
|
-
attrs = termios.tcgetattr(stdin) # Save terminal attributes.
|
|
69
|
-
|
|
70
|
-
try:
|
|
71
|
-
tty.setcbreak(stdin, termios.TCSANOW)
|
|
72
|
-
sys.stdout.write(Vt100.get_cursor_pos())
|
|
73
|
-
sys.stdout.flush()
|
|
74
|
-
while not buf or buf[-1] != "R":
|
|
75
|
-
buf += sys.stdin.read(1)
|
|
76
|
-
if matches := re.match(re_query_resp, buf): # If the response is 'Esc[r;cR'
|
|
77
|
-
groups = matches.groups()
|
|
78
|
-
pos = int(groups[0]), int(groups[1])
|
|
79
|
-
finally:
|
|
80
|
-
termios.tcsetattr(stdin, termios.TCSANOW, attrs) # Reset terminal attributes
|
|
81
|
-
|
|
82
|
-
return pos
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
from hspylib.core.metaclass.singleton import Singleton
|
|
3
|
-
from hspylib.core.tools.commons import sysout
|
|
4
|
-
from hspylib.core.tools.text_tools import last_index_of
|
|
5
|
-
from hspylib.modules.cli.vt100.vt_100 import Vt100
|
|
6
|
-
from hspylib.modules.cli.vt100.vt_code import VtCode
|
|
7
|
-
from hspylib.modules.cli.vt100.vt_color import VtColor
|
|
8
|
-
from typing import Any
|
|
9
|
-
|
|
10
|
-
from clitt.core.term.commons import Direction, EraseDirection, get_cursor_position, MoveDirection, Position, Portion
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class Cursor(metaclass=Singleton):
|
|
14
|
-
"""Provide a base class for the screen cursor."""
|
|
15
|
-
|
|
16
|
-
INSTANCE = None
|
|
17
|
-
|
|
18
|
-
CURSOR_HOME = 1, 1
|
|
19
|
-
|
|
20
|
-
def __init__(self):
|
|
21
|
-
self._position: Position = get_cursor_position() or self.CURSOR_HOME
|
|
22
|
-
self._bottom: Position = self.CURSOR_HOME
|
|
23
|
-
self._saved_attrs = self._position, self._bottom
|
|
24
|
-
|
|
25
|
-
def __str__(self):
|
|
26
|
-
return f"({', '.join(list(map(str, self._position)))})"
|
|
27
|
-
|
|
28
|
-
def __repr__(self):
|
|
29
|
-
return str(self)
|
|
30
|
-
|
|
31
|
-
@property
|
|
32
|
-
def position(self) -> Position:
|
|
33
|
-
return self._position
|
|
34
|
-
|
|
35
|
-
@position.setter
|
|
36
|
-
def position(self, new_position: Position) -> None:
|
|
37
|
-
self._bottom = (new_position[0], new_position[1]) if new_position >= self._bottom else self._bottom
|
|
38
|
-
self._position = new_position
|
|
39
|
-
|
|
40
|
-
@property
|
|
41
|
-
def bottom(self) -> Position:
|
|
42
|
-
return self._bottom
|
|
43
|
-
|
|
44
|
-
def home(self) -> None:
|
|
45
|
-
"""Move the cursor to home position.
|
|
46
|
-
:return None
|
|
47
|
-
"""
|
|
48
|
-
self.move_to(self.CURSOR_HOME[0], self.CURSOR_HOME[1])
|
|
49
|
-
|
|
50
|
-
def end(self) -> None:
|
|
51
|
-
"""Move the cursor to the bottom most position on the screen.
|
|
52
|
-
:return None
|
|
53
|
-
"""
|
|
54
|
-
self.move_to(self.bottom[0], self.bottom[1])
|
|
55
|
-
|
|
56
|
-
def move_to(self, row: int = None, column: int = None) -> Position:
|
|
57
|
-
"""Move the cursor to the specified position.
|
|
58
|
-
:param row the specified row to move.
|
|
59
|
-
:param column the specified column to move.
|
|
60
|
-
:return the cursor position after moving.
|
|
61
|
-
"""
|
|
62
|
-
row_pos = max(self.CURSOR_HOME[0], row if row is not None else self.position[0])
|
|
63
|
-
col_pos = max(self.CURSOR_HOME[1], column if column is not None else self.position[1])
|
|
64
|
-
sysout(f"%CUP({row_pos};{col_pos})%", end="")
|
|
65
|
-
self.position = row_pos, col_pos
|
|
66
|
-
return self.position
|
|
67
|
-
|
|
68
|
-
def move(self, amount: int, direction: MoveDirection) -> Position:
|
|
69
|
-
"""Move the cursor towards the specified direction.
|
|
70
|
-
:param amount the amount of columns to move.
|
|
71
|
-
:param direction the direction to move.
|
|
72
|
-
:return the cursor position after moving.
|
|
73
|
-
"""
|
|
74
|
-
if amount > 0:
|
|
75
|
-
sysout(direction.value[1].format(n=amount), end="")
|
|
76
|
-
row_pos, col_pos = self.position
|
|
77
|
-
match direction:
|
|
78
|
-
case Direction.UP:
|
|
79
|
-
row_pos -= max(0, amount)
|
|
80
|
-
case Direction.DOWN:
|
|
81
|
-
row_pos += max(0, amount)
|
|
82
|
-
case Direction.LEFT:
|
|
83
|
-
col_pos -= max(0, amount)
|
|
84
|
-
case Direction.RIGHT:
|
|
85
|
-
col_pos += max(0, amount)
|
|
86
|
-
self.position = row_pos, col_pos
|
|
87
|
-
return self.position
|
|
88
|
-
|
|
89
|
-
def erase(self, direction: EraseDirection) -> Position:
|
|
90
|
-
"""Erase the screen following the specified direction.
|
|
91
|
-
Note: It does not move the cursor along the way.
|
|
92
|
-
:param direction the direction to erase the screen.
|
|
93
|
-
:return the cursor position after erasing.
|
|
94
|
-
"""
|
|
95
|
-
sysout(direction.value[0], end="")
|
|
96
|
-
return self.position
|
|
97
|
-
|
|
98
|
-
def erase_line(self) -> Position:
|
|
99
|
-
"""Erase the previous line of the screen."""
|
|
100
|
-
row_pos, col_pos = self.position
|
|
101
|
-
self.move(1, Direction.UP)
|
|
102
|
-
self.erase(Portion.LINE)
|
|
103
|
-
self.move(col_pos, Direction.LEFT)
|
|
104
|
-
self.position = row_pos, 0
|
|
105
|
-
return self.position
|
|
106
|
-
|
|
107
|
-
def track(self) -> Position:
|
|
108
|
-
"""Track the cursor position.
|
|
109
|
-
:return the tracked cursor position.
|
|
110
|
-
"""
|
|
111
|
-
self.position = get_cursor_position() or self.position
|
|
112
|
-
return self.position
|
|
113
|
-
|
|
114
|
-
def write(self, obj: Any, end: str = "") -> Position:
|
|
115
|
-
"""Write the string representation of the object to the screen.
|
|
116
|
-
:param obj the object to be written.
|
|
117
|
-
:param end string appended after the last value, default a newline.
|
|
118
|
-
:return the cursor position after writing.
|
|
119
|
-
"""
|
|
120
|
-
sysout(obj, end=end)
|
|
121
|
-
text = (str(obj) + end).replace("%EOL%", os.linesep)
|
|
122
|
-
text = VtColor.strip_colors(VtCode.strip_codes(text))
|
|
123
|
-
text_offset = len(text[max(0, last_index_of(text, os.linesep)):])
|
|
124
|
-
self.position = self.position[0] + text.count(os.linesep), text_offset + (
|
|
125
|
-
self.position[1] if text.count(os.linesep) == 0 else 0
|
|
126
|
-
)
|
|
127
|
-
return self.position
|
|
128
|
-
|
|
129
|
-
def writeln(self, obj: Any) -> Position:
|
|
130
|
-
"""Write the string representation of the object to the screen, appending a new line.
|
|
131
|
-
:param obj the object to be written.
|
|
132
|
-
:return the cursor position after writing.
|
|
133
|
-
"""
|
|
134
|
-
return self.write(obj, end=os.linesep)
|
|
135
|
-
|
|
136
|
-
def save(self) -> Position:
|
|
137
|
-
"""Save the current cursor position and attributes.
|
|
138
|
-
:return the actual cursor position.
|
|
139
|
-
"""
|
|
140
|
-
sysout(Vt100.save_cursor(), end="")
|
|
141
|
-
self._saved_attrs = self._position, self._bottom
|
|
142
|
-
return self.position
|
|
143
|
-
|
|
144
|
-
def restore(self) -> Position:
|
|
145
|
-
"""Restore the saved cursor position and attributes.
|
|
146
|
-
:return the cursor position after restoration.
|
|
147
|
-
"""
|
|
148
|
-
sysout(Vt100.restore_cursor(), end="")
|
|
149
|
-
self._position = self._saved_attrs[0]
|
|
150
|
-
self._bottom = self._saved_attrs[1]
|
|
151
|
-
return self.position
|
|
152
|
-
|
|
153
|
-
def reset_mode(self, end="") -> Position:
|
|
154
|
-
"""Reset cursor modifiers."""
|
|
155
|
-
sysout(Vt100.mode(0), end=end)
|
|
156
|
-
return self.position
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
assert Cursor().INSTANCE is not None, "Failed to create Cursor instance"
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
from clitt.core.term.commons import Dimension, get_dimensions, Portion, Resize_Cb
|
|
2
|
-
from clitt.core.term.cursor import Cursor
|
|
3
|
-
from clitt.core.tui.tui_preferences import TUIPreferences
|
|
4
|
-
from hspylib.core.metaclass.singleton import Singleton
|
|
5
|
-
from hspylib.core.tools.commons import sysout
|
|
6
|
-
from threading import Timer
|
|
7
|
-
from typing import List, Optional
|
|
8
|
-
|
|
9
|
-
import threading
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class Screen(metaclass=Singleton):
|
|
13
|
-
"""Provide a base class for terminal UI components."""
|
|
14
|
-
|
|
15
|
-
INSTANCE = None
|
|
16
|
-
|
|
17
|
-
RESIZE_WATCH_INTERVAL = 0.5
|
|
18
|
-
|
|
19
|
-
def __init__(self):
|
|
20
|
-
self._preferences: TUIPreferences = TUIPreferences.INSTANCE
|
|
21
|
-
self._dimension: Dimension = get_dimensions()
|
|
22
|
-
self._cursor: Cursor = Cursor.INSTANCE or Cursor()
|
|
23
|
-
self._resize_timer: Optional[Timer] = None
|
|
24
|
-
self._cb_watchers: List[Resize_Cb] = []
|
|
25
|
-
self._alternate: bool = False
|
|
26
|
-
self._resize_watcher()
|
|
27
|
-
|
|
28
|
-
def __str__(self):
|
|
29
|
-
return f"Terminal.Screen(rows={self.lines}, columns={self.columns}, cursor={self.cursor})"
|
|
30
|
-
|
|
31
|
-
def __repr__(self):
|
|
32
|
-
return str(self)
|
|
33
|
-
|
|
34
|
-
@property
|
|
35
|
-
def preferences(self) -> TUIPreferences:
|
|
36
|
-
return self._preferences
|
|
37
|
-
|
|
38
|
-
@property
|
|
39
|
-
def dimension(self) -> Dimension:
|
|
40
|
-
return self._dimension
|
|
41
|
-
|
|
42
|
-
@property
|
|
43
|
-
def lines(self) -> int:
|
|
44
|
-
return self._dimension[0]
|
|
45
|
-
|
|
46
|
-
@property
|
|
47
|
-
def columns(self) -> int:
|
|
48
|
-
return self._dimension[1]
|
|
49
|
-
|
|
50
|
-
@property
|
|
51
|
-
def cursor(self) -> Cursor:
|
|
52
|
-
return self._cursor
|
|
53
|
-
|
|
54
|
-
@property
|
|
55
|
-
def alternate(self) -> bool:
|
|
56
|
-
return self._alternate
|
|
57
|
-
|
|
58
|
-
@alternate.setter
|
|
59
|
-
def alternate(self, enable: bool) -> None:
|
|
60
|
-
"""Switch to the alternate screen buffer.
|
|
61
|
-
:param enable: alternate enable on/off.
|
|
62
|
-
"""
|
|
63
|
-
if enable != self._alternate:
|
|
64
|
-
self._alternate = enable
|
|
65
|
-
sysout(f"%SC{'A' if enable else 'M'}%", end="")
|
|
66
|
-
self.cursor.track()
|
|
67
|
-
|
|
68
|
-
def clear(self) -> None:
|
|
69
|
-
"""Clear terminal and move the cursor to HOME position (0, 0)."""
|
|
70
|
-
self.cursor.home()
|
|
71
|
-
self.cursor.erase(Portion.SCREEN)
|
|
72
|
-
|
|
73
|
-
def add_watcher(self, watcher: Resize_Cb) -> None:
|
|
74
|
-
"""Add a resize watcher."""
|
|
75
|
-
self._cb_watchers.append(watcher)
|
|
76
|
-
if not self._resize_timer:
|
|
77
|
-
self._resize_watcher()
|
|
78
|
-
|
|
79
|
-
def _resize_watcher(self) -> None:
|
|
80
|
-
"""Add a watcher for screen resizes. If a resize is detected, the callback is called with the
|
|
81
|
-
new dimension."""
|
|
82
|
-
if self._cb_watchers and threading.main_thread().is_alive():
|
|
83
|
-
dimension: Dimension = get_dimensions()
|
|
84
|
-
self._resize_timer = Timer(self.RESIZE_WATCH_INTERVAL, self._resize_watcher)
|
|
85
|
-
if dimension != self._dimension:
|
|
86
|
-
list(map(lambda cb_w: cb_w(), self._cb_watchers))
|
|
87
|
-
self._dimension = dimension
|
|
88
|
-
self._resize_timer.start()
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
assert Screen().INSTANCE is not None, "Failed to create Screen instance"
|
|
@@ -1,203 +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
|
-
import atexit
|
|
16
|
-
import logging as log
|
|
17
|
-
import os
|
|
18
|
-
import platform
|
|
19
|
-
import select
|
|
20
|
-
import shlex
|
|
21
|
-
import signal
|
|
22
|
-
import sys
|
|
23
|
-
from subprocess import CalledProcessError, Popen, PIPE
|
|
24
|
-
from typing import Any, Optional, Tuple, List, Iterable
|
|
25
|
-
|
|
26
|
-
from hspylib.core.enums.charset import Charset
|
|
27
|
-
from hspylib.core.metaclass.singleton import Singleton
|
|
28
|
-
from hspylib.core.tools.commons import sysout
|
|
29
|
-
from hspylib.modules.application.exit_status import ExitStatus
|
|
30
|
-
from hspylib.modules.cli.keyboard import Keyboard
|
|
31
|
-
from hspylib.modules.cli.vt100.vt_100 import Vt100
|
|
32
|
-
|
|
33
|
-
from clitt.core.exception.exceptions import NotATerminalError
|
|
34
|
-
from clitt.core.term.cursor import Cursor
|
|
35
|
-
from clitt.core.term.screen import Screen
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
class Terminal(metaclass=Singleton):
|
|
39
|
-
"""Utility class to provide terminal features."""
|
|
40
|
-
|
|
41
|
-
INSTANCE = None
|
|
42
|
-
|
|
43
|
-
@staticmethod
|
|
44
|
-
def is_a_tty() -> bool:
|
|
45
|
-
return sys.stdout.isatty()
|
|
46
|
-
|
|
47
|
-
@staticmethod
|
|
48
|
-
def _chain_pipes(cmd_list: Iterable, **kwargs) -> Popen:
|
|
49
|
-
"""Run commands in PIPE, return the last process in chain.
|
|
50
|
-
:param cmd_list: the command list to be executed.
|
|
51
|
-
"""
|
|
52
|
-
if "stdout" in kwargs:
|
|
53
|
-
del kwargs["stdout"]
|
|
54
|
-
if "stderr" in kwargs:
|
|
55
|
-
del kwargs["stderr"]
|
|
56
|
-
if "stdin" in kwargs:
|
|
57
|
-
del kwargs["stdin"]
|
|
58
|
-
commands = map(shlex.split, cmd_list) if 'shell' not in kwargs else cmd_list
|
|
59
|
-
first_cmd, *rest_cmds = commands
|
|
60
|
-
if len(rest_cmds) > 0:
|
|
61
|
-
procs: List[Popen] = [Popen(first_cmd, stdout=PIPE, stderr=PIPE, **kwargs)]
|
|
62
|
-
for cmd in rest_cmds:
|
|
63
|
-
last_stdout = procs[-1].stdout
|
|
64
|
-
procs.append(Popen(cmd, stdin=last_stdout, stdout=PIPE, stderr=PIPE, **kwargs))
|
|
65
|
-
return procs[-1]
|
|
66
|
-
return Popen(first_cmd, stdout=PIPE, stderr=PIPE, **kwargs)
|
|
67
|
-
|
|
68
|
-
@staticmethod
|
|
69
|
-
def shell_exec(cmd_line: str, **kwargs) -> Tuple[Optional[str], ExitStatus]:
|
|
70
|
-
"""Execute command with arguments and return it's run status.
|
|
71
|
-
:param cmd_line: the command line to be executed.
|
|
72
|
-
"""
|
|
73
|
-
proc = Terminal._chain_pipes(cmd_line.split("|"), **kwargs)
|
|
74
|
-
log.info("Executing shell command: %s", cmd_line)
|
|
75
|
-
output, err_out = proc.communicate()
|
|
76
|
-
ret_code = ExitStatus.FAILED if err_out else ExitStatus.SUCCESS
|
|
77
|
-
log.info("Execution result: %s", ret_code)
|
|
78
|
-
return output.decode(Charset.UTF_8.val) if output else err_out.decode(Charset.UTF_8.val), ret_code
|
|
79
|
-
|
|
80
|
-
@staticmethod
|
|
81
|
-
def shell_poll(cmd_line: str, **kwargs) -> None:
|
|
82
|
-
"""Execute command with arguments and continuously poll it's output.
|
|
83
|
-
:param cmd_line: the command line to be executed.
|
|
84
|
-
"""
|
|
85
|
-
if "stdout" in kwargs:
|
|
86
|
-
del kwargs["stdout"] # Deleted because it's forbidden
|
|
87
|
-
if "stderr" in kwargs:
|
|
88
|
-
del kwargs["stderr"] # Deleted because it's forbidden
|
|
89
|
-
if "shell" in kwargs:
|
|
90
|
-
del kwargs["shell"] # Deleted because we don't want to use it
|
|
91
|
-
try:
|
|
92
|
-
log.info("Polling shell command: %s", cmd_line)
|
|
93
|
-
cmd_args = list(filter(None, shlex.split(cmd_line)))
|
|
94
|
-
with Popen(cmd_args, stdout=PIPE, stderr=PIPE, **kwargs) as proc:
|
|
95
|
-
process = select.poll()
|
|
96
|
-
process.register(proc.stdout)
|
|
97
|
-
process.register(proc.stderr)
|
|
98
|
-
while not Keyboard.kbhit():
|
|
99
|
-
if poll_obj := process.poll(0.5):
|
|
100
|
-
line = proc.stdout.readline()
|
|
101
|
-
sysout(line.decode(Charset.UTF_8.val) if isinstance(line, bytes) else line.strip(), end="")
|
|
102
|
-
log.debug("Polling returned: %s", str(poll_obj))
|
|
103
|
-
os.killpg(os.getpgid(proc.pid), signal.SIGTERM)
|
|
104
|
-
except (InterruptedError, KeyboardInterrupt):
|
|
105
|
-
log.warning("Polling process has been interrupted command='%s'", cmd_line)
|
|
106
|
-
except CalledProcessError as err:
|
|
107
|
-
log.error("Command failed: %s => %s", cmd_line, err)
|
|
108
|
-
|
|
109
|
-
@staticmethod
|
|
110
|
-
def open(filename: str) -> None:
|
|
111
|
-
"""Open the specified file using the default editor."""
|
|
112
|
-
my_os = os.environ.get("HHS_MY_OS", platform.system())
|
|
113
|
-
if "Darwin" == my_os:
|
|
114
|
-
Terminal.shell_exec(f"open {filename}")
|
|
115
|
-
elif "Linux" == my_os:
|
|
116
|
-
Terminal.shell_exec(f"xdg-open {filename}")
|
|
117
|
-
else:
|
|
118
|
-
raise NotImplementedError(f"OS '{my_os}' is not supported")
|
|
119
|
-
|
|
120
|
-
@classmethod
|
|
121
|
-
def restore(cls) -> None:
|
|
122
|
-
"""Clear the terminal and restore default attributes [wrap,cursor,echo]."""
|
|
123
|
-
cls.set_attributes(show_cursor=True, auto_wrap=True, enable_echo=True)
|
|
124
|
-
cls.alternate_screen(False)
|
|
125
|
-
sysout("%MOD(0)%", end="")
|
|
126
|
-
|
|
127
|
-
@classmethod
|
|
128
|
-
def set_enable_echo(cls, enabled: bool = True) -> None:
|
|
129
|
-
"""Enable echo in the terminal.
|
|
130
|
-
:param enabled: whether is enabled or not.
|
|
131
|
-
"""
|
|
132
|
-
if not cls.is_a_tty():
|
|
133
|
-
log.warning(NotATerminalError("set_enable_echo:: Requires a terminal (TTY)"))
|
|
134
|
-
return
|
|
135
|
-
|
|
136
|
-
os.popen(f"stty {'echo -raw' if enabled else 'raw -echo min 0'}").read()
|
|
137
|
-
|
|
138
|
-
@classmethod
|
|
139
|
-
def set_auto_wrap(cls, auto_wrap: bool = True) -> None:
|
|
140
|
-
"""Set auto-wrap mode in the terminal.
|
|
141
|
-
:param auto_wrap: whether auto_wrap is set or not.
|
|
142
|
-
"""
|
|
143
|
-
if not cls.is_a_tty():
|
|
144
|
-
log.warning(NotATerminalError("set_auto_wrap:: Requires a terminal (TTY)"))
|
|
145
|
-
return
|
|
146
|
-
|
|
147
|
-
sysout(Vt100.set_auto_wrap(auto_wrap), end="")
|
|
148
|
-
|
|
149
|
-
@classmethod
|
|
150
|
-
def set_show_cursor(cls, show_cursor: bool = True) -> None:
|
|
151
|
-
"""Show or hide cursor in the terminal.
|
|
152
|
-
:param show_cursor: whether to show or hide he cursor.
|
|
153
|
-
"""
|
|
154
|
-
if not cls.is_a_tty():
|
|
155
|
-
log.warning(NotATerminalError("set_show_cursor:: Requires a terminal (TTY)"))
|
|
156
|
-
return
|
|
157
|
-
|
|
158
|
-
sysout(Vt100.set_show_cursor(show_cursor), end="")
|
|
159
|
-
|
|
160
|
-
@classmethod
|
|
161
|
-
def set_attributes(cls, **attrs) -> None:
|
|
162
|
-
"""Wrapper to set all terminal attributes at once."""
|
|
163
|
-
# fmt: off
|
|
164
|
-
enable_echo = attrs['enable_echo']
|
|
165
|
-
auto_wrap = attrs['auto_wrap']
|
|
166
|
-
show_cursor = attrs['show_cursor']
|
|
167
|
-
# fmt: on
|
|
168
|
-
if enable_echo is not None:
|
|
169
|
-
cls.set_enable_echo(enable_echo)
|
|
170
|
-
if auto_wrap is not None:
|
|
171
|
-
cls.set_auto_wrap(auto_wrap)
|
|
172
|
-
if show_cursor is not None:
|
|
173
|
-
cls.set_show_cursor(show_cursor)
|
|
174
|
-
|
|
175
|
-
@classmethod
|
|
176
|
-
def clear(cls) -> None:
|
|
177
|
-
"""Clear terminal and move the cursor to HOME position (0, 0)."""
|
|
178
|
-
cls.INSTANCE.screen.clear()
|
|
179
|
-
|
|
180
|
-
@classmethod
|
|
181
|
-
def echo(cls, obj: Any, end: str = os.linesep) -> None:
|
|
182
|
-
"""Write the string representation of the object to the screen."""
|
|
183
|
-
cls.INSTANCE.screen.cursor.write(obj, end=end)
|
|
184
|
-
|
|
185
|
-
@classmethod
|
|
186
|
-
def alternate_screen(cls, enable: bool) -> None:
|
|
187
|
-
"""Switch to the alternate screen buffer on/off."""
|
|
188
|
-
cls.INSTANCE.screen.alternate = enable
|
|
189
|
-
|
|
190
|
-
def __init__(self):
|
|
191
|
-
self._screen = Screen.INSTANCE or Screen()
|
|
192
|
-
atexit.register(self.restore)
|
|
193
|
-
|
|
194
|
-
@property
|
|
195
|
-
def screen(self) -> Screen:
|
|
196
|
-
return self._screen
|
|
197
|
-
|
|
198
|
-
@property
|
|
199
|
-
def cursor(self) -> Cursor:
|
|
200
|
-
return self.screen.cursor
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
assert Terminal().INSTANCE is not None, "Failed to create Terminal instance"
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# _*_ coding: utf-8 _*_
|
|
2
|
-
#
|
|
3
|
-
# hspylib-clitt v0.9.116
|
|
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.116'
|