tksheet 7.2.1__py3-none-any.whl → 7.2.3__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/column_headers.py +247 -201
- tksheet/main_table.py +135 -116
- tksheet/row_index.py +234 -196
- tksheet/sheet.py +86 -47
- tksheet/top_left_rectangle.py +7 -2
- {tksheet-7.2.1.dist-info → tksheet-7.2.3.dist-info}/METADATA +6 -4
- tksheet-7.2.3.dist-info/RECORD +20 -0
- tksheet-7.2.1.dist-info/RECORD +0 -20
- {tksheet-7.2.1.dist-info → tksheet-7.2.3.dist-info}/LICENSE.txt +0 -0
- {tksheet-7.2.1.dist-info → tksheet-7.2.3.dist-info}/WHEEL +0 -0
- {tksheet-7.2.1.dist-info → tksheet-7.2.3.dist-info}/top_level.txt +0 -0
tksheet/main_table.py
CHANGED
@@ -852,6 +852,7 @@ class MainTable(tk.Canvas):
|
|
852
852
|
index=index,
|
853
853
|
row_heights=row_heights,
|
854
854
|
event_data=event_data,
|
855
|
+
mod_event_boxes=False,
|
855
856
|
)
|
856
857
|
if added_cols:
|
857
858
|
ctr = 0
|
@@ -901,10 +902,8 @@ class MainTable(tk.Canvas):
|
|
901
902
|
header=headers,
|
902
903
|
column_widths=column_widths,
|
903
904
|
event_data=event_data,
|
905
|
+
mod_event_boxes=False,
|
904
906
|
)
|
905
|
-
self.deselect("all", redraw=False)
|
906
|
-
if event_data["cells"]["table"] or event_data["added"]["rows"] or event_data["added"]["columns"]:
|
907
|
-
self.undo_stack.append(pickled_event_dict(event_data))
|
908
907
|
if added_rows:
|
909
908
|
selboxr = selected_r + new_data_numrows
|
910
909
|
else:
|
@@ -913,6 +912,7 @@ class MainTable(tk.Canvas):
|
|
913
912
|
selboxc = selected_c + new_data_numcols
|
914
913
|
else:
|
915
914
|
selboxc = selected_c_adjusted_new_data_numcols
|
915
|
+
self.deselect("all", redraw=False)
|
916
916
|
self.create_selection_box(
|
917
917
|
selected_r,
|
918
918
|
selected_c,
|
@@ -921,6 +921,10 @@ class MainTable(tk.Canvas):
|
|
921
921
|
"cells",
|
922
922
|
run_binding=True,
|
923
923
|
)
|
924
|
+
event_data["selection_boxes"] = self.get_boxes()
|
925
|
+
event_data["selected"] = self.selected
|
926
|
+
if event_data["cells"]["table"] or event_data["added"]["rows"] or event_data["added"]["columns"]:
|
927
|
+
self.undo_stack.append(pickled_event_dict(event_data))
|
924
928
|
self.see(
|
925
929
|
r=selected_r,
|
926
930
|
c=selected_c,
|
@@ -1561,7 +1565,6 @@ class MainTable(tk.Canvas):
|
|
1561
1565
|
event_data["selection_boxes"] = modification["selection_boxes"]
|
1562
1566
|
event_data["selected"] = modification["selected"]
|
1563
1567
|
saved_cells = False
|
1564
|
-
|
1565
1568
|
if modification["added"]["rows"] or modification["added"]["columns"]:
|
1566
1569
|
event_data = self.save_cells_using_modification(modification, event_data)
|
1567
1570
|
saved_cells = True
|
@@ -1627,11 +1630,6 @@ class MainTable(tk.Canvas):
|
|
1627
1630
|
event_data=event_data,
|
1628
1631
|
)
|
1629
1632
|
self.displayed_rows = modification["added"]["rows"]["displayed_rows"]
|
1630
|
-
if len(self.row_positions) > 1:
|
1631
|
-
self.reselect_from_get_boxes(
|
1632
|
-
modification["selection_boxes"],
|
1633
|
-
modification["selected"],
|
1634
|
-
)
|
1635
1633
|
|
1636
1634
|
if modification["added"]["columns"]:
|
1637
1635
|
self.deselect("all", run_binding=False, redraw=False)
|
@@ -1644,13 +1642,8 @@ class MainTable(tk.Canvas):
|
|
1644
1642
|
event_data=event_data,
|
1645
1643
|
)
|
1646
1644
|
self.displayed_columns = modification["added"]["columns"]["displayed_columns"]
|
1647
|
-
if len(self.col_positions) > 1:
|
1648
|
-
self.reselect_from_get_boxes(
|
1649
|
-
modification["selection_boxes"],
|
1650
|
-
modification["selected"],
|
1651
|
-
)
|
1652
1645
|
|
1653
|
-
if modification["deleted"]["rows"]:
|
1646
|
+
if modification["deleted"]["rows"] or modification["deleted"]["row_heights"]:
|
1654
1647
|
self.add_rows(
|
1655
1648
|
rows=modification["deleted"]["rows"],
|
1656
1649
|
index=modification["deleted"]["index"],
|
@@ -1663,7 +1656,7 @@ class MainTable(tk.Canvas):
|
|
1663
1656
|
)
|
1664
1657
|
self.restore_options_named_spans(modification)
|
1665
1658
|
|
1666
|
-
if modification["deleted"]["columns"]:
|
1659
|
+
if modification["deleted"]["columns"] or modification["deleted"]["column_widths"]:
|
1667
1660
|
self.add_columns(
|
1668
1661
|
columns=modification["deleted"]["columns"],
|
1669
1662
|
header=modification["deleted"]["header"],
|
@@ -1676,27 +1669,10 @@ class MainTable(tk.Canvas):
|
|
1676
1669
|
)
|
1677
1670
|
self.restore_options_named_spans(modification)
|
1678
1671
|
|
1679
|
-
if modification["eventname"].startswith("edit") and (
|
1680
|
-
modification["deleted"]["columns"] or modification["deleted"]["rows"]
|
1681
|
-
):
|
1682
|
-
self.reselect_from_get_boxes(
|
1683
|
-
modification["selection_boxes"],
|
1684
|
-
modification["selected"],
|
1685
|
-
)
|
1686
|
-
|
1687
1672
|
if modification["eventname"].startswith(("edit", "move")):
|
1688
1673
|
if not saved_cells:
|
1689
1674
|
event_data = self.save_cells_using_modification(modification, event_data)
|
1690
1675
|
event_data = self.edit_cells_using_modification(modification, event_data)
|
1691
|
-
if (
|
1692
|
-
not modification["deleted"]["columns"]
|
1693
|
-
and not modification["deleted"]["rows"]
|
1694
|
-
and not modification["eventname"].startswith("move")
|
1695
|
-
):
|
1696
|
-
self.reselect_from_get_boxes(
|
1697
|
-
modification["selection_boxes"],
|
1698
|
-
modification["selected"],
|
1699
|
-
)
|
1700
1676
|
|
1701
1677
|
elif modification["eventname"].startswith("add"):
|
1702
1678
|
event_data["eventname"] = modification["eventname"].replace("add", "delete")
|
@@ -1704,6 +1680,15 @@ class MainTable(tk.Canvas):
|
|
1704
1680
|
elif modification["eventname"].startswith("delete"):
|
1705
1681
|
event_data["eventname"] = modification["eventname"].replace("delete", "add")
|
1706
1682
|
|
1683
|
+
if not modification["eventname"].startswith("move") and (
|
1684
|
+
len(self.row_positions) > 1 or len(self.col_positions) > 1
|
1685
|
+
):
|
1686
|
+
self.deselect("all", redraw=False)
|
1687
|
+
self.reselect_from_get_boxes(
|
1688
|
+
modification["selection_boxes"],
|
1689
|
+
modification["selected"],
|
1690
|
+
)
|
1691
|
+
|
1707
1692
|
if self.selected:
|
1708
1693
|
self.see(
|
1709
1694
|
r=self.selected.row,
|
@@ -3642,7 +3627,7 @@ class MainTable(tk.Canvas):
|
|
3642
3627
|
return w + self.table_txt_height, h
|
3643
3628
|
return w, h
|
3644
3629
|
|
3645
|
-
def set_cell_size_to_text(self, r, c,
|
3630
|
+
def set_cell_size_to_text(self, r, c, only_if_too_small=False, redraw: bool = True, run_binding=False):
|
3646
3631
|
min_column_width = int(self.min_column_width)
|
3647
3632
|
min_rh = int(self.min_row_height)
|
3648
3633
|
w = min_column_width
|
@@ -3662,7 +3647,7 @@ class MainTable(tk.Canvas):
|
|
3662
3647
|
w = int(self.max_column_width)
|
3663
3648
|
cell_needs_resize_w = False
|
3664
3649
|
cell_needs_resize_h = False
|
3665
|
-
if
|
3650
|
+
if only_if_too_small:
|
3666
3651
|
if w > self.col_positions[c + 1] - self.col_positions[c]:
|
3667
3652
|
cell_needs_resize_w = True
|
3668
3653
|
if h > self.row_positions[r + 1] - self.row_positions[r]:
|
@@ -3749,9 +3734,10 @@ class MainTable(tk.Canvas):
|
|
3749
3734
|
for datacn in itercols:
|
3750
3735
|
if (hw := self.CH.get_cell_dimensions(datacn)[0]) > w:
|
3751
3736
|
w = hw
|
3737
|
+
else:
|
3738
|
+
w = min_column_width
|
3752
3739
|
for datarn in iterrows:
|
3753
|
-
txt
|
3754
|
-
if txt:
|
3740
|
+
if txt := self.get_valid_cell_data_as_str(datarn, datacn, get_displayed=True):
|
3755
3741
|
qconf(qtxtm, text=txt, font=qfont)
|
3756
3742
|
b = qbbox(qtxtm)
|
3757
3743
|
tw = b[2] - b[0] + added_w_space
|
@@ -3792,24 +3778,26 @@ class MainTable(tk.Canvas):
|
|
3792
3778
|
|
3793
3779
|
def reset_col_positions(self, ncols: int | None = None):
|
3794
3780
|
colpos = self.PAR.ops.default_column_width
|
3795
|
-
if
|
3796
|
-
self.set_col_positions(itr=(colpos
|
3781
|
+
if isinstance(ncols, int):
|
3782
|
+
self.set_col_positions(itr=repeat(colpos, ncols))
|
3797
3783
|
else:
|
3798
|
-
self.
|
3799
|
-
itr=(colpos
|
3800
|
-
|
3784
|
+
if self.all_columns_displayed:
|
3785
|
+
self.set_col_positions(itr=repeat(colpos, self.total_data_cols()))
|
3786
|
+
else:
|
3787
|
+
self.set_col_positions(itr=repeat(colpos, len(self.displayed_columns)))
|
3801
3788
|
|
3802
3789
|
def set_row_positions(self, itr: Iterator[float]) -> None:
|
3803
3790
|
self.row_positions = list(accumulate(chain([0], itr)))
|
3804
3791
|
|
3805
3792
|
def reset_row_positions(self, nrows: int | None = None):
|
3806
3793
|
rowpos = self.get_default_row_height()
|
3807
|
-
if
|
3808
|
-
self.set_row_positions(itr=(rowpos
|
3794
|
+
if isinstance(nrows, int):
|
3795
|
+
self.set_row_positions(itr=repeat(rowpos, nrows))
|
3809
3796
|
else:
|
3810
|
-
self.
|
3811
|
-
itr=(rowpos
|
3812
|
-
|
3797
|
+
if self.all_rows_displayed:
|
3798
|
+
self.set_row_positions(itr=repeat(rowpos, self.total_data_rows()))
|
3799
|
+
else:
|
3800
|
+
self.set_row_positions(itr=repeat(rowpos, len(self.displayed_rows)))
|
3813
3801
|
|
3814
3802
|
def del_col_position(self, idx: int, deselect_all: bool = False):
|
3815
3803
|
if deselect_all:
|
@@ -4298,6 +4286,7 @@ class MainTable(tk.Canvas):
|
|
4298
4286
|
create_selections: bool = True,
|
4299
4287
|
add_row_positions: bool = True,
|
4300
4288
|
push_ops: bool = True,
|
4289
|
+
mod_event_boxes: bool = True,
|
4301
4290
|
) -> EventDataDict:
|
4302
4291
|
self.saved_column_widths = {}
|
4303
4292
|
saved_displayed_columns = list(self.displayed_columns)
|
@@ -4328,18 +4317,26 @@ class MainTable(tk.Canvas):
|
|
4328
4317
|
maxrn = 0
|
4329
4318
|
for cn, rowdict in reversed(columns.items()):
|
4330
4319
|
for rn, v in rowdict.items():
|
4331
|
-
if rn
|
4320
|
+
if rn < len(self.data) and cn > len(self.data[rn]):
|
4321
|
+
self.fix_row_len(rn, cn - 1)
|
4322
|
+
elif rn >= len(self.data):
|
4332
4323
|
self.fix_data_len(rn, cn - 1)
|
4333
4324
|
if rn > maxrn:
|
4334
4325
|
maxrn = rn
|
4335
4326
|
self.data[rn].insert(cn, v)
|
4336
4327
|
# if not hiding rows then we can extend row positions if necessary
|
4337
|
-
if add_row_positions and self.all_rows_displayed and maxrn
|
4338
|
-
|
4328
|
+
if add_row_positions and self.all_rows_displayed and maxrn >= len(self.row_positions) - 1:
|
4329
|
+
default_height = self.get_default_row_height()
|
4330
|
+
event_data["added"]["rows"] = {
|
4331
|
+
"table": {},
|
4332
|
+
"index": {},
|
4333
|
+
"row_heights": {rn: default_height for rn in range(len(self.row_positions) - 1, maxrn + 1)},
|
4334
|
+
"displayed_rows": self.displayed_rows,
|
4335
|
+
}
|
4339
4336
|
self.set_row_positions(
|
4340
4337
|
itr=chain(
|
4341
4338
|
self.gen_row_heights(),
|
4342
|
-
(
|
4339
|
+
repeat(default_height, maxrn + 1 - (len(self.row_positions) - 1)),
|
4343
4340
|
)
|
4344
4341
|
)
|
4345
4342
|
if isinstance(self._headers, list) and header:
|
@@ -4360,6 +4357,9 @@ class MainTable(tk.Canvas):
|
|
4360
4357
|
"columns",
|
4361
4358
|
run_binding=True,
|
4362
4359
|
)
|
4360
|
+
if mod_event_boxes:
|
4361
|
+
event_data["selection_boxes"] = self.get_boxes()
|
4362
|
+
event_data["selected"] = self.selected
|
4363
4363
|
event_data["added"]["columns"] = {
|
4364
4364
|
"table": columns,
|
4365
4365
|
"header": header,
|
@@ -4431,6 +4431,7 @@ class MainTable(tk.Canvas):
|
|
4431
4431
|
create_selections: bool = True,
|
4432
4432
|
add_col_positions: bool = True,
|
4433
4433
|
push_ops: bool = True,
|
4434
|
+
mod_event_boxes: bool = True,
|
4434
4435
|
) -> EventDataDict:
|
4435
4436
|
self.saved_row_heights = {}
|
4436
4437
|
saved_displayed_rows = list(self.displayed_rows)
|
@@ -4470,11 +4471,18 @@ class MainTable(tk.Canvas):
|
|
4470
4471
|
if isinstance(self._row_index, list) and index:
|
4471
4472
|
self._row_index = insert_items(self._row_index, index, self.RI.fix_index)
|
4472
4473
|
# if not hiding columns then we can extend col positions if necessary
|
4473
|
-
if add_col_positions and self.all_columns_displayed and maxcn
|
4474
|
+
if add_col_positions and self.all_columns_displayed and maxcn >= len(self.col_positions) - 1:
|
4475
|
+
default_width = self.PAR.ops.default_column_width
|
4476
|
+
event_data["added"]["columns"] = {
|
4477
|
+
"table": {},
|
4478
|
+
"header": {},
|
4479
|
+
"column_widths": {cn: default_width for cn in range(len(self.col_positions) - 1, maxcn + 1)},
|
4480
|
+
"displayed_columns": self.displayed_columns,
|
4481
|
+
}
|
4474
4482
|
self.set_col_positions(
|
4475
4483
|
itr=chain(
|
4476
4484
|
self.gen_column_widths(),
|
4477
|
-
(
|
4485
|
+
repeat(default_width, maxcn + 1 - (len(self.col_positions) - 1)),
|
4478
4486
|
)
|
4479
4487
|
)
|
4480
4488
|
if push_ops:
|
@@ -4493,6 +4501,9 @@ class MainTable(tk.Canvas):
|
|
4493
4501
|
"rows",
|
4494
4502
|
run_binding=True,
|
4495
4503
|
)
|
4504
|
+
if mod_event_boxes:
|
4505
|
+
event_data["selection_boxes"] = self.get_boxes()
|
4506
|
+
event_data["selected"] = self.selected
|
4496
4507
|
event_data["added"]["rows"] = {
|
4497
4508
|
"table": rows,
|
4498
4509
|
"index": index,
|
@@ -5015,19 +5026,21 @@ class MainTable(tk.Canvas):
|
|
5015
5026
|
self.canvasy(self.winfo_height()),
|
5016
5027
|
)
|
5017
5028
|
|
5018
|
-
|
5019
|
-
|
5020
|
-
|
5021
|
-
|
5022
|
-
|
5023
|
-
|
5024
|
-
|
5025
|
-
|
5026
|
-
|
5027
|
-
|
5028
|
-
|
5029
|
-
|
5030
|
-
|
5029
|
+
@property
|
5030
|
+
def visible_text_rows(self) -> tuple[int, int]:
|
5031
|
+
start = bisect_left(self.row_positions, self.canvasy(0))
|
5032
|
+
end = bisect_right(self.row_positions, self.canvasy(self.winfo_height()))
|
5033
|
+
start = start - 1 if start else start
|
5034
|
+
end = end - 1 if end == len(self.row_positions) else end
|
5035
|
+
return start, end
|
5036
|
+
|
5037
|
+
@property
|
5038
|
+
def visible_text_columns(self) -> tuple[int, int]:
|
5039
|
+
start = bisect_left(self.col_positions, self.canvasx(0))
|
5040
|
+
end = bisect_right(self.col_positions, self.canvasx(self.winfo_width()))
|
5041
|
+
start = start - 1 if start else start
|
5042
|
+
end = end - 1 if end == len(self.col_positions) else end
|
5043
|
+
return start, end
|
5031
5044
|
|
5032
5045
|
def redraw_highlight_get_text_fg(
|
5033
5046
|
self,
|
@@ -5336,18 +5349,21 @@ class MainTable(tk.Canvas):
|
|
5336
5349
|
if i not in diffs:
|
5337
5350
|
heights[i] -= change
|
5338
5351
|
self.row_positions = list(accumulate(chain([0], heights)))
|
5339
|
-
if
|
5340
|
-
|
5341
|
-
|
5342
|
-
|
5343
|
-
|
5344
|
-
|
5345
|
-
|
5346
|
-
|
5347
|
-
|
5348
|
-
|
5349
|
-
|
5350
|
-
|
5352
|
+
if (
|
5353
|
+
self.PAR.ops.auto_resize_row_index is not True
|
5354
|
+
and can_width >= self.col_positions[-1] + self.PAR.ops.empty_horizontal
|
5355
|
+
and self.PAR.xscroll_showing
|
5356
|
+
):
|
5357
|
+
self.PAR.xscroll.grid_forget()
|
5358
|
+
self.PAR.xscroll_showing = False
|
5359
|
+
elif (
|
5360
|
+
can_width < self.col_positions[-1] + self.PAR.ops.empty_horizontal
|
5361
|
+
and not self.PAR.xscroll_showing
|
5362
|
+
and not self.PAR.xscroll_disabled
|
5363
|
+
and can_height > 40
|
5364
|
+
):
|
5365
|
+
self.PAR.xscroll.grid(row=2, column=0, columnspan=2, sticky="nswe")
|
5366
|
+
self.PAR.xscroll_showing = True
|
5351
5367
|
if can_height >= self.row_positions[-1] + self.PAR.ops.empty_vertical and self.PAR.yscroll_showing:
|
5352
5368
|
self.PAR.yscroll.grid_forget()
|
5353
5369
|
self.PAR.yscroll_showing = False
|
@@ -5374,21 +5390,26 @@ class MainTable(tk.Canvas):
|
|
5374
5390
|
self.RI.configure_scrollregion(last_row_line_pos)
|
5375
5391
|
if setting_views:
|
5376
5392
|
return False
|
5393
|
+
scrollpos_top = self.canvasy(0)
|
5377
5394
|
scrollpos_bot = self.canvasy(can_height)
|
5378
|
-
end_row = bisect_right(self.row_positions, scrollpos_bot)
|
5379
|
-
if not scrollpos_bot >= self.row_positions[-1]:
|
5380
|
-
end_row += 1
|
5381
5395
|
scrollpos_left = self.canvasx(0)
|
5382
|
-
scrollpos_top = self.canvasy(0)
|
5383
5396
|
scrollpos_right = self.canvasx(can_width)
|
5384
|
-
|
5385
|
-
|
5386
|
-
|
5397
|
+
|
5398
|
+
grid_start_row = bisect_left(self.row_positions, scrollpos_top)
|
5399
|
+
grid_end_row = bisect_right(self.row_positions, scrollpos_bot)
|
5400
|
+
grid_start_col = bisect_left(self.col_positions, scrollpos_left)
|
5401
|
+
grid_end_col = bisect_right(self.col_positions, scrollpos_right)
|
5402
|
+
|
5403
|
+
text_start_row = grid_start_row - 1 if grid_start_row else grid_start_row
|
5404
|
+
text_end_row = grid_end_row - 1 if grid_end_row == len(self.row_positions) else grid_end_row
|
5405
|
+
text_start_col = grid_start_col - 1 if grid_start_col else grid_start_col
|
5406
|
+
text_end_col = grid_end_col - 1 if grid_end_col == len(self.col_positions) else grid_end_col
|
5407
|
+
|
5387
5408
|
changed_w = False
|
5388
5409
|
if self.PAR.ops.auto_resize_row_index and redraw_row_index and self.show_index:
|
5389
5410
|
changed_w = self.RI.auto_set_index_width(
|
5390
|
-
end_row=
|
5391
|
-
only_rows=[self.datarn(r) for r in range(
|
5411
|
+
end_row=grid_end_row,
|
5412
|
+
only_rows=[self.datarn(r) for r in range(text_start_row, text_end_row)],
|
5392
5413
|
)
|
5393
5414
|
if resized_cols or resized_rows or changed_w:
|
5394
5415
|
self.recreate_all_selection_boxes()
|
@@ -5408,8 +5429,6 @@ class MainTable(tk.Canvas):
|
|
5408
5429
|
self.disp_dropdown = {}
|
5409
5430
|
self.hidd_checkbox.update(self.disp_checkbox)
|
5410
5431
|
self.disp_checkbox = {}
|
5411
|
-
if not scrollpos_right >= self.col_positions[-1]:
|
5412
|
-
end_col += 1
|
5413
5432
|
if last_col_line_pos > scrollpos_right:
|
5414
5433
|
x_stop = scrollpos_right
|
5415
5434
|
else:
|
@@ -5439,7 +5458,7 @@ class MainTable(tk.Canvas):
|
|
5439
5458
|
self.canvasx(0) - 1,
|
5440
5459
|
self.row_positions[r + 1] if len(self.row_positions) - 1 > r else self.row_positions[r],
|
5441
5460
|
)
|
5442
|
-
for r in range(
|
5461
|
+
for r in range(grid_start_row, grid_end_row)
|
5443
5462
|
]
|
5444
5463
|
)
|
5445
5464
|
)
|
@@ -5471,7 +5490,7 @@ class MainTable(tk.Canvas):
|
|
5471
5490
|
self.col_positions[c + 1] if len(self.col_positions) - 1 > c else self.col_positions[c],
|
5472
5491
|
scrollpos_top - 1,
|
5473
5492
|
)
|
5474
|
-
for c in range(
|
5493
|
+
for c in range(grid_start_col, grid_end_col)
|
5475
5494
|
]
|
5476
5495
|
)
|
5477
5496
|
)
|
@@ -5482,13 +5501,8 @@ class MainTable(tk.Canvas):
|
|
5482
5501
|
width=1,
|
5483
5502
|
tag="g",
|
5484
5503
|
)
|
5485
|
-
if start_row > 0:
|
5486
|
-
start_row -= 1
|
5487
|
-
if start_col > 0:
|
5488
|
-
start_col -= 1
|
5489
|
-
end_row -= 1
|
5490
5504
|
if redraw_table:
|
5491
|
-
selections = self.get_redraw_selections(
|
5505
|
+
selections = self.get_redraw_selections(text_start_row, grid_end_row, text_start_col, grid_end_col)
|
5492
5506
|
c_2 = (
|
5493
5507
|
self.PAR.ops.table_selected_cells_bg
|
5494
5508
|
if self.PAR.ops.table_selected_cells_bg.startswith("#")
|
@@ -5507,10 +5521,10 @@ class MainTable(tk.Canvas):
|
|
5507
5521
|
else color_map[self.PAR.ops.table_selected_rows_bg]
|
5508
5522
|
)
|
5509
5523
|
c_4_ = (int(c_4[1:3], 16), int(c_4[3:5], 16), int(c_4[5:], 16))
|
5510
|
-
rows_ = tuple(range(
|
5524
|
+
rows_ = tuple(range(text_start_row, text_end_row))
|
5511
5525
|
font = self.PAR.ops.table_font
|
5512
5526
|
dd_coords = self.dropdown.get_coords()
|
5513
|
-
for c in range(
|
5527
|
+
for c in range(text_start_col, text_end_col):
|
5514
5528
|
for r in rows_:
|
5515
5529
|
rtopgridln = self.row_positions[r]
|
5516
5530
|
rbotgridln = self.row_positions[r + 1]
|
@@ -5718,23 +5732,27 @@ class MainTable(tk.Canvas):
|
|
5718
5732
|
self.tag_raise(self.selected.iid)
|
5719
5733
|
if redraw_header and self.show_header:
|
5720
5734
|
self.CH.redraw_grid_and_text(
|
5721
|
-
last_col_line_pos,
|
5722
|
-
scrollpos_left,
|
5723
|
-
x_stop,
|
5724
|
-
|
5725
|
-
|
5726
|
-
|
5727
|
-
|
5735
|
+
last_col_line_pos=last_col_line_pos,
|
5736
|
+
scrollpos_left=scrollpos_left,
|
5737
|
+
x_stop=x_stop,
|
5738
|
+
grid_start_col=grid_start_col,
|
5739
|
+
grid_end_col=grid_end_col,
|
5740
|
+
text_start_col=text_start_col,
|
5741
|
+
text_end_col=text_end_col,
|
5742
|
+
scrollpos_right=scrollpos_right,
|
5743
|
+
col_pos_exists=col_pos_exists,
|
5728
5744
|
)
|
5729
5745
|
if redraw_row_index and self.show_index:
|
5730
5746
|
self.RI.redraw_grid_and_text(
|
5731
|
-
last_row_line_pos,
|
5732
|
-
scrollpos_top,
|
5733
|
-
y_stop,
|
5734
|
-
|
5735
|
-
|
5736
|
-
|
5737
|
-
|
5747
|
+
last_row_line_pos=last_row_line_pos,
|
5748
|
+
scrollpos_top=scrollpos_top,
|
5749
|
+
y_stop=y_stop,
|
5750
|
+
grid_start_row=grid_start_row,
|
5751
|
+
grid_end_row=grid_end_row,
|
5752
|
+
text_start_row=text_start_row,
|
5753
|
+
text_end_row=text_end_row,
|
5754
|
+
scrollpos_bot=scrollpos_bot,
|
5755
|
+
row_pos_exists=row_pos_exists,
|
5738
5756
|
)
|
5739
5757
|
event_data = {"sheetname": "", "header": redraw_header, "row_index": redraw_row_index, "table": redraw_table}
|
5740
5758
|
self.PAR.emit_event("<<SheetRedrawn>>", data=event_data)
|
@@ -5823,7 +5841,8 @@ class MainTable(tk.Canvas):
|
|
5823
5841
|
)
|
5824
5842
|
return
|
5825
5843
|
# wasn't provided an item and couldn't find a box at coords so select cell
|
5826
|
-
self.
|
5844
|
+
if r < len(self.row_positions) - 1 and c < len(self.col_positions) - 1:
|
5845
|
+
self.select_cell(r, c, redraw=True)
|
5827
5846
|
|
5828
5847
|
def set_current_to_last(self) -> None:
|
5829
5848
|
if self.selection_boxes:
|
@@ -6489,7 +6508,7 @@ class MainTable(tk.Canvas):
|
|
6489
6508
|
text = text if isinstance(text, str) else f"{text}"
|
6490
6509
|
text = "" if text is None else text
|
6491
6510
|
if self.PAR.ops.cell_auto_resize_enabled:
|
6492
|
-
self.set_cell_size_to_text(r, c,
|
6511
|
+
self.set_cell_size_to_text(r, c, only_if_too_small=True, redraw=True, run_binding=True)
|
6493
6512
|
if self.text_editor.open and (r, c) == self.text_editor.coords:
|
6494
6513
|
self.text_editor.window.set_text(self.text_editor.get() + "" if not isinstance(text, str) else text)
|
6495
6514
|
return
|
@@ -7106,7 +7125,7 @@ class MainTable(tk.Canvas):
|
|
7106
7125
|
self.undo_stack.append(pickled_event_dict(event_data))
|
7107
7126
|
self.set_cell_data(datarn, datacn, value)
|
7108
7127
|
if cell_resize and self.PAR.ops.cell_auto_resize_enabled:
|
7109
|
-
self.set_cell_size_to_text(r, c,
|
7128
|
+
self.set_cell_size_to_text(r, c, only_if_too_small=True, redraw=redraw, run_binding=True)
|
7110
7129
|
self.sheet_modified(event_data)
|
7111
7130
|
return True
|
7112
7131
|
return False
|