tksheet 7.4.12__tar.gz → 7.4.14__tar.gz

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.
Files changed (26) hide show
  1. {tksheet-7.4.12/tksheet.egg-info → tksheet-7.4.14}/PKG-INFO +7 -7
  2. {tksheet-7.4.12 → tksheet-7.4.14}/README.md +6 -6
  3. {tksheet-7.4.12 → tksheet-7.4.14}/pyproject.toml +2 -1
  4. {tksheet-7.4.12 → tksheet-7.4.14}/tksheet/__init__.py +1 -1
  5. {tksheet-7.4.12 → tksheet-7.4.14}/tksheet/column_headers.py +109 -94
  6. {tksheet-7.4.12 → tksheet-7.4.14}/tksheet/find_window.py +2 -0
  7. {tksheet-7.4.12 → tksheet-7.4.14}/tksheet/functions.py +17 -5
  8. {tksheet-7.4.12 → tksheet-7.4.14}/tksheet/main_table.py +559 -510
  9. {tksheet-7.4.12 → tksheet-7.4.14}/tksheet/other_classes.py +1 -1
  10. {tksheet-7.4.12 → tksheet-7.4.14}/tksheet/row_index.py +241 -197
  11. {tksheet-7.4.12 → tksheet-7.4.14}/tksheet/sheet.py +24 -16
  12. {tksheet-7.4.12 → tksheet-7.4.14/tksheet.egg-info}/PKG-INFO +7 -7
  13. {tksheet-7.4.12 → tksheet-7.4.14}/LICENSE.txt +0 -0
  14. {tksheet-7.4.12 → tksheet-7.4.14}/setup.cfg +0 -0
  15. {tksheet-7.4.12 → tksheet-7.4.14}/tksheet/colors.py +0 -0
  16. {tksheet-7.4.12 → tksheet-7.4.14}/tksheet/constants.py +0 -0
  17. {tksheet-7.4.12 → tksheet-7.4.14}/tksheet/formatters.py +0 -0
  18. {tksheet-7.4.12 → tksheet-7.4.14}/tksheet/sheet_options.py +0 -0
  19. {tksheet-7.4.12 → tksheet-7.4.14}/tksheet/sorting.py +0 -0
  20. {tksheet-7.4.12 → tksheet-7.4.14}/tksheet/text_editor.py +0 -0
  21. {tksheet-7.4.12 → tksheet-7.4.14}/tksheet/themes.py +0 -0
  22. {tksheet-7.4.12 → tksheet-7.4.14}/tksheet/tksheet_types.py +0 -0
  23. {tksheet-7.4.12 → tksheet-7.4.14}/tksheet/top_left_rectangle.py +0 -0
  24. {tksheet-7.4.12 → tksheet-7.4.14}/tksheet.egg-info/SOURCES.txt +0 -0
  25. {tksheet-7.4.12 → tksheet-7.4.14}/tksheet.egg-info/dependency_links.txt +0 -0
  26. {tksheet-7.4.12 → tksheet-7.4.14}/tksheet.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tksheet
3
- Version: 7.4.12
3
+ Version: 7.4.14
4
4
  Summary: Tkinter table / sheet and treeview widget
5
5
  Author-email: ragardner <github@ragardner.simplelogin.com>
6
6
  License: Copyright (c) 2019 ragardner and open source contributors
@@ -63,23 +63,23 @@ License-File: LICENSE.txt
63
63
  <tbody>
64
64
  <tr>
65
65
  <td style="color: LightCoral">Versions 6.x.x &#8594;</td>
66
- <td><a href="https://github.com/ragardner/tksheet/wiki/Version-6">Documentation</a></td>
66
+ <td><a href="https://github.com/ragardner/tksheet/wiki/Version-6" target="_blank">Documentation</a></td>
67
67
  </tr>
68
68
  <tr>
69
69
  <td style="color: lightgreen">Versions 7.x.x &#8594;</td>
