hspylib-clitt 0.9.27__py3-none-any.whl → 0.9.29__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 +2 -2
- clitt/__main__.py +46 -15
- clitt/addons/__init__.py +3 -2
- clitt/addons/appman/__init__.py +2 -2
- clitt/addons/appman/appman.py +1 -1
- clitt/addons/appman/appman_enums.py +6 -1
- clitt/addons/appman/templates/__init__.py +2 -2
- clitt/addons/setman/__init__.py +16 -0
- clitt/addons/setman/setman.py +203 -0
- clitt/addons/setman/setman_config.py +38 -0
- clitt/addons/setman/setman_entry.py +109 -0
- clitt/addons/setman/setman_enums.py +55 -0
- clitt/addons/setman/setman_repository.py +68 -0
- clitt/addons/setman/setman_service.py +67 -0
- clitt/addons/widman/__init__.py +2 -2
- clitt/addons/widman/widget.py +1 -1
- clitt/addons/widman/widget_entry.py +1 -1
- clitt/addons/widman/widgets/__init__.py +2 -2
- clitt/addons/widman/widgets/widget_free.py +1 -1
- clitt/addons/widman/widgets/widget_punch.py +1 -1
- clitt/addons/widman/widgets/widget_send_msg.py +1 -1
- clitt/addons/widman/widgets/widget_time_calc.py +1 -1
- clitt/addons/widman/widman.py +1 -1
- clitt/core/__init__.py +2 -2
- clitt/core/icons/__init__.py +2 -2
- clitt/core/icons/emojis/__init__.py +2 -2
- clitt/core/icons/emojis/emojis.py +1 -1
- clitt/core/icons/emojis/face_smiling.py +1 -1
- clitt/core/icons/font_awesome/__init__.py +2 -2
- clitt/core/icons/font_awesome/app_icons.py +1 -1
- clitt/core/icons/font_awesome/awesome.py +1 -1
- clitt/core/icons/font_awesome/control_icons.py +1 -1
- clitt/core/icons/font_awesome/dashboard_icons.py +1 -1
- clitt/core/icons/font_awesome/form_icons.py +1 -1
- clitt/core/icons/font_awesome/nav_icons.py +1 -1
- clitt/core/icons/font_awesome/widget_icons.py +1 -1
- clitt/core/tui/__init__.py +2 -2
- clitt/core/tui/mchoose/__init__.py +2 -2
- clitt/core/tui/mchoose/menu_choose.py +1 -1
- clitt/core/tui/mdashboard/__init__.py +2 -2
- clitt/core/tui/menu/__init__.py +2 -2
- clitt/core/tui/menu/tui_menu_item.py +1 -1
- clitt/core/tui/minput/__init__.py +2 -2
- clitt/core/tui/minput/minput.py +0 -15
- clitt/core/tui/mselect/__init__.py +2 -2
- clitt/core/tui/mselect/menu_select.py +3 -3
- clitt/core/tui/table/__init__.py +2 -2
- clitt/core/tui/tui_application.py +1 -1
- clitt/core/tui/tui_component.py +5 -5
- clitt/core/tui/tui_preferences.py +1 -1
- {hspylib_clitt-0.9.27.dist-info → hspylib_clitt-0.9.29.dist-info}/METADATA +2 -2
- hspylib_clitt-0.9.29.dist-info/RECORD +88 -0
- hspylib_clitt-0.9.27.dist-info/RECORD +0 -81
- {hspylib_clitt-0.9.27.dist-info → hspylib_clitt-0.9.29.dist-info}/WHEEL +0 -0
- {hspylib_clitt-0.9.27.dist-info → hspylib_clitt-0.9.29.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
@project: HsPyLib-Clitt
|
|
6
|
+
@package: clitt.addons.setman
|
|
7
|
+
@file: setman_repository.py
|
|
8
|
+
@created: Mon, 5 Jun 2023
|
|
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 List, Optional, Set
|
|
16
|
+
|
|
17
|
+
from datasource.identity import Identity
|
|
18
|
+
from datasource.sqlite.sqlite_repository import SQLiteRepository
|
|
19
|
+
|
|
20
|
+
from clitt.addons.setman.setman_entry import SetmanEntry
|
|
21
|
+
from clitt.addons.setman.setman_enums import SettingsType
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class SetmanRepository(SQLiteRepository[SetmanEntry]):
|
|
25
|
+
"""Provide CRUD operations for the Vault application."""
|
|
26
|
+
|
|
27
|
+
@property
|
|
28
|
+
def database(self) -> str:
|
|
29
|
+
return self._config.database
|
|
30
|
+
|
|
31
|
+
def find_by_name(self, name: str, fields: Set[str] = None) -> Optional[SetmanEntry]:
|
|
32
|
+
"""TODO"""
|
|
33
|
+
fields = "*" if not fields else ", ".join(fields)
|
|
34
|
+
sql = f"SELECT {fields} FROM {self.table_name()} WHERE name = ? ORDER BY name"
|
|
35
|
+
result = next((e for e in self.execute(sql, name=name)[1]), None)
|
|
36
|
+
|
|
37
|
+
return self.to_entity_type(result) if result else None
|
|
38
|
+
|
|
39
|
+
def search(self, name: str, stype: SettingsType, fields: Set[str] = None) -> List[SetmanEntry]:
|
|
40
|
+
"""TODO"""
|
|
41
|
+
fields = "*" if not fields else ", ".join(fields)
|
|
42
|
+
search_name = f"%{name}%" if name != '%' else name
|
|
43
|
+
if stype:
|
|
44
|
+
sql = f"SELECT {fields} FROM {self.table_name()} WHERE name LIKE ? AND stype = ? ORDER BY name"
|
|
45
|
+
result = self.execute(sql, name=search_name, stype=stype.val)[1] or []
|
|
46
|
+
else:
|
|
47
|
+
sql = f"SELECT {fields} FROM {self.table_name()} WHERE name LIKE ? ORDER BY name"
|
|
48
|
+
result = self.execute(sql, name=search_name)[1] or []
|
|
49
|
+
|
|
50
|
+
return list(map(self.to_entity_type, result))
|
|
51
|
+
|
|
52
|
+
def truncate(self, table_name: str) -> None:
|
|
53
|
+
"""TODO"""
|
|
54
|
+
self.execute(f'DELETE FROM "{table_name}"')
|
|
55
|
+
|
|
56
|
+
def table_name(self) -> str:
|
|
57
|
+
return "SETTINGS"
|
|
58
|
+
|
|
59
|
+
def to_entity_type(self, entity_dict: dict | tuple) -> SetmanEntry:
|
|
60
|
+
if isinstance(entity_dict, dict):
|
|
61
|
+
return SetmanEntry(Identity(SetmanEntry.SetmanId(entity_dict["uuid"])), **entity_dict)
|
|
62
|
+
return SetmanEntry(
|
|
63
|
+
Identity(SetmanEntry.SetmanId(entity_dict[0])),
|
|
64
|
+
entity_dict[1],
|
|
65
|
+
entity_dict[2],
|
|
66
|
+
SettingsType.of_value(entity_dict[3]),
|
|
67
|
+
entity_dict[4],
|
|
68
|
+
)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
@project: HsPyLib-Clitt
|
|
6
|
+
@package: clitt.addons.setman
|
|
7
|
+
@file: setman_service.py
|
|
8
|
+
@created: Mon, 5 Jun 2023
|
|
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 textwrap import dedent
|
|
16
|
+
from typing import List, Optional
|
|
17
|
+
|
|
18
|
+
from datasource.crud_service import CrudService
|
|
19
|
+
|
|
20
|
+
from clitt.addons.setman.setman_config import SetmanConfig
|
|
21
|
+
from clitt.addons.setman.setman_entry import SetmanEntry
|
|
22
|
+
from clitt.addons.setman.setman_enums import SettingsType
|
|
23
|
+
from clitt.addons.setman.setman_repository import SetmanRepository
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class SetmanService(CrudService[SetmanRepository, SetmanEntry]):
|
|
27
|
+
"""Provides a CRUD service for the Setman application."""
|
|
28
|
+
|
|
29
|
+
def __init__(self, setman_config: SetmanConfig):
|
|
30
|
+
super().__init__(SetmanRepository(setman_config))
|
|
31
|
+
|
|
32
|
+
def get(self, name: str) -> Optional[SetmanEntry]:
|
|
33
|
+
"""Get a setman entry using the specified name.
|
|
34
|
+
:param name: the setman entry name to find.
|
|
35
|
+
"""
|
|
36
|
+
return self.repository.find_by_name(name)
|
|
37
|
+
|
|
38
|
+
def search(self, name: str, stype: SettingsType = None) -> List[SetmanEntry]:
|
|
39
|
+
"""Get a setman entry using the specified name.
|
|
40
|
+
:param name: the setman entry name to find.
|
|
41
|
+
:param stype: the settings type to filter.
|
|
42
|
+
"""
|
|
43
|
+
return self.repository.search(name, stype)
|
|
44
|
+
|
|
45
|
+
def truncate_settings_db(self) -> None:
|
|
46
|
+
"""Truncate the settings table."""
|
|
47
|
+
self.repository.truncate("SETTINGS")
|
|
48
|
+
|
|
49
|
+
def create_settings_db(self) -> None:
|
|
50
|
+
"""Create a brand new setman database file."""
|
|
51
|
+
self.repository.execute(
|
|
52
|
+
dedent(
|
|
53
|
+
"""
|
|
54
|
+
CREATE TABLE IF NOT EXISTS "SETTINGS"
|
|
55
|
+
(
|
|
56
|
+
uuid TEXT not null,
|
|
57
|
+
name TEXT not null,
|
|
58
|
+
value TEXT not null,
|
|
59
|
+
stype TEXT not null,
|
|
60
|
+
modified TEXT not null,
|
|
61
|
+
|
|
62
|
+
CONSTRAINT UUID_pk PRIMARY KEY (uuid),
|
|
63
|
+
CONSTRAINT NAME_uk UNIQUE (name)
|
|
64
|
+
)
|
|
65
|
+
"""
|
|
66
|
+
)
|
|
67
|
+
)
|
clitt/addons/widman/__init__.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# _*_ coding: utf-8 _*_
|
|
2
2
|
#
|
|
3
|
-
# hspylib-clitt v0.9.
|
|
3
|
+
# hspylib-clitt v0.9.29
|
|
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.
|
|
14
|
+
__version__ = '0.9.29'
|
clitt/addons/widman/widget.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# _*_ coding: utf-8 _*_
|
|
2
2
|
#
|
|
3
|
-
# hspylib-clitt v0.9.
|
|
3
|
+
# hspylib-clitt v0.9.29
|
|
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.
|
|
14
|
+
__version__ = '0.9.29'
|
clitt/addons/widman/widman.py
CHANGED
clitt/core/__init__.py
CHANGED
clitt/core/icons/__init__.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# _*_ coding: utf-8 _*_
|
|
2
2
|
#
|
|
3
|
-
# hspylib-clitt v0.9.
|
|
3
|
+
# hspylib-clitt v0.9.29
|
|
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.
|
|
12
|
+
__version__ = '0.9.29'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# _*_ coding: utf-8 _*_
|
|
2
2
|
#
|
|
3
|
-
# hspylib-clitt v0.9.
|
|
3
|
+
# hspylib-clitt v0.9.29
|
|
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.
|
|
12
|
+
__version__ = '0.9.29'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# _*_ coding: utf-8 _*_
|
|
2
2
|
#
|
|
3
|
-
# hspylib-clitt v0.9.
|
|
3
|
+
# hspylib-clitt v0.9.29
|
|
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.
|
|
17
|
+
__version__ = '0.9.29'
|
clitt/core/tui/__init__.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# _*_ coding: utf-8 _*_
|
|
2
2
|
#
|
|
3
|
-
# hspylib-clitt v0.9.
|
|
3
|
+
# hspylib-clitt v0.9.29
|
|
4
4
|
#
|
|
5
5
|
# Package: main.clitt.core.tui
|
|
6
6
|
"""Package initialization."""
|
|
@@ -16,4 +16,4 @@ __all__ = [
|
|
|
16
16
|
'tui_component',
|
|
17
17
|
'tui_preferences'
|
|
18
18
|
]
|
|
19
|
-
__version__ = '0.9.
|
|
19
|
+
__version__ = '0.9.29'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# _*_ coding: utf-8 _*_
|
|
2
2
|
#
|
|
3
|
-
# hspylib-clitt v0.9.
|
|
3
|
+
# hspylib-clitt v0.9.29
|
|
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.
|
|
12
|
+
__version__ = '0.9.29'
|
|
@@ -81,7 +81,7 @@ class MenuChoose(TUIComponent):
|
|
|
81
81
|
option_line = str(self.items[idx])
|
|
82
82
|
erase_line()
|
|
83
83
|
# Print the selector if the index is currently selected
|
|
84
|
-
selector = self.
|
|
84
|
+
selector = self._draw_cursor_line(idx == self.sel_index)
|
|
85
85
|
mark = self.prefs.marked if self.sel_options[idx] == 1 else self.prefs.unmarked
|
|
86
86
|
# fmt: off
|
|
87
87
|
line_fmt = (
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# _*_ coding: utf-8 _*_
|
|
2
2
|
#
|
|
3
|
-
# hspylib-clitt v0.9.
|
|
3
|
+
# hspylib-clitt v0.9.29
|
|
4
4
|
#
|
|
5
5
|
# Package: main.clitt.core.tui.mdashboard
|
|
6
6
|
"""Package initialization."""
|
|
@@ -10,4 +10,4 @@ __all__ = [
|
|
|
10
10
|
'dashboard_item',
|
|
11
11
|
'mdashboard'
|
|
12
12
|
]
|
|
13
|
-
__version__ = '0.9.
|
|
13
|
+
__version__ = '0.9.29'
|
clitt/core/tui/menu/__init__.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# _*_ coding: utf-8 _*_
|
|
2
2
|
#
|
|
3
|
-
# hspylib-clitt v0.9.
|
|
3
|
+
# hspylib-clitt v0.9.29
|
|
4
4
|
#
|
|
5
5
|
# Package: main.clitt.core.tui.menu
|
|
6
6
|
"""Package initialization."""
|
|
@@ -14,4 +14,4 @@ __all__ = [
|
|
|
14
14
|
'tui_menu_utils',
|
|
15
15
|
'tui_menu_view'
|
|
16
16
|
]
|
|
17
|
-
__version__ = '0.9.
|
|
17
|
+
__version__ = '0.9.29'
|
|
@@ -84,7 +84,7 @@ class TUIMenuItem(TUIMenu):
|
|
|
84
84
|
option_line = str(self._items[idx])
|
|
85
85
|
erase_line()
|
|
86
86
|
# Print the selector if the index is currently selected
|
|
87
|
-
selector = self.
|
|
87
|
+
selector = self._draw_cursor_line(is_selected=(idx == self._sel_index), has_bg_color=False)
|
|
88
88
|
# fmt: off
|
|
89
89
|
line_fmt = (
|
|
90
90
|
" {:>" + f"{len(str(length))}" + "} "
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# _*_ coding: utf-8 _*_
|
|
2
2
|
#
|
|
3
|
-
# hspylib-clitt v0.9.
|
|
3
|
+
# hspylib-clitt v0.9.29
|
|
4
4
|
#
|
|
5
5
|
# Package: main.clitt.core.tui.minput
|
|
6
6
|
"""Package initialization."""
|
|
@@ -15,4 +15,4 @@ __all__ = [
|
|
|
15
15
|
'minput',
|
|
16
16
|
'minput_utils'
|
|
17
17
|
]
|
|
18
|
-
__version__ = '0.9.
|
|
18
|
+
__version__ = '0.9.29'
|
clitt/core/tui/minput/minput.py
CHANGED
|
@@ -44,18 +44,3 @@ def minput(
|
|
|
44
44
|
f_out.write(f"{snakecase(name, screaming=True)}={quote(value)}" + os.linesep)
|
|
45
45
|
|
|
46
46
|
return result
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if __name__ == '__main__':
|
|
50
|
-
it = [
|
|
51
|
-
'Age || numbers | 1 / 3 ||',
|
|
52
|
-
'Password | password || 8 ||',
|
|
53
|
-
'Access ||| 5 | r | Admin',
|
|
54
|
-
'Role | select || 3 / 5 || <one>,two,three ',
|
|
55
|
-
'Phone | masked | masked | 5 / 50 || ;(##) #####-#### ',
|
|
56
|
-
'Accept Conditions | checkbox ||||'
|
|
57
|
-
]
|
|
58
|
-
form_fields = MenuInput.builder() \
|
|
59
|
-
.from_tokenized(it) \
|
|
60
|
-
.build()
|
|
61
|
-
minput(form_fields, "Fill the form below", "/tmp/out.txt")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# _*_ coding: utf-8 _*_
|
|
2
2
|
#
|
|
3
|
-
# hspylib-clitt v0.9.
|
|
3
|
+
# hspylib-clitt v0.9.29
|
|
4
4
|
#
|
|
5
5
|
# Package: main.clitt.core.tui.mselect
|
|
6
6
|
"""Package initialization."""
|
|
@@ -9,4 +9,4 @@ __all__ = [
|
|
|
9
9
|
'menu_select',
|
|
10
10
|
'mselect'
|
|
11
11
|
]
|
|
12
|
-
__version__ = '0.9.
|
|
12
|
+
__version__ = '0.9.29'
|
|
@@ -40,7 +40,7 @@ class MenuSelect(TUIComponent):
|
|
|
40
40
|
self.max_line_length = max(len(str(item)) for item in items)
|
|
41
41
|
|
|
42
42
|
def execute(self) -> Optional[T]:
|
|
43
|
-
"""
|
|
43
|
+
"""Execute the component's main flow."""
|
|
44
44
|
|
|
45
45
|
if (length := len(self.items)) == 0:
|
|
46
46
|
return None
|
|
@@ -64,7 +64,7 @@ class MenuSelect(TUIComponent):
|
|
|
64
64
|
return self.items[self.sel_index] if keypress == Keyboard.VK_ENTER else None
|
|
65
65
|
|
|
66
66
|
def _render(self) -> None:
|
|
67
|
-
"""
|
|
67
|
+
"""Renders the TUI component."""
|
|
68
68
|
|
|
69
69
|
length = len(self.items)
|
|
70
70
|
_, columns = screen_size()
|
|
@@ -78,7 +78,7 @@ class MenuSelect(TUIComponent):
|
|
|
78
78
|
option_line = str(self.items[idx])
|
|
79
79
|
erase_line()
|
|
80
80
|
# Print the selector if the index is currently selected
|
|
81
|
-
selector = self.
|
|
81
|
+
selector = self._draw_cursor_line(idx == self.sel_index)
|
|
82
82
|
# fmt: off
|
|
83
83
|
line_fmt = (
|
|
84
84
|
" {:>" + f"{len(str(length))}" + "} "
|
clitt/core/tui/table/__init__.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# _*_ coding: utf-8 _*_
|
|
2
2
|
#
|
|
3
|
-
# hspylib-clitt v0.9.
|
|
3
|
+
# hspylib-clitt v0.9.29
|
|
4
4
|
#
|
|
5
5
|
# Package: main.clitt.core.tui.table
|
|
6
6
|
"""Package initialization."""
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
__all__ = [
|
|
9
9
|
'table_renderer'
|
|
10
10
|
]
|
|
11
|
-
__version__ = '0.9.
|
|
11
|
+
__version__ = '0.9.29'
|
clitt/core/tui/tui_component.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
|
|
4
4
|
"""
|
|
5
|
-
@project: HsPyLib
|
|
5
|
+
@project: HsPyLib-Clitt
|
|
6
6
|
@package: clitt.core.tui
|
|
7
7
|
@file: tui_component.py
|
|
8
8
|
@created: Tue, 4 May 2021
|
|
@@ -29,7 +29,7 @@ class TUIComponent(Generic[T], ABC):
|
|
|
29
29
|
|
|
30
30
|
@staticmethod
|
|
31
31
|
def _draw_line(line_fmt: str, max_columns: int, *args: Any) -> None:
|
|
32
|
-
"""
|
|
32
|
+
"""Draws a formatted component line respecting the specified max_columns.
|
|
33
33
|
:param line_fmt: the line format.
|
|
34
34
|
:param max_columns: the maximum length of the line. If the text is greater than this limit, it will be elided.
|
|
35
35
|
:param args: the arguments for the format.
|
|
@@ -50,8 +50,8 @@ class TUIComponent(Generic[T], ABC):
|
|
|
50
50
|
def execute(self) -> Optional[T | List[T]]:
|
|
51
51
|
"""Execute the main component flow."""
|
|
52
52
|
|
|
53
|
-
def
|
|
54
|
-
"""
|
|
53
|
+
def _draw_cursor_line(self, is_selected: bool = False, has_bg_color: bool = True) -> Awesome:
|
|
54
|
+
"""Draws and highlight the selected component line.
|
|
55
55
|
:param is_selected: whether to set a selected foreground color or not.
|
|
56
56
|
:param has_bg_color: whether to set a background or not.
|
|
57
57
|
"""
|
|
@@ -68,7 +68,7 @@ class TUIComponent(Generic[T], ABC):
|
|
|
68
68
|
|
|
69
69
|
@abstractmethod
|
|
70
70
|
def _render(self) -> None:
|
|
71
|
-
"""
|
|
71
|
+
"""Renders the TUI component."""
|
|
72
72
|
|
|
73
73
|
@abstractmethod
|
|
74
74
|
def _navbar(self, **kwargs) -> str:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: hspylib-clitt
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.29
|
|
4
4
|
Summary: HsPyLib - CLI Terminal Tools
|
|
5
5
|
Home-page: https://github.com/yorevs/hspylib
|
|
6
6
|
Author: Hugo Saporetti Junior
|
|
@@ -31,7 +31,7 @@ Requires-Dist: hspylib
|
|
|
31
31
|
## Create professional CLI applications
|
|
32
32
|
|
|
33
33
|
[](LICENSE.md)
|
|
34
|
-
[](CHANGELOG.md#unreleased)
|
|
35
35
|
[](https://pypi.org/project/hspylib-cfman)
|
|
36
36
|
[](https://github.com/yorevs/hspylib)
|
|
37
37
|
[](https://gitter.im/hspylib/community)
|