tksheet 7.4.18__py3-none-any.whl → 7.4.20__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.20"
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
@@ -327,14 +326,13 @@ class ColumnHeaders(tk.Canvas):
327
326
  x = self.canvasx(event.x)
328
327
  y = self.canvasy(event.y)
329
328
  mouse_over_resize = False
330
- mouse_over_selected = False
331
329
  if self.width_resizing_enabled:
332
330
  c = self.check_mouse_position_width_resizers(x, y)
333
331
  if c is not None:
334
332
  self.rsz_w, mouse_over_resize = c, True
335
- if self.MT.current_cursor != "sb_h_double_arrow":
333
+ if self.current_cursor != "sb_h_double_arrow":
336
334
  self.config(cursor="sb_h_double_arrow")
337
- self.MT.current_cursor = "sb_h_double_arrow"
335
+ self.current_cursor = "sb_h_double_arrow"
338
336
  else:
339
337
  self.rsz_w = None
340
338
  if self.height_resizing_enabled and not mouse_over_resize:
@@ -347,20 +345,23 @@ class ColumnHeaders(tk.Canvas):
347
345
  )
348
346
  if x >= x1 and y >= y1 and x <= x2 and y <= y2:
349
347
  self.rsz_h, mouse_over_resize = True, True
350
- if self.MT.current_cursor != "sb_v_double_arrow":
348
+ if self.current_cursor != "sb_v_double_arrow":
351
349
  self.config(cursor="sb_v_double_arrow")
352
- self.MT.current_cursor = "sb_v_double_arrow"
350
+ self.current_cursor = "sb_v_double_arrow"
353
351
  else:
354
352
  self.rsz_h = None
355
353
  except Exception:
356
354
  self.rsz_h = None
357
- if not mouse_over_resize and self.MT.col_selected(self.MT.identify_col(event, allow_end=False)):
358
- mouse_over_selected = True
359
- if self.MT.current_cursor != "hand2":
360
- self.config(cursor="hand2")
361
- self.MT.current_cursor = "hand2"
362
- if not mouse_over_resize and not mouse_over_selected:
363
- self.MT.reset_mouse_motion_creations()
355
+ if not mouse_over_resize:
356
+ if self.MT.col_selected(self.MT.identify_col(event, allow_end=False)):
357
+ if self.current_cursor != "hand2":
358
+ self.config(cursor="hand2")
359
+ self.current_cursor = "hand2"
360
+ else:
361
+ if self.current_cursor != "":
362
+ self.config(cursor="")
363
+ self.current_cursor = ""
364
+ self.MT.reset_resize_vars()
364
365
  try_binding(self.extra_motion_func, event)
365
366
 
366
367
  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
@@ -387,8 +385,8 @@ class MainTable(tk.Canvas):
387
385
 
388
386
  def basic_bindings(self, enable: bool = True) -> None:
389
387
  bindings = (
388
+ ("<Enter>", self, self.mouse_motion),
390
389
  ("<Configure>", self, self.window_configured),
391
- ("<Motion>", self, self.mouse_motion),
392
390
  ("<ButtonPress-1>", self, self.b1_press),
393
391
  ("<B1-Motion>", self, self.b1_motion),
394
392
  ("<ButtonRelease-1>", self, self.b1_release),
@@ -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,16 @@ 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
+ self.config(cursor="")
3563
+ self.current_cursor = ""
3564
+ self.reset_resize_vars()
3570
3565
  try_binding(self.extra_motion_func, event)
3571
3566
 
3572
3567
  def not_currently_resizing(self) -> bool:
@@ -6187,7 +6182,7 @@ class MainTable(tk.Canvas):
6187
6182
  and can_width >= self.col_positions[-1] + self.PAR.ops.empty_horizontal
6188
6183
  and self.PAR.xscroll_showing
6189
6184
  ):
6190
- self.PAR.xscroll.grid_forget()
6185
+ self.PAR.xscroll.grid_remove()
6191
6186
  self.PAR.xscroll_showing = False
