tksheet 7.2.2__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/main_table.py +67 -54
- tksheet/sheet.py +7 -1
- {tksheet-7.2.2.dist-info → tksheet-7.2.3.dist-info}/METADATA +1 -1
- {tksheet-7.2.2.dist-info → tksheet-7.2.3.dist-info}/RECORD +8 -8
- {tksheet-7.2.2.dist-info → tksheet-7.2.3.dist-info}/LICENSE.txt +0 -0
- {tksheet-7.2.2.dist-info → tksheet-7.2.3.dist-info}/WHEEL +0 -0
- {tksheet-7.2.2.dist-info → tksheet-7.2.3.dist-info}/top_level.txt +0 -0
tksheet/__init__.py
CHANGED
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,
|
@@ -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
|
@@ -4300,6 +4286,7 @@ class MainTable(tk.Canvas):
|
|
4300
4286
|
create_selections: bool = True,
|
4301
4287
|
add_row_positions: bool = True,
|
4302
4288
|
push_ops: bool = True,
|
4289
|
+
mod_event_boxes: bool = True,
|
4303
4290
|
) -> EventDataDict:
|
4304
4291
|
self.saved_column_widths = {}
|
4305
4292
|
saved_displayed_columns = list(self.displayed_columns)
|
@@ -4330,18 +4317,26 @@ class MainTable(tk.Canvas):
|
|
4330
4317
|
maxrn = 0
|
4331
4318
|
for cn, rowdict in reversed(columns.items()):
|
4332
4319
|
for rn, v in rowdict.items():
|
4333
|
-
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):
|
4334
4323
|
self.fix_data_len(rn, cn - 1)
|
4335
4324
|
if rn > maxrn:
|
4336
4325
|
maxrn = rn
|
4337
4326
|
self.data[rn].insert(cn, v)
|
4338
4327
|
# if not hiding rows then we can extend row positions if necessary
|
4339
|
-
if add_row_positions and self.all_rows_displayed and maxrn
|
4340
|
-
|
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
|
+
}
|
4341
4336
|
self.set_row_positions(
|
4342
4337
|
itr=chain(
|
4343
4338
|
self.gen_row_heights(),
|
4344
|
-
repeat(
|
4339
|
+
repeat(default_height, maxrn + 1 - (len(self.row_positions) - 1)),
|
4345
4340
|
)
|
4346
4341
|
)
|
4347
4342
|
if isinstance(self._headers, list) and header:
|
@@ -4362,6 +4357,9 @@ class MainTable(tk.Canvas):
|
|
4362
4357
|
"columns",
|
4363
4358
|
run_binding=True,
|
4364
4359
|
)
|
4360
|
+
if mod_event_boxes:
|
4361
|
+
event_data["selection_boxes"] = self.get_boxes()
|
4362
|
+
event_data["selected"] = self.selected
|
4365
4363
|
event_data["added"]["columns"] = {
|
4366
4364
|
"table": columns,
|
4367
4365
|
"header": header,
|
@@ -4433,6 +4431,7 @@ class MainTable(tk.Canvas):
|
|
4433
4431
|
create_selections: bool = True,
|
4434
4432
|
add_col_positions: bool = True,
|
4435
4433
|
push_ops: bool = True,
|
4434
|
+
mod_event_boxes: bool = True,
|
4436
4435
|
) -> EventDataDict:
|
4437
4436
|
self.saved_row_heights = {}
|
4438
4437
|
saved_displayed_rows = list(self.displayed_rows)
|
@@ -4472,11 +4471,18 @@ class MainTable(tk.Canvas):
|
|
4472
4471
|
if isinstance(self._row_index, list) and index:
|
4473
4472
|
self._row_index = insert_items(self._row_index, index, self.RI.fix_index)
|
4474
4473
|
# if not hiding columns then we can extend col positions if necessary
|
4475
|
-
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
|
+
}
|
4476
4482
|
self.set_col_positions(
|
4477
4483
|
itr=chain(
|
4478
4484
|
self.gen_column_widths(),
|
4479
|
-
repeat(
|
4485
|
+
repeat(default_width, maxcn + 1 - (len(self.col_positions) - 1)),
|
4480
4486
|
)
|
4481
4487
|
)
|
4482
4488
|
if push_ops:
|
@@ -4495,6 +4501,9 @@ class MainTable(tk.Canvas):
|
|
4495
4501
|
"rows",
|
4496
4502
|
run_binding=True,
|
4497
4503
|
)
|
4504
|
+
if mod_event_boxes:
|
4505
|
+
event_data["selection_boxes"] = self.get_boxes()
|
4506
|
+
event_data["selected"] = self.selected
|
4498
4507
|
event_data["added"]["rows"] = {
|
4499
4508
|
"table": rows,
|
4500
4509
|
"index": index,
|
@@ -5340,18 +5349,21 @@ class MainTable(tk.Canvas):
|
|
5340
5349
|
if i not in diffs:
|
5341
5350
|
heights[i] -= change
|
5342
5351
|
self.row_positions = list(accumulate(chain([0], heights)))
|
5343
|
-
if
|
5344
|
-
|
5345
|
-
|
5346
|
-
|
5347
|
-
|
5348
|
-
|
5349
|
-
|
5350
|
-
|
5351
|
-
|
5352
|
-
|
5353
|
-
|
5354
|
-
|
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
|
5355
5367
|
if can_height >= self.row_positions[-1] + self.PAR.ops.empty_vertical and self.PAR.yscroll_showing:
|
5356
5368
|
self.PAR.yscroll.grid_forget()
|
5357
5369
|
self.PAR.yscroll_showing = False
|
@@ -5829,7 +5841,8 @@ class MainTable(tk.Canvas):
|
|
5829
5841
|
)
|
5830
5842
|
return
|
5831
5843
|
# wasn't provided an item and couldn't find a box at coords so select cell
|
5832
|
-
self.
|
5844
|
+
if r < len(self.row_positions) - 1 and c < len(self.col_positions) - 1:
|
5845
|
+
self.select_cell(r, c, redraw=True)
|
5833
5846
|
|
5834
5847
|
def set_current_to_last(self) -> None:
|
5835
5848
|
if self.selection_boxes:
|
tksheet/sheet.py
CHANGED
@@ -1503,6 +1503,7 @@ class Sheet(tk.Frame):
|
|
1503
1503
|
self.MT.deselect(redraw=False)
|
1504
1504
|
if sheet_options:
|
1505
1505
|
self.ops = new_sheet_options()
|
1506
|
+
self.change_theme(redraw=False)
|
1506
1507
|
if tree:
|
1507
1508
|
self.RI.tree_reset()
|
1508
1509
|
if tree or row_heights or column_widths:
|
@@ -4291,6 +4292,9 @@ class Sheet(tk.Frame):
|
|
4291
4292
|
if any(k in kwargs for k in scrollbar_options_keys):
|
4292
4293
|
self.set_scrollbar_options()
|
4293
4294
|
self.MT.create_rc_menus()
|
4295
|
+
if "treeview" in kwargs:
|
4296
|
+
self.set_options(auto_resize_row_index=True, redraw=False)
|
4297
|
+
self.index_align("w", redraw=False)
|
4294
4298
|
return self.set_refresh_timer(redraw)
|
4295
4299
|
|
4296
4300
|
def set_scrollbar_options(self) -> Sheet:
|
@@ -4793,9 +4797,11 @@ class Sheet(tk.Frame):
|
|
4793
4797
|
idx += sum(1 for _ in self.RI.get_iid_descendants(cid)) + 1
|
4794
4798
|
else:
|
4795
4799
|
idx = len(self.MT._row_index)
|
4800
|
+
if values is None:
|
4801
|
+
values = []
|
4796
4802
|
self.insert_rows(
|
4797
4803
|
idx=idx,
|
4798
|
-
rows=[[self.RI.tree[iid]] +
|
4804
|
+
rows=[[self.RI.tree[iid]] + values],
|
4799
4805
|
row_index=True,
|
4800
4806
|
create_selections=create_selections,
|
4801
4807
|
fill=False,
|
@@ -1,20 +1,20 @@
|
|
1
|
-
tksheet/__init__.py,sha256=
|
1
|
+
tksheet/__init__.py,sha256=ExwA5frHCiXaPMRIH-EKonUH_RKCgMI6IpAps9dtesE,2124
|
2
2
|
tksheet/colors.py,sha256=1k06VorynLmnC4FdJg8H4reIA6rXaeXBpdMwXLhN8oc,51594
|
3
3
|
tksheet/column_headers.py,sha256=zArcBsPeob8xUvM0cYB4RjwcKMfLLkHiz7oUtDFBAeg,102039
|
4
4
|
tksheet/formatters.py,sha256=DXif00aq9DgFpXwkbiqD86KxtDg0Meop51hLY-KcGNQ,10037
|
5
5
|
tksheet/functions.py,sha256=rNfDpQRoXZm_Ro-tlF92ox3fi37p71Mio1PGTreM_oc,40835
|
6
|
-
tksheet/main_table.py,sha256=
|
6
|
+
tksheet/main_table.py,sha256=CudkuoJ8NSlCwTZjQCxQHRNdBTYdjSyo3CqnIZSmynI,325631
|
7
7
|
tksheet/other_classes.py,sha256=P3FYUYreLhstATvHCNow8sDQoCsD_02KB6oXcca3ahE,13628
|
8
8
|
tksheet/row_index.py,sha256=aBNZIKMBnbIHdCSsmKdLgZSQ8ESDyAXwFxlSRVR1RO8,108213
|
9
|
-
tksheet/sheet.py,sha256=
|
9
|
+
tksheet/sheet.py,sha256=q8MSMTCLHaud-Hddh2vMflWbl785SuiwlZ6H2tam1cw,268536
|
10
10
|
tksheet/sheet_options.py,sha256=Azo7_-H0e0ssYEoU7Mq_OWy3S-U05rp4_6Q2E2Ffuu8,12262
|
11
11
|
tksheet/text_editor.py,sha256=aRm1Y5GfORiEAJthtN1uQ30CT3VoF8mRWvR-SIXPrJU,6548
|
12
12
|
tksheet/themes.py,sha256=N9nAj6vcWk4UdcrAakvz2LPbJEJWXdv3j7Om6AnvX5k,14474
|
13
13
|
tksheet/top_left_rectangle.py,sha256=o-M6i5NjaJwo60tV-BDP9SbaT1CzQNoPjuoC7p-nb5Q,8436
|
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.3.dist-info/LICENSE.txt,sha256=ndbcCPe9SlHfweE_W2RAueWUe2k7yudyxYLq6WjFdn4,1101
|
17
|
+
tksheet-7.2.3.dist-info/METADATA,sha256=Phxh9tGDvtVNUVESqLiCDYnot995x8l2rhmkJYbOEK4,6319
|
18
|
+
tksheet-7.2.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
19
|
+
tksheet-7.2.3.dist-info/top_level.txt,sha256=my61PXCcck_HHAc9cq3NAlyAr3A3FXxCy9gptEOaCN8,8
|
20
|
+
tksheet-7.2.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|