euporie 2.8.0__py3-none-any.whl → 2.8.5__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.
Files changed (129) hide show
  1. euporie/console/_commands.py +143 -0
  2. euporie/console/_settings.py +58 -0
  3. euporie/console/app.py +25 -71
  4. euporie/console/tabs/console.py +267 -147
  5. euporie/core/__init__.py +1 -9
  6. euporie/core/__main__.py +31 -5
  7. euporie/core/_settings.py +104 -0
  8. euporie/core/app/__init__.py +3 -0
  9. euporie/core/app/_commands.py +70 -0
  10. euporie/core/app/_settings.py +427 -0
  11. euporie/core/{app.py → app/app.py} +214 -572
  12. euporie/core/app/base.py +51 -0
  13. euporie/core/{current.py → app/current.py} +13 -4
  14. euporie/core/app/cursor.py +35 -0
  15. euporie/core/app/dummy.py +12 -0
  16. euporie/core/app/launch.py +28 -0
  17. euporie/core/bars/__init__.py +11 -0
  18. euporie/core/bars/command.py +182 -0
  19. euporie/core/bars/menu.py +258 -0
  20. euporie/core/{widgets → bars}/search.py +154 -57
  21. euporie/core/{widgets → bars}/status.py +9 -26
  22. euporie/core/clipboard.py +19 -80
  23. euporie/core/comm/base.py +8 -6
  24. euporie/core/comm/ipywidgets.py +21 -12
  25. euporie/core/comm/registry.py +2 -1
  26. euporie/core/commands.py +11 -5
  27. euporie/core/completion.py +3 -2
  28. euporie/core/config.py +368 -341
  29. euporie/core/convert/__init__.py +0 -30
  30. euporie/core/convert/datum.py +131 -60
  31. euporie/core/convert/formats/__init__.py +31 -0
  32. euporie/core/convert/formats/ansi.py +46 -30
  33. euporie/core/convert/formats/common.py +11 -23
  34. euporie/core/convert/formats/html.py +45 -40
  35. euporie/core/convert/formats/pil.py +1 -1
  36. euporie/core/convert/formats/png.py +3 -5
  37. euporie/core/convert/formats/sixel.py +3 -3
  38. euporie/core/convert/registry.py +11 -8
  39. euporie/core/convert/utils.py +50 -23
  40. euporie/core/diagnostics.py +2 -2
  41. euporie/core/filters.py +72 -82
  42. euporie/core/format.py +13 -2
  43. euporie/core/ft/ansi.py +1 -1
  44. euporie/core/ft/html.py +36 -36
  45. euporie/core/ft/table.py +1 -3
  46. euporie/core/ft/utils.py +4 -1
  47. euporie/core/graphics.py +216 -124
  48. euporie/core/history.py +2 -2
  49. euporie/core/inspection.py +3 -2
  50. euporie/core/io.py +207 -28
  51. euporie/core/kernel/__init__.py +1 -0
  52. euporie/core/{kernel.py → kernel/client.py} +100 -139
  53. euporie/core/kernel/manager.py +114 -0
  54. euporie/core/key_binding/bindings/__init__.py +2 -8
  55. euporie/core/key_binding/bindings/basic.py +47 -7
  56. euporie/core/key_binding/bindings/completion.py +3 -8
  57. euporie/core/key_binding/bindings/micro.py +5 -7
  58. euporie/core/key_binding/bindings/mouse.py +26 -24
  59. euporie/core/key_binding/bindings/terminal.py +193 -0
  60. euporie/core/key_binding/bindings/vi.py +46 -0
  61. euporie/core/key_binding/key_processor.py +43 -2
  62. euporie/core/key_binding/registry.py +2 -0
  63. euporie/core/key_binding/utils.py +22 -2
  64. euporie/core/keys.py +7156 -92
  65. euporie/core/layout/cache.py +35 -25
  66. euporie/core/layout/containers.py +280 -74
  67. euporie/core/layout/decor.py +5 -5
  68. euporie/core/layout/mouse.py +1 -1
  69. euporie/core/layout/print.py +16 -3
  70. euporie/core/layout/scroll.py +26 -28
  71. euporie/core/log.py +75 -60
  72. euporie/core/lsp.py +118 -24
  73. euporie/core/margins.py +60 -31
  74. euporie/core/path.py +2 -1
  75. euporie/core/renderer.py +58 -17
  76. euporie/core/style.py +60 -40
  77. euporie/core/suggest.py +103 -85
  78. euporie/core/tabs/__init__.py +34 -0
  79. euporie/core/tabs/_settings.py +113 -0
  80. euporie/core/tabs/base.py +11 -435
  81. euporie/core/tabs/kernel.py +420 -0
  82. euporie/core/tabs/notebook.py +20 -54
  83. euporie/core/utils.py +98 -6
  84. euporie/core/validation.py +1 -1
  85. euporie/core/widgets/_settings.py +188 -0
  86. euporie/core/widgets/cell.py +90 -158
  87. euporie/core/widgets/cell_outputs.py +26 -37
  88. euporie/core/widgets/decor.py +11 -41
  89. euporie/core/widgets/dialog.py +55 -44
  90. euporie/core/widgets/display.py +27 -24
  91. euporie/core/widgets/file_browser.py +5 -26
  92. euporie/core/widgets/forms.py +16 -12
  93. euporie/core/widgets/inputs.py +37 -81
  94. euporie/core/widgets/layout.py +7 -6
  95. euporie/core/widgets/logo.py +49 -0
  96. euporie/core/widgets/menu.py +13 -11
  97. euporie/core/widgets/pager.py +9 -11
  98. euporie/core/widgets/palette.py +6 -6
  99. euporie/hub/app.py +52 -31
  100. euporie/notebook/_commands.py +24 -0
  101. euporie/notebook/_settings.py +107 -0
  102. euporie/notebook/app.py +109 -210
  103. euporie/notebook/filters.py +1 -1
  104. euporie/notebook/tabs/__init__.py +46 -7
  105. euporie/notebook/tabs/_commands.py +714 -0
  106. euporie/notebook/tabs/_settings.py +32 -0
  107. euporie/notebook/tabs/display.py +2 -2
  108. euporie/notebook/tabs/edit.py +12 -7
  109. euporie/notebook/tabs/json.py +3 -3
  110. euporie/notebook/tabs/log.py +1 -18
  111. euporie/notebook/tabs/notebook.py +21 -674
  112. euporie/notebook/widgets/_commands.py +11 -0
  113. euporie/notebook/widgets/_settings.py +19 -0
  114. euporie/notebook/widgets/side_bar.py +14 -34
  115. euporie/preview/_settings.py +104 -0
  116. euporie/preview/app.py +8 -30
  117. euporie/preview/tabs/notebook.py +15 -86
  118. euporie/web/tabs/web.py +4 -6
  119. euporie/web/widgets/webview.py +5 -12
  120. {euporie-2.8.0.dist-info → euporie-2.8.5.dist-info}/METADATA +11 -15
  121. euporie-2.8.5.dist-info/RECORD +172 -0
  122. {euporie-2.8.0.dist-info → euporie-2.8.5.dist-info}/WHEEL +1 -1
  123. {euporie-2.8.0.dist-info → euporie-2.8.5.dist-info}/entry_points.txt +2 -2
  124. {euporie-2.8.0.dist-info → euporie-2.8.5.dist-info}/licenses/LICENSE +1 -1
  125. euporie/core/launch.py +0 -59
  126. euporie/core/terminal.py +0 -527
  127. euporie-2.8.0.dist-info/RECORD +0 -146
  128. {euporie-2.8.0.data → euporie-2.8.5.data}/data/share/applications/euporie-console.desktop +0 -0
  129. {euporie-2.8.0.data → euporie-2.8.5.data}/data/share/applications/euporie-notebook.desktop +0 -0
