hspylib-clitt 0.9.32__tar.gz → 0.9.34__tar.gz

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.

Files changed (100) hide show
  1. {hspylib-clitt-0.9.32/hspylib_clitt.egg-info → hspylib-clitt-0.9.34}/PKG-INFO +2 -2
  2. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/README.md +1 -1
  3. hspylib-clitt-0.9.34/clitt/.version +1 -0
  4. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/__init__.py +2 -2
  5. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/__init__.py +2 -2
  6. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/appman/__init__.py +2 -2
  7. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/appman/templates/__init__.py +2 -2
  8. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/setman/__init__.py +2 -2
  9. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/widman/__init__.py +2 -2
  10. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/widman/widgets/__init__.py +2 -2
  11. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/__init__.py +2 -2
  12. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/icons/__init__.py +2 -2
  13. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/icons/emojis/__init__.py +2 -2
  14. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/icons/font_awesome/__init__.py +2 -2
  15. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/__init__.py +2 -2
  16. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/mchoose/__init__.py +2 -2
  17. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/mdashboard/__init__.py +2 -2
  18. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/menu/__init__.py +2 -2
  19. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/minput/__init__.py +3 -2
  20. hspylib-clitt-0.9.34/clitt/core/tui/minput/field_builder.py +112 -0
  21. hspylib-clitt-0.9.34/clitt/core/tui/minput/form_builder.py +73 -0
  22. hspylib-clitt-0.9.34/clitt/core/tui/minput/form_field.py +174 -0
  23. hspylib-clitt-0.9.34/clitt/core/tui/minput/input_validator.py +114 -0
  24. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/minput/menu_input.py +56 -63
  25. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/minput/minput_utils.py +33 -28
  26. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/mselect/__init__.py +2 -2
  27. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/table/__init__.py +2 -2
  28. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34/hspylib_clitt.egg-info}/PKG-INFO +2 -2
  29. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/hspylib_clitt.egg-info/SOURCES.txt +1 -0
  30. hspylib-clitt-0.9.32/clitt/.version +0 -1
  31. hspylib-clitt-0.9.32/clitt/core/tui/minput/form_builder.py +0 -152
  32. hspylib-clitt-0.9.32/clitt/core/tui/minput/form_field.py +0 -95
  33. hspylib-clitt-0.9.32/clitt/core/tui/minput/input_validator.py +0 -125
  34. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/MANIFEST.in +0 -0
  35. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/__classpath__.py +0 -0
  36. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/__main__.py +0 -0
  37. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/appman/appman.py +0 -0
  38. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/appman/appman_enums.py +0 -0
  39. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/appman/templates/build.gradle.tpl +0 -0
  40. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/appman/templates/classpath.py.tpl +0 -0
  41. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/appman/templates/dependencies.hspd.tpl +0 -0
  42. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/appman/templates/gitignore.tpl +0 -0
  43. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/appman/templates/main.py.tpl +0 -0
  44. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/appman/templates/main_qt.py.tpl +0 -0
  45. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/appman/templates/main_qt_view.py.tpl +0 -0
  46. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/appman/templates/main_qt_view.ui.tpl +0 -0
  47. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/appman/templates/run.sh.tpl +0 -0
  48. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/appman/templates/test_main.py.tpl +0 -0
  49. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/appman/templates/usage.txt.tpl +0 -0
  50. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/appman/templates/widget.py.tpl +0 -0
  51. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/setman/setman.py +0 -0
  52. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/setman/setman_config.py +0 -0
  53. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/setman/setman_entry.py +0 -0
  54. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/setman/setman_enums.py +0 -0
  55. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/setman/setman_repository.py +0 -0
  56. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/setman/setman_service.py +0 -0
  57. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/widman/widget.py +0 -0
  58. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/widman/widget_entry.py +0 -0
  59. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/widman/widgets/widget_free.py +0 -0
  60. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/widman/widgets/widget_punch.py +0 -0
  61. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/widman/widgets/widget_send_msg.py +0 -0
  62. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/widman/widgets/widget_time_calc.py +0 -0
  63. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/addons/widman/widman.py +0 -0
  64. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/icons/emojis/emojis.py +0 -0
  65. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/icons/emojis/face_smiling.py +0 -0
  66. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/icons/font_awesome/app_icons.py +0 -0
  67. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/icons/font_awesome/awesome.py +0 -0
  68. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/icons/font_awesome/control_icons.py +0 -0
  69. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/icons/font_awesome/dashboard_icons.py +0 -0
  70. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/icons/font_awesome/form_icons.py +0 -0
  71. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/icons/font_awesome/nav_icons.py +0 -0
  72. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/icons/font_awesome/widget_icons.py +0 -0
  73. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/mchoose/mchoose.py +0 -0
  74. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/mchoose/menu_choose.py +0 -0
  75. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/mdashboard/dashboard_builder.py +0 -0
  76. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/mdashboard/dashboard_item.py +0 -0
  77. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/mdashboard/mdashboard.py +0 -0
  78. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/mdashboard/menu_dashboard.py +0 -0
  79. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/menu/tui_menu.py +0 -0
  80. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/menu/tui_menu_action.py +0 -0
  81. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/menu/tui_menu_factory.py +0 -0
  82. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/menu/tui_menu_item.py +0 -0
  83. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/menu/tui_menu_ui.py +0 -0
  84. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/menu/tui_menu_view.py +0 -0
  85. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/minput/access_type.py +0 -0
  86. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/minput/input_type.py +0 -0
  87. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/minput/minput.py +0 -0
  88. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/mselect/menu_select.py +0 -0
  89. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/mselect/mselect.py +0 -0
  90. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/table/table_renderer.py +0 -0
  91. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/tui_application.py +0 -0
  92. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/tui_component.py +0 -0
  93. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/tui_preferences.py +0 -0
  94. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/core/tui/tui_screen.py +0 -0
  95. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/clitt/welcome.txt +0 -0
  96. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/hspylib_clitt.egg-info/dependency_links.txt +0 -0
  97. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/hspylib_clitt.egg-info/requires.txt +0 -0
  98. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/hspylib_clitt.egg-info/top_level.txt +0 -0
  99. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/setup.cfg +0 -0
  100. {hspylib-clitt-0.9.32 → hspylib-clitt-0.9.34}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hspylib-clitt
