argenta 0.5.0a0__tar.gz → 0.5.0b2__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.
Files changed (29) hide show
  1. {argenta-0.5.0a0 → argenta-0.5.0b2}/PKG-INFO +33 -13
  2. {argenta-0.5.0a0 → argenta-0.5.0b2}/README.md +32 -12
  3. {argenta-0.5.0a0 → argenta-0.5.0b2}/argenta/app/autocompleter/entity.py +0 -1
  4. {argenta-0.5.0a0 → argenta-0.5.0b2}/argenta/app/exceptions.py +0 -5
  5. {argenta-0.5.0a0 → argenta-0.5.0b2}/argenta/app/models.py +10 -13
  6. {argenta-0.5.0a0 → argenta-0.5.0b2}/pyproject.toml +1 -1
  7. {argenta-0.5.0a0 → argenta-0.5.0b2}/LICENSE +0 -0
  8. {argenta-0.5.0a0 → argenta-0.5.0b2}/argenta/__init__.py +0 -0
  9. {argenta-0.5.0a0 → argenta-0.5.0b2}/argenta/app/__init__.py +0 -0
  10. {argenta-0.5.0a0 → argenta-0.5.0b2}/argenta/app/autocompleter/__init__.py +0 -0
  11. {argenta-0.5.0a0 → argenta-0.5.0b2}/argenta/app/defaults.py +0 -0
  12. {argenta-0.5.0a0 → argenta-0.5.0b2}/argenta/app/dividing_line/__init__.py +0 -0
  13. {argenta-0.5.0a0 → argenta-0.5.0b2}/argenta/app/dividing_line/models.py +0 -0
  14. {argenta-0.5.0a0 → argenta-0.5.0b2}/argenta/app/registered_routers/__init__.py +0 -0
  15. {argenta-0.5.0a0 → argenta-0.5.0b2}/argenta/app/registered_routers/entity.py +0 -0
  16. {argenta-0.5.0a0 → argenta-0.5.0b2}/argenta/command/__init__.py +0 -0
  17. {argenta-0.5.0a0 → argenta-0.5.0b2}/argenta/command/exceptions.py +0 -0
  18. {argenta-0.5.0a0 → argenta-0.5.0b2}/argenta/command/flag/__init__.py +0 -0
  19. {argenta-0.5.0a0 → argenta-0.5.0b2}/argenta/command/flag/defaults.py +0 -0
  20. {argenta-0.5.0a0 → argenta-0.5.0b2}/argenta/command/flag/models.py +0 -0
  21. {argenta-0.5.0a0 → argenta-0.5.0b2}/argenta/command/models.py +0 -0
  22. {argenta-0.5.0a0 → argenta-0.5.0b2}/argenta/router/__init__.py +0 -0
  23. {argenta-0.5.0a0 → argenta-0.5.0b2}/argenta/router/command_handler/__init__.py +0 -0
  24. {argenta-0.5.0a0 → argenta-0.5.0b2}/argenta/router/command_handler/entity.py +0 -0
  25. {argenta-0.5.0a0 → argenta-0.5.0b2}/argenta/router/command_handlers/__init__.py +0 -0
  26. {argenta-0.5.0a0 → argenta-0.5.0b2}/argenta/router/command_handlers/entity.py +0 -0
  27. {argenta-0.5.0a0 → argenta-0.5.0b2}/argenta/router/defaults.py +0 -0
  28. {argenta-0.5.0a0 → argenta-0.5.0b2}/argenta/router/entity.py +0 -0
  29. {argenta-0.5.0a0 → argenta-0.5.0b2}/argenta/router/exceptions.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: argenta
3
- Version: 0.5.0a0
3
+ Version: 0.5.0b2
4
4
  Summary: Python library for creating TUI
5
5
  License: MIT
6
6
  Author: kolo
@@ -22,7 +22,7 @@ Description-Content-Type: text/markdown
22
22
  ## Описание
23
23
  **Argenta** — Python library for creating TUI
24
24
 
