tksheet 7.2.16__py3-none-any.whl → 7.2.17__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 +44 -12
- tksheet/sheet.py +5 -5
- {tksheet-7.2.16.dist-info → tksheet-7.2.17.dist-info}/METADATA +6 -3
- {tksheet-7.2.16.dist-info → tksheet-7.2.17.dist-info}/RECORD +8 -8
- {tksheet-7.2.16.dist-info → tksheet-7.2.17.dist-info}/LICENSE.txt +0 -0
- {tksheet-7.2.16.dist-info → tksheet-7.2.17.dist-info}/WHEEL +0 -0
- {tksheet-7.2.16.dist-info → tksheet-7.2.17.dist-info}/top_level.txt +0 -0
tksheet/__init__.py
CHANGED
tksheet/row_index.py
CHANGED
@@ -925,7 +925,7 @@ class RowIndex(tk.Canvas):
|
|
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
|
-
< (indent := self.
|
928
|
+
< (indent := self.get_iid_indent((iid := self.MT._row_index[datarn].iid))) + self.MT.index_txt_height + 4
|
929
929
|
and eventx >= indent + 1
|
930
930
|
):
|
931
931
|
return iid
|
@@ -1057,7 +1057,7 @@ class RowIndex(tk.Canvas):
|
|
1057
1057
|
align = self.align
|
1058
1058
|
if align == "w":
|
1059
1059
|
w += self.MT.index_txt_height
|
1060
|
-
w += self.
|
1060
|
+
w += self.get_iid_indent(self.MT._row_index[datarn].iid) + 10
|
1061
1061
|
return w, h
|
1062
1062
|
|
1063
1063
|
def get_row_text_height(
|
@@ -1332,12 +1332,13 @@ class RowIndex(tk.Canvas):
|
|
1332
1332
|
self,
|
1333
1333
|
x1: float,
|
1334
1334
|
y1: float,
|
1335
|
-
|
1335
|
+
y2: float,
|
1336
1336
|
fill: str,
|
1337
1337
|
tag: str | tuple[str],
|
1338
1338
|
indent: float,
|
1339
1339
|
has_children: bool = False,
|
1340
1340
|
open_: bool = False,
|
1341
|
+
level: int = 1,
|
1341
1342
|
) -> None:
|
1342
1343
|
mod = (self.MT.index_txt_height - 1) if self.MT.index_txt_height % 2 else self.MT.index_txt_height
|
1343
1344
|
small_mod = int(mod / 5)
|
@@ -1370,14 +1371,36 @@ class RowIndex(tk.Canvas):
|
|
1370
1371
|
y1 + mid_y + small_mod + small_mod,
|
1371
1372
|
)
|
1372
1373
|
else:
|
1374
|
+
# POINTS FOR A LINE THAT STOPS BELOW FIRST LINE OF TEXT
|
1375
|
+
# points = (
|
1376
|
+
# # the upper point
|
1377
|
+
# x1 + 5 + indent + small_mod + small_mod,
|
1378
|
+
# y1 + mid_y - small_mod - small_mod,
|
1379
|
+
# # the bottom point
|
1380
|
+
# x1 + 5 + indent + small_mod + small_mod,
|
1381
|
+
# y1 + mid_y + small_mod + small_mod,
|
1382
|
+
# )
|
1383
|
+
|
1384
|
+
# POINTS FOR A LINE THAT STOPS AT ROW LINE
|
1385
|
+
# points = (
|
1386
|
+
# # the upper point
|
1387
|
+
# x1 + 5 + indent + small_mod + small_mod,
|
1388
|
+
# y1 + mid_y - small_mod - small_mod,
|
1389
|
+
# # the bottom point
|
1390
|
+
# x1 + 5 + indent + small_mod + small_mod,
|
1391
|
+
# y2 - mid_y + small_mod + small_mod,
|
1392
|
+
# )
|
1393
|
+
|
1394
|
+
# POINTS FOR A HORIZONTAL LINE
|
1373
1395
|
points = (
|
1374
|
-
# the
|
1375
|
-
x1 + 5 + indent
|
1376
|
-
y1 + mid_y
|
1377
|
-
# the
|
1378
|
-
x1 + 5 + indent + small_mod + small_mod,
|
1379
|
-
y1 + mid_y
|
1396
|
+
# the left point
|
1397
|
+
x1 + 5 + indent,
|
1398
|
+
y1 + mid_y,
|
1399
|
+
# the right point
|
1400
|
+
x1 + 5 + indent + small_mod + small_mod + small_mod + small_mod,
|
1401
|
+
y1 + mid_y,
|
1380
1402
|
)
|
1403
|
+
|
1381
1404
|
if self.hidd_tree_arrow:
|
1382
1405
|
t, sh = self.hidd_tree_arrow.popitem()
|
1383
1406
|
self.coords(t, points)
|
@@ -1697,17 +1720,18 @@ class RowIndex(tk.Canvas):
|
|
1697
1720
|
mw -= self.MT.index_txt_height
|
1698
1721
|
if align == "w":
|
1699
1722
|
draw_x += self.MT.index_txt_height + 3
|
1700
|
-
indent = self.
|
1723
|
+
level, indent = self.get_iid_level_indent(iid)
|
1701
1724
|
draw_x += indent + 5
|
1702
1725
|
self.redraw_tree_arrow(
|
1703
1726
|
2,
|
1704
1727
|
rtopgridln,
|
1705
|
-
|
1728
|
+
rbotgridln - 1,
|
1706
1729
|
fill=tree_arrow_fg,
|
1707
1730
|
tag="ta",
|
1708
1731
|
indent=indent,
|
1709
1732
|
has_children=bool(self.tree[iid].children),
|
1710
1733
|
open_=self.MT._row_index[datarn].iid in self.tree_open_ids,
|
1734
|
+
level=level,
|
1711
1735
|
)
|
1712
1736
|
lns = self.get_valid_cell_data_as_str(datarn, fix=False)
|
1713
1737
|
if not lns:
|
@@ -2518,13 +2542,21 @@ class RowIndex(tk.Canvas):
|
|
2518
2542
|
def gen_top_nodes(self) -> Generator[Node]:
|
2519
2543
|
yield from (node for node in self.MT._row_index if node.parent == "")
|
2520
2544
|
|
2521
|
-
def
|
2545
|
+
def get_iid_indent(self, iid: str) -> int:
|
2522
2546
|
if isinstance(self.PAR.ops.treeview_indent, str):
|
2523
2547
|
indent = self.MT.index_txt_width * int(self.PAR.ops.treeview_indent)
|
2524
2548
|
else:
|
2525
2549
|
indent = self.PAR.ops.treeview_indent
|
2526
2550
|
return indent * max(self.get_node_level(self.tree[iid]))
|
2527
2551
|
|
2552
|
+
def get_iid_level_indent(self, iid: str) -> tuple[int, int]:
|
2553
|
+
if isinstance(self.PAR.ops.treeview_indent, str):
|
2554
|
+
indent = self.MT.index_txt_width * int(self.PAR.ops.treeview_indent)
|
2555
|
+
else:
|
2556
|
+
indent = self.PAR.ops.treeview_indent
|
2557
|
+
level = max(self.get_node_level(self.tree[iid]))
|
2558
|
+
return level, indent * level
|
2559
|
+
|
2528
2560
|
def remove_node_from_parents_children(self, node: Node) -> None:
|
2529
2561
|
if node.parent:
|
2530
2562
|
node.parent.children.remove(node)
|
tksheet/sheet.py
CHANGED
@@ -193,7 +193,7 @@ class Sheet(tk.Frame):
|
|
193
193
|
edit_cell_return: Literal["right", "down", ""] = "down",
|
194
194
|
editor_del_key: Literal["forward", "backward", ""] = "forward",
|
195
195
|
treeview: bool = False,
|
196
|
-
treeview_indent: str | int = "
|
196
|
+
treeview_indent: str | int = "5",
|
197
197
|
rounded_boxes: bool = True,
|
198
198
|
alternate_color: str = "",
|
199
199
|
# colors
|
@@ -4709,7 +4709,7 @@ class Sheet(tk.Frame):
|
|
4709
4709
|
data: list[list[object]],
|
4710
4710
|
iid_column: int,
|
4711
4711
|
parent_column: int,
|
4712
|
-
text_column: None | int = None,
|
4712
|
+
text_column: None | int | list[str] = None,
|
4713
4713
|
push_ops: bool = False,
|
4714
4714
|
row_heights: Sequence[int] | None | False = None,
|
4715
4715
|
open_ids: Iterator[str] | None = None,
|
@@ -4741,15 +4741,15 @@ class Sheet(tk.Frame):
|
|
4741
4741
|
tally_of_ids[iid] += 1
|
4742
4742
|
row[iid_column] = new
|
4743
4743
|
if iid in self.RI.tree:
|
4744
|
-
self.RI.tree[iid].text = row[text_column]
|
4744
|
+
self.RI.tree[iid].text = row[text_column] if isinstance(text_column, int) else text_column[rn]
|
4745
4745
|
else:
|
4746
|
-
self.RI.tree[iid] = Node(row[text_column], iid, "")
|
4746
|
+
self.RI.tree[iid] = Node(row[text_column] if isinstance(text_column, int) else text_column[rn], iid, "")
|
4747
4747
|
if safety and (iid == pid or self.RI.build_pid_causes_recursive_loop(iid, pid)):
|
4748
4748
|
row[parent_column] = ""
|
4749
4749
|
pid = ""
|
4750
4750
|
if pid:
|
4751
4751
|
if pid not in self.RI.tree:
|
4752
|
-
self.RI.tree[pid] = Node(row[text_column], pid)
|
4752
|
+
self.RI.tree[pid] = Node(row[text_column] if isinstance(text_column, int) else text_column[rn], pid)
|
4753
4753
|
self.RI.tree[iid].parent = self.RI.tree[pid]
|
4754
4754
|
self.RI.tree[pid].children.append(self.RI.tree[iid])
|
4755
4755
|
else:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: tksheet
|
3
|
-
Version: 7.2.
|
3
|
+
Version: 7.2.17
|
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,7 +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
|
+
- [Treeview mode](https://github.com/ragardner/tksheet/wiki/Version-7#treeview-mode)
|
87
87
|
- [Hide rows and/or columns](https://github.com/ragardner/tksheet/wiki/Version-7#example-header-dropdown-boxes-and-row-filtering)
|
88
88
|
- Left `"w"`, Center `"center"` or Right `"e"` text alignment for any cell/row/column
|
89
89
|
|
@@ -114,4 +114,7 @@ sheet.delete_columns(columns=[0, 3], undo=True)
|
|
114
114
|
|
115
115
|
### **treeview mode**
|
116
116
|
|
117
|
-

|
118
|
+
|
119
|
+
|
120
|
+
|
@@ -1,20 +1,20 @@
|
|
1
|
-
tksheet/__init__.py,sha256=
|
1
|
+
tksheet/__init__.py,sha256=TDIJBK7_SlAbZEGQyaWByzoFyx9741bcSAEQHnD_Rms,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=
|
8
|
+
tksheet/row_index.py,sha256=kEdlyPaSeTFGhEwKMN57jH61WMN5fX91Xi3EnR1x8Ws,110974
|
9
|
+
tksheet/sheet.py,sha256=3U5E7k9_LdRKmTmEX_WBuPVPuTWYY5SzRY0OTiRIgXQ,277075
|
10
10
|
tksheet/sheet_options.py,sha256=hA4Gi2spLmltq3HrgfzetUaqvT_FaVI8PrSQkgdoyEE,12442
|
11
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.17.dist-info/LICENSE.txt,sha256=ndbcCPe9SlHfweE_W2RAueWUe2k7yudyxYLq6WjFdn4,1101
|
17
|
+
tksheet-7.2.17.dist-info/METADATA,sha256=9Alc-s77Mb9MEJR4TIcAUQ8zM4h1hJCztLUEEB7uxMw,6476
|
18
|
+
tksheet-7.2.17.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
19
|
+
tksheet-7.2.17.dist-info/top_level.txt,sha256=my61PXCcck_HHAc9cq3NAlyAr3A3FXxCy9gptEOaCN8,8
|
20
|
+
tksheet-7.2.17.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|