70
- <td><a href="https://ragardner.github.io/tksheet/DOCUMENTATION.html">Documentation</a></td>
70
+ <td><a href="https://ragardner.github.io/tksheet/DOCUMENTATION.html" target="_blank">Documentation</a></td>
71
71
  </tr>
72
72
  <tr>
73
- <td align="right" colspan="2"><a href="https://github.com/ragardner/tksheet/blob/master/docs/CHANGELOG.md">Changelog</a></td>
73
+ <td align="right" colspan="2"><a href="https://github.com/ragardner/tksheet/blob/master/docs/CHANGELOG.md" target="_blank">Changelog</a></td>
74
74
  </tr>
75
75
  <tr>
76
- <td align="right" colspan="2"><a href="https://github.com/ragardner/tksheet/wiki/Version-7#asking-questions">Questions</a></td>
76
+ <td align="right" colspan="2"><a href="https://github.com/ragardner/tksheet/wiki/Version-7#asking-questions" target="_blank">Questions</a></td>
77
77
  </tr>
78
78
  <tr>
79
- <td align="right" colspan="2"><a href="https://github.com/ragardner/tksheet/wiki/Version-7#issues">Issues</a></td>
79
+ <td align="right" colspan="2"><a href="https://github.com/ragardner/tksheet/wiki/Version-7#issues" target="_blank">Issues</a></td>
80
80
  </tr>
81
81
  <tr>
82
- <td align="right" colspan="2"><a href="https://github.com/ragardner/tksheet/wiki/Version-7#enhancements-or-suggestions">Suggestions and Contributors</a></td>
82
+ <td align="right" colspan="2"><a href="https://github.com/ragardner/tksheet/wiki/Version-7#enhancements-or-suggestions" target="_blank">Suggestions and Contributors</a></td>
83
83
  </tr>
84
84
  </tbody>
85
85
  </table>
@@ -18,23 +18,23 @@
18
18
  <tbody>
19
19
  <tr>
20
20
  <td style="color: LightCoral">Versions 6.x.x &#8594;</td>
21
- <td><a href="https://github.com/ragardner/tksheet/wiki/Version-6">Documentation</a></td>
21
+ <td><a href="https://github.com/ragardner/tksheet/wiki/Version-6" target="_blank">Documentation</a></td>
22
22
  </tr>
23
23
  <tr>
24
24
  <td style="color: lightgreen">Versions 7.x.x &#8594;</td>
25
- <td><a href="https://ragardner.github.io/tksheet/DOCUMENTATION.html">Documentation</a></td>
25
+ <td><a href="https://ragardner.github.io/tksheet/DOCUMENTATION.html" target="_blank">Documentation</a></td>
26
26
  </tr>
27
27
  <tr>
28
- <td align="right" colspan="2"><a href="https://github.com/ragardner/tksheet/blob/master/docs/CHANGELOG.md">Changelog</a></td>
28
+ <td align="right" colspan="2"><a href="https://github.com/ragardner/tksheet/blob/master/docs/CHANGELOG.md" target="_blank">Changelog</a></td>
29
29
  </tr>
30
30
  <tr>
31
- <td align="right" colspan="2"><a href="https://github.com/ragardner/tksheet/wiki/Version-7#asking-questions">Questions</a></td>
31
+ <td align="right" colspan="2"><a href="https://github.com/ragardner/tksheet/wiki/Version-7#asking-questions" target="_blank">Questions</a></td>
32
32
  </tr>
33
33
  <tr>
34
- <td align="right" colspan="2"><a href="https://github.com/ragardner/tksheet/wiki/Version-7#issues">Issues</a></td>
34
+ <td align="right" colspan="2"><a href="https://github.com/ragardner/tksheet/wiki/Version-7#issues" target="_blank">Issues</a></td>
35
35
  </tr>
36
36
  <tr>
37
- <td align="right" colspan="2"><a href="https://github.com/ragardner/tksheet/wiki/Version-7#enhancements-or-suggestions">Suggestions and Contributors</a></td>
37
+ <td align="right" colspan="2"><a href="https://github.com/ragardner/tksheet/wiki/Version-7#enhancements-or-suggestions" target="_blank">Suggestions and Contributors</a></td>
38
38
  </tr>
