tksheet 7.4.18__py3-none-any.whl → 7.4.19__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 CHANGED
@@ -4,7 +4,7 @@
4
4
  tksheet - A Python tkinter table widget
5
5
  """
6
6
 
7
- __version__ = "7.4.18"
7
+ __version__ = "7.4.19"
8
8
 
9
9
  from .colors import (
10
10
  color_map,
tksheet/column_headers.py CHANGED
@@ -4,7 +4,7 @@ import tkinter as tk
4
4
  from collections import defaultdict
5
5
  from collections.abc import Callable, Hashable, Iterator, Sequence
6
6
  from functools import partial
7
- from itertools import cycle, islice, repeat
7
+ from itertools import islice, repeat
8
8
  from math import ceil
9
9
  from operator import itemgetter
10
10
  from typing import Any, Literal
@@ -54,11 +54,10 @@ class ColumnHeaders(tk.Canvas):
54
54
  self.MT = None # is set from within MainTable() __init__
55
55
  self.RI: RowIndex | None = None # is set from within MainTable() __init__
56
56
  self.TL = None # is set from within TopLeftRectangle() __init__
57
+ self.current_cursor = ""
57
58
  self.popup_menu_loc = None
58
59
  self.extra_begin_edit_cell_func = None
59
60
  self.extra_end_edit_cell_func = None
60
- self.centre_alignment_text_mod_indexes = (slice(1, None), slice(None, -1))
61
- self.c_align_cyc = cycle(self.centre_alignment_text_mod_indexes)
62
61
  self.b1_pressed_loc = None
63
62
  self.closed_dropdown = None
64
63
  self.being_drawn_item = None
@@ -332,9 +331,9 @@ class ColumnHeaders(tk.Canvas):
332
331
  c = self.check_mouse_position_width_resizers(x, y)
333
332
  if c is not None:
334
333
  self.rsz_w, mouse_over_resize = c, True
335
- if self.MT.current_cursor != "sb_h_double_arrow":
334
+ if self.current_cursor != "sb_h_double_arrow":
336
335
  self.config(cursor="sb_h_double_arrow")
337
- self.MT.current_cursor = "sb_h_double_arrow"
336
+ self.current_cursor = "sb_h_double_arrow"
338
337
  else:
339
338
  self.rsz_w = None
340
339
  if self.height_resizing_enabled and not mouse_over_resize:
@@ -347,20 +346,23 @@ class ColumnHeaders(tk.Canvas):
347
346
  )
348
347
  if x >= x1 and y >= y1 and x <= x2 and y <= y2:
349
348
  self.rsz_h, mouse_over_resize = True, True
350
- if self.MT.current_cursor != "sb_v_double_arrow":
349
+ if self.current_cursor != "sb_v_double_arrow":
351
350
  self.config(cursor="sb_v_double_arrow")
352
- self.MT.current_cursor = "sb_v_double_arrow"
351
+ self.current_cursor = "sb_v_double_arrow"
353
352
  else:
354
353
  self.rsz_h = None
355
354
  except Exception:
356
355
  self.rsz_h = None
357
356
  if not mouse_over_resize and self.MT.col_selected(self.MT.identify_col(event, allow_end=False)):
358
357
  mouse_over_selected = True
359
- if self.MT.current_cursor != "hand2":
358
+ if self.current_cursor != "hand2":
360
359
  self.config(cursor="hand2")
361
- self.MT.current_cursor = "hand2"
360
+ self.current_cursor = "hand2"
362
361
  if not mouse_over_resize and not mouse_over_selected:
363
- self.MT.reset_mouse_motion_creations()
362
+ if self.current_cursor != "":
363
+ self.config(cursor="")
364
+ self.current_cursor = ""
365
+ self.MT.reset_resize_vars()
364
366
  try_binding(self.extra_motion_func, event)
365
367
 
366
368
  def double_b1(self, event: Any) -> None:
tksheet/main_table.py CHANGED
@@ -7,7 +7,7 @@ from bisect import bisect_left, bisect_right
7
7
  from collections import defaultdict, deque
8
8
  from collections.abc import Callable, Generator, Hashable, Iterator, Sequence
9
9
  from functools import partial
10
- from itertools import accumulate, chain, cycle, filterfalse, islice, repeat
10
+ from itertools import accumulate, chain, filterfalse, islice, repeat
11
11
  from operator import itemgetter
12
12
  from re import IGNORECASE, escape, sub
13
13
  from tkinter import TclError
@@ -130,8 +130,6 @@ class MainTable(tk.Canvas):
130
130
  self.ctrl_b1_pressed = False
131
131
  self.b1_pressed_loc = None
132
132
  self.closed_dropdown = None
133
- self.centre_alignment_text_mod_indexes = (slice(1, None), slice(None, -1))
134
- self.c_align_cyc = cycle(self.centre_alignment_text_mod_indexes)
135
133
  self.allow_auto_resize_columns = True
136
134
  self.allow_auto_resize_rows = True
137
135
  self.span = self.PAR.span
@@ -1390,25 +1388,25 @@ class MainTable(tk.Canvas):
1390
1388
  )
1391
1389
  selboxr = selected_r + new_data_numrows if added_rows else selected_r_adjusted_new_data_numrows
1392
1390
  selboxc = selected_c + new_data_numcols if added_cols else selected_c_adjusted_new_data_numcols
1393
- self.deselect("all", redraw=False)
1394
- self.set_currently_selected(
1395
- *curr_coords,
1396
- item=self.create_selection_box(
1397
- selected_r,
1398
- selected_c,
1399
- selboxr,
1400
- selboxc,
1401
- type_="cells",
1402
- set_current=False,
1403
- run_binding=True,
1404
- ),
1405
- )
1406
- event_data["selection_boxes"] = self.get_boxes()
1407
- event_data["selected"] = self.selected
1408
- self.see(selected_r, selected_c, redraw=False)
1409
- self.refresh()
1410
1391
  event_data = self.bulk_edit_validation(event_data)
1411
1392
  if event_data["cells"]["table"] or event_data["added"]["rows"] or event_data["added"]["columns"]:
1393
+ self.deselect("all", redraw=False)
1394
+ self.set_currently_selected(
1395
+ *curr_coords,
1396
+ item=self.create_selection_box(
1397
+ selected_r,
1398
+ selected_c,
1399
+ selboxr,
1400
+ selboxc,
1401
+ type_="cells",
1402
+ set_current=False,
1403
+ run_binding=True,
1404
+ ),
1405
+ )
1406
+ event_data["selection_boxes"] = self.get_boxes()
1407
+ event_data["selected"] = self.selected
1408
+ self.see(selected_r, selected_c, redraw=False)
1409
+ self.refresh()
1412
1410
  if self.undo_enabled:
1413
1411
  self.undo_stack.append(stored_event_dict(event_data))
1414
1412
  try_binding(self.extra_end_ctrl_v_func, event_data, "end_ctrl_v")
@@ -3554,19 +3552,17 @@ class MainTable(tk.Canvas):
3554
3552
  for binding in self.PAR.ops[bindings_key]:
3555
3553
  widget.unbind(binding)
3556
3554
 
3557
- def reset_mouse_motion_creations(self) -> None:
3558
- if self.current_cursor != "":
3559
- self.config(cursor="")
3560
- self.RI.config(cursor="")
3561
- self.CH.config(cursor="")
3562
- self.current_cursor = ""
3555
+ def reset_resize_vars(self) -> None:
3563
3556
  self.RI.rsz_w = None
3564
3557
  self.RI.rsz_h = None
3565
3558
  self.CH.rsz_w = None
3566
3559
  self.CH.rsz_h = None
3567
3560
 
3568
3561
  def mouse_motion(self, event: Any) -> None:
3569
- self.reset_mouse_motion_creations()
3562
+ if self.current_cursor != "":
3563
+ self.config(cursor="")
3564
+ self.current_cursor = ""
3565
+ self.reset_resize_vars()
3570
3566
  try_binding(self.extra_motion_func, event)
3571
3567
 
3572
3568
  def not_currently_resizing(self) -> bool:
tksheet/row_index.py CHANGED
@@ -5,7 +5,7 @@ from collections import defaultdict
5
5
  from collections.abc import Callable, Generator, Hashable, Iterator, Sequence
6
6
  from contextlib import suppress
7
7
  from functools import partial
8
- from itertools import cycle, islice, repeat
8
+ from itertools import islice, repeat
9
9
  from math import ceil
10
10
  from re import findall
11
11
  from typing import Any, Literal
@@ -56,6 +56,7 @@ class RowIndex(tk.Canvas):
56
56
  self.MT = None # is set from within MainTable() __init__
57
57
  self.CH = None # is set from within MainTable() __init__
58
58
  self.TL = None # is set from within TopLeftRectangle() __init__
59
+ self.current_cursor = ""
59
60
  self.new_iid_ctr = -1
60
61
  self.current_width = None
61
62
  self.popup_menu_loc = None
@@ -63,8 +64,6 @@ class RowIndex(tk.Canvas):
63
64
  self.extra_end_edit_cell_func = None
64
65
  self.b1_pressed_loc = None
65
66
  self.closed_dropdown = None
66
- self.centre_alignment_text_mod_indexes = (slice(1, None), slice(None, -1))
67
- self.c_align_cyc = cycle(self.centre_alignment_text_mod_indexes)
68
67
  self.being_drawn_item = None
69
68
  self.extra_motion_func = None
70
69
  self.extra_b1_press_func = None
@@ -328,9 +327,9 @@ class RowIndex(tk.Canvas):
328
327
  r = self.check_mouse_position_height_resizers(x, y)
329
328
  if r is not None:
330
329
  self.rsz_h, mouse_over_resize = r, True
331
- if self.MT.current_cursor != "sb_v_double_arrow":
330
+ if self.current_cursor != "sb_v_double_arrow":
332
331
  self.config(cursor="sb_v_double_arrow")
333
- self.MT.current_cursor = "sb_v_double_arrow"
332
+ self.current_cursor = "sb_v_double_arrow"
334
333
  else:
335
334
  self.rsz_h = None
336
335
  if (
@@ -352,20 +351,23 @@ class RowIndex(tk.Canvas):
352
351
  )
353
352
  if x >= x1 and y >= y1 and x <= x2 and y <= y2:
354
353
  self.rsz_w, mouse_over_resize = True, True
355
- if self.MT.current_cursor != "sb_h_double_arrow":
354
+ if self.current_cursor != "sb_h_double_arrow":
356
355
  self.config(cursor="sb_h_double_arrow")
357
- self.MT.current_cursor = "sb_h_double_arrow"
356
+ self.current_cursor = "sb_h_double_arrow"
358
357
  else:
359
358
  self.rsz_w = None
360
359
  except Exception:
361
360
  self.rsz_w = None
362
361
  if not mouse_over_resize and self.MT.row_selected(self.MT.identify_row(event, allow_end=False)):
363
362
  mouse_over_selected = True
364
- if self.MT.current_cursor != "hand2":
363
+ if self.current_cursor != "hand2":
365
364
  self.config(cursor="hand2")
366
- self.MT.current_cursor = "hand2"
365
+ self.current_cursor = "hand2"
367
366
  if not mouse_over_resize and not mouse_over_selected:
368
- self.MT.reset_mouse_motion_creations()
367
+ if self.current_cursor != "":
368
+ self.config(cursor="")
369
+ self.current_cursor = ""
370
+ self.MT.reset_resize_vars()
369
371
  try_binding(self.extra_motion_func, event)
370
372
 
371
373
  def double_b1(self, event: Any):
tksheet/sheet.py CHANGED
@@ -328,6 +328,7 @@ class Sheet(tk.Frame):
328
328
  if treeview:
329
329
  index_align = "w"
330
330
  auto_resize_row_index = True
331
+ paste_can_expand_y = False
331
332
  for k, v in locals().items():
332
333
  if (xk := backwards_compatibility_keys.get(k, k)) in self.ops and v != self.ops[xk]:
333
334
  self.ops[xk] = v
@@ -4182,6 +4183,7 @@ class Sheet(tk.Frame):
4182
4183
  self.MT.create_rc_menus()
4183
4184
  if "treeview" in kwargs:
4184
4185
  self.index_align("nw", redraw=False)
4186
+ self.ops.paste_can_expand_y = False
4185
4187
  return self.set_refresh_timer(redraw)
4186
4188
 
4187
4189
  def set_scrollbar_options(self) -> Sheet:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tksheet
3
- Version: 7.4.18
3
+ Version: 7.4.19
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
@@ -1,22 +1,22 @@
1
- tksheet/__init__.py,sha256=KzVp7ncwHA5rEgQ25NL2YzAyUIXskxZE-NXVco4xyCw,2327
1
+ tksheet/__init__.py,sha256=r1MtaXM6JEo-rMgHtcZzUmw19x_-Qwh5pkXaZQ6qjHo,2327
2
2
  tksheet/colors.py,sha256=dHhmdFuQDlwohDHsAfT9VdrKoSl_R33L72a3HCin5zo,51591
3
- tksheet/column_headers.py,sha256=POoLTtR8qvrRYJl1c7WMc6UiDxfoNxhLUC2ikcEzt1M,103446
3
+ tksheet/column_headers.py,sha256=m00q9bPwaGqVtBB5unr8N8Ezw4yfEoi-zDWkDQaLwlg,103423
4
4
  tksheet/constants.py,sha256=aiDvUSaPtl_TSNtRRJ_p87c9iTBz9ksMd5IsSXzz4Hk,13316
5
5
  tksheet/find_window.py,sha256=w6S0FZFLRNHiM57Oq97avALT_PctIBPegSxnkNUwkwk,19982
6
6
  tksheet/formatters.py,sha256=DGcRiMsDJnySNpQcjfiX84oJ7TmOSMdU6u9injIhA4g,10095
7
7
  tksheet/functions.py,sha256=qks2dLqBE9GMAuEXaA4qiU-rrL-dzmz4-tkmkp6_ETk,53037
8
- tksheet/main_table.py,sha256=TLhm9kwmOmEAoA06ey37Jdm3e579JOUMMLJxdaYfj60,367118
8
+ tksheet/main_table.py,sha256=ejszte92ogu0uPCvzJJKaXC8VYUVDvh0etPDQL2lK8E,366921
9
9
  tksheet/other_classes.py,sha256=B2SrUAviztDUOPGoWkcu-AixqAaKwItshoVZPGe1_Tc,16662
10
- tksheet/row_index.py,sha256=a0W78zqZIXVxfzyF5yYfXu1iUXnnDcK0ESodLl6joiA,141720
11
- tksheet/sheet.py,sha256=MRk0Q_LzX_VjJnTVWq3bgIRRF4FrDChS2uFHqHTAZEE,269796
10
+ tksheet/row_index.py,sha256=dk1hEZNzsYJ4QzHXWYF4wJhZD2EZ3taxjXsrC0gzC1A,141697
11
+ tksheet/sheet.py,sha256=GauQYaET1NTadIo9jvNhXy-sw8kIiHEc86WsSXIfTPY,269885
12
12
  tksheet/sheet_options.py,sha256=ob-XYgGfBoi2TaFAvUUmlWUkw9xB-yXmJw17gu9__Lw,9948
13
13
  tksheet/sorting.py,sha256=zcZPpRtP1h_xJGtGkG3E43H7deKQFnh9cMwZ1B2-aGc,17502
14
14
  tksheet/text_editor.py,sha256=rU8Fz0-ltkM63W9io2DoZJPyzUGzCc9Z0qBtc4D1H40,7404
15
15
  tksheet/themes.py,sha256=AoNAxibnQi04MN0Zpbn9-kyDnkiiV8TDNWP9FYjpuf0,18473
16
16
  tksheet/tksheet_types.py,sha256=1MjXR34EmvP1KfHlLTvKKVnf0VMz_LU_WOM2q4o5hfI,4598
17
17
  tksheet/top_left_rectangle.py,sha256=M52IrPIeMoYE3jSpooZmqw_0W5Fz_R-Yu1ZqA685EZ8,8557
18
- tksheet-7.4.18.dist-info/licenses/LICENSE.txt,sha256=ndbcCPe9SlHfweE_W2RAueWUe2k7yudyxYLq6WjFdn4,1101
19
- tksheet-7.4.18.dist-info/METADATA,sha256=GNx2NJ-qfa0PEE1mxFbSR92Maq3yUMQpqRygY2ks19Y,8117
20
- tksheet-7.4.18.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
21
- tksheet-7.4.18.dist-info/top_level.txt,sha256=my61PXCcck_HHAc9cq3NAlyAr3A3FXxCy9gptEOaCN8,8
22
- tksheet-7.4.18.dist-info/RECORD,,
18
+ tksheet-7.4.19.dist-info/licenses/LICENSE.txt,sha256=ndbcCPe9SlHfweE_W2RAueWUe2k7yudyxYLq6WjFdn4,1101
19
+ tksheet-7.4.19.dist-info/METADATA,sha256=kVnj5walRR-WcaI-O5JO1qJoj1p1mdfGOcLSyIPa2h0,8117
20
+ tksheet-7.4.19.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
21
+ tksheet-7.4.19.dist-info/top_level.txt,sha256=my61PXCcck_HHAc9cq3NAlyAr3A3FXxCy9gptEOaCN8,8
22
+ tksheet-7.4.19.dist-info/RECORD,,