Skip to content

Commit

Permalink
7.2.14 -> 7.2.15
Browse files Browse the repository at this point in the history
#### Added:
- New option to address [247](#247)
  • Loading branch information
ragardner committed Aug 28, 2024
1 parent 9518868 commit 64e2588
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 4 deletions.
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### Version 7.2.15
#### Added:
- New option to address [247](https://github.com/ragardner/tksheet/issues/247)

### Version 7.2.14
#### Added:
- New options to address [246](https://github.com/ragardner/tksheet/issues/246)
Expand Down
4 changes: 3 additions & 1 deletion docs/DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,9 @@ def __init__(
show_selected_cells_border: bool = True,
edit_cell_tab: Literal["right", "down", ""] = "right",
edit_cell_return: Literal["right", "down", ""] = "down",
editor_del_key: Literal["forward", "backward", ""] = "forward",
treeview: bool = False,
treeview_indent: str | int = "3",
treeview_indent: str | int = "6",
rounded_boxes: bool = True,
# colors
outline_thickness: int = 0,
Expand Down Expand Up @@ -5351,6 +5352,7 @@ The list of key word arguments available for `set_options()` are as follows, [se
```python
edit_cell_tab
edit_cell_return
editor_del_key
auto_resize_columns
auto_resize_rows
to_clipboard_delimiter
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
name = "tksheet"
description = "Tkinter table / sheet widget"
readme = "README.md"
version = "7.2.14"
version = "7.2.15"
authors = [{ name = "ragardner", email = "[email protected]" }]
requires-python = ">=3.8"
license = {file = "LICENSE.txt"}
Expand Down
2 changes: 1 addition & 1 deletion tksheet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
tksheet - A Python tkinter table widget
"""

__version__ = "7.2.14"
__version__ = "7.2.15"

from .colors import (
color_map,
Expand Down
1 change: 1 addition & 0 deletions tksheet/sheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ def __init__(
show_selected_cells_border: bool = True,
edit_cell_tab: Literal["right", "down", ""] = "right",
edit_cell_return: Literal["right", "down", ""] = "down",
editor_del_key: Literal["forward", "backward", ""] = "forward",
treeview: bool = False,
treeview_indent: str | int = "6",
rounded_boxes: bool = True,
Expand Down
2 changes: 1 addition & 1 deletion tksheet/sheet_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ def new_sheet_options() -> DotDict:
],
"delete_bindings": [
"<Delete>",
"<Delete>",
],
"select_all_bindings": [
f"<{ctrl_key}-a>",
Expand Down Expand Up @@ -241,6 +240,7 @@ def new_sheet_options() -> DotDict:
"show_selected_cells_border": True,
"edit_cell_tab": "right",
"edit_cell_return": "down",
"editor_del_key": "forward",
"treeview": False,
"treeview_indent": "6",
"rounded_boxes": True,
Expand Down
15 changes: 15 additions & 0 deletions tksheet/text_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def __init__(
self.bind(rc_binding, self.rc)
self.bind(f"<{ctrl_key}-a>", self.select_all)
self.bind(f"<{ctrl_key}-A>", self.select_all)
self.bind("<Delete>", self.delete_key)
self._orig = self._w + "_orig"
self.tk.call("rename", self._w, self._orig)
self.tk.createcommand(self._w, self._proxy)
Expand All @@ -62,6 +63,7 @@ def reset(
insertbackground=fg,
state=state,
)
self.editor_del_key = sheet_ops.editor_del_key
self.align = align
self.rc_popup_menu.delete(0, "end")
self.rc_popup_menu.add_command(
Expand Down Expand Up @@ -126,6 +128,19 @@ def rc(self, event: object) -> None:
self.focus_set()
self.rc_popup_menu.tk_popup(event.x_root, event.y_root)

def delete_key(self, event: object = None) -> None:
if self.editor_del_key == "forward":
return
elif not self.editor_del_key:
return "break"
elif self.editor_del_key == "backward":
if self.tag_ranges("sel"):
return
if self.index("insert") == "1.0":
return "break"
self.delete("insert-1c")
return "break"

def select_all(self, event: object = None) -> Literal["break"]:
self.tag_add(tk.SEL, "1.0", tk.END)
self.mark_set(tk.INSERT, tk.END)
Expand Down

0 comments on commit 64e2588

Please sign in to comment.