tksheet 7.4.20__py3-none-any.whl → 7.4.21__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/functions.py +0 -2
- tksheet/main_table.py +5 -9
- tksheet/other_classes.py +40 -10
- tksheet/top_left_rectangle.py +3 -4
- {tksheet-7.4.20.dist-info → tksheet-7.4.21.dist-info}/METADATA +1 -1
- {tksheet-7.4.20.dist-info → tksheet-7.4.21.dist-info}/RECORD +10 -10
- {tksheet-7.4.20.dist-info → tksheet-7.4.21.dist-info}/WHEEL +1 -1
- {tksheet-7.4.20.dist-info → tksheet-7.4.21.dist-info}/licenses/LICENSE.txt +0 -0
- {tksheet-7.4.20.dist-info → tksheet-7.4.21.dist-info}/top_level.txt +0 -0
tksheet/__init__.py
CHANGED
tksheet/functions.py
CHANGED
@@ -2,7 +2,6 @@ from __future__ import annotations
|
|
2
2
|
|
3
3
|
import csv
|
4
4
|
import io
|
5
|
-
import pickle
|
6
5
|
import re
|
7
6
|
import tkinter as tk
|
8
7
|
from bisect import bisect_left
|
@@ -17,7 +16,6 @@ from .constants import align_value_error, symbols_set
|
|
17
16
|
from .formatters import to_bool
|
18
17
|
from .other_classes import DotDict, EventDataDict, Highlight, Loc, Span
|
19
18
|
|
20
|
-
unpickle_obj = pickle.loads
|
21
19
|
lines_re = re.compile(r"[^\n]+")
|
22
20
|
ORD_A = ord("A")
|
23
21
|
|
tksheet/main_table.py
CHANGED
@@ -73,7 +73,6 @@ from .functions import (
|
|
73
73
|
len_to_idx,
|
74
74
|
mod_event_val,
|
75
75
|
mod_span,
|
76
|
-
mod_span_widget,
|
77
76
|
move_elements_by_mapping_gen,
|
78
77
|
move_fast,
|
79
78
|
new_tk_event,
|
@@ -83,7 +82,6 @@ from .functions import (
|
|
83
82
|
span_idxs_post_move,
|
84
83
|
stored_event_dict,
|
85
84
|
try_binding,
|
86
|
-
unpickle_obj,
|
87
85
|
wrap_text,
|
88
86
|
)
|
89
87
|
from .other_classes import (
|
@@ -1528,7 +1526,7 @@ class MainTable(tk.Canvas):
|
|
1528
1526
|
"displayed": {} if disp_new_idxs is None else disp_new_idxs,
|
1529
1527
|
}
|
1530
1528
|
event_data["options"] = self.copy_options()
|
1531
|
-
event_data["named_spans"] = {k: span.
|
1529
|
+
event_data["named_spans"] = {k: span.copy_self() for k, span in self.named_spans.items()}
|
1532
1530
|
|
1533
1531
|
if move_widths and disp_new_idxs:
|
1534
1532
|
self.set_col_positions(
|
@@ -1787,7 +1785,7 @@ class MainTable(tk.Canvas):
|
|
1787
1785
|
"displayed": {} if disp_new_idxs is None else disp_new_idxs,
|
1788
1786
|
}
|
1789
1787
|
event_data["options"] = self.copy_options()
|
1790
|
-
event_data["named_spans"] = {k: span.
|
1788
|
+
event_data["named_spans"] = {k: span.copy_self() for k, span in self.named_spans.items()}
|
1791
1789
|
|
1792
1790
|
if move_data:
|
1793
1791
|
maxidx = len_to_idx(totalrows)
|
@@ -2081,9 +2079,7 @@ class MainTable(tk.Canvas):
|
|
2081
2079
|
if "tagged_columns" in modification["options"]:
|
2082
2080
|
self.tagged_columns = modification["options"]["tagged_columns"]
|
2083
2081
|
if modification["named_spans"]:
|
2084
|
-
self.named_spans =
|
2085
|
-
k: mod_span_widget(unpickle_obj(v), self.PAR) for k, v in modification["named_spans"].items()
|
2086
|
-
}
|
2082
|
+
self.named_spans = modification["named_spans"]
|
2087
2083
|
if modification["sheet_state"]:
|
2088
2084
|
self.RI.tree_open_ids = modification["sheet_state"]["tree_open_ids"]
|
2089
2085
|
self.row_positions = modification["sheet_state"]["row_positions"]
|
@@ -5467,7 +5463,7 @@ class MainTable(tk.Canvas):
|
|
5467
5463
|
if not event_data:
|
5468
5464
|
event_data = self.new_event_dict("delete_columns", state=True)
|
5469
5465
|
event_data["options"] = self.copy_options()
|
5470
|
-
event_data["named_spans"] = {k: span.
|
5466
|
+
event_data["named_spans"] = {k: span.copy_self() for k, span in self.named_spans.items()}
|
5471
5467
|
for i, datacn in enumerate(cols):
|
5472
5468
|
for rn in range(len(self.data)):
|
5473
5469
|
if datacn not in event_data["deleted"]["columns"]:
|
@@ -5557,7 +5553,7 @@ class MainTable(tk.Canvas):
|
|
5557
5553
|
if not event_data:
|
5558
5554
|
event_data = self.new_event_dict("delete_rows", state=True)
|
5559
5555
|
event_data["options"] = self.copy_options()
|
5560
|
-
event_data["named_spans"] = {k: span.
|
5556
|
+
event_data["named_spans"] = {k: span.copy_self() for k, span in self.named_spans.items()}
|
5561
5557
|
|
5562
5558
|
for i, datarn in enumerate(rows):
|
5563
5559
|
event_data["deleted"]["rows"][datarn] = self.data.pop(datarn - i)
|
tksheet/other_classes.py
CHANGED
@@ -1,14 +1,11 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
|
-
import
|
3
|
+
import copy
|
4
4
|
import tkinter as tk
|
5
5
|
from collections import namedtuple
|
6
6
|
from collections.abc import Callable, Hashable, Iterator
|
7
|
-
from functools import partial
|
8
7
|
from typing import Any, Literal
|
9
8
|
|
10
|
-
pickle_obj = partial(pickle.dumps, protocol=pickle.HIGHEST_PROTOCOL)
|
11
|
-
|
12
9
|
FontTuple = namedtuple("FontTuple", "family size style")
|
13
10
|
Box_nt = namedtuple(
|
14
11
|
"Box_nt",
|
@@ -423,12 +420,45 @@ class Span(dict):
|
|
423
420
|
cols = self.columns
|
424
421
|
return Box_nt(rows.from_, cols.from_, rows.upto_, cols.upto_)
|
425
422
|
|
426
|
-
def
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
423
|
+
def copy_self(self) -> "Span":
|
424
|
+
# Create a new Span instance
|
425
|
+
span = Span()
|
426
|
+
|
427
|
+
# Iterate over all dictionary items to capture all attributes
|
428
|
+
for key, value in self.items():
|
429
|
+
if key == "widget":
|
430
|
+
# Tkinter widget: retain reference (do not copy)
|
431
|
+
span[key] = value
|
432
|
+
elif key == "kwargs":
|
433
|
+
# Handle kwargs, which may contain functions or lambdas
|
434
|
+
span[key] = {}
|
435
|
+
for k, v in value.items():
|
436
|
+
if callable(v):
|
437
|
+
# Functions/lambdas: shallow copy (immutable, but check for safety)
|
438
|
+
span[key][k] = v
|
439
|
+
else:
|
440
|
+
try:
|
441
|
+
# Deep copy non-callable items in kwargs
|
442
|
+
span[key][k] = copy.deepcopy(v)
|
443
|
+
except (TypeError, AttributeError):
|
444
|
+
# Handle non-copyable objects (e.g., complex closures or objects)
|
445
|
+
span[key][k] = v # Fallback to shallow copy
|
446
|
+
elif key == "convert" and callable(value):
|
447
|
+
# Convert is a callable: shallow copy (immutable)
|
448
|
+
span[key] = value
|
449
|
+
else:
|
450
|
+
# Deep copy other values to handle nested objects like DotDict
|
451
|
+
try:
|
452
|
+
span[key] = copy.deepcopy(value)
|
453
|
+
except (TypeError, AttributeError):
|
454
|
+
# Fallback for non-copyable objects
|
455
|
+
span[key] = value # Shallow copy as fallback
|
456
|
+
|
457
|
+
# Ensure widget is set if not already present (edge case)
|
458
|
+
if "widget" not in span and hasattr(self, "widget"):
|
459
|
+
span["widget"] = self["widget"]
|
460
|
+
|
461
|
+
return span
|
432
462
|
|
433
463
|
__setattr__ = __setitem__
|
434
464
|
__getattr__ = __getitem__
|
tksheet/top_left_rectangle.py
CHANGED
@@ -4,6 +4,7 @@ import tkinter as tk
|
|
4
4
|
from typing import Any
|
5
5
|
|
6
6
|
from .constants import rc_binding
|
7
|
+
from .functions import try_binding
|
7
8
|
|
8
9
|
|
9
10
|
class TopLeftRectangle(tk.Canvas):
|
@@ -198,10 +199,8 @@ class TopLeftRectangle(tk.Canvas):
|
|
198
199
|
)
|
199
200
|
self.coords(self.select_all_box, 0, 0, w - 5, h - 5)
|
200
201
|
|
201
|
-
def mouse_motion(self, event: Any
|
202
|
-
self.
|
203
|
-
if self.extra_motion_func is not None:
|
204
|
-
self.extra_motion_func(event)
|
202
|
+
def mouse_motion(self, event: Any) -> None:
|
203
|
+
try_binding(self.extra_motion_func, event)
|
205
204
|
|
206
205
|
def b1_press(self, event: Any = None) -> None:
|
207
206
|
self.focus_set()
|
@@ -1,12 +1,12 @@
|
|
1
|
-
tksheet/__init__.py,sha256=
|
1
|
+
tksheet/__init__.py,sha256=qibxlAtUNwyDztrSuu3utGUQAfNrmJHEMEydswd4YAw,2327
|
2
2
|
tksheet/colors.py,sha256=dHhmdFuQDlwohDHsAfT9VdrKoSl_R33L72a3HCin5zo,51591
|
3
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
|
-
tksheet/functions.py,sha256=
|
8
|
-
tksheet/main_table.py,sha256=
|
9
|
-
tksheet/other_classes.py,sha256=
|
7
|
+
tksheet/functions.py,sha256=gwf9X9ENHmoikjbXtoj-00uUVQGRJVffkeJHoR7yB2E,52993
|
8
|
+
tksheet/main_table.py,sha256=QOX7diYHRovSfq-RGUeEBXswnCmU0cMNPkd8f-QtHJk,366639
|
9
|
+
tksheet/other_classes.py,sha256=1qsaUlxD8GbQupl9pefzP2tFM6z337uY4XkUXb0zRJw,18213
|
10
10
|
tksheet/row_index.py,sha256=8zuNU00ATmz5oumEqSyB_nOUAIuCS23mUfTpq3R1WOM,141611
|
11
11
|
tksheet/sheet.py,sha256=MXt-ebQJVx-l4lozRqCxhivMMaCC7JpOD7wzfVj0rRk,269777
|
12
12
|
tksheet/sheet_options.py,sha256=ob-XYgGfBoi2TaFAvUUmlWUkw9xB-yXmJw17gu9__Lw,9948
|
@@ -14,9 +14,9 @@ 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
|
-
tksheet/top_left_rectangle.py,sha256=
|
18
|
-
tksheet-7.4.
|
19
|
-
tksheet-7.4.
|
20
|
-
tksheet-7.4.
|
21
|
-
tksheet-7.4.
|
22
|
-
tksheet-7.4.
|
17
|
+
tksheet/top_left_rectangle.py,sha256=A4wWL8PFl57Pn2Ek71rASCE1-bW844cTl7bgt4tLWzI,8499
|
18
|
+
tksheet-7.4.21.dist-info/licenses/LICENSE.txt,sha256=ndbcCPe9SlHfweE_W2RAueWUe2k7yudyxYLq6WjFdn4,1101
|
19
|
+
tksheet-7.4.21.dist-info/METADATA,sha256=aJV9Yll6JK0cvLEe-3r-0GYvFo8bkE-hZcmRdnG-WFI,8117
|
20
|
+
tksheet-7.4.21.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
|
21
|
+
tksheet-7.4.21.dist-info/top_level.txt,sha256=my61PXCcck_HHAc9cq3NAlyAr3A3FXxCy9gptEOaCN8,8
|
22
|
+
tksheet-7.4.21.dist-info/RECORD,,
|
File without changes
|
File without changes
|