3
- Version: 0.9.32
3
+ Version: 0.9.34
4
4
  Summary: HsPyLib - CLI Terminal Tools
5
5
  Home-page: https://github.com/yorevs/hspylib
6
6
  Author: Hugo Saporetti Junior
@@ -30,7 +30,7 @@ Description-Content-Type: text/markdown
30
30
  ## Create professional CLI applications
31
31
 
32
32
  [![License](https://badgen.net/badge/license/MIT/gray)](LICENSE.md)
33
- [![Release](https://badgen.net/badge/release/v0.9.32/gray)](CHANGELOG.md#unreleased)
33
+ [![Release](https://badgen.net/badge/release/v0.9.34/gray)](CHANGELOG.md#unreleased)
34
34
  [![PyPi](https://badgen.net/badge/icon/python?icon=pypi&label)](https://pypi.org/project/hspylib-cfman)
35
35
  [![GitHub](https://badgen.net/badge/icon/github?icon=github&label)](https://github.com/yorevs/hspylib)
36
36
  [![Gitter](https://badgen.net/badge/icon/gitter?icon=gitter&label)](https://gitter.im/hspylib/community)
@@ -3,7 +3,7 @@
3
3
  ## Create professional CLI applications
4
4
 
5
5
  [![License](https://badgen.net/badge/license/MIT/gray)](LICENSE.md)
6
- [![Release](https://badgen.net/badge/release/v0.9.32/gray)](CHANGELOG.md#unreleased)
6
+ [![Release](https://badgen.net/badge/release/v0.9.34/gray)](CHANGELOG.md#unreleased)
7
7
  [![PyPi](https://badgen.net/badge/icon/python?icon=pypi&label)](https://pypi.org/project/hspylib-cfman)
8
8
  [![GitHub](https://badgen.net/badge/icon/github?icon=github&label)](https://github.com/yorevs/hspylib)
9
9
  [![Gitter](https://badgen.net/badge/icon/gitter?icon=gitter&label)](https://gitter.im/hspylib/community)
@@ -0,0 +1 @@
1
+ 0.9.34
@@ -1,6 +1,6 @@
1
1
  # _*_ coding: utf-8 _*_
2
2
  #
3
- # hspylib-clitt v0.9.32
3
+ # hspylib-clitt v0.9.34
4
4
  #
5
5
  # Package: main.clitt
6
6
  """Package initialization."""
@@ -9,4 +9,4 @@ __all__ = [
9
9
  'addons',
10
10
  'core'
11
11
  ]
12
- __version__ = '0.9.32'
12
+ __version__ = '0.9.34'
@@ -1,6 +1,6 @@
1
1
  # _*_ coding: utf-8 _*_
2
2
  #
3
- # hspylib-clitt v0.9.32
3
+ # hspylib-clitt v0.9.34
4
4
  #
5
5
  # Package: main.clitt.addons
6
6
  """Package initialization."""
@@ -10,4 +10,4 @@ __all__ = [
10
10
  'setman',
11
11
  'widman'
12
12
  ]
13
- __version__ = '0.9.32'
13
+ __version__ = '0.9.34'
@@ -1,6 +1,6 @@
1
1
  # _*_ coding: utf-8 _*_
2
2
  #
3
- # hspylib-clitt v0.9.32
3
+ # hspylib-clitt v0.9.34
4
4
  #
5
5
  # Package: main.clitt.addons.appman
6
6
  """Package initialization."""
@@ -10,4 +10,4 @@ __all__ = [
10
10
  'appman_enums',
11
11
  'templates'
12
12
  ]
13
- __version__ = '0.9.32'
13
+ __version__ = '0.9.34'
@@ -1,6 +1,6 @@
1
1
  # _*_ coding: utf-8 _*_
2
2
  #
3
- # hspylib-clitt v0.9.32
3
+ # hspylib-clitt v0.9.34
4
4
  #
5
5
  # Package: main.clitt.addons.appman.templates
6
6
  """Package initialization."""
@@ -8,4 +8,4 @@
8
8
  __all__ = [
9
9
 
10
10
  ]
11
- __version__ = '0.9.32'
11
+ __version__ = '0.9.34'
@@ -1,6 +1,6 @@
1
1
  # _*_ coding: utf-8 _*_
2
2
  #
3
- # hspylib-clitt v0.9.32
3
+ # hspylib-clitt v0.9.34
4
4
  #
5
5
  # Package: main.clitt.addons.setman
6
6
  """Package initialization."""
@@ -13,4 +13,4 @@ __all__ = [
13
13
  'setman_repository',
14
14
  'setman_service'
15
15
  ]
16
- __version__ = '0.9.32'
16
+ __version__ = '0.9.34'
@@ -1,6 +1,6 @@
1
1
  # _*_ coding: utf-8 _*_
2
2
  #
3
- # hspylib-clitt v0.9.32
3
+ # hspylib-clitt v0.9.34
4
4
  #
5
5
  # Package: main.clitt.addons.widman
6
6
  """Package initialization."""
@@ -11,4 +11,4 @@ __all__ = [
11
11
  'widgets',
12
12
  'widman'
13
13
  ]
14
- __version__ = '0.9.32'
14
+ __version__ = '0.9.34'
@@ -1,6 +1,6 @@
1
1
  # _*_ coding: utf-8 _*_
2
2
  #
3
- # hspylib-clitt v0.9.32
3
+ # hspylib-clitt v0.9.34
4
4
  #
5
5
  # Package: main.clitt.addons.widman.widgets
6
6
  """Package initialization."""
@@ -11,4 +11,4 @@ __all__ = [
11
11
  'widget_send_msg',
12
12
  'widget_time_calc'
13
13
  ]
14
- __version__ = '0.9.32'
14
+ __version__ = '0.9.34'
@@ -1,6 +1,6 @@
1
1
  # _*_ coding: utf-8 _*_
2
2
  #
3
- # hspylib-clitt v0.9.32
3
+ # hspylib-clitt v0.9.34
4
4
  #
5
5
  # Package: main.clitt.core
6
6
  """Package initialization."""
@@ -9,4 +9,4 @@ __all__ = [
9
9
  'icons',
10
10
  'tui'
11
11
  ]
12
- __version__ = '0.9.32'
12
+ __version__ = '0.9.34'
@@ -1,6 +1,6 @@
1
1
  # _*_ coding: utf-8 _*_
2
2
  #
3
- # hspylib-clitt v0.9.32
3
+ # hspylib-clitt v0.9.34
4
4
  #
5
5
  # Package: main.clitt.core.icons
6
6
  """Package initialization."""
@@ -9,4 +9,4 @@ __all__ = [
9
9
  'emojis',
10
10
  'font_awesome'
11
11
  ]
12
- __version__ = '0.9.32'
12
+ __version__ = '0.9.34'
@@ -1,6 +1,6 @@
1
1
  # _*_ coding: utf-8 _*_
2
2
  #
3
- # hspylib-clitt v0.9.32
3
+ # hspylib-clitt v0.9.34
4
4
  #
5
5
  # Package: main.clitt.core.icons.emojis
6
6
  """Package initialization."""
@@ -9,4 +9,4 @@ __all__ = [
9
9
  'emojis',
10
10
  'face_smiling'
11
11
  ]
12
- __version__ = '0.9.32'
12
+ __version__ = '0.9.34'
@@ -1,6 +1,6 @@
1
1
  # _*_ coding: utf-8 _*_
2
2
  #
3
- # hspylib-clitt v0.9.32
3
+ # hspylib-clitt v0.9.34
4
4
  #
5
5
  # Package: main.clitt.core.icons.font_awesome
6
6
  """Package initialization."""
@@ -14,4 +14,4 @@ __all__ = [
14
14
  'nav_icons',
15
15
  'widget_icons'
16
16
  ]
17
- __version__ = '0.9.32'
17
+ __version__ = '0.9.34'
@@ -1,6 +1,6 @@
1
1
  # _*_ coding: utf-8 _*_
2
2
  #
3
- # hspylib-clitt v0.9.32
3
+ # hspylib-clitt v0.9.34
4
4
  #
5
5
  # Package: main.clitt.core.tui
6
6
  """Package initialization."""
@@ -17,4 +17,4 @@ __all__ = [
17
17
  'tui_preferences',
18
18
  'tui_screen'
19
19
  ]
20
- __version__ = '0.9.32'
20
+ __version__ = '0.9.34'
@@ -1,6 +1,6 @@
1
1
  # _*_ coding: utf-8 _*_
2
2
  #
3
- # hspylib-clitt v0.9.32
3
+ # hspylib-clitt v0.9.34
4
4
  #
5
5
  # Package: main.clitt.core.tui.mchoose
6
6
  """Package initialization."""
@@ -9,4 +9,4 @@ __all__ = [
9
9
  'mchoose',
10
10
  'menu_choose'
11
11
  ]
12
- __version__ = '0.9.32'
12
+ __version__ = '0.9.34'
@@ -1,6 +1,6 @@
1
1
  # _*_ coding: utf-8 _*_
2
2
  #
3
- # hspylib-clitt v0.9.32
3
+ # hspylib-clitt v0.9.34
4
4
  #
5
5
  # Package: main.clitt.core.tui.mdashboard
6
6
  """Package initialization."""
@@ -11,4 +11,4 @@ __all__ = [
11
11
  'mdashboard',
12
12
  'menu_dashboard'
13
13
  ]
14
- __version__ = '0.9.32'
14
+ __version__ = '0.9.34'
@@ -1,6 +1,6 @@
1
1
  # _*_ coding: utf-8 _*_
2
2
  #
3
- # hspylib-clitt v0.9.32
3
+ # hspylib-clitt v0.9.34
4
4
  #
5
5
  # Package: main.clitt.core.tui.menu
6
6
  """Package initialization."""
@@ -13,4 +13,4 @@ __all__ = [
13
13
  'tui_menu_ui',
14
14
  'tui_menu_view'
15
15
  ]
16
- __version__ = '0.9.32'
16
+ __version__ = '0.9.34'
@@ -1,12 +1,13 @@
1
1
  # _*_ coding: utf-8 _*_
2
2
  #
3
- # hspylib-clitt v0.9.32
3
+ # hspylib-clitt v0.9.34
4
4
  #
5
5
  # Package: main.clitt.core.tui.minput
6
6
  """Package initialization."""
7
7
 
8
8
  __all__ = [
9
9
  'access_type',
10
+ 'field_builder',
10
11
  'form_builder',
11
12
  'form_field',
12
13
  'input_type',
@@ -15,4 +16,4 @@ __all__ = [
15
16
  'minput',
16
17
  'minput_utils'
17
18
  ]
18
- __version__ = '0.9.32'
19
+ __version__ = '0.9.34'
@@ -0,0 +1,112 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+
4
+ """
5
+ @project: HsPyLib
6
+ @package: clitt.core.tui.minput
7
+ @file: field_builder.py
8
+ @created: Thu, 20 May 2021
9
+ @author: <B>H</B>ugo <B>S</B>aporetti <B>J</B>unior"
10
+ @site: https://github.com/yorevs/hspylib
11
+ @license: MIT - Please refer to <https://opensource.org/licenses/MIT>
12
+
13
+ Copyright 2023, HsPyLib team
14
+ """
15
+ import re
16
+ from functools import reduce
17
+ from typing import Any
18
+
19
+ from hspylib.core.preconditions import check_argument
20
+ from hspylib.core.tools.commons import str_to_bool
21
+ from hspylib.core.tools.text_tools import snakecase
22
+
23
+ from clitt.core.tui.minput.access_type import AccessType
24
+ from clitt.core.tui.minput.form_field import FIELD_VALIDATOR_FNC, FormField
25
+ from clitt.core.tui.minput.input_type import InputType
26
+ from clitt.core.tui.minput.input_validator import InputValidator
27
+ from clitt.core.tui.minput.minput_utils import get_selected, MASK_SYMBOLS, unpack_masked, VALUE_SEPARATORS
28
+
29
+
30
+ class FieldBuilder:
31
+ """MenuInput form field builder."""
32
+
33
+ @staticmethod
34
+ def _validate_field(field: FormField) -> bool:
35
+ match field.itype:
36
+ case InputType.MASKED:
37
+ value, mask = unpack_masked(field.value)
38
+ valid = reduce(lambda n, m: n + m, list(map(lambda s: mask[len(value):].count(s), MASK_SYMBOLS))) == 0
39
+ case InputType.CHECKBOX:
40
+ valid = isinstance(field.value, bool)
41
+ case InputType.SELECT:
42
+ _, value = get_selected(field.value)
43
+ length = len(str(value or ''))
44
+ valid = field.min_length <= length <= field.max_length
45
+ case _:
46
+ length = len(str(field.value or ''))
47
+ valid = field.min_length <= length <= field.max_length
48
+ return valid
49
+
50
+ def __init__(self, parent: Any):
51
+ self._parent = parent
52
+ self._label = "Label"
53
+ self._dest = None
54
+ self._itype = InputType.TEXT
55
+ self._access_type = AccessType.READ_WRITE
56
+ self._min_max_length = 5, 30
57
+ self._value = ""
58
+ self._validator = InputValidator.anything(), self._validate_field
59
+
60
+ def label(self, label: str) -> "FieldBuilder":
61
+ self._label = label
62
+ return self
63
+
64
+ def dest(self, dest: str) -> "FieldBuilder":
65
+ self._dest = dest
66
+ return self
67
+
68
+ def itype(self, itype: str) -> "FieldBuilder":
69
+ self._itype = InputType.of_value(itype)
70
+ return self
71
+
72
+ def min_max_length(self, min_length: int, max_length: int) -> "FieldBuilder":
73
+ check_argument(max_length >= min_length, "Invalid field length: ({}-{})", min_length, max_length)
74
+ check_argument(
75
+ max_length > 0 and min_length > 0, "Invalid field length: ({}-{})", min_length, max_length
76
+ )
77
+ self._min_max_length = min_length, max_length
78
+ return self
79
+
80
+ def access_type(self, access_type: str) -> "FieldBuilder":
81
+ self._access_type = AccessType.of_value(access_type)
82
+ return self
83
+
84
+ def value(self, value: Any | None) -> "FieldBuilder":
85
+ self._value = value
86
+ return self
87
+
88
+ def validator(
89
+ self,
90
+ input_validator: InputValidator = None,
91
+ field_validator: FIELD_VALIDATOR_FNC = None) -> "FieldBuilder":
92
+ self._validator = input_validator, field_validator or self._validate_field
93
+ return self
94
+
95
+ def build(self) -> Any:
96
+ if self._itype == InputType.CHECKBOX:
97
+ self._value = str_to_bool(str(self._value))
98
+ elif self._itype == InputType.SELECT:
99
+ parts = re.split(VALUE_SEPARATORS, re.sub('[<>]', '', str(self._value or '')))
100
+ self._min_max_length = len(min(parts, key=len)), len(max(parts, key=len))
101
+ elif self._itype == InputType.MASKED:
102
+ _, mask = unpack_masked(str(self._value))
103
+ min_max = reduce(lambda n, m: n + m, list(map(lambda s: mask.count(s), MASK_SYMBOLS)))
104
+ self._min_max_length = min_max, min_max
105
+ self._dest = self._dest or snakecase(self._label)
106
+ self._parent.fields.append(FormField(
107
+ self._label, self._dest, self._itype,
108
+ self._min_max_length[0], self._min_max_length[1],
109
+ self._access_type, self._value, self._validator[0], self._validator[1]
110
+ ))
111
+
112
+ return self._parent
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+
4
+ """
5
+ @project: HsPyLib
6
+ @package: clitt.core.tui.minput
7
+ @file: form_builder.py
8
+ @created: Thu, 20 May 2021
9
+ @author: <B>H</B>ugo <B>S</B>aporetti <B>J</B>unior"
10
+ @site: https://github.com/yorevs/hspylib
11
+ @license: MIT - Please refer to <https://opensource.org/licenses/MIT>
12
+
13
+ Copyright 2023, HsPyLib team
14
+ """
15
+ import re
16
+ from typing import Any, List
17
+
18
+ from hspylib.core.tools.dict_tools import get_or_default
19
+
20
+ from clitt.core.tui.minput.field_builder import FieldBuilder
21
+ from clitt.core.tui.minput.form_field import FormField
22
+ from clitt.core.tui.minput.input_validator import InputValidator
23
+
24
+
25
+ class FormBuilder:
26
+ """MenuInput form builder."""
27
+
28
+ def __init__(self) -> None:
29
+ self.fields = []
30
+ self._fn_validate = None
31
+
32
+ @staticmethod
33
+ def get_attr(parts: List[str], index: int, default_value: Any = None) -> str:
34
+ return get_or_default(parts, index, default_value) or default_value
35
+
36
+ def from_tokenized(self, minput_tokens: List[str], separator: str = '|') -> 'FormBuilder':
37
+ """Construct the forms based on string tokens.
38
+
39
+ Field tokens (in-order):
40
+ <Label> : The field label. Consisting only of alphanumeric characters and under‐scores.
41
+ [Mode] : The input mode. One of {[text]|password|checkbox|select}.
42
+ [Type] : The input type. One of {letters|numbers|words|[anything]}.
43
+ [Min/Max len] : The minimum and maximum length of characters allowed. Defaults to [0/30].
44
+ [Perm] : The field permissions. One of {r|[rw]}. Where \"r\" for Read Only ; \"rw\" for Read & Write.
45
+ [Value] : The initial value of the field. This field may not be blank if the field is read only.
46
+ """
47
+ for tk_field in minput_tokens:
48
+ parts = list(map(str.strip, tk_field.split(separator)))
49
+ validator_fn = getattr(InputValidator, self.get_attr(parts, 2, 'anything'))
50
+ min_max = list(map(int, map(str.strip, self.get_attr(parts, 3, '5/30').split('/'))))
51
+ access = re.sub('^rw$', 'read-write', self.get_attr(parts, 4, 'rw'))
52
+ access = re.sub('^r$', 'read-only', access)
53
+ # fmt: off
54
+ self.field() \
55
+ .label(self.get_attr(parts, 0, 'Label')) \
56
+ .itype(self.get_attr(parts, 1, 'text')) \
57
+ .min_max_length(
58
+ get_or_default(min_max, 0, 5),
59
+ get_or_default(min_max, 1, 30)
60
+ ) \
61
+ .access_type(access) \
62
+ .validator(validator_fn()) \
63
+ .value(self.get_attr(parts, 5, None)) \
64
+ .build()
65
+ # fmt: on
66
+
67
+ return self
68
+
69
+ def field(self) -> Any:
70
+ return FieldBuilder(self)
71
+
72
+ def build(self) -> List[FormField]:
73
+ return self.fields
@@ -0,0 +1,174 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+
4
+ """
5
+ @project: HsPyLib
6
+ @package: clitt.core.tui.minput
7
+ @file: form_field.py
8
+ @created: Thu, 20 May 2021
9
+ @author: <B>H</B>ugo <B>S</B>aporetti <B>J</B>unior"
10
+ @site: https://github.com/yorevs/hspylib
11
+ @license: MIT - Please refer to <https://opensource.org/licenses/MIT>
12
+
13
+ Copyright 2023, HsPyLib team
14
+ """
15
+ from typing import Any, Callable, Optional, TypeVar
16
+
17
+ from hspylib.core.exception.exceptions import InvalidInputError
18
+
19
+ from clitt.core.icons.font_awesome.form_icons import FormIcons
20
+ from clitt.core.tui.minput.access_type import AccessType
21
+ from clitt.core.tui.minput.input_type import InputType
22
+ from clitt.core.tui.minput.input_validator import InputValidator
23
+ from clitt.core.tui.minput.minput_utils import get_selected, MASK_SYMBOLS, toggle_selected, unpack_masked
24
+
25
+ FIELD_VALIDATOR_FNC = TypeVar("FIELD_VALIDATOR_FNC", bound=Callable[['FormField'], bool])
26
+
27
+
28
+ class FormField:
29
+ """Represent a MenuInput form field."""
30
+
31
+ def __init__(
32
+ self,
33
+ label: str = None,
34
+ dest: str = None,
35
+ itype: InputType = InputType.TEXT,
36
+ min_length: int = 5,
37
+ max_length: int = 30,
38
+ access_type: AccessType = AccessType.READ_WRITE,
39
+ value: Any = "",
40
+ input_validator: InputValidator = InputValidator.anything(),
41
+ field_validator: FIELD_VALIDATOR_FNC = None
42
+ ):
43
+ self._label = label
44
+ self._dest = dest
45
+ self._itype = itype
46
+ self._min_length = min_length
47
+ self._max_length = max_length
48
+ self._access_type = access_type
49
+ self.input_validator = input_validator
50
+ self.field_validator = field_validator
51
+ self._value = self.assign(value)
52
+
53
+ def __str__(self) -> str:
54
+ return (
55
+ f"[{self.label}, {self.itype.name}({self.min_length}/{self.max_length})"
56
+ f"<{self.access_type}> = '{self.value or ''}']"
57
+ )
58
+
59
+ def __repr__(self):
60
+ return str(self)
61
+
62
+ @property
63
+ def label(self) -> str:
64
+ return self._label
65
+
66
+ @property
67
+ def dest(self) -> str:
68
+ return self._dest
69
+
70
+ @property
71
+ def itype(self) -> InputType:
72
+ return self._itype
73
+
74
+ @property
75
+ def min_length(self) -> int:
76
+ return self._min_length
77
+
78
+ @property
79
+ def max_length(self) -> int:
80
+ return self._max_length
81
+
82
+ @property
83
+ def access_type(self) -> AccessType:
84
+ return self._access_type
85
+
86
+ @property
87
+ def value(self) -> Optional[Any]:
88
+ return self._value
89
+
90
+ @value.setter
91
+ def value(self, new_value: Any) -> None:
92
+ self._value = self.assign(new_value)
93
+
94
+ @property
95
+ def length(self) -> int:
96
+ """Get the field real length, depending on the field type."""
97
+ real_value = str(self.value or '')
98
+ match self.itype:
99
+ case InputType.CHECKBOX:
100
+ real_value = '1'
101
+ case InputType.SELECT:
102
+ _, real_value = get_selected(str(self.value))
103
+ case InputType.MASKED:
104
+ real_value, mask = unpack_masked(str(self.value))
105
+ idx = len(real_value)
106
+ while idx < len(mask) and mask[idx] not in MASK_SYMBOLS:
107
+ idx += 1
108
+ return idx
109
+
110
+ return len(real_value)
111
+
112
+ @property
113
+ def icon(self) -> FormIcons:
114
+ if self.access_type == AccessType.READ_ONLY:
115
+ return FormIcons.LOCKED
116
+ match self.itype:
117
+ case InputType.PASSWORD:
118
+ icon = FormIcons.HIDDEN
119
+ case InputType.CHECKBOX:
120
+ icon = FormIcons.MARKED
121
+ case InputType.SELECT:
122
+ icon = FormIcons.SELECTABLE
123
+ case InputType.MASKED:
124
+ icon = FormIcons.MASKED
125
+ case InputType.TEXT:
126
+ if self.input_validator.pattern_type == InputValidator.PatternType.NUMBERS:
127
+ icon = FormIcons.NUMBERS
128
+ elif self.input_validator.pattern_type == InputValidator.PatternType.LETTERS:
129
+ icon = FormIcons.LETTERS
130
+ elif self.input_validator.pattern_type == InputValidator.PatternType.WORDS:
131
+ icon = FormIcons.EDITABLE
132
+ else:
133
+ icon = FormIcons.EDITABLE
134
+ case _:
135
+ icon = FormIcons.QUESTION_CIRCLE
136
+ return icon
137
+
138
+ def can_write(self) -> bool:
139
+ """Whether this field value can be set or not."""
140
+ return self.access_type == AccessType.READ_WRITE
141
+
142
+ def assign(self, value: Any) -> Any:
143
+ """Assign a value for this field. Must match the input validator, otherwise an exception will be thrown.
144
+ :param value: TODO
145
+ """
146
+ valid = True
147
+ if value is not None and self.input_validator:
148
+ match self.itype:
149
+ case InputType.MASKED:
150
+ unpack_masked(value)
151
+ case InputType.SELECT:
152
+ toggle_selected(value)
153
+ case InputType.CHECKBOX:
154
+ valid = isinstance(value, bool)
155
+ case _:
156
+ valid = all([self.validate_input(val) for val in str(value)])
157
+
158
+ if not valid:
159
+ raise InvalidInputError(f"Value {value} is invalid!")
160
+
161
+ self._value = value
162
+
163
+ return self._value
164
+
165
+ def validate_input(self, value: Any = None) -> bool:
166
+ """Validate the input using the assigned validator.
167
+ :param value: the value to validate against.
168
+ """
169
+ return self.input_validator(str(value)) if self.input_validator else True
170
+
171
+ def validate_field(self) -> bool:
172
+ """Validate the field using the assigned validator function.
173
+ """
174
+ return self.field_validator(self) if self.field_validator else False