argenta 0.5.0a0__py3-none-any.whl → 0.5.0b0__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.
- argenta/app/autocompleter/entity.py +0 -1
- argenta/app/models.py +8 -8
- {argenta-0.5.0a0.dist-info → argenta-0.5.0b0.dist-info}/METADATA +35 -13
- {argenta-0.5.0a0.dist-info → argenta-0.5.0b0.dist-info}/RECORD +6 -6
- {argenta-0.5.0a0.dist-info → argenta-0.5.0b0.dist-info}/LICENSE +0 -0
- {argenta-0.5.0a0.dist-info → argenta-0.5.0b0.dist-info}/WHEEL +0 -0
argenta/app/models.py
CHANGED
@@ -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'
|
@@ -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,12 +1,12 @@
|
|
1
1
|
argenta/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
2
|
argenta/app/__init__.py,sha256=I8FTXU17ajDI-hbC6Rw0LxLmvDYipdQaos3v1pmu14E,57
|
3
3
|
argenta/app/autocompleter/__init__.py,sha256=VT_p3QA78UnczV7pYR2NnwQ0Atd8mnDUnLazvUQNqJk,93
|
4
|
-
argenta/app/autocompleter/entity.py,sha256=
|
4
|
+
argenta/app/autocompleter/entity.py,sha256=6so4tFXbx45gNU0ZPq1jnIwsL4ieyfbz2qX15CFK2H4,1825
|
5
5
|
argenta/app/defaults.py,sha256=D0z9yGnfF8hhWUxHCvBhxTrxg6a9rPiySAn2Fyy7TXQ,311
|
6
6
|
argenta/app/dividing_line/__init__.py,sha256=jJZDDZix8XYCAUWW4FzGJH0JmJlchYcx0FPWifjgv1I,147
|
7
7
|
argenta/app/dividing_line/models.py,sha256=ueBDmy1hfYzGAr1X2G2Mw0hjES7YQBtP7N3TLBDz9h0,700
|
8
8
|
argenta/app/exceptions.py,sha256=oTvec3ZGX_tS1nqa0pLLAPqMlhrLS6SsXY2lYiOwIVM,465
|
9
|
-
argenta/app/models.py,sha256=
|
9
|
+
argenta/app/models.py,sha256=Pko34Yi8IMVSuU12OtO_T8-wUstGRfLMoziIjNfzDJ4,12756
|
10
10
|
argenta/app/registered_routers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
11
|
argenta/app/registered_routers/entity.py,sha256=OQZyrF4eoCoDHzRJ22zZxhNEx-bOUDu7NZIFDfO-fuY,688
|
12
12
|
argenta/command/__init__.py,sha256=Plo2Da0fhq8H1eo2mg7nA1-OBLuGjK2BYpDGRvGGMIU,67
|
@@ -23,7 +23,7 @@ argenta/router/command_handlers/entity.py,sha256=KgFKjAMUr_mOcn9xahTxMUKB6lIxXgq
|
|
23
23
|
argenta/router/defaults.py,sha256=huftOg1HMjrT_R2SHHOL4eJ5uZHspNEYBSg-mCq9xhU,126
|
24
24
|
argenta/router/entity.py,sha256=d9S9Af9vACAgUaiPq-CgVGrb7KcAZYfYm3oavVAceI8,5900
|
25
25
|
argenta/router/exceptions.py,sha256=tdeaR8zDvnytgRYo_wQWKHt3if2brapgauIhhMIsTsA,678
|
26
|
-
argenta-0.5.
|
27
|
-
argenta-0.5.
|
28
|
-
argenta-0.5.
|
29
|
-
argenta-0.5.
|
26
|
+
argenta-0.5.0b0.dist-info/LICENSE,sha256=zmqoGh2n5rReBv4s8wPxF_gZEZDgauJYSPMuPczgOiU,1082
|
27
|
+
argenta-0.5.0b0.dist-info/METADATA,sha256=BDN-ar30p07jIwl_avTC0fZPs5F9xdHQLppU0PFObhw,22398
|
28
|
+
argenta-0.5.0b0.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
29
|
+
argenta-0.5.0b0.dist-info/RECORD,,
|
File without changes
|
File without changes
|