argenta 0.5.0a0__tar.gz → 0.5.0b0__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.
- {argenta-0.5.0a0 → argenta-0.5.0b0}/PKG-INFO +35 -13
- {argenta-0.5.0a0 → argenta-0.5.0b0}/README.md +34 -12
- {argenta-0.5.0a0 → argenta-0.5.0b0}/argenta/app/autocompleter/entity.py +0 -1
- {argenta-0.5.0a0 → argenta-0.5.0b0}/argenta/app/models.py +8 -8
- {argenta-0.5.0a0 → argenta-0.5.0b0}/pyproject.toml +1 -1
- {argenta-0.5.0a0 → argenta-0.5.0b0}/LICENSE +0 -0
- {argenta-0.5.0a0 → argenta-0.5.0b0}/argenta/__init__.py +0 -0
- {argenta-0.5.0a0 → argenta-0.5.0b0}/argenta/app/__init__.py +0 -0
- {argenta-0.5.0a0 → argenta-0.5.0b0}/argenta/app/autocompleter/__init__.py +0 -0
- {argenta-0.5.0a0 → argenta-0.5.0b0}/argenta/app/defaults.py +0 -0
- {argenta-0.5.0a0 → argenta-0.5.0b0}/argenta/app/dividing_line/__init__.py +0 -0
- {argenta-0.5.0a0 → argenta-0.5.0b0}/argenta/app/dividing_line/models.py +0 -0
- {argenta-0.5.0a0 → argenta-0.5.0b0}/argenta/app/exceptions.py +0 -0
- {argenta-0.5.0a0 → argenta-0.5.0b0}/argenta/app/registered_routers/__init__.py +0 -0
- {argenta-0.5.0a0 → argenta-0.5.0b0}/argenta/app/registered_routers/entity.py +0 -0
- {argenta-0.5.0a0 → argenta-0.5.0b0}/argenta/command/__init__.py +0 -0
- {argenta-0.5.0a0 → argenta-0.5.0b0}/argenta/command/exceptions.py +0 -0
- {argenta-0.5.0a0 → argenta-0.5.0b0}/argenta/command/flag/__init__.py +0 -0
- {argenta-0.5.0a0 → argenta-0.5.0b0}/argenta/command/flag/defaults.py +0 -0
- {argenta-0.5.0a0 → argenta-0.5.0b0}/argenta/command/flag/models.py +0 -0
- {argenta-0.5.0a0 → argenta-0.5.0b0}/argenta/command/models.py +0 -0
- {argenta-0.5.0a0 → argenta-0.5.0b0}/argenta/router/__init__.py +0 -0
- {argenta-0.5.0a0 → argenta-0.5.0b0}/argenta/router/command_handler/__init__.py +0 -0
- {argenta-0.5.0a0 → argenta-0.5.0b0}/argenta/router/command_handler/entity.py +0 -0
- {argenta-0.5.0a0 → argenta-0.5.0b0}/argenta/router/command_handlers/__init__.py +0 -0
- {argenta-0.5.0a0 → argenta-0.5.0b0}/argenta/router/command_handlers/entity.py +0 -0
- {argenta-0.5.0a0 → argenta-0.5.0b0}/argenta/router/defaults.py +0 -0
- {argenta-0.5.0a0 → argenta-0.5.0b0}/argenta/router/entity.py +0 -0
- {argenta-0.5.0a0 → argenta-0.5.0b0}/argenta/router/exceptions.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: argenta
|
3
|
-
Version: 0.5.
|
3
|
+
Version: 0.5.0b0
|
4
4
|
Summary: Python library for creating TUI
|
5
5
|
License: MIT
|
6
6
|
Author: kolo
|
@@ -15,6 +15,8 @@ Requires-Dist: art (>=6.4,<7.0)
|
|
15
15
|
Requires-Dist: rich (>=14.0.0,<15.0.0)
|
16
16
|
Description-Content-Type: text/markdown
|
17
17
|
|
18
|
+
from argenta.app.autocompleter import AutoCompleter
|
19
|
+
|
18
20
|
# Argenta
|
19
21
|
|
20
22
|
---
|
@@ -22,7 +24,7 @@ Description-Content-Type: text/markdown
|
|
22
24
|
## Описание
|
23
25
|
**Argenta** — Python library for creating TUI
|
24
26
|
|
25
|
-

