txl_notebook_editor 0.2.7__tar.gz → 0.2.8__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.
- {txl_notebook_editor-0.2.7 → txl_notebook_editor-0.2.8}/PKG-INFO +1 -1
- txl_notebook_editor-0.2.8/txl_notebook_editor/__init__.py +1 -0
- {txl_notebook_editor-0.2.7 → txl_notebook_editor-0.2.8}/txl_notebook_editor/components.py +35 -13
- txl_notebook_editor-0.2.7/txl_notebook_editor/__init__.py +0 -1
- {txl_notebook_editor-0.2.7 → txl_notebook_editor-0.2.8}/.gitignore +0 -0
- {txl_notebook_editor-0.2.7 → txl_notebook_editor-0.2.8}/LICENSE.txt +0 -0
- {txl_notebook_editor-0.2.7 → txl_notebook_editor-0.2.8}/README.md +0 -0
- {txl_notebook_editor-0.2.7 → txl_notebook_editor-0.2.8}/pyproject.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: txl_notebook_editor
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.8
|
|
4
4
|
Summary: TXL plugin for a notebook editor
|
|
5
5
|
Project-URL: Source, https://github.com/davidbrochart/jpterm/plugins/notebook_editor
|
|
6
6
|
Author-email: David Brochart <david.brochart@gmail.com>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.8"
|
|
@@ -173,6 +173,13 @@ class NotebookEditor(Editor, VerticalScroll, metaclass=NotebookEditorMeta):
|
|
|
173
173
|
if delete is not None:
|
|
174
174
|
self.cells[idx].remove()
|
|
175
175
|
del self.cells[idx]
|
|
176
|
+
if self.cell_i == len(self.cells):
|
|
177
|
+
self.cell_i -= 1
|
|
178
|
+
self.current_cell.select()
|
|
179
|
+
self.current_cell.focus()
|
|
180
|
+
elif self.cell_i == 0:
|
|
181
|
+
self.current_cell.select()
|
|
182
|
+
self.current_cell.focus()
|
|
176
183
|
insert = d.get("insert")
|
|
177
184
|
if insert is not None:
|
|
178
185
|
for c in insert:
|
|
@@ -206,12 +213,7 @@ class NotebookEditor(Editor, VerticalScroll, metaclass=NotebookEditorMeta):
|
|
|
206
213
|
elif event.key == Keys.Down:
|
|
207
214
|
if not self.edit_mode:
|
|
208
215
|
event.stop()
|
|
209
|
-
|
|
210
|
-
self.current_cell.unselect()
|
|
211
|
-
self.cell_i += 1
|
|
212
|
-
self.current_cell.select()
|
|
213
|
-
self.current_cell.focus()
|
|
214
|
-
self.scroll_to_widget(self.current_cell)
|
|
216
|
+
self.go_down()
|
|
215
217
|
elif event.key == Keys.ControlUp:
|
|
216
218
|
event.stop()
|
|
217
219
|
if self.cell_i > 0:
|
|
@@ -272,7 +274,8 @@ class NotebookEditor(Editor, VerticalScroll, metaclass=NotebookEditorMeta):
|
|
|
272
274
|
elif event.character == "x":
|
|
273
275
|
event.stop()
|
|
274
276
|
self.cell_copy = str(self.current_cell.ycell)
|
|
275
|
-
|
|
277
|
+
if len(self.cells) > 1:
|
|
278
|
+
del self.ynb.ycells[self.cell_i]
|
|
276
279
|
elif event.key == Keys.ControlV:
|
|
277
280
|
event.stop()
|
|
278
281
|
if self.cell_copy is not None:
|
|
@@ -314,13 +317,32 @@ class NotebookEditor(Editor, VerticalScroll, metaclass=NotebookEditorMeta):
|
|
|
314
317
|
)
|
|
315
318
|
else:
|
|
316
319
|
await self.kernel.execute(self.current_cell.ycell)
|
|
317
|
-
if self.cell_i
|
|
318
|
-
self.
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
320
|
+
if self.cell_i == len(self.cells) - 1:
|
|
321
|
+
ycell = self.ynb.create_ycell(
|
|
322
|
+
{
|
|
323
|
+
"cell_type": "code",
|
|
324
|
+
"execution_count": None,
|
|
325
|
+
"source": "",
|
|
326
|
+
}
|
|
327
|
+
)
|
|
328
|
+
self.ynb.ycells.append(ycell)
|
|
329
|
+
async def will_go_down():
|
|
330
|
+
while self.cell_i == len(self.cells) - 1:
|
|
331
|
+
await asyncio.sleep(0)
|
|
332
|
+
self.go_down(edit_mode=True)
|
|
333
|
+
asyncio.create_task(will_go_down())
|
|
334
|
+
|
|
335
|
+
def go_down(self, edit_mode: bool = False) -> None:
|
|
336
|
+
if self.cell_i < len(self.cells) - 1:
|
|
337
|
+
self.current_cell.unselect()
|
|
338
|
+
self.cell_i += 1
|
|
339
|
+
self.current_cell.select()
|
|
340
|
+
if edit_mode:
|
|
322
341
|
self.edit_mode = True
|
|
323
|
-
self.
|
|
342
|
+
self.current_cell.source.focus()
|
|
343
|
+
else:
|
|
344
|
+
self.current_cell.focus()
|
|
345
|
+
self.scroll_to_widget(self.current_cell)
|
|
324
346
|
|
|
325
347
|
def on_click(self) -> None:
|
|
326
348
|
for cell_i, cell in enumerate(self.cells):
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.2.7"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|