tksheet 7.2.14__py3-none-any.whl → 7.2.16__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.
- tksheet/__init__.py +1 -1
- tksheet/row_index.py +3 -2
- tksheet/sheet.py +42 -6
- tksheet/sheet_options.py +2 -2
- tksheet/text_editor.py +15 -0
- {tksheet-7.2.14.dist-info → tksheet-7.2.16.dist-info}/METADATA +6 -1
- {tksheet-7.2.14.dist-info → tksheet-7.2.16.dist-info}/RECORD +10 -10
- {tksheet-7.2.14.dist-info → tksheet-7.2.16.dist-info}/WHEEL +1 -1
- {tksheet-7.2.14.dist-info → tksheet-7.2.16.dist-info}/LICENSE.txt +0 -0
- {tksheet-7.2.14.dist-info → tksheet-7.2.16.dist-info}/top_level.txt +0 -0
tksheet/__init__.py
CHANGED
tksheet/row_index.py
CHANGED
@@ -921,11 +921,12 @@ class RowIndex(tk.Canvas):
|
|
921
921
|
eventx: int,
|
922
922
|
) -> bool:
|
923
923
|
if self.PAR.ops.treeview and (
|
924
|
-
canvasy < self.MT.row_positions[r] + self.MT.index_txt_height +
|
924
|
+
canvasy < self.MT.row_positions[r] + self.MT.index_txt_height + 5
|
925
925
|
and isinstance(self.MT._row_index, list)
|
926
926
|
and (datarn := self.MT.datarn(r)) < len(self.MT._row_index)
|
927
927
|
and eventx
|
928
|
-
< self.get_treeview_indent((iid := self.MT._row_index[datarn].iid)) + self.MT.index_txt_height +
|
928
|
+
< (indent := self.get_treeview_indent((iid := self.MT._row_index[datarn].iid))) + self.MT.index_txt_height + 4
|
929
|
+
and eventx >= indent + 1
|
929
930
|
):
|
930
931
|
return iid
|
931
932
|
return None
|
tksheet/sheet.py
CHANGED
@@ -10,6 +10,7 @@ from collections.abc import (
|
|
10
10
|
Iterator,
|
11
11
|
Sequence,
|
12
12
|
)
|
13
|
+
from functools import partial
|
13
14
|
from itertools import (
|
14
15
|
accumulate,
|
15
16
|
chain,
|
@@ -190,6 +191,7 @@ class Sheet(tk.Frame):
|
|
190
191
|
show_selected_cells_border: bool = True,
|
191
192
|
edit_cell_tab: Literal["right", "down", ""] = "right",
|
192
193
|
edit_cell_return: Literal["right", "down", ""] = "down",
|
194
|
+
editor_del_key: Literal["forward", "backward", ""] = "forward",
|
193
195
|
treeview: bool = False,
|
194
196
|
treeview_indent: str | int = "6",
|
195
197
|
rounded_boxes: bool = True,
|
@@ -4713,6 +4715,8 @@ class Sheet(tk.Frame):
|
|
4713
4715
|
open_ids: Iterator[str] | None = None,
|
4714
4716
|
safety: bool = True,
|
4715
4717
|
ncols: int | None = None,
|
4718
|
+
include_iid_column: bool = True,
|
4719
|
+
include_parent_column: bool = True,
|
4716
4720
|
) -> Sheet:
|
4717
4721
|
self.reset(cell_options=False, column_widths=False, header=False, redraw=False)
|
4718
4722
|
if text_column is None:
|
@@ -4758,8 +4762,9 @@ class Sheet(tk.Frame):
|
|
4758
4762
|
newrow[iid_column] = n.iid
|
4759
4763
|
self.RI.tree_rns[n.iid] = len(data)
|
4760
4764
|
data.append(newrow)
|
4761
|
-
|
4762
|
-
|
4765
|
+
|
4766
|
+
insert_rows = partial(
|
4767
|
+
self.insert_rows,
|
4763
4768
|
idx=0,
|
4764
4769
|
heights={} if row_heights is False else row_heights,
|
4765
4770
|
row_index=True,
|
@@ -4768,6 +4773,37 @@ class Sheet(tk.Frame):
|
|
4768
4773
|
push_ops=push_ops,
|
4769
4774
|
redraw=False,
|
4770
4775
|
)
|
4776
|
+
|
4777
|
+
if include_iid_column and include_parent_column:
|
4778
|
+
insert_rows(rows=[[self.RI.tree[iid]] + data[self.RI.tree_rns[iid]] for iid in self.get_children()])
|
4779
|
+
|
4780
|
+
elif include_iid_column and not include_parent_column:
|
4781
|
+
exclude = {parent_column}
|
4782
|
+
insert_rows(
|
4783
|
+
rows=[
|
4784
|
+
[self.RI.tree[iid]] + [e for i, e in enumerate(data[self.RI.tree_rns[iid]]) if i not in exclude]
|
4785
|
+
for iid in self.get_children()
|
4786
|
+
]
|
4787
|
+
)
|
4788
|
+
|
4789
|
+
elif include_parent_column and not include_iid_column:
|
4790
|
+
exclude = {iid_column}
|
4791
|
+
insert_rows(
|
4792
|
+
rows=[
|
4793
|
+
[self.RI.tree[iid]] + [e for i, e in enumerate(data[self.RI.tree_rns[iid]]) if i not in exclude]
|
4794
|
+
for iid in self.get_children()
|
4795
|
+
]
|
4796
|
+
)
|
4797
|
+
|
4798
|
+
elif not include_iid_column and not include_parent_column:
|
4799
|
+
exclude = {iid_column, parent_column}
|
4800
|
+
insert_rows(
|
4801
|
+
rows=[
|
4802
|
+
[self.RI.tree[iid]] + [e for i, e in enumerate(data[self.RI.tree_rns[iid]]) if i not in exclude]
|
4803
|
+
for iid in self.get_children()
|
4804
|
+
]
|
4805
|
+
)
|
4806
|
+
|
4771
4807
|
self.MT.all_rows_displayed = False
|
4772
4808
|
self.MT.displayed_rows = list(range(len(self.MT._row_index)))
|
4773
4809
|
self.RI.tree_rns = {n.iid: i for i, n in enumerate(self.MT._row_index)}
|
@@ -4885,12 +4921,12 @@ class Sheet(tk.Frame):
|
|
4885
4921
|
index: None | int | Literal["end"] = None,
|
4886
4922
|
iid: None | str = None,
|
4887
4923
|
text: None | str = None,
|
4888
|
-
values: None | list = None,
|
4924
|
+
values: None | list[object] = None,
|
4889
4925
|
create_selections: bool = False,
|
4890
4926
|
) -> str:
|
4891
4927
|
if iid is None:
|
4892
4928
|
i = 0
|
4893
|
-
while (iid := f"{i}") in self.RI.tree:
|
4929
|
+
while (iid := f"{num2alpha(i)}") in self.RI.tree:
|
4894
4930
|
i += 1
|
4895
4931
|
iid, pid = iid.lower(), parent.lower()
|
4896
4932
|
if not iid:
|
@@ -5213,7 +5249,7 @@ class Sheet(tk.Frame):
|
|
5213
5249
|
raise ValueError(f"Item '{item}' does not exist.")
|
5214
5250
|
return self.RI.tree_rns[item] in self.MT.displayed_rows
|
5215
5251
|
|
5216
|
-
def display_item(self, item: str, redraw=False) -> Sheet:
|
5252
|
+
def display_item(self, item: str, redraw: bool = False) -> Sheet:
|
5217
5253
|
"""
|
5218
5254
|
Ensure that item is displayed in the tree
|
5219
5255
|
- Opens all of an item's ancestors
|
@@ -5230,7 +5266,7 @@ class Sheet(tk.Frame):
|
|
5230
5266
|
)
|
5231
5267
|
return self.set_refresh_timer(redraw)
|
5232
5268
|
|
5233
|
-
def scroll_to_item(self, item: str, redraw=False) -> Sheet:
|
5269
|
+
def scroll_to_item(self, item: str, redraw: bool = False) -> Sheet:
|
5234
5270
|
"""
|
5235
5271
|
Scrolls to an item and ensures that it is displayed
|
5236
5272
|
"""
|
tksheet/sheet_options.py
CHANGED
@@ -98,7 +98,6 @@ def new_sheet_options() -> DotDict:
|
|
98
98
|
],
|
99
99
|
"delete_bindings": [
|
100
100
|
"<Delete>",
|
101
|
-
"<Delete>",
|
102
101
|
],
|
103
102
|
"select_all_bindings": [
|
104
103
|
f"<{ctrl_key}-a>",
|
@@ -241,8 +240,9 @@ def new_sheet_options() -> DotDict:
|
|
241
240
|
"show_selected_cells_border": True,
|
242
241
|
"edit_cell_tab": "right",
|
243
242
|
"edit_cell_return": "down",
|
243
|
+
"editor_del_key": "forward",
|
244
244
|
"treeview": False,
|
245
|
-
"treeview_indent": "
|
245
|
+
"treeview_indent": "5",
|
246
246
|
"rounded_boxes": True,
|
247
247
|
"alternate_color": "",
|
248
248
|
}
|
tksheet/text_editor.py
CHANGED
@@ -40,6 +40,7 @@ class TextEditorTkText(tk.Text):
|
|
40
40
|
self.bind(rc_binding, self.rc)
|
41
41
|
self.bind(f"<{ctrl_key}-a>", self.select_all)
|
42
42
|
self.bind(f"<{ctrl_key}-A>", self.select_all)
|
43
|
+
self.bind("<Delete>", self.delete_key)
|
43
44
|
self._orig = self._w + "_orig"
|
44
45
|
self.tk.call("rename", self._w, self._orig)
|
45
46
|
self.tk.createcommand(self._w, self._proxy)
|
@@ -62,6 +63,7 @@ class TextEditorTkText(tk.Text):
|
|
62
63
|
insertbackground=fg,
|
63
64
|
state=state,
|
64
65
|
)
|
66
|
+
self.editor_del_key = sheet_ops.editor_del_key
|
65
67
|
self.align = align
|
66
68
|
self.rc_popup_menu.delete(0, "end")
|
67
69
|
self.rc_popup_menu.add_command(
|
@@ -126,6 +128,19 @@ class TextEditorTkText(tk.Text):
|
|
126
128
|
self.focus_set()
|
127
129
|
self.rc_popup_menu.tk_popup(event.x_root, event.y_root)
|
128
130
|
|
131
|
+
def delete_key(self, event: object = None) -> None:
|
132
|
+
if self.editor_del_key == "forward":
|
133
|
+
return
|
134
|
+
elif not self.editor_del_key:
|
135
|
+
return "break"
|
136
|
+
elif self.editor_del_key == "backward":
|
137
|
+
if self.tag_ranges("sel"):
|
138
|
+
return
|
139
|
+
if self.index("insert") == "1.0":
|
140
|
+
return "break"
|
141
|
+
self.delete("insert-1c")
|
142
|
+
return "break"
|
143
|
+
|
129
144
|
def select_all(self, event: object = None) -> Literal["break"]:
|
130
145
|
self.tag_add(tk.SEL, "1.0", tk.END)
|
131
146
|
self.mark_set(tk.INSERT, tk.END)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: tksheet
|
3
|
-
Version: 7.2.
|
3
|
+
Version: 7.2.16
|
4
4
|
Summary: Tkinter table / sheet widget
|
5
5
|
Author-email: ragardner <github@ragardner.simplelogin.com>
|
6
6
|
License: Copyright (c) 2019 ragardner and open source contributors
|
@@ -83,6 +83,7 @@ This library is maintained with the help of **[others](https://github.com/ragard
|
|
83
83
|
- Change fonts and font size (not for individual cells)
|
84
84
|
- Change any colors in the sheet
|
85
85
|
- Dropdowns, check boxes, progress bars
|
86
|
+
- Treeview mode
|
86
87
|
- [Hide rows and/or columns](https://github.com/ragardner/tksheet/wiki/Version-7#example-header-dropdown-boxes-and-row-filtering)
|
87
88
|
- Left `"w"`, Center `"center"` or Right `"e"` text alignment for any cell/row/column
|
88
89
|
|
@@ -110,3 +111,7 @@ sheet.delete_columns(columns=[0, 3], undo=True)
|
|
110
111
|
### **dark theme**
|
111
112
|
|
112
113
|

|
114
|
+
|
115
|
+
### **treeview mode**
|
116
|
+
|
117
|
+

|
@@ -1,20 +1,20 @@
|
|
1
|
-
tksheet/__init__.py,sha256=
|
1
|
+
tksheet/__init__.py,sha256=X3AZkLmfPiFkqbcT_7zxfzR3WmneO3LBwgt1XFoPlck,2165
|
2
2
|
tksheet/colors.py,sha256=1k06VorynLmnC4FdJg8H4reIA6rXaeXBpdMwXLhN8oc,51594
|
3
3
|
tksheet/column_headers.py,sha256=bHv67vRhRYxw_qyrw5akJo-b77vtN4y-mEO617FEqxE,102222
|
4
4
|
tksheet/formatters.py,sha256=DXif00aq9DgFpXwkbiqD86KxtDg0Meop51hLY-KcGNQ,10037
|
5
5
|
tksheet/functions.py,sha256=wTWsTFZkTMJH-2qz--9qNaprWqhA7sYVzCEhuw_PRhs,42369
|
6
6
|
tksheet/main_table.py,sha256=WeSemTwFb8zEu0v2QabPNGZqM06kkCs-IvP1HLSR1oM,328843
|
7
7
|
tksheet/other_classes.py,sha256=HIKIDNXJRv0H5qbftcCtLVWW8NKSBAwyNXQOlmPWTDQ,15633
|
8
|
-
tksheet/row_index.py,sha256=
|
9
|
-
tksheet/sheet.py,sha256=
|
10
|
-
tksheet/sheet_options.py,sha256=
|
11
|
-
tksheet/text_editor.py,sha256
|
8
|
+
tksheet/row_index.py,sha256=VVM9rs0ShHfWdy_J-fr4Oz6zDpsKrQWY5Yo6KmZWs0s,109680
|
9
|
+
tksheet/sheet.py,sha256=41b3rCcGpli_zD5js91r8Ml59fWp272mdCDOy1VDCC8,276904
|
10
|
+
tksheet/sheet_options.py,sha256=hA4Gi2spLmltq3HrgfzetUaqvT_FaVI8PrSQkgdoyEE,12442
|
11
|
+
tksheet/text_editor.py,sha256=lmmHOPb11S8tlNtC10vijF1QqVB5Ts2hUKnGJd_JkWA,7103
|
12
12
|
tksheet/themes.py,sha256=ZO4RqnAhEpApsoA5ZGUkYvb7huaNHSmrV_ug2TWWzOE,14474
|
13
13
|
tksheet/top_left_rectangle.py,sha256=ri7hb9CC5l37ynmxceprq11UuWWRpWEI_0AI42wzv0A,8444
|
14
14
|
tksheet/types.py,sha256=IgoEHMbceKpakcZtanxKaKJ4RdCq7UW6EoEIIz5O59k,340
|
15
15
|
tksheet/vars.py,sha256=86ubZZElsnQuC6Lv6bW2lt2NhD9wAp6PxtkK7ufKqq0,3452
|
16
|
-
tksheet-7.2.
|
17
|
-
tksheet-7.2.
|
18
|
-
tksheet-7.2.
|
19
|
-
tksheet-7.2.
|
20
|
-
tksheet-7.2.
|
16
|
+
tksheet-7.2.16.dist-info/LICENSE.txt,sha256=ndbcCPe9SlHfweE_W2RAueWUe2k7yudyxYLq6WjFdn4,1101
|
17
|
+
tksheet-7.2.16.dist-info/METADATA,sha256=3MazU2uACyAR_E5Fkdn4HFmcuovzLfcBH2Udv1zV9PA,6404
|
18
|
+
tksheet-7.2.16.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
19
|
+
tksheet-7.2.16.dist-info/top_level.txt,sha256=my61PXCcck_HHAc9cq3NAlyAr3A3FXxCy9gptEOaCN8,8
|
20
|
+
tksheet-7.2.16.dist-info/RECORD,,
|
File without changes
|
File without changes
|