euporie 2.8.4__py3-none-any.whl → 2.8.6__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.
- euporie/console/_commands.py +143 -0
- euporie/console/_settings.py +58 -0
- euporie/console/app.py +25 -71
- euporie/console/tabs/console.py +58 -62
- euporie/core/__init__.py +1 -1
- euporie/core/__main__.py +28 -11
- euporie/core/_settings.py +109 -0
- euporie/core/app/__init__.py +3 -0
- euporie/core/app/_commands.py +95 -0
- euporie/core/app/_settings.py +457 -0
- euporie/core/{app.py → app/app.py} +212 -576
- euporie/core/app/base.py +51 -0
- euporie/core/{current.py → app/current.py} +13 -4
- euporie/core/app/cursor.py +35 -0
- euporie/core/app/dummy.py +12 -0
- euporie/core/app/launch.py +28 -0
- euporie/core/bars/__init__.py +11 -0
- euporie/core/bars/command.py +205 -0
- euporie/core/bars/menu.py +258 -0
- euporie/core/{widgets → bars}/search.py +20 -16
- euporie/core/{widgets → bars}/status.py +6 -23
- euporie/core/clipboard.py +19 -80
- euporie/core/comm/base.py +8 -6
- euporie/core/comm/ipywidgets.py +16 -7
- euporie/core/comm/registry.py +2 -1
- euporie/core/commands.py +10 -20
- euporie/core/completion.py +3 -2
- euporie/core/config.py +368 -341
- euporie/core/convert/__init__.py +0 -30
- euporie/core/convert/datum.py +116 -53
- euporie/core/convert/formats/__init__.py +31 -0
- euporie/core/convert/formats/ansi.py +9 -23
- euporie/core/convert/formats/common.py +11 -23
- euporie/core/convert/formats/html.py +45 -40
- euporie/core/convert/formats/pil.py +1 -1
- euporie/core/convert/formats/png.py +3 -5
- euporie/core/convert/formats/sixel.py +3 -3
- euporie/core/convert/registry.py +4 -6
- euporie/core/convert/utils.py +41 -4
- euporie/core/diagnostics.py +2 -2
- euporie/core/filters.py +98 -40
- euporie/core/format.py +2 -3
- euporie/core/ft/ansi.py +1 -1
- euporie/core/ft/html.py +12 -21
- euporie/core/ft/table.py +1 -3
- euporie/core/ft/utils.py +4 -1
- euporie/core/graphics.py +386 -133
- euporie/core/history.py +2 -2
- euporie/core/inspection.py +3 -2
- euporie/core/io.py +207 -28
- euporie/core/kernel/__init__.py +1 -0
- euporie/core/{kernel.py → kernel/client.py} +45 -108
- euporie/core/kernel/manager.py +114 -0
- euporie/core/key_binding/bindings/__init__.py +1 -8
- euporie/core/key_binding/bindings/basic.py +47 -7
- euporie/core/key_binding/bindings/completion.py +3 -8
- euporie/core/key_binding/bindings/micro.py +1 -6
- euporie/core/key_binding/bindings/mouse.py +2 -2
- euporie/core/key_binding/bindings/terminal.py +193 -0
- euporie/core/key_binding/key_processor.py +43 -2
- euporie/core/key_binding/registry.py +2 -0
- euporie/core/key_binding/utils.py +22 -2
- euporie/core/keys.py +7156 -93
- euporie/core/layout/cache.py +3 -3
- euporie/core/layout/containers.py +48 -4
- euporie/core/layout/decor.py +2 -2
- euporie/core/layout/mouse.py +1 -1
- euporie/core/layout/print.py +2 -1
- euporie/core/layout/scroll.py +39 -34
- euporie/core/log.py +76 -64
- euporie/core/lsp.py +118 -24
- euporie/core/margins.py +1 -1
- euporie/core/path.py +62 -13
- euporie/core/renderer.py +58 -17
- euporie/core/style.py +57 -39
- euporie/core/suggest.py +103 -85
- euporie/core/tabs/__init__.py +32 -0
- euporie/core/tabs/_settings.py +113 -0
- euporie/core/tabs/base.py +80 -470
- euporie/core/tabs/kernel.py +419 -0
- euporie/core/tabs/notebook.py +24 -101
- euporie/core/utils.py +92 -15
- euporie/core/validation.py +1 -1
- euporie/core/widgets/_settings.py +188 -0
- euporie/core/widgets/cell.py +19 -50
- euporie/core/widgets/cell_outputs.py +25 -36
- euporie/core/widgets/decor.py +11 -41
- euporie/core/widgets/dialog.py +62 -27
- euporie/core/widgets/display.py +12 -15
- euporie/core/widgets/file_browser.py +2 -23
- euporie/core/widgets/forms.py +8 -5
- euporie/core/widgets/inputs.py +13 -70
- euporie/core/widgets/layout.py +2 -1
- euporie/core/widgets/logo.py +49 -0
- euporie/core/widgets/menu.py +10 -8
- euporie/core/widgets/pager.py +6 -10
- euporie/core/widgets/palette.py +6 -6
- euporie/hub/app.py +52 -35
- euporie/notebook/_commands.py +24 -0
- euporie/notebook/_settings.py +107 -0
- euporie/notebook/app.py +49 -171
- euporie/notebook/filters.py +1 -1
- euporie/notebook/tabs/__init__.py +46 -7
- euporie/notebook/tabs/_commands.py +714 -0
- euporie/notebook/tabs/_settings.py +32 -0
- euporie/notebook/tabs/display.py +4 -4
- euporie/notebook/tabs/edit.py +11 -44
- euporie/notebook/tabs/json.py +5 -5
- euporie/notebook/tabs/log.py +1 -18
- euporie/notebook/tabs/notebook.py +11 -660
- euporie/notebook/widgets/_commands.py +11 -0
- euporie/notebook/widgets/_settings.py +19 -0
- euporie/notebook/widgets/side_bar.py +14 -34
- euporie/preview/_settings.py +104 -0
- euporie/preview/app.py +6 -31
- euporie/preview/tabs/notebook.py +6 -72
- euporie/web/__init__.py +1 -0
- euporie/web/tabs/__init__.py +14 -0
- euporie/web/tabs/web.py +11 -6
- euporie/web/widgets/__init__.py +1 -0
- euporie/web/widgets/webview.py +5 -15
- {euporie-2.8.4.dist-info → euporie-2.8.6.dist-info}/METADATA +10 -8
- euporie-2.8.6.dist-info/RECORD +175 -0
- {euporie-2.8.4.dist-info → euporie-2.8.6.dist-info}/WHEEL +1 -1
- {euporie-2.8.4.dist-info → euporie-2.8.6.dist-info}/entry_points.txt +2 -2
- {euporie-2.8.4.dist-info → euporie-2.8.6.dist-info}/licenses/LICENSE +1 -1
- euporie/core/launch.py +0 -64
- euporie/core/terminal.py +0 -522
- euporie-2.8.4.dist-info/RECORD +0 -147
- {euporie-2.8.4.data → euporie-2.8.6.data}/data/share/applications/euporie-console.desktop +0 -0
- {euporie-2.8.4.data → euporie-2.8.6.data}/data/share/applications/euporie-notebook.desktop +0 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
"""Define settings for the notebook app tabs."""
|
2
|
+
|
3
|
+
from euporie.core.config import add_setting
|
4
|
+
|
5
|
+
add_setting(
|
6
|
+
name="show_scroll_bar",
|
7
|
+
group="euporie.notebook.tabs.notebook",
|
8
|
+
title="scroll bar",
|
9
|
+
flags=["--show-scroll-bar"],
|
10
|
+
type_=bool,
|
11
|
+
help_="Show the scroll bar",
|
12
|
+
default=True,
|
13
|
+
description="""
|
14
|
+
Whether the scroll bar should be shown on the right of the screen.
|
15
|
+
""",
|
16
|
+
)
|
17
|
+
|
18
|
+
add_setting(
|
19
|
+
name="show_side_bar",
|
20
|
+
group="euporie.notebook.widgets.side_bar",
|
21
|
+
flags=["--show-side-bar"],
|
22
|
+
type_=bool,
|
23
|
+
title="side-bar",
|
24
|
+
help_="Show the side-bar",
|
25
|
+
default=False,
|
26
|
+
schema={
|
27
|
+
"type": "boolean",
|
28
|
+
},
|
29
|
+
description="""
|
30
|
+
Whether the side-bar should be shown at the side of the screen.
|
31
|
+
""",
|
32
|
+
)
|
euporie/notebook/tabs/display.py
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
from __future__ import annotations
|
4
4
|
|
5
|
+
import asyncio
|
5
6
|
import logging
|
6
7
|
from typing import TYPE_CHECKING, ClassVar
|
7
8
|
|
@@ -12,7 +13,6 @@ from euporie.core.convert.datum import Datum
|
|
12
13
|
from euporie.core.convert.mime import MIME_FORMATS, get_format
|
13
14
|
from euporie.core.margins import MarginContainer, ScrollbarMargin
|
14
15
|
from euporie.core.tabs.base import Tab
|
15
|
-
from euporie.core.utils import run_in_thread_with_context
|
16
16
|
from euporie.core.widgets.display import Display
|
17
17
|
|
18
18
|
if TYPE_CHECKING:
|
@@ -20,8 +20,8 @@ if TYPE_CHECKING:
|
|
20
20
|
|
21
21
|
from prompt_toolkit.layout.containers import AnyContainer
|
22
22
|
|
23
|
-
from euporie.core.app import BaseApp
|
24
|
-
from euporie.core.
|
23
|
+
from euporie.core.app.app import BaseApp
|
24
|
+
from euporie.core.bars.status import StatusBarFields
|
25
25
|
|
26
26
|
log = logging.getLogger(__name__)
|
27
27
|
|
@@ -44,7 +44,7 @@ class DisplayTab(Tab):
|
|
44
44
|
self.app.layout.focus(self.container)
|
45
45
|
self.app.invalidate()
|
46
46
|
|
47
|
-
|
47
|
+
app.create_background_task(asyncio.to_thread(_load))
|
48
48
|
|
49
49
|
def __pt_status__(self) -> StatusBarFields | None:
|
50
50
|
"""Return a list of statusbar field values shown then this tab is active."""
|
euporie/notebook/tabs/edit.py
CHANGED
@@ -9,11 +9,11 @@ from prompt_toolkit.layout.containers import HSplit
|
|
9
9
|
from prompt_toolkit.layout.dimension import Dimension
|
10
10
|
|
11
11
|
from euporie.core.filters import insert_mode, replace_mode
|
12
|
-
from euporie.core.kernel import Kernel, MsgCallbacks
|
12
|
+
from euporie.core.kernel.client import Kernel, MsgCallbacks
|
13
13
|
from euporie.core.key_binding.registry import load_registered_bindings
|
14
14
|
from euporie.core.lexers import detect_lexer
|
15
15
|
from euporie.core.path import UntitledPath
|
16
|
-
from euporie.core.tabs.
|
16
|
+
from euporie.core.tabs.kernel import KernelTab
|
17
17
|
from euporie.core.widgets.inputs import KernelInput
|
18
18
|
|
19
19
|
if TYPE_CHECKING:
|
@@ -22,9 +22,9 @@ if TYPE_CHECKING:
|
|
22
22
|
|
23
23
|
from prompt_toolkit.layout.containers import AnyContainer
|
24
24
|
|
25
|
-
from euporie.core.app import BaseApp
|
25
|
+
from euporie.core.app.app import BaseApp
|
26
|
+
from euporie.core.bars.status import StatusBarFields
|
26
27
|
from euporie.core.comm.base import Comm
|
27
|
-
from euporie.core.widgets.status import StatusBarFields
|
28
28
|
|
29
29
|
log = logging.getLogger(__name__)
|
30
30
|
|
@@ -154,44 +154,11 @@ class EditorTab(KernelTab):
|
|
154
154
|
),
|
155
155
|
)
|
156
156
|
|
157
|
-
def
|
158
|
-
"""
|
159
|
-
if path is not None:
|
160
|
-
self.path = path
|
157
|
+
def write_file(self, path: Path) -> None:
|
158
|
+
"""Write the file's text data to a path.
|
161
159
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
self.saving = True
|
168
|
-
self.app.invalidate()
|
169
|
-
|
170
|
-
# Save to a temp file, then replace the original
|
171
|
-
temp_path = self.path.parent / f".{self.path.stem}.tmp{self.path.suffix}"
|
172
|
-
log.debug("Using temporary file %s", temp_path.name)
|
173
|
-
try:
|
174
|
-
open_file = temp_path.open("w")
|
175
|
-
except NotImplementedError:
|
176
|
-
if dialog := self.app.dialogs.get("save-as"):
|
177
|
-
dialog.show(tab=self, cb=cb)
|
178
|
-
else:
|
179
|
-
try:
|
180
|
-
open_file.write(self.input_box.buffer.text)
|
181
|
-
except Exception:
|
182
|
-
if dialog := self.app.dialogs.get("save-as"):
|
183
|
-
dialog.show(tab=self, cb=cb)
|
184
|
-
else:
|
185
|
-
try:
|
186
|
-
temp_path.rename(self.path)
|
187
|
-
except Exception:
|
188
|
-
if dialog := self.app.dialogs.get("save-as"):
|
189
|
-
dialog.show(tab=self, cb=cb)
|
190
|
-
else:
|
191
|
-
self.dirty = False
|
192
|
-
self.saving = False
|
193
|
-
self.app.invalidate()
|
194
|
-
log.debug("File saved")
|
195
|
-
# Run the callback
|
196
|
-
if callable(cb):
|
197
|
-
cb()
|
160
|
+
Args:
|
161
|
+
path: An path at which to save the file
|
162
|
+
|
163
|
+
"""
|
164
|
+
path.write_text(self.input_box.buffer.text)
|
euporie/notebook/tabs/json.py
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
from __future__ import annotations
|
4
4
|
|
5
|
+
import asyncio
|
5
6
|
import json
|
6
7
|
import logging
|
7
8
|
from typing import TYPE_CHECKING, ClassVar
|
@@ -10,7 +11,6 @@ from prompt_toolkit.layout.containers import VSplit
|
|
10
11
|
from prompt_toolkit.layout.dimension import Dimension
|
11
12
|
|
12
13
|
from euporie.core.tabs.base import Tab
|
13
|
-
from euporie.core.utils import run_in_thread_with_context
|
14
14
|
from euporie.core.widgets.tree import JsonView
|
15
15
|
|
16
16
|
if TYPE_CHECKING:
|
@@ -18,8 +18,8 @@ if TYPE_CHECKING:
|
|
18
18
|
|
19
19
|
from prompt_toolkit.layout.containers import AnyContainer
|
20
20
|
|
21
|
-
from euporie.core.app import BaseApp
|
22
|
-
from euporie.core.
|
21
|
+
from euporie.core.app.app import BaseApp
|
22
|
+
from euporie.core.bars.status import StatusBarFields
|
23
23
|
|
24
24
|
log = logging.getLogger(__name__)
|
25
25
|
|
@@ -29,7 +29,7 @@ class JsonTab(Tab):
|
|
29
29
|
|
30
30
|
name = "JSON Viewer"
|
31
31
|
mime_types: ClassVar[set[str]] = {"*json"}
|
32
|
-
|
32
|
+
file_types: ClassVar[dict[str, None]] = {".json": None}
|
33
33
|
|
34
34
|
def __init__(self, app: BaseApp, path: Path | None = None) -> None:
|
35
35
|
"""Call when the tab is created."""
|
@@ -43,7 +43,7 @@ class JsonTab(Tab):
|
|
43
43
|
self.app.layout.focus(self.container)
|
44
44
|
self.app.invalidate()
|
45
45
|
|
46
|
-
|
46
|
+
app.create_background_task(asyncio.to_thread(_load))
|
47
47
|
|
48
48
|
def __pt_status__(self) -> StatusBarFields | None:
|
49
49
|
"""Return a list of statusbar field values shown then this tab is active."""
|
euporie/notebook/tabs/log.py
CHANGED
@@ -9,8 +9,6 @@ from prompt_toolkit.layout.containers import HSplit, VSplit
|
|
9
9
|
from prompt_toolkit.layout.dimension import Dimension
|
10
10
|
from prompt_toolkit.widgets import SearchToolbar
|
11
11
|
|
12
|
-
from euporie.core.commands import add_cmd
|
13
|
-
from euporie.core.current import get_app
|
14
12
|
from euporie.core.log import LOG_QUEUE, QueueHandler
|
15
13
|
from euporie.core.margins import MarginContainer, ScrollbarMargin
|
16
14
|
from euporie.core.path import parse_path
|
@@ -23,7 +21,7 @@ if TYPE_CHECKING:
|
|
23
21
|
|
24
22
|
from prompt_toolkit.formatted_text.base import FormattedText
|
25
23
|
|
26
|
-
from euporie.core.app import BaseApp
|
24
|
+
from euporie.core.app.app import BaseApp
|
27
25
|
|
28
26
|
|
29
27
|
class LogView(Tab):
|
@@ -93,18 +91,3 @@ class LogView(Tab):
|
|
93
91
|
"""Remove log queue handler hook on close."""
|
94
92
|
QueueHandler.unhook(self.hook_id)
|
95
93
|
super().close(cb=cb)
|
96
|
-
|
97
|
-
# ################################### Commands ####################################
|
98
|
-
|
99
|
-
@staticmethod
|
100
|
-
@add_cmd()
|
101
|
-
def _view_logs() -> None:
|
102
|
-
"""Open the logs in a new tab."""
|
103
|
-
app = get_app()
|
104
|
-
for tab in app.tabs:
|
105
|
-
if isinstance(tab, LogView):
|
106
|
-
break
|
107
|
-
else:
|
108
|
-
tab = LogView(app)
|
109
|
-
app.add_tab(tab)
|
110
|
-
tab.focus()
|