25
- ![prewiev](https://github.com/koloideal/Argenta/blob/kolo/imgs/mock_app_preview_last.png?raw=True)
25
+ ![preview](https://github.com/koloideal/Argenta/blob/kolo/imgs/mock_app_preview_last.png?raw=True)
26
26
  Пример внешнего вида TUI, написанного с помощью Argenta
27
27
 
28
28
  ---
@@ -112,16 +112,16 @@ def handler_with_flags(flags: InputFlags):
112
112
 
113
113
  ### Конструктор
114
114
  ```python
115
- App(prompt: str = 'What do you want to do?\n',
116
- initial_message: str = 'Argenta',
117
- farewell_message: str = 'See you',
118
- exit_command: str = 'Q',
119
- exit_command_description: str = 'Exit command',
120
- system_points_title: str = 'System points:',
115
+ App(prompt: str = '[italic dim bold]What do you want to do?\n',
116
+ initial_message: str = '\nArgenta\n',
117
+ farewell_message: str = '\nSee you\n',
118
+ exit_command: Command = Command('Q', 'Exit command'),
119
+ system_points_title: str | None = 'System points:',
121
120
  ignore_command_register: bool = True,
122
121
  dividing_line: StaticDividingLine | DynamicDividingLine = StaticDividingLine(),
123
122
  repeat_command_groups: bool = True,
124
- full_override_system_messages: bool = False
123
+ override_system_messages: bool = False,
124
+ autocompleter: AutoCompleter = AutoCompleter(),
125
125
  print_func: Callable[[str], None] = Console().print)
126
126
  ```
127
127
  **Аргументы:**
@@ -129,13 +129,13 @@ App(prompt: str = 'What do you want to do?\n',
129
129
  - `prompt` (`str`): Сообщение перед вводом команды.
130
130
  - `initial_message` (`str`): Приветственное сообщение при запуске.
131
131
  - `farewell_message` (`str`): Сообщение при выходе.
132
- - `exit_command` (`str`): Команда выхода (по умолчанию `'Q'`).
133
- - `exit_command_description` (`str`): Описание команды выхода.
132
+ - `exit_command` (`Command`): Сущность команды, которая будет отвечать за завершение работы.
134
133
  - `system_points_title` (`str`): Заголовок перед списком системных команд.
135
134
  - `ignore_command_register` (`bool`): Игнорировать регистр всех команд.
136
135
  - `dividing_line` (`StaticDividingLine | DynamicDividingLine`): Разделительная строка.
137
136
  - `repeat_command_groups` (`bool`): Повторять описание команд перед вводом.
138
- - `full_override_system_messages` (`bool`): Переопределить ли дефолтное оформление сообщений ([подробнее см.](#override_defaults))
137
+ - `override_system_messages` (`bool`): Переопределить ли дефолтное оформление сообщений ([подробнее см.](#override_defaults))
138
+ - `autocompleter` (`AutoCompleter`): Сущность автодополнителя ввода.
139
139
  - `print_func` (`Callable[[str], None]`): Функция вывода текста в терминал.
140
140
 
141
141
  ---
@@ -260,6 +260,26 @@ App(prompt: str = 'What do you want to do?\n',
260
260
 
261
261
  ---
262
262
 
263
+ ## *class* :: `AutoCompleter`
264
+ Класс, экземпляр которого представляет собой автодополнитель ввода
265
+
266
+ ### Конструктор
267
+ ```python
268
+ AutoCompleter(history_filename: str = False,
269
+ autocomplete_button: str = 'tab')
270
+ ```
271
+
272
+ **Аргументы:**
273
+ - **name : mean**
274
+ - `history_filename` (`str` | `False`): Путь к файлу, который будет являться или является
275
+ историй пользовательского ввода, в последующем эти команды будут автодополняться, файл
276
+ может не существовать при инициализации, тогда он будет создан, при значении аргумента `False`
277
+ история пользовательского ввода будет существовать только в пределах сессии и не сохраняться в файл
278
+ - `autocomplete_button` (`str`): Строковое обозначение кнопки на клавиатуре, которая будет
279
+ использоваться для автодополнения при вводе, по умолчанию `tab`
280
+
281
+ ---
282
+
263
283
  ## *class* :: `StaticDivideLine`
264
284
  Класс, экземпляр которого представляет собой строковый разделитель фиксированной длины
265
285
 
@@ -295,7 +315,7 @@ DinamicDivideLine(unit_part: str = '-')
295
315
 
296
316
  ### Конструктор
297
317
  ```python
298
- Router(title: str = 'Commands group title:',
318
+ Router(title: str | None = None,
299
319
  name: str = 'Default')
300
320
  ```
301
321
 
@@ -5,7 +5,7 @@
5
5
  ## Описание
6
6
  **Argenta** — Python library for creating TUI
7
7
 
8
- ![prewiev](https://github.com/koloideal/Argenta/blob/kolo/imgs/mock_app_preview_last.png?raw=True)
8
+ ![preview](https://github.com/koloideal/Argenta/blob/kolo/imgs/mock_app_preview_last.png?raw=True)
9
9
  Пример внешнего вида TUI, написанного с помощью Argenta
10
10
 
11
11
  ---
@@ -95,16 +95,16 @@ def handler_with_flags(flags: InputFlags):
95
95
 
96
96
  ### Конструктор
97
97
  ```python
98
- App(prompt: str = 'What do you want to do?\n',
99
- initial_message: str = 'Argenta',
100
- farewell_message: str = 'See you',
101
- exit_command: str = 'Q',
102
- exit_command_description: str = 'Exit command',
103
- system_points_title: str = 'System points:',
98
+ App(prompt: str = '[italic dim bold]What do you want to do?\n',
99
+ initial_message: str = '\nArgenta\n',
100
+ farewell_message: str = '\nSee you\n',
101
+ exit_command: Command = Command('Q', 'Exit command'),
102
+ system_points_title: str | None = 'System points:',
104
103
  ignore_command_register: bool = True,
105
104
  dividing_line: StaticDividingLine | DynamicDividingLine = StaticDividingLine(),
106
105
  repeat_command_groups: bool = True,
107
- full_override_system_messages: bool = False
106
+ override_system_messages: bool = False,
107
+ autocompleter: AutoCompleter = AutoCompleter(),
108
108
  print_func: Callable[[str], None] = Console().print)
109
109
  ```
110
110
  **Аргументы:**
@@ -112,13 +112,13 @@ App(prompt: str = 'What do you want to do?\n',
112
112
  - `prompt` (`str`): Сообщение перед вводом команды.
113
113
  - `initial_message` (`str`): Приветственное сообщение при запуске.
114
114
  - `farewell_message` (`str`): Сообщение при выходе.
115
- - `exit_command` (`str`): Команда выхода (по умолчанию `'Q'`).
116
- - `exit_command_description` (`str`): Описание команды выхода.
115
+ - `exit_command` (`Command`): Сущность команды, которая будет отвечать за завершение работы.
117
116
  - `system_points_title` (`str`): Заголовок перед списком системных команд.
118
117
  - `ignore_command_register` (`bool`): Игнорировать регистр всех команд.
119
118
  - `dividing_line` (`StaticDividingLine | DynamicDividingLine`): Разделительная строка.
120
119
  - `repeat_command_groups` (`bool`): Повторять описание команд перед вводом.
121
- - `full_override_system_messages` (`bool`): Переопределить ли дефолтное оформление сообщений ([подробнее см.](#override_defaults))
120
+ - `override_system_messages` (`bool`): Переопределить ли дефолтное оформление сообщений ([подробнее см.](#override_defaults))
121
+ - `autocompleter` (`AutoCompleter`): Сущность автодополнителя ввода.
122
122
  - `print_func` (`Callable[[str], None]`): Функция вывода текста в терминал.
123
123
 
124
124
  ---
@@ -243,6 +243,26 @@ App(prompt: str = 'What do you want to do?\n',
243
243
 
244
244
  ---
245
245
 
246
+ ## *class* :: `AutoCompleter`
247
+ Класс, экземпляр которого представляет собой автодополнитель ввода
248
+
249
+ ### Конструктор
250
+ ```python
251
+ AutoCompleter(history_filename: str = False,
252
+ autocomplete_button: str = 'tab')
253
+ ```
254
+
255
+ **Аргументы:**
256
+ - **name : mean**
257
+ - `history_filename` (`str` | `False`): Путь к файлу, который будет являться или является
258
+ историй пользовательского ввода, в последующем эти команды будут автодополняться, файл
259
+ может не существовать при инициализации, тогда он будет создан, при значении аргумента `False`
260
+ история пользовательского ввода будет существовать только в пределах сессии и не сохраняться в файл
261
+ - `autocomplete_button` (`str`): Строковое обозначение кнопки на клавиатуре, которая будет
262
+ использоваться для автодополнения при вводе, по умолчанию `tab`
263
+
264
+ ---
265
+
246
266
  ## *class* :: `StaticDivideLine`
247
267
  Класс, экземпляр которого представляет собой строковый разделитель фиксированной длины
248
268
 
@@ -278,7 +298,7 @@ DinamicDivideLine(unit_part: str = '-')
278
298
 
279
299
  ### Конструктор
280
300
  ```python
281
- Router(title: str = 'Commands group title:',
301
+ Router(title: str | None = None,
282
302
  name: str = 'Default')
283
303
  ```
284
304
 
@@ -1,5 +1,4 @@
1
1
  import os
2
-
3
2
  import readline
4
3
 
5
4
 
@@ -1,8 +1,3 @@
1
- class InvalidRouterInstanceException(Exception):
2
- def __str__(self):
3
- return "Invalid Router Instance"
4
-
5
-
6
1
  class NoRegisteredRoutersException(Exception):
7
2
  def __str__(self):
8
3
  return "No Registered Router Found"
@@ -15,8 +15,7 @@ from argenta.command.exceptions import (UnprocessedInputFlagException,
15
15
  RepeatedInputFlagsException,
16
16
  EmptyInputCommandException,
17
17
  BaseInputCommandException)
18
- from argenta.app.exceptions import (InvalidRouterInstanceException,
19
- NoRegisteredRoutersException,
18
+ from argenta.app.exceptions import (NoRegisteredRoutersException,
20
19
  NoRegisteredHandlersException)
21
20
  from argenta.app.registered_routers.entity import RegisteredRouters
22
21
 
@@ -32,7 +31,7 @@ class AppInit:
32
31
  ignore_command_register: bool = True,
33
32
  dividing_line: StaticDividingLine | DynamicDividingLine = StaticDividingLine(),
34
33
  repeat_command_groups: bool = True,
35
- full_override_system_messages: bool = False,
34
+ override_system_messages: bool = False,
36
35
  autocompleter: AutoCompleter = AutoCompleter(),
37
36
  print_func: Callable[[str], None] = Console().print) -> None:
38
37
  self._prompt = prompt
@@ -42,7 +41,7 @@ class AppInit:
42
41
  self._dividing_line = dividing_line
43
42
  self._ignore_command_register = ignore_command_register
44
43
  self._repeat_command_groups_description = repeat_command_groups
45
- self._full_override_system_messages = full_override_system_messages
44
+ self._override_system_messages = override_system_messages
46
45
  self._autocompleter = autocompleter
47
46
 
48
47
  self._farewell_message = farewell_message
@@ -53,10 +52,10 @@ class AppInit:
53
52
  self._registered_routers: RegisteredRouters = RegisteredRouters()
54
53
  self._messages_on_startup = []
55
54
 
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}')
55
+ self._invalid_input_flags_handler: Callable[[str], None] = lambda raw_command: print_func(f'[red bold]Incorrect flag syntax: {escape(raw_command)}')
56
+ self._repeated_input_flags_handler: Callable[[str], None] = lambda raw_command: print_func(f'[red bold]Repeated input flags: {escape(raw_command)}')
58
57
  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()}")
58
+ self._unknown_command_handler: Callable[[InputCommand], None] = lambda command: print_func(f"[red bold]Unknown command: {escape(command.get_trigger())}")
60
59
  self._exit_command_handler: Callable[[], None] = lambda: print_func(self._farewell_message)
61
60
 
62
61
 
@@ -112,7 +111,7 @@ class AppNonStandardHandlers(AppPrinters):
112
111
  if self._ignore_command_register:
113
112
  system_router.input_command_handler(command)
114
113
  return True
115
- elif command.get_trigger() == self._exit_command:
114
+ elif command.get_trigger() == self._exit_command.get_trigger():
116
115
  system_router.input_command_handler(command)
117
116
  return True
118
117
  return False
@@ -128,7 +127,7 @@ class AppNonStandardHandlers(AppPrinters):
128
127
  elif handled_command_trigger == command.get_trigger():
129
128
  return False
130
129
  elif handled_command_aliases:
131
- if command.get_trigger().lower() in [x.lower() for x in handled_command_aliases] and self._ignore_command_register:
130
+ if (command.get_trigger().lower() in [x.lower() for x in handled_command_aliases]) and self._ignore_command_register:
132
131
  return False
133
132
  elif command.get_trigger() in handled_command_trigger:
134
133
  return False
@@ -179,7 +178,7 @@ class AppSetups(AppValidators, AppPrinters):
179
178
  self._registered_routers.add_registered_router(system_router)
180
179
 
181
180
  def _setup_default_view(self):
182
- if not self._full_override_system_messages:
181
+ if not self._override_system_messages:
183
182
  self._initial_message = f'\n[bold red]{text2art(self._initial_message, font='tarty1')}\n\n'
184
183
  self._farewell_message = (
185
184
  f'[bold red]\n{text2art(f'\n{self._farewell_message}\n', font='chanky')}[/bold red]\n'
@@ -201,6 +200,7 @@ class AppSetups(AppValidators, AppPrinters):
201
200
 
202
201
  for message in self._messages_on_startup:
203
202
  self._print_func(message)
203
+ print('\n\n')
204
204
 
205
205
  if not self._repeat_command_groups_description:
206
206
  self._print_command_group_description()
@@ -253,9 +253,6 @@ class App(AppSetters, AppNonStandardHandlers, AppSetups):
253
253
 
254
254
 
255
255
  def include_router(self, router: Router) -> None:
256
- if not isinstance(router, Router):
257
- raise InvalidRouterInstanceException()
258
-
259
256
  router.set_ignore_command_register(self._ignore_command_register)
260
257
  self._registered_routers.add_registered_router(router)
261
258
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "argenta"
3
- version = "0.5.0-alpha"
3
+ version = "0.5.0-beta2"
4
4
  description = "Python library for creating TUI"
5
5
  authors = [
6
6
  {name = "kolo", email = "kolo.is.main@gmail.com"}
File without changes
File without changes