39
39
  </tbody>
40
40
  </table>
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
6
6
  name = "tksheet"
7
7
  description = "Tkinter table / sheet and treeview widget"
8
8
  readme = "README.md"
9
- version = "7.4.12"
9
+ version = "7.4.14"
10
10
  authors = [{ name = "ragardner", email = "github@ragardner.simplelogin.com" }]
11
11
  requires-python = ">=3.8"
12
12
  license = {file = "LICENSE.txt"}
@@ -35,3 +35,4 @@ Funding = "https://github.com/ragardner"
35
35
  line-length = 120
36
36
  extend-select = ["I", "F", "C4", "E", "B", "SIM"]
37
37
  fix = true
38
+ ignore = ["SIM401"]
@@ -4,7 +4,7 @@
4
4
  tksheet - A Python tkinter table widget
5
5
  """
6
6
 
7
- __version__ = "7.4.12"
7
+ __version__ = "7.4.14"
8
8
 
9
9
  from .colors import (
10
10
  color_map,
@@ -5,7 +5,7 @@ from collections import defaultdict
5
5
  from collections.abc import Callable, Hashable, Iterator, Sequence
6
6
  from functools import partial
7
7
  from itertools import cycle, islice, repeat
8
- from math import ceil, floor
8
+ from math import ceil
9
9
  from operator import itemgetter
10
10
  from typing import Any, Literal
11
11
 
@@ -741,7 +741,7 @@ class ColumnHeaders(tk.Canvas):
741
741
  if size < self.ops.min_column_width:
742
742
  new_col_pos = ceil(self.MT.col_positions[self.rsz_w - 1] + self.ops.min_column_width)
743
743
  elif size > self.ops.max_column_width:
744
- new_col_pos = floor(self.MT.col_positions[self.rsz_w - 1] + self.ops.max_column_width)
744
+ new_col_pos = int(self.MT.col_positions[self.rsz_w - 1] + self.ops.max_column_width)
745
745
  increment = new_col_pos - self.MT.col_positions[self.rsz_w]
746
746
  self.MT.col_positions[self.rsz_w + 1 :] = [
747
747
  e + increment for e in islice(self.MT.col_positions, self.rsz_w + 1, None)
@@ -1283,7 +1283,6 @@ class ColumnHeaders(tk.Canvas):
1283
1283
  self.current_height - 1,
1284
1284
  fill=fill,
1285
1285
  outline=self.ops.header_fg if has_dd and self.ops.show_dropdown_borders else "",
1286
- tag="hi",
1287
1286
  )
1288
1287
  elif not kwargs:
1289
1288
  if "columns" in selections and c in selections["columns"]:
@@ -1295,7 +1294,6 @@ class ColumnHeaders(tk.Canvas):
1295
1294
  self.current_height - 1,
1296
1295
  fill=self.ops.header_selected_columns_bg,
1297
1296
  outline=self.ops.header_fg if has_dd and self.ops.show_dropdown_borders else "",
1298
- tag="hi",
1299
1297
  )
1300
1298
  elif "cells" in selections and c in selections["cells"]:
1301
1299
  txtfg = self.ops.header_selected_cells_fg
@@ -1306,7 +1304,6 @@ class ColumnHeaders(tk.Canvas):
1306
1304
  self.current_height - 1,
1307
1305
  fill=self.ops.header_selected_cells_bg,
1308
1306
  outline=self.ops.header_fg if has_dd and self.ops.show_dropdown_borders else "",
1309
- tag="hi",
1310
1307
  )
1311
1308
  else:
1312
1309
  txtfg = self.ops.header_fg
@@ -1320,7 +1317,6 @@ class ColumnHeaders(tk.Canvas):
1320
1317
  y2: float,
1321
1318
  fill: str,
1322
1319
  outline: str,
1323
- tag: str | tuple[str],
1324
1320
  ) -> bool:
1325
1321
  coords = (x1, y1, x2, y2)
1326
1322
  if self.hidd_high:
@@ -1329,10 +1325,9 @@ class ColumnHeaders(tk.Canvas):
1329
1325
  if showing:
1330
1326
  self.itemconfig(iid, fill=fill, outline=outline)
1331
1327
  else:
1332
- self.itemconfig(iid, fill=fill, outline=outline, tag=tag, state="normal")
1333
- self.tag_raise(iid)
1328
+ self.itemconfig(iid, fill=fill, outline=outline, state="normal")
1334
1329
  else:
1335
- iid = self.create_rectangle(coords, fill=fill, outline=outline, tag=tag)
1330
+ iid = self.create_rectangle(coords, fill=fill, outline=outline)
1336
1331
  self.disp_high[iid] = True
1337
1332
  return True
1338
1333
 
@@ -1341,19 +1336,17 @@ class ColumnHeaders(tk.Canvas):
1341
1336
  points: Sequence[float],
1342
1337
  fill: str,
1343
1338
  width: int,
1344
- tag: str | tuple[str],
1345
1339
  ) -> None:
1346
1340
  if self.hidd_grid:
1347
1341
  t, sh = self.hidd_grid.popitem()
1348
1342
  self.coords(t, points)
1349
1343
  if sh:
1350
- self.itemconfig(t, fill=fill, width=width, tag=tag)
1344
+ self.itemconfig(t, fill=fill, width=width)
1351
1345
  else:
1352
- self.itemconfig(t, fill=fill, width=width, tag=tag, state="normal")
1346
+ self.itemconfig(t, fill=fill, width=width, state="normal")
1353
1347
  self.disp_grid[t] = True
1354
- self.tag_raise(t)
1355
1348
  else:
1356
- self.disp_grid[self.create_line(points, fill=fill, width=width, tag=tag)] = True
1349
+ self.disp_grid[self.create_line(points, fill=fill, width=width)] = True
1357
1350
 
1358
1351
  def redraw_dropdown(
1359
1352
  self,
@@ -1363,17 +1356,16 @@ class ColumnHeaders(tk.Canvas):
1363
1356
  y2: float,
1364
1357
  fill: str,
1365
1358
  outline: str,
1366
- tag: str | tuple[str],
1367
1359
  draw_outline: bool = True,
1368
1360
  draw_arrow: bool = True,
1369
1361
  open_: bool = False,
1370
1362
  ) -> None:
1371
1363
  if draw_outline and self.ops.show_dropdown_borders:
1372
- self.redraw_highlight(x1 + 1, y1 + 1, x2, y2, fill="", outline=self.ops.header_fg, tag=tag)
1364
+ self.redraw_highlight(x1 + 1, y1 + 1, x2, y2, fill="", outline=self.ops.header_fg)
1373
1365
  if draw_arrow:
1374
1366
  mod = (self.MT.header_txt_height - 1) if self.MT.header_txt_height % 2 else self.MT.header_txt_height
1375
1367
  small_mod = int(mod / 5)
1376
- mid_y = floor(self.MT.min_header_height / 2)
1368
+ mid_y = int(self.MT.min_header_height / 2)
1377
1369
  if open_:
1378
1370
  # up arrow
1379
1371
  points = (
@@ -1400,17 +1392,9 @@ class ColumnHeaders(tk.Canvas):
1400
1392
  if sh:
1401
1393
  self.itemconfig(t, fill=fill)
1402
1394
  else:
1403
- self.itemconfig(t, fill=fill, tag=tag, state="normal")
1404
- self.lift(t)
1395
+ self.itemconfig(t, fill=fill, state="normal")
1405
1396
  else:
1406
- t = self.create_line(
1407
- points,
1408
- fill=fill,
1409
- tag=tag,
1410
- width=2,
1411
- capstyle=tk.ROUND,
1412
- joinstyle=tk.BEVEL,
1413
- )
1397
+ t = self.create_line(points, fill=fill, width=2, capstyle=tk.ROUND, joinstyle=tk.BEVEL, tag="lift")
1414
1398
  self.disp_dropdown[t] = True
1415
1399
 
1416
1400
  def redraw_checkbox(
@@ -1421,7 +1405,6 @@ class ColumnHeaders(tk.Canvas):
1421
1405
  y2: float,
1422
1406
  fill: str,
1423
1407
  outline: str,
1424
- tag: str | tuple[str],
1425
1408
  draw_check: bool = False,
1426
1409
  ) -> None:
1427
1410
  points = rounded_box_coords(x1, y1, x2, y2)
@@ -1431,10 +1414,9 @@ class ColumnHeaders(tk.Canvas):
1431
1414
  if sh:
1432
1415
  self.itemconfig(t, fill=outline, outline=fill)
1433
1416
  else:
1434
- self.itemconfig(t, fill=outline, outline=fill, tag=tag, state="normal")
1435
- self.lift(t)
1417
+ self.itemconfig(t, fill=outline, outline=fill, state="normal")
1436
1418
  else:
1437
- t = self.create_polygon(points, fill=outline, outline=fill, tag=tag, smooth=True)
1419
+ t = self.create_polygon(points, fill=outline, outline=fill, smooth=True, tag="lift")
1438
1420
  self.disp_checkbox[t] = True
1439
1421
  if draw_check:
1440
1422
  # draw filled box
@@ -1449,10 +1431,9 @@ class ColumnHeaders(tk.Canvas):
1449
1431
  if sh:
1450
1432
  self.itemconfig(t, fill=fill, outline=outline)
1451
1433
  else:
1452
- self.itemconfig(t, fill=fill, outline=outline, tag=tag, state="normal")
1453
- self.lift(t)
1434
+ self.itemconfig(t, fill=fill, outline=outline, state="normal")
1454
1435
  else:
1455
- t = self.create_polygon(points, fill=fill, outline=outline, tag=tag, smooth=True)
1436
+ t = self.create_polygon(points, fill=fill, outline=outline, smooth=True, tag="lift")
1456
1437
  self.disp_checkbox[t] = True
1457
1438
 
1458
1439
  def configure_scrollregion(self, last_col_line_pos: float) -> bool:
@@ -1470,15 +1451,15 @@ class ColumnHeaders(tk.Canvas):
1470
1451
  return False
1471
1452
 
1472
1453
  def wrap_get_char_w(self, c: str) -> int:
1473
- self.MT.txt_measure_canvas.itemconfig(
1474
- self.MT.txt_measure_canvas_text,
1475
- text=_test_str + c,
1476
- font=self.header_font,
1477
- )
1478
- b = self.MT.txt_measure_canvas.bbox(self.MT.txt_measure_canvas_text)
1479
1454
  if c in self.MT.char_widths[self.header_font]:
1480
1455
  return self.MT.char_widths[self.header_font][c]
1481
1456
  else:
1457
+ self.MT.txt_measure_canvas.itemconfig(
1458
+ self.MT.txt_measure_canvas_text,
1459
+ text=_test_str + c,
1460
+ font=self.header_font,
1461
+ )
1462
+ b = self.MT.txt_measure_canvas.bbox(self.MT.txt_measure_canvas_text)
1482
1463
  wd = b[2] - b[0] - self.header_test_str_w
1483
1464
  self.MT.char_widths[self.header_font][c] = wd
1484
1465
  return wd
@@ -1516,6 +1497,35 @@ class ColumnHeaders(tk.Canvas):
1516
1497
  self.current_height,
1517
1498
  )
1518
1499
  top = self.canvasy(0)
1500
+
1501
+ if (self.ops.show_vertical_grid or self.width_resizing_enabled) and col_pos_exists:
1502
+ yend = self.current_height - 5
1503
+ points = [
1504
+ x_stop - 1,
1505
+ self.current_height - 1,
1506
+ scrollpos_left - 1,
1507
+ self.current_height - 1,
1508
+ scrollpos_left - 1,
1509
+ -1,
1510
+ ]
1511
+ for c in range(grid_start_col, grid_end_col):
1512
+ draw_x = self.MT.col_positions[c]
1513
+ if c and self.width_resizing_enabled:
1514
+ self.visible_col_dividers[c] = (draw_x - 2, 1, draw_x + 2, yend)
1515
+ points.extend(
1516
+ (
1517
+ draw_x,
1518
+ -1,
1519
+ draw_x,
1520
+ self.current_height,
1521
+ draw_x,
1522
+ -1,
1523
+ self.MT.col_positions[c + 1] if len(self.MT.col_positions) - 1 > c else draw_x,
1524
+ -1,
1525
+ )
1526
+ )
1527
+ self.redraw_gridline(points=points, fill=self.ops.header_grid_fg, width=1)
1528
+
1519
1529
  sel_cols_bg = (
1520
1530
  self.ops.header_selected_cells_bg
1521
1531
  if self.ops.header_selected_cells_bg.startswith("#")
@@ -1552,13 +1562,13 @@ class ColumnHeaders(tk.Canvas):
1552
1562
  else:
1553
1563
  align = self.align
1554
1564
  if kwargs:
1555
- max_width = crightgridln - cleftgridln - txt_h - 2
1556
- if align.endswith("w"):
1565
+ max_width = crightgridln - cleftgridln - txt_h - 5
1566
+ if align[-1] == "w":
1557
1567
  draw_x = cleftgridln + 2
1558
- elif align.endswith("e"):
1568
+ elif align[-1] == "e":
1559
1569
  draw_x = crightgridln - 5 - txt_h
1560
- elif align.endswith("n"):
1561
- draw_x = cleftgridln + ceil((crightgridln - cleftgridln - txt_h) / 2)
1570
+ elif align[-1] == "n":
1571
+ draw_x = cleftgridln + (crightgridln - cleftgridln - txt_h) / 2
1562
1572
  self.redraw_dropdown(
1563
1573
  cleftgridln,
1564
1574
  0,
@@ -1566,25 +1576,24 @@ class ColumnHeaders(tk.Canvas):
1566
1576
  self.current_height - 1,
1567
1577
  fill=fill if kwargs["state"] != "disabled" else self.ops.header_grid_fg,
1568
1578
  outline=fill,
1569
- tag="dd",
1570
1579
  draw_outline=not dd_drawn,
1571
1580
  draw_arrow=max_width >= 5,
1572
1581
  open_=dd_coords == c,
1573
1582
  )
1574
1583
  else:
1575
1584
  max_width = crightgridln - cleftgridln - 2
1576
- if align.endswith("w"):
1585
+ if align[-1] == "w":
1577
1586
  draw_x = cleftgridln + 2
1578
- elif align.endswith("e"):
1587
+ elif align[-1] == "e":
1579
1588
  draw_x = crightgridln - 2
1580
- elif align.endswith("n"):
1581
- draw_x = cleftgridln + floor((crightgridln - cleftgridln) / 2)
1589
+ elif align[-1] == "n":
1590
+ draw_x = cleftgridln + (crightgridln - cleftgridln) / 2
1582
1591
  if (kwargs := self.get_cell_kwargs(datacn, key="checkbox")) and max_width > txt_h + 1:
1583
1592
  box_w = txt_h + 1
1584
- if align.endswith("w"):
1593
+ if align[-1] == "w":
1585
1594
  draw_x += box_w + 3
1586
- elif align.endswith("n"):
1587
- draw_x += ceil(box_w / 2) + 1
1595
+ elif align[-1] == "n":
1596
+ draw_x += box_w / 2 + 1
1588
1597
  max_width -= box_w + 4
1589
1598
  try:
1590
1599
  draw_check = (
@@ -1601,35 +1610,34 @@ class ColumnHeaders(tk.Canvas):
1601
1610
  txt_h + 3,
1602
1611
  fill=fill if kwargs["state"] == "normal" else self.ops.header_grid_fg,
1603
1612
  outline="",
1604
- tag="cb",
1605
1613
  draw_check=draw_check,
1606
1614
  )
1607
1615
  if (
1608
1616
  max_width < self.MT.header_txt_width
1609
- or (align.endswith("w") and draw_x > scrollpos_right)
1610
- or (align.endswith("e") and cleftgridln + 5 > scrollpos_right)
1611
- or (align.endswith("n") and cleftgridln + 5 > scrollpos_right)
1617
+ or (align[-1] == "w" and draw_x > scrollpos_right)
1618
+ or (align[-1] == "e" and cleftgridln + 5 > scrollpos_right)
1619
+ or (align[-1] == "n" and cleftgridln + 5 > scrollpos_right)
1612
1620
  ):
1613
1621
  continue
1614
1622
  text = self.cell_str(datacn, fix=False)
1615
1623
  if not text:
1616
1624
  continue
1617
- max_lines = int((self.current_height - top - 2) / txt_h)
1618
- for wrapped in wrap_text(
1625
+ gen_lines = wrap_text(
1619
1626
  text=text,
1620
1627
  max_width=max_width,
1621
- max_lines=max_lines,
1628
+ max_lines=int((self.current_height - top - 2) / txt_h),
1622
1629
  char_width_fn=self.wrap_get_char_w,
1623
1630
  widths=self.MT.char_widths[font],
1624
1631
  wrap=wrap,
1625
- ):
1632
+ )
1633
+ if align[-1] == "w" or align[-1] == "e":
1626
1634
  if self.hidd_text:
1627
1635
  iid, showing = self.hidd_text.popitem()
1628
1636
  self.coords(iid, draw_x, draw_y)
1629
1637
  if showing:
1630
1638
  self.itemconfig(
1631
1639
  iid,
1632
- text=wrapped,
1640
+ text="\n".join(gen_lines),
1633
1641
  fill=fill,
1634
1642
  font=font,
1635
1643
  anchor=align,
@@ -1637,7 +1645,7 @@ class ColumnHeaders(tk.Canvas):
1637
1645
  else:
1638
1646
  self.itemconfig(
1639
1647
  iid,
1640
- text=wrapped,
1648
+ text="\n".join(gen_lines),
1641
1649
  fill=fill,
1642
1650
  font=font,
1643
1651
  anchor=align,
@@ -1647,47 +1655,54 @@ class ColumnHeaders(tk.Canvas):
1647
1655
  iid = self.create_text(
1648
1656
  draw_x,
1649
1657
  draw_y,
1650
- text=wrapped,
1658
+ text="\n".join(gen_lines),
1651
1659
  fill=fill,
1652
1660
  font=font,
1653
1661
  anchor=align,
1654
- tags="t",
1662
+ tag="lift",
1655
1663
  )
1656
1664
  self.disp_text[iid] = True
1657
- draw_y += self.MT.header_txt_height
1658
- yend = self.current_height - 5
1659
- if (self.ops.show_vertical_grid or self.width_resizing_enabled) and col_pos_exists:
1660
- points = [
1661
- x_stop - 1,
1662
- self.current_height - 1,
1663
- scrollpos_left - 1,
1664
- self.current_height - 1,
1665
- scrollpos_left - 1,
1666
- -1,
1667
- ]
1668
- for c in range(grid_start_col, grid_end_col):
1669
- draw_x = self.MT.col_positions[c]
1670
- if c and self.width_resizing_enabled:
1671
- self.visible_col_dividers[c] = (draw_x - 2, 1, draw_x + 2, yend)
1672
- points.extend(
1673
- (
1674
- draw_x,
1675
- -1,
1676
- draw_x,
1677
- self.current_height,
1678
- draw_x,
1679
- -1,
1680
- self.MT.col_positions[c + 1] if len(self.MT.col_positions) - 1 > c else draw_x,
1681
- -1,
1682
- )
1683
- )
1684
- self.redraw_gridline(points=points, fill=self.ops.header_grid_fg, width=1, tag="v")
1665
+ else:
1666
+ for line in gen_lines:
1667
+ if self.hidd_text:
1668
+ iid, showing = self.hidd_text.popitem()
1669
+ self.coords(iid, draw_x, draw_y)
1670
+ if showing:
1671
+ self.itemconfig(
1672
+ iid,
1673
+ text=line,
1674
+ fill=fill,
1675
+ font=font,
1676
+ anchor=align,
1677
+ )
1678
+ else:
1679
+ self.itemconfig(
1680
+ iid,
1681
+ text=line,
1682
+ fill=fill,
1683
+ font=font,
1684
+ anchor=align,
1685
+ state="normal",
1686
+ )
1687
+ else:
1688
+ iid = self.create_text(
1689
+ draw_x,
1690
+ draw_y,
1691
+ text=line,
1692
+ fill=fill,
1693
+ font=font,
1694
+ anchor=align,
1695
+ tag="lift",
1696
+ )
1697
+ self.disp_text[iid] = True
1698
+ draw_y += self.MT.header_txt_height
1699
+
1685
1700
  for dct in (self.hidd_text, self.hidd_high, self.hidd_grid, self.hidd_dropdown, self.hidd_checkbox):
1686
1701
  for iid, showing in dct.items():
1687
1702
  if showing:
1688
1703
  self.itemconfig(iid, state="hidden")
1689
1704
  dct[iid] = False
1690
- self.tag_raise("t")
1705
+ self.tag_raise("lift")
1691
1706
  if self.disp_resize_lines:
1692
1707
  self.tag_raise("rw")
1693
1708
  return True
@@ -317,6 +317,8 @@ class FindWindow(tk.Frame):
317
317
  return "break"
318
318
 
319
319
  def focus_replace(self, event: tk.Misc = None) -> Literal["break"]:
320
+ if self.replace_enabled and not self.replace_visible:
321
+ self.toggle_replace_window()
320
322
  widget = self.focus_get()
321
323
  if widget == self.replace_tktext:
322
324
  self.replace_tktext.select_all()
@@ -793,6 +793,11 @@ def move_elements_by_mapping_gen(
793
793
  return (seq[old_idxs[i]] if i in old_idxs else next(remaining_values) for i in range(len(seq)))
794
794
 
795
795
 
796
+ def move_fast(seq: list[Any], new_idxs: dict[int, int], old_idxs: dict[int, int]) -> list[Any]:
797
+ remaining_values = (e for i, e in enumerate(seq) if i not in new_idxs)
798
+ return [seq[old_idxs[i]] if i in old_idxs else next(remaining_values) for i in range(len(seq))]
799
+
800
+
796
801
  def move_elements_to(
797
802
  seq: list[Any],
798
803
  move_to: int,
@@ -819,10 +824,17 @@ def get_new_indexes(
819
824
  returns {old idx: new idx, ...}
820
825
  """
