tksheet 7.2.11__tar.gz → 7.2.12__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.2.11/tksheet.egg-info → tksheet-7.2.12}/PKG-INFO +1 -1
- {tksheet-7.2.11 → tksheet-7.2.12}/pyproject.toml +1 -1
- {tksheet-7.2.11 → tksheet-7.2.12}/tksheet/__init__.py +1 -1
- {tksheet-7.2.11 → tksheet-7.2.12}/tksheet/column_headers.py +11 -2
- {tksheet-7.2.11 → tksheet-7.2.12}/tksheet/functions.py +14 -2
- {tksheet-7.2.11 → tksheet-7.2.12}/tksheet/main_table.py +19 -0
- {tksheet-7.2.11 → tksheet-7.2.12}/tksheet/row_index.py +13 -5
- {tksheet-7.2.11 → tksheet-7.2.12}/tksheet/sheet.py +1 -1
- {tksheet-7.2.11 → tksheet-7.2.12/tksheet.egg-info}/PKG-INFO +1 -1
- {tksheet-7.2.11 → tksheet-7.2.12}/LICENSE.txt +0 -0
- {tksheet-7.2.11 → tksheet-7.2.12}/README.md +0 -0
- {tksheet-7.2.11 → tksheet-7.2.12}/setup.cfg +0 -0
- {tksheet-7.2.11 → tksheet-7.2.12}/tksheet/colors.py +0 -0
- {tksheet-7.2.11 → tksheet-7.2.12}/tksheet/formatters.py +0 -0
- {tksheet-7.2.11 → tksheet-7.2.12}/tksheet/other_classes.py +0 -0
- {tksheet-7.2.11 → tksheet-7.2.12}/tksheet/sheet_options.py +0 -0
- {tksheet-7.2.11 → tksheet-7.2.12}/tksheet/text_editor.py +0 -0
- {tksheet-7.2.11 → tksheet-7.2.12}/tksheet/themes.py +0 -0
- {tksheet-7.2.11 → tksheet-7.2.12}/tksheet/top_left_rectangle.py +0 -0
- {tksheet-7.2.11 → tksheet-7.2.12}/tksheet/types.py +0 -0
- {tksheet-7.2.11 → tksheet-7.2.12}/tksheet/vars.py +0 -0
- {tksheet-7.2.11 → tksheet-7.2.12}/tksheet.egg-info/SOURCES.txt +0 -0
- {tksheet-7.2.11 → tksheet-7.2.12}/tksheet.egg-info/dependency_links.txt +0 -0
- {tksheet-7.2.11 → tksheet-7.2.12}/tksheet.egg-info/top_level.txt +0 -0
@@ -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.2.
|
9
|
+
version = "7.2.12"
|
10
10
|
authors = [{ name = "ragardner", email = "github@ragardner.simplelogin.com" }]
|
11
11
|
requires-python = ">=3.8"
|
12
12
|
license = {file = "LICENSE.txt"}
|
@@ -599,7 +599,7 @@ class ColumnHeaders(tk.Canvas):
|
|
599
599
|
if need_redraw:
|
600
600
|
self.MT.main_table_redraw_grid_and_text(redraw_header=True, redraw_row_index=False)
|
601
601
|
try_binding(self.extra_b1_motion_func, event)
|
602
|
-
|
602
|
+
|
603
603
|
def drag_height_resize(self) -> None:
|
604
604
|
self.set_height(self.new_col_height, set_TL=True)
|
605
605
|
self.MT.main_table_redraw_grid_and_text(redraw_header=True, redraw_row_index=True)
|
@@ -2176,7 +2176,16 @@ class ColumnHeaders(tk.Canvas):
|
|
2176
2176
|
)
|
2177
2177
|
edited = False
|
2178
2178
|
if isinstance(self.MT._headers, int):
|
2179
|
-
|
2179
|
+
disprn = self.MT.try_disprn(self.MT._headers)
|
2180
|
+
edited = self.MT.set_cell_data_undo(
|
2181
|
+
r=disprn if isinstance(disprn, int) else 0,
|
2182
|
+
c=c,
|
2183
|
+
datarn=self.MT._headers,
|
2184
|
+
datacn=datacn,
|
2185
|
+
value=value,
|
2186
|
+
undo=True,
|
2187
|
+
cell_resize=isinstance(disprn, int),
|
2188
|
+
)
|
2180
2189
|
else:
|
2181
2190
|
self.fix_header(datacn)
|
2182
2191
|
if not check_input_valid or self.input_valid_for_cell(datacn, value):
|
@@ -1,12 +1,14 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
|
-
import bisect
|
4
3
|
import csv
|
5
4
|
import io
|
6
5
|
import pickle
|
7
6
|
import re
|
8
7
|
import tkinter as tk
|
9
8
|
import zlib
|
9
|
+
from bisect import (
|
10
|
+
bisect_left,
|
11
|
+
)
|
10
12
|
from collections import deque
|
11
13
|
from collections.abc import (
|
12
14
|
Callable,
|
@@ -208,6 +210,16 @@ def len_to_idx(n: int) -> int:
|
|
208
210
|
return n - 1
|
209
211
|
|
210
212
|
|
213
|
+
def b_index(sorted_seq: Sequence[int], num_to_index: int) -> int:
|
214
|
+
"""
|
215
|
+
Designed to be a faster way of finding the index of an int
|
216
|
+
in a sorted list of ints than list.index()
|
217
|
+
"""
|
218
|
+
if (idx := bisect_left(sorted_seq, num_to_index)) == len(sorted_seq) or sorted_seq[idx] != num_to_index:
|
219
|
+
raise ValueError(f"{num_to_index} is not in Sequence")
|
220
|
+
return idx
|
221
|
+
|
222
|
+
|
211
223
|
def get_dropdown_kwargs(
|
212
224
|
values: list = [],
|
213
225
|
set_value: object = None,
|
@@ -379,7 +391,7 @@ def get_seq_without_gaps_at_index(
|
|
379
391
|
position: int,
|
380
392
|
get_st_end: bool = False,
|
381
393
|
) -> tuple[int, int] | list[int]:
|
382
|
-
start_idx =
|
394
|
+
start_idx = bisect_left(seq, position)
|
383
395
|
forward_gap = get_index_of_gap_in_sorted_integer_seq_forward(seq, start_idx)
|
384
396
|
reverse_gap = get_index_of_gap_in_sorted_integer_seq_reverse(seq, start_idx)
|
385
397
|
if forward_gap is not None:
|
@@ -49,6 +49,7 @@ from .formatters import (
|
|
49
49
|
try_to_bool,
|
50
50
|
)
|
51
51
|
from .functions import (
|
52
|
+
b_index,
|
52
53
|
consecutive_ranges,
|
53
54
|
decompress_load,
|
54
55
|
diff_gen,
|
@@ -7460,3 +7461,21 @@ class MainTable(tk.Canvas):
|
|
7460
7461
|
|
7461
7462
|
def datarn(self, r: int) -> int:
|
7462
7463
|
return r if self.all_rows_displayed else self.displayed_rows[r]
|
7464
|
+
|
7465
|
+
def dispcn(self, datacn: int) -> int:
|
7466
|
+
return datacn if self.all_columns_displayed else b_index(self.displayed_columns, datacn)
|
7467
|
+
|
7468
|
+
def try_dispcn(self, datacn: int) -> int | None:
|
7469
|
+
try:
|
7470
|
+
return self.dispcn(datacn)
|
7471
|
+
except Exception:
|
7472
|
+
return None
|
7473
|
+
|
7474
|
+
def disprn(self, datarn: int) -> int:
|
7475
|
+
return datarn if self.all_rows_displayed else b_index(self.displayed_rows, datarn)
|
7476
|
+
|
7477
|
+
def try_disprn(self, datarn: int) -> int | None:
|
7478
|
+
try:
|
7479
|
+
return self.disprn(datarn)
|
7480
|
+
except Exception:
|
7481
|
+
return None
|
@@ -780,7 +780,7 @@ class RowIndex(tk.Canvas):
|
|
780
780
|
and self.get_cell_kwargs(datarn, key="checkbox")
|
781
781
|
and event.x < self.MT.index_txt_height + 4
|
782
782
|
)
|
783
|
-
|
783
|
+
|
784
784
|
def drag_width_resize(self) -> None:
|
785
785
|
self.set_width(self.new_row_width, set_TL=True)
|
786
786
|
self.MT.main_table_redraw_grid_and_text(redraw_header=True, redraw_row_index=True)
|
@@ -2296,7 +2296,16 @@ class RowIndex(tk.Canvas):
|
|
2296
2296
|
)
|
2297
2297
|
edited = False
|
2298
2298
|
if isinstance(self.MT._row_index, int):
|
2299
|
-
|
2299
|
+
dispcn = self.MT.try_dispcn(self.MT._row_index)
|
2300
|
+
edited = self.MT.set_cell_data_undo(
|
2301
|
+
r=r,
|
2302
|
+
c=dispcn if isinstance(dispcn, int) else 0,
|
2303
|
+
datarn=datarn,
|
2304
|
+
datacn=self.MT._row_index,
|
2305
|
+
value=value,
|
2306
|
+
undo=True,
|
2307
|
+
cell_resize=isinstance(dispcn, int),
|
2308
|
+
)
|
2300
2309
|
else:
|
2301
2310
|
self.fix_index(datarn)
|
2302
2311
|
if not check_input_valid or self.input_valid_for_cell(datarn, value):
|
@@ -2431,7 +2440,7 @@ class RowIndex(tk.Canvas):
|
|
2431
2440
|
elif isinstance(self.MT._row_index, int):
|
2432
2441
|
value = (
|
2433
2442
|
not self.MT.data[datarn][self.MT._row_index]
|
2434
|
-
if
|
2443
|
+
if isinstance(self.MT.data[datarn][self.MT._row_index], bool)
|
2435
2444
|
else False
|
2436
2445
|
)
|
2437
2446
|
else:
|
@@ -2476,8 +2485,7 @@ class RowIndex(tk.Canvas):
|
|
2476
2485
|
if iid not in self.tree_open_ids:
|
2477
2486
|
return False
|
2478
2487
|
return True
|
2479
|
-
|
2480
|
-
return all(iid in self.tree_open_ids for iid in self.get_iid_ancestors(iid))
|
2488
|
+
return all(map(self.tree_open_ids.__contains__, self.get_iid_ancestors(iid)))
|
2481
2489
|
|
2482
2490
|
def get_iid_ancestors(self, iid: str) -> Generator[str]:
|
2483
2491
|
if self.tree[iid].parent:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|