tksheet 7.3.3__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 +6 -28
- tksheet/main_table.py +297 -398
- 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.3.dist-info → tksheet-7.3.4.dist-info}/METADATA +1 -1
- tksheet-7.3.4.dist-info/RECORD +21 -0
- tksheet-7.3.3.dist-info/RECORD +0 -21
- {tksheet-7.3.3.dist-info → tksheet-7.3.4.dist-info}/LICENSE.txt +0 -0
- {tksheet-7.3.3.dist-info → tksheet-7.3.4.dist-info}/WHEEL +0 -0
- {tksheet-7.3.3.dist-info → tksheet-7.3.4.dist-info}/top_level.txt +0 -0
tksheet/__init__.py
CHANGED
tksheet/colors.py
CHANGED
@@ -10,7 +10,7 @@ color_map: dict[str, str] = {
|
|
10
10
|
"ANTIQUE WHITE": "#FAEBD7",
|
11
11
|
"AntiqueWhite": "#FAEBD7",
|
12
12
|
"antiquewhite": "#FAEBD7",
|
13
|
-
"#
|
13
|
+
"#ANTIQUEWHITE": "#FAEBD7",
|
14
14
|
"AntiqueWhite1": "#FFEFDB",
|
15
15
|
"antiquewhite1": "#FFEFDB",
|
16
16
|
"ANTIQUEWHITE1": "#FFEFDB",
|
tksheet/column_headers.py
CHANGED
@@ -2,27 +2,14 @@ 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
|
-
from functools import (
|
10
|
-
partial,
|
11
|
-
)
|
12
|
-
from itertools import (
|
13
|
-
cycle,
|
14
|
-
islice,
|
15
|
-
repeat,
|
16
|
-
)
|
5
|
+
from collections.abc import Hashable, Sequence
|
6
|
+
from functools import partial
|
7
|
+
from itertools import cycle, islice, repeat
|
17
8
|
from math import ceil, floor
|
18
|
-
from operator import
|
19
|
-
itemgetter,
|
20
|
-
)
|
9
|
+
from operator import itemgetter
|
21
10
|
from typing import Literal
|
22
11
|
|
23
|
-
from .colors import
|
24
|
-
color_map,
|
25
|
-
)
|
12
|
+
from .colors import color_map
|
26
13
|
from .constants import (
|
27
14
|
USER_OS,
|
28
15
|
rc_binding,
|
@@ -44,18 +31,9 @@ from .functions import (
|
|
44
31
|
stored_event_dict,
|
45
32
|
try_binding,
|
46
33
|
)
|
47
|
-
from .other_classes import
|
48
|
-
|
49
|
-
|
50
|
-
DropdownStorage,
|
51
|
-
TextEditorStorage,
|
52
|
-
)
|
53
|
-
from .text_editor import (
|
54
|
-
TextEditor,
|
55
|
-
)
|
56
|
-
from .types import (
|
57
|
-
AnyIter,
|
58
|
-
)
|
34
|
+
from .other_classes import DotDict, DraggedRowColumn, DropdownStorage, TextEditorStorage
|
35
|
+
from .text_editor import TextEditor
|
36
|
+
from .types import AnyIter
|
59
37
|
|
60
38
|
|
61
39
|
class ColumnHeaders(tk.Canvas):
|
@@ -464,9 +442,9 @@ class ColumnHeaders(tk.Canvas):
|
|
464
442
|
self.current_height,
|
465
443
|
width=1,
|
466
444
|
fill=self.PAR.ops.resizing_line_fg,
|
467
|
-
tag="rwl",
|
445
|
+
tag=("rw", "rwl"),
|
468
446
|
)
|
469
|
-
self.MT.create_resize_line(x, y1, x, y2, width=1, fill=self.PAR.ops.resizing_line_fg, tag="rwl")
|
447
|
+
self.MT.create_resize_line(x, y1, x, y2, width=1, fill=self.PAR.ops.resizing_line_fg, tag=("rw", "rwl"))
|
470
448
|
self.create_resize_line(
|
471
449
|
line2x,
|
472
450
|
0,
|
@@ -474,9 +452,11 @@ class ColumnHeaders(tk.Canvas):
|
|
474
452
|
self.current_height,
|
475
453
|
width=1,
|
476
454
|
fill=self.PAR.ops.resizing_line_fg,
|
477
|
-
tag="rwl2",
|
455
|
+
tag=("rw", "rwl2"),
|
456
|
+
)
|
457
|
+
self.MT.create_resize_line(
|
458
|
+
line2x, y1, line2x, y2, width=1, fill=self.PAR.ops.resizing_line_fg, tag=("rw", "rwl2")
|
478
459
|
)
|
479
|
-
self.MT.create_resize_line(line2x, y1, line2x, y2, width=1, fill=self.PAR.ops.resizing_line_fg, tag="rwl2")
|
480
460
|
elif self.height_resizing_enabled and self.rsz_w is None and self.rsz_h is not None:
|
481
461
|
self.currently_resizing_height = True
|
482
462
|
elif self.MT.identify_col(x=event.x, allow_end=False) is None:
|
@@ -516,9 +496,9 @@ class ColumnHeaders(tk.Canvas):
|
|
516
496
|
self.current_height,
|
517
497
|
width=1,
|
518
498
|
fill=self.PAR.ops.resizing_line_fg,
|
519
|
-
tag="rwl",
|
499
|
+
tag=("rw", "rwl"),
|
520
500
|
)
|
521
|
-
self.MT.create_resize_line(x, y1, x, y2, width=1, fill=self.PAR.ops.resizing_line_fg, tag="rwl")
|
501
|
+
self.MT.create_resize_line(x, y1, x, y2, width=1, fill=self.PAR.ops.resizing_line_fg, tag=("rw", "rwl"))
|
522
502
|
self.create_resize_line(
|
523
503
|
line2x,
|
524
504
|
0,
|
@@ -526,7 +506,7 @@ class ColumnHeaders(tk.Canvas):
|
|
526
506
|
self.current_height,
|
527
507
|
width=1,
|
528
508
|
fill=self.PAR.ops.resizing_line_fg,
|
529
|
-
tag="rwl2",
|
509
|
+
tag=("rw", "rwl2"),
|
530
510
|
)
|
531
511
|
self.MT.create_resize_line(
|
532
512
|
line2x,
|
@@ -535,7 +515,7 @@ class ColumnHeaders(tk.Canvas):
|
|
535
515
|
y2,
|
536
516
|
width=1,
|
537
517
|
fill=self.PAR.ops.resizing_line_fg,
|
538
|
-
tag="rwl2",
|
518
|
+
tag=("rw", "rwl2"),
|
539
519
|
)
|
540
520
|
self.drag_width_resize()
|
541
521
|
elif self.height_resizing_enabled and self.rsz_h is not None and self.currently_resizing_height:
|
@@ -1271,6 +1251,7 @@ class ColumnHeaders(tk.Canvas):
|
|
1271
1251
|
self.itemconfig(iid, fill=fill, outline=outline)
|
1272
1252
|
else:
|
1273
1253
|
self.itemconfig(iid, fill=fill, outline=outline, tag=tag, state="normal")
|
1254
|
+
self.tag_raise(iid)
|
1274
1255
|
else:
|
1275
1256
|
iid = self.create_rectangle(coords, fill=fill, outline=outline, tag=tag)
|
1276
1257
|
self.disp_high[iid] = True
|
@@ -1291,6 +1272,7 @@ class ColumnHeaders(tk.Canvas):
|
|
1291
1272
|
else:
|
1292
1273
|
self.itemconfig(t, fill=fill, width=width, tag=tag, state="normal")
|
1293
1274
|
self.disp_grid[t] = True
|
1275
|
+
self.tag_raise(t)
|
1294
1276
|
else:
|
1295
1277
|
self.disp_grid[self.create_line(points, fill=fill, width=width, tag=tag)] = True
|
1296
1278
|
|
@@ -1437,33 +1419,6 @@ class ColumnHeaders(tk.Canvas):
|
|
1437
1419
|
x_stop,
|
1438
1420
|
self.current_height,
|
1439
1421
|
)
|
1440
|
-
yend = self.current_height - 5
|
1441
|
-
if (self.PAR.ops.show_vertical_grid or self.width_resizing_enabled) and col_pos_exists:
|
1442
|
-
points = [
|
1443
|
-
x_stop - 1,
|
1444
|
-
self.current_height - 1,
|
1445
|
-
scrollpos_left - 1,
|
1446
|
-
self.current_height - 1,
|
1447
|
-
scrollpos_left - 1,
|
1448
|
-
-1,
|
1449
|
-
]
|
1450
|
-
for c in range(grid_start_col, grid_end_col):
|
1451
|
-
draw_x = self.MT.col_positions[c]
|
1452
|
-
if c and self.width_resizing_enabled:
|
1453
|
-
self.visible_col_dividers[c] = (draw_x - 2, 1, draw_x + 2, yend)
|
1454
|
-
points.extend(
|
1455
|
-
(
|
1456
|
-
draw_x,
|
1457
|
-
-1,
|
1458
|
-
draw_x,
|
1459
|
-
self.current_height,
|
1460
|
-
draw_x,
|
1461
|
-
-1,
|
1462
|
-
self.MT.col_positions[c + 1] if len(self.MT.col_positions) - 1 > c else draw_x,
|
1463
|
-
-1,
|
1464
|
-
)
|
1465
|
-
)
|
1466
|
-
self.redraw_gridline(points=points, fill=self.PAR.ops.header_grid_fg, width=1, tag="v")
|
1467
1422
|
top = self.canvasy(0)
|
1468
1423
|
sel_cols_bg = (
|
1469
1424
|
self.PAR.ops.header_selected_cells_bg
|
@@ -1492,74 +1447,39 @@ class ColumnHeaders(tk.Canvas):
|
|
1492
1447
|
selections=selections,
|
1493
1448
|
datacn=datacn,
|
1494
1449
|
)
|
1495
|
-
|
1496
1450
|
if datacn in self.cell_options and "align" in self.cell_options[datacn]:
|
1497
1451
|
align = self.cell_options[datacn]["align"]
|
1498
1452
|
else:
|
1499
1453
|
align = self.align
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
mw = crightgridln - cleftgridln - self.MT.header_txt_height - 2
|
1506
|
-
self.redraw_dropdown(
|
1507
|
-
cleftgridln,
|
1508
|
-
0,
|
1509
|
-
crightgridln,
|
1510
|
-
self.current_height - 1,
|
1511
|
-
fill=fill if kwargs["state"] != "disabled" else self.PAR.ops.header_grid_fg,
|
1512
|
-
outline=fill,
|
1513
|
-
tag="dd",
|
1514
|
-
draw_outline=not dd_drawn,
|
1515
|
-
draw_arrow=mw >= 5,
|
1516
|
-
open_=dd_coords == c,
|
1517
|
-
)
|
1518
|
-
else:
|
1519
|
-
mw = crightgridln - cleftgridln - 1
|
1520
|
-
|
1521
|
-
elif align == "e":
|
1522
|
-
if kwargs:
|
1523
|
-
mw = crightgridln - cleftgridln - self.MT.header_txt_height - 2
|
1454
|
+
if kwargs := self.get_cell_kwargs(datacn, key="dropdown"):
|
1455
|
+
mw = crightgridln - cleftgridln - self.MT.header_txt_height - 2
|
1456
|
+
if align == "w":
|
1457
|
+
draw_x = cleftgridln + 3
|
1458
|
+
elif align == "e":
|
1524
1459
|
draw_x = crightgridln - 5 - self.MT.header_txt_height
|
1525
|
-
|
1526
|
-
cleftgridln,
|
1527
|
-
0,
|
1528
|
-
crightgridln,
|
1529
|
-
self.current_height - 1,
|
1530
|
-
fill=fill if kwargs["state"] != "disabled" else self.PAR.ops.header_grid_fg,
|
1531
|
-
outline=fill,
|
1532
|
-
tag="dd",
|
1533
|
-
draw_outline=not dd_drawn,
|
1534
|
-
draw_arrow=mw >= 5,
|
1535
|
-
open_=dd_coords == c,
|
1536
|
-
)
|
1537
|
-
else:
|
1538
|
-
mw = crightgridln - cleftgridln - 1
|
1539
|
-
draw_x = crightgridln - 3
|
1540
|
-
|
1541
|
-
elif align == "center":
|
1542
|
-
if kwargs:
|
1543
|
-
mw = crightgridln - cleftgridln - self.MT.header_txt_height - 2
|
1460
|
+
elif align == "center":
|
1544
1461
|
draw_x = cleftgridln + ceil((crightgridln - cleftgridln - self.MT.header_txt_height) / 2)
|
1545
|
-
|
1546
|
-
|
1547
|
-
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1462
|
+
self.redraw_dropdown(
|
1463
|
+
cleftgridln,
|
1464
|
+
0,
|
1465
|
+
crightgridln,
|
1466
|
+
self.current_height - 1,
|
1467
|
+
fill=fill if kwargs["state"] != "disabled" else self.PAR.ops.header_grid_fg,
|
1468
|
+
outline=fill,
|
1469
|
+
tag="dd",
|
1470
|
+
draw_outline=not dd_drawn,
|
1471
|
+
draw_arrow=mw >= 5,
|
1472
|
+
open_=dd_coords == c,
|
1473
|
+
)
|
1474
|
+
else:
|
1475
|
+
mw = crightgridln - cleftgridln - 1
|
1476
|
+
if align == "w":
|
1477
|
+
draw_x = cleftgridln + 3
|
1478
|
+
elif align == "e":
|
1479
|
+
draw_x = crightgridln - 3
|
1480
|
+
elif align == "center":
|
1559
1481
|
draw_x = cleftgridln + floor((crightgridln - cleftgridln) / 2)
|
1560
|
-
|
1561
|
-
kwargs = self.get_cell_kwargs(datacn, key="checkbox")
|
1562
|
-
if kwargs and mw > self.MT.header_txt_height + 1:
|
1482
|
+
if (kwargs := self.get_cell_kwargs(datacn, key="checkbox")) and mw > self.MT.header_txt_height + 1:
|
1563
1483
|
box_w = self.MT.header_txt_height + 1
|
1564
1484
|
if align == "w":
|
1565
1485
|
draw_x += box_w + 3
|
@@ -1584,91 +1504,120 @@ class ColumnHeaders(tk.Canvas):
|
|
1584
1504
|
tag="cb",
|
1585
1505
|
draw_check=draw_check,
|
1586
1506
|
)
|
1587
|
-
|
1588
|
-
|
1589
|
-
|
1590
|
-
lns = lns.split("\n")
|
1591
|
-
if mw > self.MT.header_txt_width and not (
|
1592
|
-
(align == "w" and draw_x > scrollpos_right)
|
1507
|
+
if (
|
1508
|
+
mw < self.MT.header_txt_width
|
1509
|
+
or (align == "w" and draw_x > scrollpos_right)
|
1593
1510
|
or (align == "e" and cleftgridln + 5 > scrollpos_right)
|
1594
1511
|
or (align == "center" and cleftgridln + 5 > scrollpos_right)
|
1595
1512
|
):
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1603
|
-
|
1604
|
-
|
1605
|
-
|
1606
|
-
|
1607
|
-
|
1608
|
-
|
1609
|
-
|
1610
|
-
|
1611
|
-
|
1612
|
-
|
1613
|
-
|
1614
|
-
|
1615
|
-
|
1616
|
-
|
1617
|
-
fill=fill,
|
1618
|
-
font=font,
|
1619
|
-
anchor=align,
|
1620
|
-
state="normal",
|
1621
|
-
)
|
1622
|
-
self.tag_raise(iid)
|
1513
|
+
continue
|
1514
|
+
if not (lines := self.get_valid_cell_data_as_str(datacn, fix=False)):
|
1515
|
+
continue
|
1516
|
+
lines = lines.split("\n")
|
1517
|
+
for txt in islice(
|
1518
|
+
lines,
|
1519
|
+
self.lines_start_at if self.lines_start_at < len(lines) else len(lines) - 1,
|
1520
|
+
None,
|
1521
|
+
):
|
1522
|
+
if draw_y > top:
|
1523
|
+
if self.hidd_text:
|
1524
|
+
iid, showing = self.hidd_text.popitem()
|
1525
|
+
self.coords(iid, draw_x, draw_y)
|
1526
|
+
if showing:
|
1527
|
+
self.itemconfig(
|
1528
|
+
iid,
|
1529
|
+
text=txt,
|
1530
|
+
fill=fill,
|
1531
|
+
font=font,
|
1532
|
+
anchor=align,
|
1533
|
+
)
|
1623
1534
|
else:
|
1624
|
-
|
1625
|
-
|
1626
|
-
draw_y,
|
1535
|
+
self.itemconfig(
|
1536
|
+
iid,
|
1627
1537
|
text=txt,
|
1628
1538
|
fill=fill,
|
1629
1539
|
font=font,
|
1630
1540
|
anchor=align,
|
1631
|
-
|
1541
|
+
state="normal",
|
1632
1542
|
)
|
1633
|
-
self.
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1637
|
-
|
1638
|
-
|
1543
|
+
self.tag_raise(iid)
|
1544
|
+
else:
|
1545
|
+
iid = self.create_text(
|
1546
|
+
draw_x,
|
1547
|
+
draw_y,
|
1548
|
+
text=txt,
|
1549
|
+
fill=fill,
|
1550
|
+
font=font,
|
1551
|
+
anchor=align,
|
1552
|
+
tag="t",
|
1553
|
+
)
|
1554
|
+
self.disp_text[iid] = True
|
1555
|
+
wd = self.bbox(iid)
|
1556
|
+
if (wd := wd[2] - wd[0]) > mw:
|
1557
|
+
if align == "w":
|
1558
|
+
txt = txt[: int(len(txt) * (mw / wd))]
|
1559
|
+
self.itemconfig(iid, text=txt)
|
1560
|
+
wd = self.bbox(iid)
|
1561
|
+
while wd[2] - wd[0] > mw:
|
1562
|
+
txt = txt[:-1]
|
1639
1563
|
self.itemconfig(iid, text=txt)
|
1640
1564
|
wd = self.bbox(iid)
|
1641
|
-
|
1642
|
-
|
1643
|
-
|
1644
|
-
|
1645
|
-
|
1646
|
-
txt = txt[
|
1565
|
+
elif align == "e":
|
1566
|
+
txt = txt[len(txt) - int(len(txt) * (mw / wd)) :]
|
1567
|
+
self.itemconfig(iid, text=txt)
|
1568
|
+
wd = self.bbox(iid)
|
1569
|
+
while wd[2] - wd[0] > mw:
|
1570
|
+
txt = txt[1:]
|
1647
1571
|
self.itemconfig(iid, text=txt)
|
1648
1572
|
wd = self.bbox(iid)
|
1649
|
-
|
1650
|
-
|
1651
|
-
|
1652
|
-
|
1653
|
-
|
1654
|
-
|
1655
|
-
|
1656
|
-
txt = txt[
|
1573
|
+
elif align == "center":
|
1574
|
+
self.c_align_cyc = cycle(self.centre_alignment_text_mod_indexes)
|
1575
|
+
tmod = ceil((len(txt) - int(len(txt) * (mw / wd))) / 2)
|
1576
|
+
txt = txt[tmod - 1 : -tmod]
|
1577
|
+
self.itemconfig(iid, text=txt)
|
1578
|
+
wd = self.bbox(iid)
|
1579
|
+
while wd[2] - wd[0] > mw:
|
1580
|
+
txt = txt[next(self.c_align_cyc)]
|
1657
1581
|
self.itemconfig(iid, text=txt)
|
1658
1582
|
wd = self.bbox(iid)
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1664
|
-
|
1665
|
-
|
1666
|
-
|
1583
|
+
self.coords(iid, draw_x, draw_y)
|
1584
|
+
draw_y += self.MT.header_xtra_lines_increment
|
1585
|
+
if draw_y - 1 > self.current_height:
|
1586
|
+
break
|
1587
|
+
yend = self.current_height - 5
|
1588
|
+
if (self.PAR.ops.show_vertical_grid or self.width_resizing_enabled) and col_pos_exists:
|
1589
|
+
points = [
|
1590
|
+
x_stop - 1,
|
1591
|
+
self.current_height - 1,
|
1592
|
+
scrollpos_left - 1,
|
1593
|
+
self.current_height - 1,
|
1594
|
+
scrollpos_left - 1,
|
1595
|
+
-1,
|
1596
|
+
]
|
1597
|
+
for c in range(grid_start_col, grid_end_col):
|
1598
|
+
draw_x = self.MT.col_positions[c]
|
1599
|
+
if c and self.width_resizing_enabled:
|
1600
|
+
self.visible_col_dividers[c] = (draw_x - 2, 1, draw_x + 2, yend)
|
1601
|
+
points.extend(
|
1602
|
+
(
|
1603
|
+
draw_x,
|
1604
|
+
-1,
|
1605
|
+
draw_x,
|
1606
|
+
self.current_height,
|
1607
|
+
draw_x,
|
1608
|
+
-1,
|
1609
|
+
self.MT.col_positions[c + 1] if len(self.MT.col_positions) - 1 > c else draw_x,
|
1610
|
+
-1,
|
1611
|
+
)
|
1612
|
+
)
|
1613
|
+
self.redraw_gridline(points=points, fill=self.PAR.ops.header_grid_fg, width=1, tag="v")
|
1667
1614
|
for dct in (self.hidd_text, self.hidd_high, self.hidd_grid, self.hidd_dropdown, self.hidd_checkbox):
|
1668
1615
|
for iid, showing in dct.items():
|
1669
1616
|
if showing:
|
1670
1617
|
self.itemconfig(iid, state="hidden")
|
1671
1618
|
dct[iid] = False
|
1619
|
+
if self.disp_resize_lines:
|
1620
|
+
self.tag_raise("rw")
|
1672
1621
|
return True
|
1673
1622
|
|
1674
1623
|
def get_redraw_selections(self, startc: int, endc: int) -> dict[str, set[int]]:
|
@@ -1979,8 +1928,7 @@ class ColumnHeaders(tk.Canvas):
|
|
1979
1928
|
win_h += self.MT.min_header_height
|
1980
1929
|
if i == 5:
|
1981
1930
|
break
|
1982
|
-
|
1983
|
-
win_h = 500
|
1931
|
+
win_h = min(win_h, 500)
|
1984
1932
|
space_bot = self.MT.get_space_bot(0, text_editor_h)
|
1985
1933
|
win_h2 = int(win_h)
|
1986
1934
|
if win_h > space_bot:
|
@@ -2049,7 +1997,7 @@ class ColumnHeaders(tk.Canvas):
|
|
2049
1997
|
self.coords(self.dropdown.canvas_id, self.MT.col_positions[c], ypos)
|
2050
1998
|
self.dropdown.window.tkraise()
|
2051
1999
|
else:
|
2052
|
-
self.dropdown.window = self.PAR.
|
2000
|
+
self.dropdown.window = self.PAR._dropdown_cls(
|
2053
2001
|
self.winfo_toplevel(),
|
2054
2002
|
**reset_kwargs,
|
2055
2003
|
single_index="c",
|
@@ -2092,13 +2040,11 @@ class ColumnHeaders(tk.Canvas):
|
|
2092
2040
|
if c is not None and selection is not None:
|
2093
2041
|
datacn = c if self.MT.all_columns_displayed else self.MT.displayed_columns[c]
|
2094
2042
|
kwargs = self.get_cell_kwargs(datacn, key="dropdown")
|
2095
|
-
pre_edit_value = self.get_cell_data(datacn)
|
2096
|
-
edited = False
|
2097
2043
|
event_data = event_dict(
|
2098
2044
|
name="end_edit_header",
|
2099
2045
|
sheet=self.PAR.name,
|
2100
2046
|
widget=self,
|
2101
|
-
cells_header={datacn:
|
2047
|
+
cells_header={datacn: self.get_cell_data(datacn)},
|
2102
2048
|
key="??",
|
2103
2049
|
value=selection,
|
2104
2050
|
loc=c,
|
@@ -2106,16 +2052,12 @@ class ColumnHeaders(tk.Canvas):
|
|
2106
2052
|
boxes=self.MT.get_boxes(),
|
2107
2053
|
selected=self.MT.selected,
|
2108
2054
|
)
|
2109
|
-
|
2110
|
-
|
2111
|
-
if
|
2112
|
-
selection = self.MT.edit_validation_func(event_data)
|
2113
|
-
if selection is not None:
|
2114
|
-
edited = self.set_cell_data_undo(c, datacn=datacn, value=selection, redraw=not redraw)
|
2115
|
-
else:
|
2055
|
+
try_binding(kwargs["select_function"], event_data)
|
2056
|
+
selection = selection if not self.MT.edit_validation_func else self.MT.edit_validation_func(event_data)
|
2057
|
+
if selection is not None:
|
2116
2058
|
edited = self.set_cell_data_undo(c, datacn=datacn, value=selection, redraw=not redraw)
|
2117
|
-
|
2118
|
-
|
2059
|
+
if edited:
|
2060
|
+
try_binding(self.extra_end_edit_cell_func, event_data)
|
2119
2061
|
self.MT.recreate_all_selection_boxes()
|
2120
2062
|
self.focus_set()
|
2121
2063
|
self.hide_text_editor_and_dropdown(redraw=redraw)
|
tksheet/find_window.py
CHANGED
@@ -1,21 +1,12 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
3
|
import tkinter as tk
|
4
|
-
from collections.abc import
|
5
|
-
Callable,
|
6
|
-
)
|
4
|
+
from collections.abc import Callable
|
7
5
|
from typing import Literal
|
8
6
|
|
9
|
-
from .
|
10
|
-
|
11
|
-
|
12
|
-
from .constants import (
|
13
|
-
ctrl_key,
|
14
|
-
rc_binding,
|
15
|
-
)
|
16
|
-
from .functions import (
|
17
|
-
recursive_bind,
|
18
|
-
)
|
7
|
+
from .constants import ctrl_key, rc_binding
|
8
|
+
from .functions import recursive_bind
|
9
|
+
from .other_classes import DotDict
|
19
10
|
|
20
11
|
|
21
12
|
class FindWindowTkText(tk.Text):
|
tksheet/functions.py
CHANGED
@@ -5,39 +5,17 @@ import io
|
|
5
5
|
import pickle
|
6
6
|
import re
|
7
7
|
import tkinter as tk
|
8
|
-
from bisect import
|
9
|
-
bisect_left,
|
10
|
-
)
|
8
|
+
from bisect import bisect_left
|
11
9
|
from collections import deque
|
12
|
-
from collections.abc import
|
13
|
-
Callable,
|
14
|
-
Generator,
|
15
|
-
Hashable,
|
16
|
-
Iterable,
|
17
|
-
Iterator,
|
18
|
-
Sequence,
|
19
|
-
)
|
10
|
+
from collections.abc import Callable, Generator, Hashable, Iterable, Iterator, Sequence
|
20
11
|
from itertools import islice, repeat
|
21
12
|
from typing import Literal
|
22
13
|
|
23
14
|
from .colors import color_map
|
24
|
-
from .constants import
|
25
|
-
|
26
|
-
|
27
|
-
from .
|
28
|
-
to_bool,
|
29
|
-
)
|
30
|
-
from .other_classes import (
|
31
|
-
Box_nt,
|
32
|
-
DotDict,
|
33
|
-
EventDataDict,
|
34
|
-
Highlight,
|
35
|
-
Loc,
|
36
|
-
Span,
|
37
|
-
)
|
38
|
-
from .types import (
|
39
|
-
AnyIter,
|
40
|
-
)
|
15
|
+
from .constants import symbols_set
|
16
|
+
from .formatters import to_bool
|
17
|
+
from .other_classes import Box_nt, DotDict, EventDataDict, Highlight, Loc, Span
|
18
|
+
from .types import AnyIter
|
41
19
|
|
42
20
|
unpickle_obj = pickle.loads
|
43
21
|
|