tksheet 7.3.2__py3-none-any.whl → 7.3.4__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/colors.py +1 -1
- tksheet/column_headers.py +148 -206
- tksheet/find_window.py +4 -13
- tksheet/functions.py +106 -38
- tksheet/main_table.py +419 -517
- tksheet/other_classes.py +1 -1
- tksheet/row_index.py +188 -257
- tksheet/sheet.py +15 -40
- tksheet/sheet_options.py +3 -11
- tksheet/text_editor.py +3 -10
- tksheet/types.py +2 -7
- {tksheet-7.3.2.dist-info → tksheet-7.3.4.dist-info}/METADATA +1 -1
- tksheet-7.3.4.dist-info/RECORD +21 -0
- tksheet-7.3.2.dist-info/RECORD +0 -21
- {tksheet-7.3.2.dist-info → tksheet-7.3.4.dist-info}/LICENSE.txt +0 -0
- {tksheet-7.3.2.dist-info → tksheet-7.3.4.dist-info}/WHEEL +0 -0
- {tksheet-7.3.2.dist-info → tksheet-7.3.4.dist-info}/top_level.txt +0 -0
tksheet/other_classes.py
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
3
|
import pickle
|
4
|
+
import tkinter as tk
|
4
5
|
from collections import namedtuple
|
5
6
|
from collections.abc import Callable, Generator, Hashable, Iterator
|
6
7
|
from functools import partial
|
7
8
|
from typing import Literal
|
8
|
-
import tkinter as tk
|
9
9
|
|
10
10
|
pickle_obj = partial(pickle.dumps, protocol=pickle.HIGHEST_PROTOCOL)
|
11
11
|
|
tksheet/row_index.py
CHANGED
@@ -2,42 +2,16 @@ from __future__ import annotations
|
|
2
2
|
|
3
3
|
import tkinter as tk
|
4
4
|
from collections import defaultdict
|
5
|
-
from collections.abc import
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
from functools import (
|
11
|
-
partial,
|
12
|
-
)
|
13
|
-
from itertools import (
|
14
|
-
chain,
|
15
|
-
cycle,
|
16
|
-
islice,
|
17
|
-
repeat,
|
18
|
-
)
|
19
|
-
from math import (
|
20
|
-
ceil,
|
21
|
-
floor,
|
22
|
-
)
|
23
|
-
from operator import (
|
24
|
-
itemgetter,
|
25
|
-
)
|
5
|
+
from collections.abc import Generator, Hashable, Sequence
|
6
|
+
from functools import partial
|
7
|
+
from itertools import chain, cycle, islice, repeat
|
8
|
+
from math import ceil, floor
|
9
|
+
from operator import itemgetter
|
26
10
|
from typing import Literal
|
27
11
|
|
28
|
-
from .colors import
|
29
|
-
|
30
|
-
|
31
|
-
from .constants import (
|
32
|
-
rc_binding,
|
33
|
-
text_editor_close_bindings,
|
34
|
-
text_editor_newline_bindings,
|
35
|
-
text_editor_to_unbind,
|
36
|
-
)
|
37
|
-
from .formatters import (
|
38
|
-
is_bool_like,
|
39
|
-
try_to_bool,
|
40
|
-
)
|
12
|
+
from .colors import color_map
|
13
|
+
from .constants import rc_binding, text_editor_close_bindings, text_editor_newline_bindings, text_editor_to_unbind
|
14
|
+
from .formatters import is_bool_like, try_to_bool
|
41
15
|
from .functions import (
|
42
16
|
consecutive_chunks,
|
43
17
|
consecutive_ranges,
|
@@ -53,19 +27,9 @@ from .functions import (
|
|
53
27
|
stored_event_dict,
|
54
28
|
try_binding,
|
55
29
|
)
|
56
|
-
from .other_classes import
|
57
|
-
|
58
|
-
|
59
|
-
DropdownStorage,
|
60
|
-
Node,
|
61
|
-
TextEditorStorage,
|
62
|
-
)
|
63
|
-
from .text_editor import (
|
64
|
-
TextEditor,
|
65
|
-
)
|
66
|
-
from .types import (
|
67
|
-
AnyIter,
|
68
|
-
)
|
30
|
+
from .other_classes import DotDict, DraggedRowColumn, DropdownStorage, Node, TextEditorStorage
|
31
|
+
from .text_editor import TextEditor
|
32
|
+
from .types import AnyIter
|
69
33
|
|
70
34
|
|
71
35
|
class RowIndex(tk.Canvas):
|
@@ -472,9 +436,9 @@ class RowIndex(tk.Canvas):
|
|
472
436
|
y,
|
473
437
|
width=1,
|
474
438
|
fill=self.PAR.ops.resizing_line_fg,
|
475
|
-
tag="rhl",
|
439
|
+
tag=("rh", "rhl"),
|
476
440
|
)
|
477
|
-
self.MT.create_resize_line(x1, y, x2, y, width=1, fill=self.PAR.ops.resizing_line_fg, tag="rhl")
|
441
|
+
self.MT.create_resize_line(x1, y, x2, y, width=1, fill=self.PAR.ops.resizing_line_fg, tag=("rh", "rhl"))
|
478
442
|
self.create_resize_line(
|
479
443
|
0,
|
480
444
|
line2y,
|
@@ -482,9 +446,11 @@ class RowIndex(tk.Canvas):
|
|
482
446
|
line2y,
|
483
447
|
width=1,
|
484
448
|
fill=self.PAR.ops.resizing_line_fg,
|
485
|
-
tag="rhl2",
|
449
|
+
tag=("rh", "rhl2"),
|
450
|
+
)
|
451
|
+
self.MT.create_resize_line(
|
452
|
+
x1, line2y, x2, line2y, width=1, fill=self.PAR.ops.resizing_line_fg, tag=("rh", "rhl2")
|
486
453
|
)
|
487
|
-
self.MT.create_resize_line(x1, line2y, x2, line2y, width=1, fill=self.PAR.ops.resizing_line_fg, tag="rhl2")
|
488
454
|
elif self.width_resizing_enabled and self.rsz_h is None and self.rsz_w is True:
|
489
455
|
self.currently_resizing_width = True
|
490
456
|
elif self.MT.identify_row(y=event.y, allow_end=False) is None:
|
@@ -525,9 +491,9 @@ class RowIndex(tk.Canvas):
|
|
525
491
|
y,
|
526
492
|
width=1,
|
527
493
|
fill=self.PAR.ops.resizing_line_fg,
|
528
|
-
tag="rhl",
|
494
|
+
tag=("rh", "rhl"),
|
529
495
|
)
|
530
|
-
self.MT.create_resize_line(x1, y, x2, y, width=1, fill=self.PAR.ops.resizing_line_fg, tag="rhl")
|
496
|
+
self.MT.create_resize_line(x1, y, x2, y, width=1, fill=self.PAR.ops.resizing_line_fg, tag=("rh", "rhl"))
|
531
497
|
self.create_resize_line(
|
532
498
|
0,
|
533
499
|
line2y,
|
@@ -535,7 +501,7 @@ class RowIndex(tk.Canvas):
|
|
535
501
|
line2y,
|
536
502
|
width=1,
|
537
503
|
fill=self.PAR.ops.resizing_line_fg,
|
538
|
-
tag="rhl2",
|
504
|
+
tag=("rh", "rhl2"),
|
539
505
|
)
|
540
506
|
self.MT.create_resize_line(
|
541
507
|
x1,
|
@@ -544,7 +510,7 @@ class RowIndex(tk.Canvas):
|
|
544
510
|
line2y,
|
545
511
|
width=1,
|
546
512
|
fill=self.PAR.ops.resizing_line_fg,
|
547
|
-
tag="rhl2",
|
513
|
+
tag=("rh", "rhl2"),
|
548
514
|
)
|
549
515
|
self.drag_height_resize()
|
550
516
|
elif self.width_resizing_enabled and self.rsz_w is not None and self.currently_resizing_width:
|
@@ -1308,6 +1274,7 @@ class RowIndex(tk.Canvas):
|
|
1308
1274
|
self.itemconfig(iid, fill=fill, outline=outline)
|
1309
1275
|
else:
|
1310
1276
|
self.itemconfig(iid, fill=fill, outline=outline, tag=tag, state="normal")
|
1277
|
+
self.tag_raise(iid)
|
1311
1278
|
else:
|
1312
1279
|
iid = self.create_rectangle(coords, fill=fill, outline=outline, tag=tag)
|
1313
1280
|
self.disp_high[iid] = True
|
@@ -1562,39 +1529,12 @@ class RowIndex(tk.Canvas):
|
|
1562
1529
|
self.hidd_tree_arrow.update(self.disp_tree_arrow)
|
1563
1530
|
self.disp_tree_arrow = {}
|
1564
1531
|
self.visible_row_dividers = {}
|
1565
|
-
xend = self.current_width - 6
|
1566
1532
|
self.row_width_resize_bbox = (
|
1567
1533
|
self.current_width - 2,
|
1568
1534
|
scrollpos_top,
|
1569
1535
|
self.current_width,
|
1570
1536
|
scrollpos_bot,
|
1571
1537
|
)
|
1572
|
-
if (self.PAR.ops.show_horizontal_grid or self.height_resizing_enabled) and row_pos_exists:
|
1573
|
-
points = [
|
1574
|
-
self.current_width - 1,
|
1575
|
-
y_stop - 1,
|
1576
|
-
self.current_width - 1,
|
1577
|
-
scrollpos_top - 1,
|
1578
|
-
-1,
|
1579
|
-
scrollpos_top - 1,
|
1580
|
-
]
|
1581
|
-
for r in range(grid_start_row, grid_end_row):
|
1582
|
-
draw_y = self.MT.row_positions[r]
|
1583
|
-
if r and self.height_resizing_enabled:
|
1584
|
-
self.visible_row_dividers[r] = (1, draw_y - 2, xend, draw_y + 2)
|
1585
|
-
points.extend(
|
1586
|
-
(
|
1587
|
-
-1,
|
1588
|
-
draw_y,
|
1589
|
-
self.current_width,
|
1590
|
-
draw_y,
|
1591
|
-
-1,
|
1592
|
-
draw_y,
|
1593
|
-
-1,
|
1594
|
-
self.MT.row_positions[r + 1] if len(self.MT.row_positions) - 1 > r else draw_y,
|
1595
|
-
)
|
1596
|
-
)
|
1597
|
-
self.redraw_gridline(points=points, fill=self.PAR.ops.index_grid_fg, width=1, tag="h")
|
1598
1538
|
sel_cells_bg = (
|
1599
1539
|
self.PAR.ops.index_selected_cells_bg
|
1600
1540
|
if self.PAR.ops.index_selected_cells_bg.startswith("#")
|
@@ -1615,6 +1555,7 @@ class RowIndex(tk.Canvas):
|
|
1615
1555
|
rbotgridln = self.MT.row_positions[r + 1]
|
1616
1556
|
if rbotgridln - rtopgridln < self.MT.index_txt_height:
|
1617
1557
|
continue
|
1558
|
+
checkbox_kwargs = {}
|
1618
1559
|
datarn = r if self.MT.all_rows_displayed else self.MT.displayed_rows[r]
|
1619
1560
|
fill, tree_arrow_fg, dd_drawn = self.redraw_highlight_get_text_fg(
|
1620
1561
|
fr=rtopgridln,
|
@@ -1625,99 +1566,70 @@ class RowIndex(tk.Canvas):
|
|
1625
1566
|
selections=selections,
|
1626
1567
|
datarn=datarn,
|
1627
1568
|
)
|
1628
|
-
|
1629
1569
|
if datarn in self.cell_options and "align" in self.cell_options[datarn]:
|
1630
1570
|
align = self.cell_options[datarn]["align"]
|
1631
1571
|
else:
|
1632
1572
|
align = self.align
|
1633
|
-
dropdown_kwargs
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1637
|
-
|
1638
|
-
self.redraw_dropdown(
|
1639
|
-
0,
|
1640
|
-
rtopgridln,
|
1641
|
-
self.current_width - 1,
|
1642
|
-
rbotgridln - 1,
|
1643
|
-
fill=fill if dropdown_kwargs["state"] != "disabled" else self.PAR.ops.index_grid_fg,
|
1644
|
-
outline=fill,
|
1645
|
-
tag="dd",
|
1646
|
-
draw_outline=not dd_drawn,
|
1647
|
-
draw_arrow=True,
|
1648
|
-
open_=dd_coords == r,
|
1649
|
-
)
|
1650
|
-
else:
|
1651
|
-
mw = self.current_width - 2
|
1652
|
-
|
1653
|
-
elif align == "e":
|
1654
|
-
if dropdown_kwargs:
|
1655
|
-
mw = self.current_width - self.MT.index_txt_height - 2
|
1573
|
+
if dropdown_kwargs := self.get_cell_kwargs(datarn, key="dropdown"):
|
1574
|
+
mw = self.current_width - self.MT.index_txt_height - 2
|
1575
|
+
if align == "w":
|
1576
|
+
draw_x = 3
|
1577
|
+
elif align == "e":
|
1656
1578
|
draw_x = self.current_width - 5 - self.MT.index_txt_height
|
1657
|
-
|
1658
|
-
0,
|
1659
|
-
rtopgridln,
|
1660
|
-
self.current_width - 1,
|
1661
|
-
rbotgridln - 1,
|
1662
|
-
fill=fill if dropdown_kwargs["state"] != "disabled" else self.PAR.ops.index_grid_fg,
|
1663
|
-
outline=fill,
|
1664
|
-
tag="dd",
|
1665
|
-
draw_outline=not dd_drawn,
|
1666
|
-
draw_arrow=True,
|
1667
|
-
open_=dd_coords == r,
|
1668
|
-
)
|
1669
|
-
else:
|
1670
|
-
mw = self.current_width - 2
|
1671
|
-
draw_x = self.current_width - 3
|
1672
|
-
|
1673
|
-
elif align == "center":
|
1674
|
-
if dropdown_kwargs:
|
1675
|
-
mw = self.current_width - self.MT.index_txt_height - 2
|
1579
|
+
elif align == "center":
|
1676
1580
|
draw_x = ceil((self.current_width - self.MT.index_txt_height) / 2)
|
1677
|
-
|
1678
|
-
|
1679
|
-
|
1680
|
-
|
1681
|
-
|
1682
|
-
|
1683
|
-
|
1684
|
-
|
1685
|
-
|
1686
|
-
|
1687
|
-
|
1688
|
-
|
1689
|
-
|
1690
|
-
|
1691
|
-
draw_x = floor(self.current_width / 2)
|
1692
|
-
checkbox_kwargs = self.get_cell_kwargs(datarn, key="checkbox")
|
1693
|
-
if checkbox_kwargs and not dropdown_kwargs and mw > self.MT.index_txt_height + 1:
|
1694
|
-
box_w = self.MT.index_txt_height + 1
|
1581
|
+
self.redraw_dropdown(
|
1582
|
+
0,
|
1583
|
+
rtopgridln,
|
1584
|
+
self.current_width - 1,
|
1585
|
+
rbotgridln - 1,
|
1586
|
+
fill=fill if dropdown_kwargs["state"] != "disabled" else self.PAR.ops.index_grid_fg,
|
1587
|
+
outline=fill,
|
1588
|
+
tag="dd",
|
1589
|
+
draw_outline=not dd_drawn,
|
1590
|
+
draw_arrow=True,
|
1591
|
+
open_=dd_coords == r,
|
1592
|
+
)
|
1593
|
+
else:
|
1594
|
+
mw = self.current_width - 2
|
1695
1595
|
if align == "w":
|
1696
|
-
draw_x
|
1697
|
-
|
1596
|
+
draw_x = 3
|
1597
|
+
elif align == "e":
|
1598
|
+
draw_x = self.current_width - 3
|
1698
1599
|
elif align == "center":
|
1699
|
-
draw_x
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1600
|
+
draw_x = floor(self.current_width / 2)
|
1601
|
+
if (
|
1602
|
+
(checkbox_kwargs := self.get_cell_kwargs(datarn, key="checkbox"))
|
1603
|
+
and not dropdown_kwargs
|
1604
|
+
and mw > self.MT.index_txt_height + 1
|
1605
|
+
):
|
1606
|
+
box_w = self.MT.index_txt_height + 1
|
1607
|
+
if align == "w":
|
1608
|
+
draw_x += box_w + 3
|
1609
|
+
mw -= box_w + 3
|
1610
|
+
elif align == "center":
|
1611
|
+
draw_x += ceil(box_w / 2) + 1
|
1612
|
+
mw -= box_w + 2
|
1613
|
+
else:
|
1614
|
+
mw -= box_w + 1
|
1615
|
+
try:
|
1616
|
+
draw_check = (
|
1617
|
+
self.MT._row_index[datarn]
|
1618
|
+
if isinstance(self.MT._row_index, (list, tuple))
|
1619
|
+
else self.MT.data[datarn][self.MT._row_index]
|
1620
|
+
)
|
1621
|
+
except Exception:
|
1622
|
+
draw_check = False
|
1623
|
+
self.redraw_checkbox(
|
1624
|
+
2,
|
1625
|
+
rtopgridln + 2,
|
1626
|
+
self.MT.index_txt_height + 3,
|
1627
|
+
rtopgridln + self.MT.index_txt_height + 3,
|
1628
|
+
fill=fill if checkbox_kwargs["state"] == "normal" else self.PAR.ops.index_grid_fg,
|
1629
|
+
outline="",
|
1630
|
+
tag="cb",
|
1631
|
+
draw_check=draw_check,
|
1708
1632
|
)
|
1709
|
-
except Exception:
|
1710
|
-
draw_check = False
|
1711
|
-
self.redraw_checkbox(
|
1712
|
-
2,
|
1713
|
-
rtopgridln + 2,
|
1714
|
-
self.MT.index_txt_height + 3,
|
1715
|
-
rtopgridln + self.MT.index_txt_height + 3,
|
1716
|
-
fill=fill if checkbox_kwargs["state"] == "normal" else self.PAR.ops.index_grid_fg,
|
1717
|
-
outline="",
|
1718
|
-
tag="cb",
|
1719
|
-
draw_check=draw_check,
|
1720
|
-
)
|
1721
1633
|
if treeview and isinstance(self.MT._row_index, list) and len(self.MT._row_index) > datarn:
|
1722
1634
|
iid = self.MT._row_index[datarn].iid
|
1723
1635
|
mw -= self.MT.index_txt_height
|
@@ -1736,84 +1648,108 @@ class RowIndex(tk.Canvas):
|
|
1736
1648
|
open_=self.MT._row_index[datarn].iid in self.tree_open_ids,
|
1737
1649
|
level=level,
|
1738
1650
|
)
|
1739
|
-
|
1740
|
-
if not lns:
|
1651
|
+
if mw < 5:
|
1741
1652
|
continue
|
1742
|
-
|
1743
|
-
if
|
1744
|
-
|
1745
|
-
|
1746
|
-
|
1747
|
-
|
1748
|
-
|
1749
|
-
|
1750
|
-
|
1751
|
-
|
1752
|
-
|
1753
|
-
|
1754
|
-
|
1755
|
-
|
1756
|
-
|
1757
|
-
|
1758
|
-
|
1759
|
-
|
1760
|
-
|
1761
|
-
|
1762
|
-
|
1763
|
-
|
1764
|
-
|
1765
|
-
|
1766
|
-
|
1767
|
-
|
1768
|
-
|
1769
|
-
|
1770
|
-
|
1771
|
-
|
1772
|
-
|
1773
|
-
|
1774
|
-
|
1775
|
-
|
1776
|
-
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1780
|
-
|
1781
|
-
|
1782
|
-
|
1783
|
-
|
1653
|
+
lines = self.get_valid_cell_data_as_str(datarn, fix=False)
|
1654
|
+
if not lines:
|
1655
|
+
continue
|
1656
|
+
start_ln = max(0, int((scrollpos_top - rtopgridln) / self.MT.index_xtra_lines_increment))
|
1657
|
+
draw_y = rtopgridln + self.MT.index_first_ln_ins + (start_ln * self.MT.index_xtra_lines_increment)
|
1658
|
+
lines = lines.split("\n")
|
1659
|
+
if len(lines) <= start_ln or draw_y + self.MT.index_half_txt_height - 1 > rbotgridln:
|
1660
|
+
continue
|
1661
|
+
for txt in islice(lines, start_ln, None):
|
1662
|
+
if self.hidd_text:
|
1663
|
+
iid, showing = self.hidd_text.popitem()
|
1664
|
+
self.coords(iid, draw_x, draw_y)
|
1665
|
+
if showing:
|
1666
|
+
self.itemconfig(
|
1667
|
+
iid,
|
1668
|
+
text=txt,
|
1669
|
+
fill=fill,
|
1670
|
+
font=font,
|
1671
|
+
anchor=align,
|
1672
|
+
)
|
1673
|
+
else:
|
1674
|
+
self.itemconfig(
|
1675
|
+
iid,
|
1676
|
+
text=txt,
|
1677
|
+
fill=fill,
|
1678
|
+
font=font,
|
1679
|
+
anchor=align,
|
1680
|
+
state="normal",
|
1681
|
+
)
|
1682
|
+
self.tag_raise(iid)
|
1683
|
+
else:
|
1684
|
+
iid = self.create_text(
|
1685
|
+
draw_x,
|
1686
|
+
draw_y,
|
1687
|
+
text=txt,
|
1688
|
+
fill=fill,
|
1689
|
+
font=font,
|
1690
|
+
anchor=align,
|
1691
|
+
tag="t",
|
1692
|
+
)
|
1693
|
+
self.disp_text[iid] = True
|
1694
|
+
wd = self.bbox(iid)
|
1695
|
+
if (wd := wd[2] - wd[0]) > mw:
|
1696
|
+
if align == "w" and dropdown_kwargs:
|
1697
|
+
txt = txt[: int(len(txt) * (mw / wd))]
|
1698
|
+
self.itemconfig(iid, text=txt)
|
1699
|
+
wd = self.bbox(iid)
|
1700
|
+
while wd[2] - wd[0] > mw:
|
1701
|
+
txt = txt[:-1]
|
1702
|
+
self.itemconfig(iid, text=txt)
|
1703
|
+
wd = self.bbox(iid)
|
1704
|
+
elif align == "e" and checkbox_kwargs:
|
1705
|
+
txt = txt[len(txt) - int(len(txt) * (mw / wd)) :]
|
1706
|
+
self.itemconfig(iid, text=txt)
|
1784
1707
|
wd = self.bbox(iid)
|
1785
|
-
|
1786
|
-
|
1787
|
-
|
1788
|
-
|
1789
|
-
|
1790
|
-
|
1791
|
-
|
1792
|
-
|
1793
|
-
|
1794
|
-
|
1795
|
-
|
1796
|
-
|
1797
|
-
|
1798
|
-
|
1799
|
-
|
1800
|
-
|
1801
|
-
|
1802
|
-
|
1803
|
-
|
1804
|
-
|
1805
|
-
|
1806
|
-
|
1807
|
-
|
1808
|
-
|
1809
|
-
|
1810
|
-
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
|
1708
|
+
while wd[2] - wd[0] > mw:
|
1709
|
+
txt = txt[1:]
|
1710
|
+
self.itemconfig(iid, text=txt)
|
1711
|
+
wd = self.bbox(iid)
|
1712
|
+
elif align == "center" and (dropdown_kwargs or checkbox_kwargs):
|
1713
|
+
tmod = ceil((len(txt) - int(len(txt) * (mw / wd))) / 2)
|
1714
|
+
txt = txt[tmod - 1 : -tmod]
|
1715
|
+
self.itemconfig(iid, text=txt)
|
1716
|
+
wd = self.bbox(iid)
|
1717
|
+
self.c_align_cyc = cycle(self.centre_alignment_text_mod_indexes)
|
1718
|
+
while wd[2] - wd[0] > mw:
|
1719
|
+
txt = txt[next(self.c_align_cyc)]
|
1720
|
+
self.itemconfig(iid, text=txt)
|
1721
|
+
wd = self.bbox(iid)
|
1722
|
+
self.coords(iid, draw_x, draw_y)
|
1723
|
+
draw_y += self.MT.index_xtra_lines_increment
|
1724
|
+
if draw_y + self.MT.index_half_txt_height - 1 > rbotgridln:
|
1725
|
+
break
|
1726
|
+
xend = self.current_width - 6
|
1727
|
+
if (self.PAR.ops.show_horizontal_grid or self.height_resizing_enabled) and row_pos_exists:
|
1728
|
+
points = [
|
1729
|
+
self.current_width - 1,
|
1730
|
+
y_stop - 1,
|
1731
|
+
self.current_width - 1,
|
1732
|
+
scrollpos_top - 1,
|
1733
|
+
-1,
|
1734
|
+
scrollpos_top - 1,
|
1735
|
+
]
|
1736
|
+
for r in range(grid_start_row, grid_end_row):
|
1737
|
+
draw_y = self.MT.row_positions[r]
|
1738
|
+
if r and self.height_resizing_enabled:
|
1739
|
+
self.visible_row_dividers[r] = (1, draw_y - 2, xend, draw_y + 2)
|
1740
|
+
points.extend(
|
1741
|
+
(
|
1742
|
+
-1,
|
1743
|
+
draw_y,
|
1744
|
+
self.current_width,
|
1745
|
+
draw_y,
|
1746
|
+
-1,
|
1747
|
+
draw_y,
|
1748
|
+
-1,
|
1749
|
+
self.MT.row_positions[r + 1] if len(self.MT.row_positions) - 1 > r else draw_y,
|
1750
|
+
)
|
1751
|
+
)
|
1752
|
+
self.redraw_gridline(points=points, fill=self.PAR.ops.index_grid_fg, width=1, tag="h")
|
1817
1753
|
for dct in (
|
1818
1754
|
self.hidd_text,
|
1819
1755
|
self.hidd_high,
|
@@ -1826,6 +1762,8 @@ class RowIndex(tk.Canvas):
|
|
1826
1762
|
if showing:
|
1827
1763
|
self.itemconfig(iid, state="hidden")
|
1828
1764
|
dct[iid] = False
|
1765
|
+
if self.disp_resize_lines:
|
1766
|
+
self.tag_raise("rh")
|
1829
1767
|
return True
|
1830
1768
|
|
1831
1769
|
def get_redraw_selections(self, startr: int, endr: int) -> dict[str, set[int]]:
|
@@ -2116,8 +2054,7 @@ class RowIndex(tk.Canvas):
|
|
2116
2054
|
win_h += self.MT.min_row_height
|
2117
2055
|
if i == 5:
|
2118
2056
|
break
|
2119
|
-
|
2120
|
-
win_h = 500
|
2057
|
+
win_h = min(win_h, 500)
|
2121
2058
|
space_bot = self.MT.get_space_bot(r, text_editor_h)
|
2122
2059
|
space_top = int(self.MT.row_positions[r])
|
2123
2060
|
anchor = "nw"
|
@@ -2200,7 +2137,7 @@ class RowIndex(tk.Canvas):
|
|
2200
2137
|
self.coords(self.dropdown.canvas_id, 0, ypos)
|
2201
2138
|
self.dropdown.window.tkraise()
|
2202
2139
|
else:
|
2203
|
-
self.dropdown.window = self.PAR.
|
2140
|
+
self.dropdown.window = self.PAR._dropdown_cls(
|
2204
2141
|
self.winfo_toplevel(),
|
2205
2142
|
**reset_kwargs,
|
2206
2143
|
single_index="r",
|
@@ -2244,13 +2181,11 @@ class RowIndex(tk.Canvas):
|
|
2244
2181
|
if r is not None and selection is not None:
|
2245
2182
|
datarn = r if self.MT.all_rows_displayed else self.MT.displayed_rows[r]
|
2246
2183
|
kwargs = self.get_cell_kwargs(datarn, key="dropdown")
|
2247
|
-
pre_edit_value = self.get_cell_data(datarn)
|
2248
|
-
edited = False
|
2249
2184
|
event_data = event_dict(
|
2250
2185
|
name="end_edit_index",
|
2251
2186
|
sheet=self.PAR.name,
|
2252
2187
|
widget=self,
|
2253
|
-
cells_header={datarn:
|
2188
|
+
cells_header={datarn: self.get_cell_data(datarn)},
|
2254
2189
|
key="??",
|
2255
2190
|
value=selection,
|
2256
2191
|
loc=r,
|
@@ -2258,16 +2193,12 @@ class RowIndex(tk.Canvas):
|
|
2258
2193
|
boxes=self.MT.get_boxes(),
|
2259
2194
|
selected=self.MT.selected,
|
2260
2195
|
)
|
2261
|
-
|
2262
|
-
|
2263
|
-
if
|
2264
|
-
selection = self.MT.edit_validation_func(event_data)
|
2265
|
-
if selection is not None:
|
2266
|
-
edited = self.set_cell_data_undo(r, datarn=datarn, value=selection, redraw=not redraw)
|
2267
|
-
else:
|
2196
|
+
try_binding(kwargs["select_function"], event_data)
|
2197
|
+
selection = selection if not self.MT.edit_validation_func else self.MT.edit_validation_func(event_data)
|
2198
|
+
if selection is not None:
|
2268
2199
|
edited = self.set_cell_data_undo(r, datarn=datarn, value=selection, redraw=not redraw)
|
2269
|
-
|
2270
|
-
|
2200
|
+
if edited:
|
2201
|
+
try_binding(self.extra_end_edit_cell_func, event_data)
|
2271
2202
|
self.MT.recreate_all_selection_boxes()
|
2272
2203
|
self.focus_set()
|
2273
2204
|
self.hide_text_editor_and_dropdown(redraw=redraw)
|