|
26
28
|
Пример внешнего вида TUI, написанного с помощью Argenta
|
27
29
|
|
28
30
|
---
|
@@ -112,16 +114,16 @@ def handler_with_flags(flags: InputFlags):
|
|
112
114
|
|
113
115
|
### Конструктор
|
114
116
|
```python
|
115
|
-
App(prompt: str = 'What do you want to do?\n',
|
116
|
-
initial_message: str = '
|
117
|
-
farewell_message: str = '
|
118
|
-
exit_command:
|
119
|
-
|
120
|
-
system_points_title: str = 'System points:',
|
117
|
+
App(prompt: str = '[italic dim bold]What do you want to do?\n',
|
118
|
+
initial_message: str = '\nArgenta\n',
|
119
|
+
farewell_message: str = '\nSee you\n',
|
120
|
+
exit_command: Command = Command('Q', 'Exit command'),
|
121
|
+
system_points_title: str | None = 'System points:',
|
121
122
|
ignore_command_register: bool = True,
|
122
123
|
dividing_line: StaticDividingLine | DynamicDividingLine = StaticDividingLine(),
|
123
124
|
repeat_command_groups: bool = True,
|
124
|
-
|
125
|
+
override_system_messages: bool = False,
|
126
|
+
autocompleter: AutoCompleter = AutoCompleter(),
|
125
127
|
print_func: Callable[[str], None] = Console().print)
|
126
128
|
```
|
127
129
|
**Аргументы:**
|
@@ -129,13 +131,13 @@ App(prompt: str = 'What do you want to do?\n',
|
|
129
131
|
- `prompt` (`str`): Сообщение перед вводом команды.
|
130
132
|
- `initial_message` (`str`): Приветственное сообщение при запуске.
|
131
133
|
- `farewell_message` (`str`): Сообщение при выходе.
|
132
|
-
- `exit_command` (`
|
133
|
-
- `exit_command_description` (`str`): Описание команды выхода.
|
134
|
+
- `exit_command` (`Command`): Сущность команды, которая будет отвечать за завершение работы.
|
134
135
|
- `system_points_title` (`str`): Заголовок перед списком системных команд.
|
135
136
|
- `ignore_command_register` (`bool`): Игнорировать регистр всех команд.
|
136
137
|
- `dividing_line` (`StaticDividingLine | DynamicDividingLine`): Разделительная строка.
|
137
138
|
- `repeat_command_groups` (`bool`): Повторять описание команд перед вводом.
|
138
|
-
- `
|
139
|
+
- `override_system_messages` (`bool`): Переопределить ли дефолтное оформление сообщений ([подробнее см.](#override_defaults))
|
140
|
+
- `autocompleter` (`AutoCompleter`): Сущность автодополнителя ввода.
|
139
141
|
- `print_func` (`Callable[[str], None]`): Функция вывода текста в терминал.
|
140
142
|
|
141
143
|
---
|
@@ -260,6 +262,26 @@ App(prompt: str = 'What do you want to do?\n',
|
|
260
262
|
|
261
263
|
---
|
262
264
|
|
265
|
+
## *class* :: `AutoCompleter`
|
266
|
+
Класс, экземпляр которого представляет собой автодополнитель ввода
|
267
|
+
|
268
|
+
### Конструктор
|
269
|
+
```python
|
270
|
+
AutoCompleter(history_filename: str = False,
|
271
|
+
autocomplete_button: str = 'tab')
|
272
|
+
```
|
273
|
+
|
274
|
+
**Аргументы:**
|
275
|
+
- **name : mean**
|
276
|
+
- `history_filename` (`str` | `False`): Путь к файлу, который будет являться или является
|
277
|
+
историй пользовательского ввода, в последующем эти команды будут автодополняться, файл
|
278
|
+
может не существовать при инициализации, тогда он будет создан, при значении аргумента `False`
|
279
|
+
история пользовательского ввода будет существовать только в пределах сессии и не сохраняться в файл
|
280
|
+
- `autocomplete_button` (`str`): Строковое обозначение кнопки на клавиатуре, которая будет
|
281
|
+
использоваться для автодополнения при вводе, по умолчанию `tab`
|
282
|
+
|
283
|
+
---
|
284
|
+
|
263
285
|
## *class* :: `StaticDivideLine`
|
264
286
|
Класс, экземпляр которого представляет собой строковый разделитель фиксированной длины
|
265
287
|
|
@@ -295,7 +317,7 @@ DinamicDivideLine(unit_part: str = '-')
|
|
295
317
|
|
296
318
|
### Конструктор
|
297
319
|
```python
|
298
|
-
Router(title: str
|
320
|
+
Router(title: str | None = None,
|
299
321
|
name: str = 'Default')
|
300
322
|
```
|
301
323
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
from argenta.app.autocompleter import AutoCompleter
|
2
|
+
|
1
3
|
# Argenta
|
2
4
|
|
3
5
|
---
|
@@ -5,7 +7,7 @@
|
|
5
7
|
## Описание
|
6
8
|
**Argenta** — Python library for creating TUI
|
7
9
|
|
8
|
-

|
9
11
|
Пример внешнего вида TUI, написанного с помощью Argenta
|
10
12
|
|
11
13
|
---
|
@@ -95,16 +97,16 @@ def handler_with_flags(flags: InputFlags):
|
|
95
97
|
|
96
98
|
### Конструктор
|
97
99
|
```python
|
98
|
-
App(prompt: str = 'What do you want to do?\n',
|
99
|
-
initial_message: str = '
|
100
|
-
farewell_message: str = '
|
101
|
-
exit_command:
|
102
|
-
|
103
|
-
system_points_title: str = 'System points:',
|
100
|
+
App(prompt: str = '[italic dim bold]What do you want to do?\n',
|
101
|
+
initial_message: str = '\nArgenta\n',
|
102
|
+
farewell_message: str = '\nSee you\n',
|
103
|
+
exit_command: Command = Command('Q', 'Exit command'),
|
104
|
+
system_points_title: str | None = 'System points:',
|
104
105
|
ignore_command_register: bool = True,
|
105
106
|
dividing_line: StaticDividingLine | DynamicDividingLine = StaticDividingLine(),
|
106
107
|
repeat_command_groups: bool = True,
|
107
|
-
|
108
|
+
override_system_messages: bool = False,
|
109
|
+
autocompleter: AutoCompleter = AutoCompleter(),
|
108
110
|
print_func: Callable[[str], None] = Console().print)
|
109
111
|
```
|
110
112
|
**Аргументы:**
|
@@ -112,13 +114,13 @@ App(prompt: str = 'What do you want to do?\n',
|
|
112
114
|
- `prompt` (`str`): Сообщение перед вводом команды.
|
113
115
|
- `initial_message` (`str`): Приветственное сообщение при запуске.
|
114
116
|
- `farewell_message` (`str`): Сообщение при выходе.
|
115
|
-
- `exit_command` (`
|
116
|
-
- `exit_command_description` (`str`): Описание команды выхода.
|
117
|
+
- `exit_command` (`Command`): Сущность команды, которая будет отвечать за завершение работы.
|
117
118
|
- `system_points_title` (`str`): Заголовок перед списком системных команд.
|
118
119
|
- `ignore_command_register` (`bool`): Игнорировать регистр всех команд.
|
119
120
|
- `dividing_line` (`StaticDividingLine | DynamicDividingLine`): Разделительная строка.
|
120
121
|
- `repeat_command_groups` (`bool`): Повторять описание команд перед вводом.
|
121
|
-
- `
|
122
|
+
- `override_system_messages` (`bool`): Переопределить ли дефолтное оформление сообщений ([подробнее см.](#override_defaults))
|
123
|
+
- `autocompleter` (`AutoCompleter`): Сущность автодополнителя ввода.
|
122
124
|
- `print_func` (`Callable[[str], None]`): Функция вывода текста в терминал.
|
123
125
|
|
124
126
|
---
|
@@ -243,6 +245,26 @@ App(prompt: str = 'What do you want to do?\n',
|
|
243
245
|
|
244
246
|
---
|
245
247
|
|
248
|
+
## *class* :: `AutoCompleter`
|
249
|
+
Класс, экземпляр которого представляет собой автодополнитель ввода
|
250
|
+
|
251
|
+
### Конструктор
|
252
|
+
```python
|
253
|
+
AutoCompleter(history_filename: str = False,
|
254
|
+
autocomplete_button: str = 'tab')
|
255
|
+
```
|
256
|
+
|
257
|
+
**Аргументы:**
|
258
|
+
- **name : mean**
|
259
|
+
- `history_filename` (`str` | `False`): Путь к файлу, который будет являться или является
|
260
|
+
историй пользовательского ввода, в последующем эти команды будут автодополняться, файл
|
261
|
+
может не существовать при инициализации, тогда он будет создан, при значении аргумента `False`
|
262
|
+
история пользовательского ввода будет существовать только в пределах сессии и не сохраняться в файл
|
263
|
+
- `autocomplete_button` (`str`): Строковое обозначение кнопки на клавиатуре, которая будет
|
264
|
+
использоваться для автодополнения при вводе, по умолчанию `tab`
|
265
|
+
|
266
|
+
---
|
267
|
+
|
246
268
|
## *class* :: `StaticDivideLine`
|
247
269
|
Класс, экземпляр которого представляет собой строковый разделитель фиксированной длины
|
248
270
|
|
@@ -278,7 +300,7 @@ DinamicDivideLine(unit_part: str = '-')
|
|
278
300
|
|
279
301
|
### Конструктор
|
280
302
|
```python
|
281
|
-
Router(title: str
|
303
|
+
Router(title: str | None = None,
|
282
304
|
name: str = 'Default')
|
283
305
|
```
|
284
306
|
|
@@ -32,7 +32,7 @@ class AppInit:
|
|
32
32
|
ignore_command_register: bool = True,
|
33
33
|
dividing_line: StaticDividingLine | DynamicDividingLine = StaticDividingLine(),
|
34
34
|
repeat_command_groups: bool = True,
|
35
|
-
|
35
|
+
override_system_messages: bool = False,
|
36
36
|
autocompleter: AutoCompleter = AutoCompleter(),
|
37
37
|
print_func: Callable[[str], None] = Console().print) -> None:
|
38
38
|
self._prompt = prompt
|
@@ -42,7 +42,7 @@ class AppInit:
|
|
42
42
|
self._dividing_line = dividing_line
|
43
43
|
self._ignore_command_register = ignore_command_register
|
44
44
|
self._repeat_command_groups_description = repeat_command_groups
|
45
|
-
self.
|
45
|
+
self._override_system_messages = override_system_messages
|
46
46
|
self._autocompleter = autocompleter
|
47
47
|
|
48
48
|
self._farewell_message = farewell_message
|
@@ -53,10 +53,10 @@ class AppInit:
|
|
53
53
|
self._registered_routers: RegisteredRouters = RegisteredRouters()
|
54
54
|
self._messages_on_startup = []
|
55
55
|
|
56
|
-
self._invalid_input_flags_handler: Callable[[str], None] = lambda raw_command: print_func(f'[red bold]Incorrect flag syntax: {raw_command}')
|
57
|
-
self._repeated_input_flags_handler: Callable[[str], None] = lambda raw_command: print_func(f'[red bold]Repeated input flags: {raw_command}')
|
56
|
+
self._invalid_input_flags_handler: Callable[[str], None] = lambda raw_command: print_func(f'[red bold]Incorrect flag syntax: {escape(raw_command)}')
|
57
|
+
self._repeated_input_flags_handler: Callable[[str], None] = lambda raw_command: print_func(f'[red bold]Repeated input flags: {escape(raw_command)}')
|
58
58
|
self._empty_input_command_handler: Callable[[], None] = lambda: print_func('[red bold]Empty input command')
|
59
|
-
self._unknown_command_handler: Callable[[InputCommand], None] = lambda command: print_func(f"[red bold]Unknown command: {command.get_trigger()}")
|
59
|
+
self._unknown_command_handler: Callable[[InputCommand], None] = lambda command: print_func(f"[red bold]Unknown command: {escape(command.get_trigger())}")
|
60
60
|
self._exit_command_handler: Callable[[], None] = lambda: print_func(self._farewell_message)
|
61
61
|
|
62
62
|
|
@@ -112,7 +112,7 @@ class AppNonStandardHandlers(AppPrinters):
|
|
112
112
|
if self._ignore_command_register:
|
113
113
|
system_router.input_command_handler(command)
|
114
114
|
return True
|
115
|
-
elif command.get_trigger() == self._exit_command:
|
115
|
+
elif command.get_trigger() == self._exit_command.get_trigger():
|
116
116
|
system_router.input_command_handler(command)
|
117
117
|
return True
|
118
118
|
return False
|
@@ -128,7 +128,7 @@ class AppNonStandardHandlers(AppPrinters):
|
|
128
128
|
elif handled_command_trigger == command.get_trigger():
|
129
129
|
return False
|
130
130
|
elif handled_command_aliases:
|
131
|
-
if command.get_trigger().lower() in [x.lower() for x in handled_command_aliases] and self._ignore_command_register:
|
131
|
+
if (command.get_trigger().lower() in [x.lower() for x in handled_command_aliases]) and self._ignore_command_register:
|
132
132
|
return False
|
133
133
|
elif command.get_trigger() in handled_command_trigger:
|
134
134
|
return False
|
@@ -179,7 +179,7 @@ class AppSetups(AppValidators, AppPrinters):
|
|
179
179
|
self._registered_routers.add_registered_router(system_router)
|
180
180
|
|
181
181
|
def _setup_default_view(self):
|
182
|
-
if not self.
|
182
|
+
if not self._override_system_messages:
|
183
183
|
self._initial_message = f'\n[bold red]{text2art(self._initial_message, font='tarty1')}\n\n'
|
184
184
|
self._farewell_message = (
|
185
185
|
f'[bold red]\n{text2art(f'\n{self._farewell_message}\n', font='chanky')}[/bold red]\n'
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|