6192
6187
  elif (
6193
6188
  can_width < self.col_positions[-1] + self.PAR.ops.empty_horizontal
@@ -6195,10 +6190,10 @@ class MainTable(tk.Canvas):
6195
6190
  and not self.PAR.xscroll_disabled
6196
6191
  and can_height > 40
6197
6192
  ):
6198
- self.PAR.xscroll.grid(row=2, column=0, columnspan=2, sticky="nswe")
6193
+ self.PAR.xscroll.grid()
6199
6194
  self.PAR.xscroll_showing = True
6200
6195
  if can_height >= self.row_positions[-1] + self.PAR.ops.empty_vertical and self.PAR.yscroll_showing:
6201
- self.PAR.yscroll.grid_forget()
6196
+ self.PAR.yscroll.grid_remove()
6202
6197
  self.PAR.yscroll_showing = False
6203
6198
  elif (
6204
6199
  can_height < self.row_positions[-1] + self.PAR.ops.empty_vertical
@@ -6206,7 +6201,7 @@ class MainTable(tk.Canvas):
6206
6201
  and not self.PAR.yscroll_disabled
6207
6202
  and can_width > 40
6208
6203
  ):
6209
- self.PAR.yscroll.grid(row=0, column=2, rowspan=3, sticky="nswe")
6204
+ self.PAR.yscroll.grid()
6210
6205
  self.PAR.yscroll_showing = True
6211
6206
 