821
826
  offset = sum(1 for i in to_move if i < move_to)
822
- new_idxs = dict(zip(to_move, range(move_to - offset, move_to - offset + len(to_move))))
823
- if get_inverse:
824
- return new_idxs, dict(zip(new_idxs.values(), new_idxs))
825
- return new_idxs
827
+ correct_move_to = move_to - offset
828
+ if not get_inverse:
829
+ return {elem: correct_move_to + i for i, elem in enumerate(to_move)}
830
+ else:
831
+ new_idxs = {}
832
+ old_idxs = {}
833
+ for i, elem in enumerate(to_move):
834
+ value = correct_move_to + i
835
+ new_idxs[elem] = value
836
+ old_idxs[value] = elem
837
+ return new_idxs, old_idxs
826
838
 
827
839
 
828
840
  def insert_items(
@@ -833,7 +845,7 @@ def insert_items(
833
845
  """
834
846
  seq: list[Any]
835
847
  to_insert: keys are ints sorted, representing list indexes to insert items.
836
- Values are any, e.g. {1: 200, 0: 200}
848
+ Values are any, e.g. {0: 200, 1: 200}
837
849
  """
838
850
  if to_insert:
839
851
  if seq_len_func and next(reversed(to_insert)) >= len(seq) + len(to_insert):