euporie/core/commands.py CHANGED
@@ -15,7 +15,8 @@ from prompt_toolkit.key_binding.key_processor import KeyPressEvent
15
15
  from euporie.core.key_binding.utils import parse_keys
16
16
 
17
17
  if TYPE_CHECKING:
18
- from typing import Any, Callable, Coroutine
18
+ from collections.abc import Coroutine
19
+ from typing import Any, Callable
19
20
 
20
21
  from prompt_toolkit.filters import Filter, FilterOrBool
21
22
  from prompt_toolkit.key_binding.key_bindings import (
@@ -50,6 +51,7 @@ class Command:
50
51
  filter: FilterOrBool = True,
51
52
  hidden: FilterOrBool = False,
52
53
  name: str | None = None,
54
+ aliases: list[str] | None = None,
53
55
  title: str | None = None,
54
56
  menu_title: str | None = None,
55
57
  description: str | None = None,
@@ -66,6 +68,7 @@ class Command:
66
68
  filter: The condition under which the command is allowed to run
67
69
  hidden: The condition under the command is visible to the user
68
70
  name: The name of the command, for accessing the command from the registry
71
+ aliases: List of additional names for the command
69
72
  title: The title of the command for display
70
73
  menu_title: The title to display in menus if different
71
74
  description: The description of the command to explain it's function
@@ -77,6 +80,7 @@ class Command:
77
80
 
78
81
  """
79
82
  self.handler = handler
83
+ self.aliases = aliases or []
80
84
  self.filter = to_filter(filter)
81
85
  self.hidden = to_filter(hidden)
82
86
  if name is None:
@@ -106,18 +110,18 @@ class Command:
106
110
 
107
111
  self.keys: list[tuple[str | Keys, ...]] = []
108
112
 
109
- def run(self) -> None:
113
+ def run(self, arg: str | None = None) -> None:
110
114
  """Run the command's handler."""
111
115
  if self.filter():
112
116
  app = get_app()
113
117
  result = self.key_handler(
114
118
  KeyPressEvent(
115
119
  key_processor_ref=weakref.ref(app.key_processor),
116
- arg=None,
120
+ arg=arg,
117
121
  key_sequence=[],
118
122
  previous_key_sequence=[],
119
123
  is_repeat=False,
120
- )
124
+ ),
121
125
  )
