tksheet 7.1.11__tar.gz → 7.1.20__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.
- {tksheet-7.1.11/tksheet.egg-info → tksheet-7.1.20}/PKG-INFO +2 -2
- {tksheet-7.1.11 → tksheet-7.1.20}/README.md +1 -1
- {tksheet-7.1.11 → tksheet-7.1.20}/pyproject.toml +1 -1
- {tksheet-7.1.11 → tksheet-7.1.20}/tksheet/__init__.py +2 -1
- {tksheet-7.1.11 → tksheet-7.1.20}/tksheet/column_headers.py +10 -3
- {tksheet-7.1.11 → tksheet-7.1.20}/tksheet/functions.py +28 -10
- {tksheet-7.1.11 → tksheet-7.1.20}/tksheet/main_table.py +149 -116
- {tksheet-7.1.11 → tksheet-7.1.20}/tksheet/row_index.py +5 -3
- {tksheet-7.1.11 → tksheet-7.1.20}/tksheet/sheet.py +51 -40
- {tksheet-7.1.11 → tksheet-7.1.20}/tksheet/themes.py +12 -10
- {tksheet-7.1.11 → tksheet-7.1.20}/tksheet/vars.py +52 -2
- {tksheet-7.1.11 → tksheet-7.1.20/tksheet.egg-info}/PKG-INFO +2 -2
- {tksheet-7.1.11 → tksheet-7.1.20}/LICENSE.txt +0 -0
- {tksheet-7.1.11 → tksheet-7.1.20}/setup.cfg +0 -0
- {tksheet-7.1.11 → tksheet-7.1.20}/tksheet/colors.py +0 -0
- {tksheet-7.1.11 → tksheet-7.1.20}/tksheet/formatters.py +0 -0
- {tksheet-7.1.11 → tksheet-7.1.20}/tksheet/other_classes.py +0 -0
- {tksheet-7.1.11 → tksheet-7.1.20}/tksheet/sheet_options.py +0 -0
- {tksheet-7.1.11 → tksheet-7.1.20}/tksheet/text_editor.py +0 -0
- {tksheet-7.1.11 → tksheet-7.1.20}/tksheet/top_left_rectangle.py +0 -0
- {tksheet-7.1.11 → tksheet-7.1.20}/tksheet/types.py +0 -0
- {tksheet-7.1.11 → tksheet-7.1.20}/tksheet.egg-info/SOURCES.txt +0 -0
- {tksheet-7.1.11 → tksheet-7.1.20}/tksheet.egg-info/dependency_links.txt +0 -0
- {tksheet-7.1.11 → tksheet-7.1.20}/tksheet.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: tksheet
|
3
|
-
Version: 7.1.
|
3
|
+
Version: 7.1.20
|
4
4
|
Summary: Tkinter table / sheet widget
|
5
5
|
Author-email: ragardner <github@ragardner.simplelogin.com>
|
6
6
|
License: Copyright (c) 2019 ragardner and open source contributors
|
@@ -42,7 +42,7 @@ License-File: LICENSE.txt
|
|
42
42
|
|
43
43
|
# tksheet
|
44
44
|
|
45
|
-
[](https://pypi.python.org/pypi/tksheet/) ](https://pypi.python.org/pypi/tksheet/)  [](https://github.com/ragardner/tksheet/blob/master/LICENSE.txt)
|
46
46
|
|
47
47
|
[](https://github.com/ragardner/tksheet/releases) [](https://pypi.org/project/tksheet/)
|
48
48
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# tksheet
|
2
2
|
|
3
|
-
[](https://pypi.python.org/pypi/tksheet/) ](https://pypi.python.org/pypi/tksheet/)  [](https://github.com/ragardner/tksheet/blob/master/LICENSE.txt)
|
4
4
|
|
5
5
|
[](https://github.com/ragardner/tksheet/releases) [](https://pypi.org/project/tksheet/)
|
6
6
|
|
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
|
|
6
6
|
name = "tksheet"
|
7
7
|
description = "Tkinter table / sheet widget"
|
8
8
|
readme = "README.md"
|
9
|
-
version = "7.1.
|
9
|
+
version = "7.1.20"
|
10
10
|
authors = [{ name = "ragardner", email = "github@ragardner.simplelogin.com" }]
|
11
11
|
requires-python = ">=3.8"
|
12
12
|
license = {file = "LICENSE.txt"}
|
@@ -4,7 +4,7 @@
|
|
4
4
|
tksheet - A Python tkinter table widget
|
5
5
|
"""
|
6
6
|
|
7
|
-
__version__ = "7.1.
|
7
|
+
__version__ = "7.1.20"
|
8
8
|
|
9
9
|
from .colors import (
|
10
10
|
color_map,
|
@@ -42,6 +42,7 @@ from .functions import (
|
|
42
42
|
event_dict,
|
43
43
|
get_checkbox_dict,
|
44
44
|
get_checkbox_kwargs,
|
45
|
+
get_data_from_clipboard,
|
45
46
|
get_dropdown_dict,
|
46
47
|
get_dropdown_kwargs,
|
47
48
|
get_index_of_gap_in_sorted_integer_seq_forward,
|
@@ -22,10 +22,10 @@ from .colors import (
|
|
22
22
|
from .formatters import is_bool_like, try_to_bool
|
23
23
|
from .functions import (
|
24
24
|
consecutive_ranges,
|
25
|
-
ev_stack_dict,
|
26
25
|
event_dict,
|
27
26
|
get_n2a,
|
28
27
|
is_contiguous,
|
28
|
+
pickled_event_dict,
|
29
29
|
rounded_box_coords,
|
30
30
|
try_binding,
|
31
31
|
)
|
@@ -133,6 +133,9 @@ class ColumnHeaders(tk.Canvas):
|
|
133
133
|
self.bind("<Double-Button-1>", self.double_b1)
|
134
134
|
self.bind(rc_binding, self.rc)
|
135
135
|
self.bind("<MouseWheel>", self.mousewheel)
|
136
|
+
if USER_OS == "linux":
|
137
|
+
self.bind("<Button-4>", self.mousewheel)
|
138
|
+
self.bind("<Button-5>", self.mousewheel)
|
136
139
|
else:
|
137
140
|
self.unbind("<Motion>")
|
138
141
|
self.unbind("<ButtonPress-1>")
|
@@ -141,6 +144,9 @@ class ColumnHeaders(tk.Canvas):
|
|
141
144
|
self.unbind("<Double-Button-1>")
|
142
145
|
self.unbind(rc_binding)
|
143
146
|
self.unbind("<MouseWheel>")
|
147
|
+
if USER_OS == "linux":
|
148
|
+
self.unbind("<Button-4>")
|
149
|
+
self.unbind("<Button-5>")
|
144
150
|
|
145
151
|
def mousewheel(self, event: object):
|
146
152
|
maxlines = 0
|
@@ -845,7 +851,7 @@ class ColumnHeaders(tk.Canvas):
|
|
845
851
|
"displayed": disp_new_idxs,
|
846
852
|
}
|
847
853
|
if self.MT.undo_enabled:
|
848
|
-
self.MT.undo_stack.append(
|
854
|
+
self.MT.undo_stack.append(pickled_event_dict(event_data))
|
849
855
|
self.MT.main_table_redraw_grid_and_text(redraw_header=True, redraw_row_index=True)
|
850
856
|
try_binding(self.ch_extra_end_drag_drop_func, event_data, "end_move_columns")
|
851
857
|
self.MT.sheet_modified(event_data)
|
@@ -1953,6 +1959,7 @@ class ColumnHeaders(tk.Canvas):
|
|
1953
1959
|
self.dropdown.window.reset(**reset_kwargs)
|
1954
1960
|
self.itemconfig(self.dropdown.canvas_id, state="normal")
|
1955
1961
|
self.coords(self.dropdown.canvas_id, self.MT.col_positions[c], ypos)
|
1962
|
+
self.dropdown.window.tkraise()
|
1956
1963
|
else:
|
1957
1964
|
self.dropdown.window = self.PAR.dropdown_class(
|
1958
1965
|
self.winfo_toplevel(),
|
@@ -2090,7 +2097,7 @@ class ColumnHeaders(tk.Canvas):
|
|
2090
2097
|
self.fix_header(datacn)
|
2091
2098
|
if not check_input_valid or self.input_valid_for_cell(datacn, value):
|
2092
2099
|
if self.MT.undo_enabled and undo:
|
2093
|
-
self.MT.undo_stack.append(
|
2100
|
+
self.MT.undo_stack.append(pickled_event_dict(event_data))
|
2094
2101
|
self.set_cell_data(datacn=datacn, value=value)
|
2095
2102
|
edited = True
|
2096
2103
|
if edited and cell_resize and self.PAR.ops.cell_auto_resize_enabled:
|
@@ -1,8 +1,11 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
3
|
import bisect
|
4
|
+
import csv
|
5
|
+
import io
|
4
6
|
import pickle
|
5
7
|
import re
|
8
|
+
import tkinter as tk
|
6
9
|
import zlib
|
7
10
|
from collections import deque
|
8
11
|
from collections.abc import (
|
@@ -19,6 +22,7 @@ from .other_classes import (
|
|
19
22
|
DotDict,
|
20
23
|
EventDataDict,
|
21
24
|
Highlight,
|
25
|
+
Loc,
|
22
26
|
Span,
|
23
27
|
)
|
24
28
|
|
@@ -27,6 +31,21 @@ pickle_obj = partial(pickle.dumps, protocol=pickle.HIGHEST_PROTOCOL)
|
|
27
31
|
unpickle_obj = pickle.loads
|
28
32
|
|
29
33
|
|
34
|
+
def get_data_from_clipboard(
|
35
|
+
widget: tk.Misc,
|
36
|
+
delimiters: str,
|
37
|
+
lineterminator: str = "\n",
|
38
|
+
) -> list[list[str]]:
|
39
|
+
data = widget.clipboard_get()
|
40
|
+
try:
|
41
|
+
dialect = csv.Sniffer().sniff(data, delimiters=delimiters)
|
42
|
+
except Exception:
|
43
|
+
dialect = csv.excel_tab
|
44
|
+
if dialect.delimiter in data or lineterminator in data:
|
45
|
+
return list(csv.reader(io.StringIO(data), dialect=dialect, skipinitialspace=True))
|
46
|
+
return [[data]]
|
47
|
+
|
48
|
+
|
30
49
|
def pickle_compress(obj: object) -> bytes:
|
31
50
|
return compress(pickle_obj(obj))
|
32
51
|
|
@@ -164,11 +183,8 @@ def change_eventname(event_dict: EventDataDict, newname: str) -> EventDataDict:
|
|
164
183
|
return EventDataDict({**event_dict, **{"eventname": newname}})
|
165
184
|
|
166
185
|
|
167
|
-
def
|
168
|
-
return DotDict(
|
169
|
-
name=d["eventname"],
|
170
|
-
data=pickle_compress(d),
|
171
|
-
)
|
186
|
+
def pickled_event_dict(d: DotDict) -> DotDict:
|
187
|
+
return DotDict(name=d["eventname"], data=pickle_compress(d))
|
172
188
|
|
173
189
|
|
174
190
|
def len_to_idx(n: int) -> int:
|
@@ -204,8 +220,6 @@ def get_dropdown_kwargs(
|
|
204
220
|
def get_dropdown_dict(**kwargs) -> dict:
|
205
221
|
return {
|
206
222
|
"values": kwargs["values"],
|
207
|
-
"window": "no dropdown open",
|
208
|
-
"canvas_id": "no dropdown open",
|
209
223
|
"select_function": kwargs["selection_function"],
|
210
224
|
"modified_function": kwargs["modified_function"],
|
211
225
|
"search_function": kwargs["search_function"],
|
@@ -408,11 +422,13 @@ def index_exists(seq: Sequence[object], index: int) -> bool:
|
|
408
422
|
def move_elements_by_mapping(
|
409
423
|
seq: list[object],
|
410
424
|
new_idxs: dict[int, int],
|
411
|
-
old_idxs: dict[int, int],
|
425
|
+
old_idxs: dict[int, int] | None = None,
|
412
426
|
) -> list[object]:
|
413
427
|
# move elements of a list around, displacing
|
414
428
|
# other elements based on mapping
|
415
429
|
# of {old index: new index, ...}
|
430
|
+
if old_idxs is None:
|
431
|
+
old_idxs = dict(zip(new_idxs.values(), new_idxs))
|
416
432
|
|
417
433
|
# create dummy list
|
418
434
|
res = [0] * len(seq)
|
@@ -1295,10 +1311,12 @@ def mod_span_widget(span: Span, widget: object) -> Span:
|
|
1295
1311
|
def mod_event_val(
|
1296
1312
|
event_data: EventDataDict,
|
1297
1313
|
val: object,
|
1298
|
-
loc:
|
1314
|
+
loc: Loc | int,
|
1299
1315
|
) -> EventDataDict:
|
1300
1316
|
event_data.value = val
|
1301
|
-
event_data.loc = loc
|
1317
|
+
event_data.loc = Loc(*loc)
|
1318
|
+
event_data.row = loc[0]
|
1319
|
+
event_data.column = loc[1]
|
1302
1320
|
return event_data
|
1303
1321
|
|
1304
1322
|
|