6212
6207
  def _overflow(
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
@@ -323,14 +322,13 @@ class RowIndex(tk.Canvas):
323
322
  x = self.canvasx(event.x)
324
323
  y = self.canvasy(event.y)
325
324
  mouse_over_resize = False
326
- mouse_over_selected = False
327
- if self.height_resizing_enabled and not mouse_over_resize:
325
+ if self.height_resizing_enabled:
328
326
  r = self.check_mouse_position_height_resizers(x, y)
329
327
  if r is not None:
330
328
  self.rsz_h, mouse_over_resize = r, True
331
- if self.MT.current_cursor != "sb_v_double_arrow":
329
+ if self.current_cursor != "sb_v_double_arrow":
332
330
  self.config(cursor="sb_v_double_arrow")
333
- self.MT.current_cursor = "sb_v_double_arrow"
331
+ self.current_cursor = "sb_v_double_arrow"
334
332
  else:
335
333
  self.rsz_h = None
336
334
  if (
@@ -352,23 +350,26 @@ class RowIndex(tk.Canvas):
352
350
  )
353
351
  if x >= x1 and y >= y1 and x <= x2 and y <= y2:
354
352
  self.rsz_w, mouse_over_resize = True, True
355
- if self.MT.current_cursor != "sb_h_double_arrow":
353
+ if self.current_cursor != "sb_h_double_arrow":
356
354
  self.config(cursor="sb_h_double_arrow")
357
- self.MT.current_cursor = "sb_h_double_arrow"
355
+ self.current_cursor = "sb_h_double_arrow"
358
356
  else:
359
357
  self.rsz_w = None
360
358
  except Exception:
361
359
  self.rsz_w = None
362
- if not mouse_over_resize and self.MT.row_selected(self.MT.identify_row(event, allow_end=False)):
363
- mouse_over_selected = True
364
- if self.MT.current_cursor != "hand2":
365
- self.config(cursor="hand2")
366
- self.MT.current_cursor = "hand2"
367
- if not mouse_over_resize and not mouse_over_selected:
368
- self.MT.reset_mouse_motion_creations()
360
+ if not mouse_over_resize:
361
+ if self.MT.row_selected(self.MT.identify_row(event, allow_end=False)):
362
+ if self.current_cursor != "hand2":
363
+ self.config(cursor="hand2")
364
+ self.current_cursor = "hand2"
365
+ else:
366
+ if self.current_cursor != "":
367
+ self.config(cursor="")
368
+ self.current_cursor = ""
369
+ self.MT.reset_resize_vars()
369
370
  try_binding(self.extra_motion_func, event)
370
371
 
371
- def double_b1(self, event: Any):
372
+ def double_b1(self, event: Any) -> None:
372
373
  self.mouseclick_outside_editor_or_dropdown_all_canvases(inside=True)
373
374
  self.focus_set()
374
375
  if (
@@ -414,7 +415,7 @@ class RowIndex(tk.Canvas):
414
415
  self.mouse_motion(event)
415
416
  try_binding(self.extra_double_b1_func, event)
416
417
 
417
- def b1_press(self, event: Any):
418
+ def b1_press(self, event: Any) -> None:
418
419
  self.MT.unbind("<MouseWheel>")
419
420
  self.focus_set()
420
421
  self.closed_dropdown = self.mouseclick_outside_editor_or_dropdown_all_canvases(inside=True)
@@ -483,7 +484,7 @@ class RowIndex(tk.Canvas):
483
484
  self.toggle_select_row(r, redraw=True)
484
485
  try_binding(self.extra_b1_press_func, event)
485
486
 
486
- def b1_motion(self, event: Any):
487
+ def b1_motion(self, event: Any) -> None:
487
488
  x1, y1, x2, y2 = self.MT.get_canvas_visible_area()
488
489
  if self.height_resizing_enabled and self.rsz_h is not None and self.currently_resizing_height:
489
490
  y = self.canvasy(event.y)
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
@@ -445,7 +446,6 @@ class Sheet(tk.Frame):
445
446
  style=f"Sheet{self.unique_id}.Vertical.TScrollbar",
446
447
  )
447
448
  self.MT["yscrollcommand"] = self.yscroll.set
448
- self.RI["yscrollcommand"] = self.yscroll.set
449
449
  self.xscroll = ttk.Scrollbar(
450
450
  self,
451
451
  command=self.MT._xscrollbar,
@@ -453,7 +453,6 @@ class Sheet(tk.Frame):
453
453
  style=f"Sheet{self.unique_id}.Horizontal.TScrollbar",
454
454
  )
455
455
  self.MT["xscrollcommand"] = self.xscroll.set
456
- self.CH["xscrollcommand"] = self.xscroll.set
457
456
  self.show()
458
457
  if show_top_left is False or (show_top_left is None and (not show_row_index or not show_header)):
459
458
  self.hide("top_left")
@@ -4182,6 +4181,7 @@ class Sheet(tk.Frame):
4182
4181
  self.MT.create_rc_menus()
4183
4182
  if "treeview" in kwargs:
4184
4183
  self.index_align("nw", redraw=False)
4184
+ self.ops.paste_can_expand_y = False
4185
4185
  return self.set_refresh_timer(redraw)
4186
4186
 
4187
4187
  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.20
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=PpkbN7xCe4kL9f_ReQmjZFSjqrJtjldKtRMpIJXWnZM,2327
2
2
  tksheet/colors.py,sha256=dHhmdFuQDlwohDHsAfT9VdrKoSl_R33L72a3HCin5zo,51591
3
- tksheet/column_headers.py,sha256=POoLTtR8qvrRYJl1c7WMc6UiDxfoNxhLUC2ikcEzt1M,103446
3
+ tksheet/column_headers.py,sha256=cP0RImb-EgHdVLSfNmU42k5GwCol7akKgMH6xq1sZfY,103339
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=_VFoj01R4mS-m7JoDLG_36zkprweFGh0TYMalRRK4rE,366788
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=8zuNU00ATmz5oumEqSyB_nOUAIuCS23mUfTpq3R1WOM,141611
11
+ tksheet/sheet.py,sha256=MXt-ebQJVx-l4lozRqCxhivMMaCC7JpOD7wzfVj0rRk,269777
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.20.dist-info/licenses/LICENSE.txt,sha256=ndbcCPe9SlHfweE_W2RAueWUe2k7yudyxYLq6WjFdn4,1101
19
+ tksheet-7.4.20.dist-info/METADATA,sha256=esWuLkorvJ4si2jups_4X0Qrvg60SVupWtLRG1D89Og,8117
20
+ tksheet-7.4.20.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
21
+ tksheet-7.4.20.dist-info/top_level.txt,sha256=my61PXCcck_HHAc9cq3NAlyAr3A3FXxCy9gptEOaCN8,8
22
+ tksheet-7.4.20.dist-info/RECORD,,