122
126
  if isawaitable(result):
123
127
 
@@ -222,6 +226,8 @@ def add_cmd(**kwargs: Any) -> Callable:
222
226
  def decorator(handler: Callable) -> Callable:
223
227
  cmd = Command(handler, **kwargs)
224
228
  commands[cmd.name] = cmd
229
+ for alias in cmd.aliases:
230
+ commands[alias] = cmd
225
231
  return handler
226
232
 
227
233
  return decorator
@@ -243,4 +249,4 @@ def get_cmd(name: str) -> Command:
243
249
  try:
244
250
  return commands[name]
245
251
  except KeyError as e:
246
- raise KeyError("Unknown command: %r" % name) from e
252
+ raise KeyError(f"Unknown command: {name}") from e
@@ -3,16 +3,17 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import logging
6
- from typing import TYPE_CHECKING, AsyncGenerator, Iterable
6
+ from typing import TYPE_CHECKING
7
7
 
8
8
  from prompt_toolkit.completion.base import CompleteEvent, Completer, Completion
9
9
 
10
10
  if TYPE_CHECKING:
11
+ from collections.abc import AsyncGenerator, Iterable
11
12
  from pathlib import Path
12
13
 
13
14
  from prompt_toolkit.document import Document
14
15
 
15
- from euporie.core.kernel import Kernel
16
+ from euporie.core.kernel.client import Kernel
16
17
  from euporie.core.lsp import LspClient
17
18
 
18
19
  log = logging.getLogger(__name__)