tksheet 7.1.0__py3-none-any.whl → 7.1.2__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 +96 -96
- tksheet/functions.py +5 -0
- tksheet/main_table.py +66 -75
- tksheet/row_index.py +2 -2
- tksheet/sheet.py +94 -33
- {tksheet-7.1.0.dist-info → tksheet-7.1.2.dist-info}/METADATA +1 -1
- {tksheet-7.1.0.dist-info → tksheet-7.1.2.dist-info}/RECORD +10 -10
- {tksheet-7.1.0.dist-info → tksheet-7.1.2.dist-info}/LICENSE.txt +0 -0
- {tksheet-7.1.0.dist-info → tksheet-7.1.2.dist-info}/WHEEL +0 -0
- {tksheet-7.1.0.dist-info → tksheet-7.1.2.dist-info}/top_level.txt +0 -0
tksheet/__init__.py
CHANGED
@@ -1,96 +1,96 @@
|
|
1
|
-
# ruff: noqa: F401
|
2
|
-
|
3
|
-
"""
|
4
|
-
tksheet - A Python tkinter table widget
|
5
|
-
"""
|
6
|
-
|
7
|
-
__version__ = "7.1.
|
8
|
-
|
9
|
-
from .colors import (
|
10
|
-
color_map,
|
11
|
-
)
|
12
|
-
from .column_headers import ColumnHeaders
|
13
|
-
from .formatters import (
|
14
|
-
Formatter,
|
15
|
-
bool_formatter,
|
16
|
-
data_to_str,
|
17
|
-
float_formatter,
|
18
|
-
float_to_str,
|
19
|
-
format_data,
|
20
|
-
formatter,
|
21
|
-
get_clipboard_data,
|
22
|
-
get_data_with_valid_check,
|
23
|
-
int_formatter,
|
24
|
-
is_bool_like,
|
25
|
-
is_none_like,
|
26
|
-
percentage_formatter,
|
27
|
-
percentage_to_str,
|
28
|
-
to_bool,
|
29
|
-
to_float,
|
30
|
-
to_int,
|
31
|
-
to_str,
|
32
|
-
try_to_bool,
|
33
|
-
)
|
34
|
-
from .functions import (
|
35
|
-
alpha2idx,
|
36
|
-
alpha2num,
|
37
|
-
consecutive_chunks,
|
38
|
-
data_to_displayed_idxs,
|
39
|
-
displayed_to_data_idxs,
|
40
|
-
dropdown_search_function,
|
41
|
-
event_dict,
|
42
|
-
get_checkbox_dict,
|
43
|
-
get_checkbox_kwargs,
|
44
|
-
get_checkbox_points,
|
45
|
-
get_dropdown_dict,
|
46
|
-
get_dropdown_kwargs,
|
47
|
-
get_index_of_gap_in_sorted_integer_seq_forward,
|
48
|
-
get_index_of_gap_in_sorted_integer_seq_reverse,
|
49
|
-
get_n2a,
|
50
|
-
get_new_indexes,
|
51
|
-
get_seq_without_gaps_at_index,
|
52
|
-
is_iterable,
|
53
|
-
move_elements_by_mapping,
|
54
|
-
move_elements_to,
|
55
|
-
num2alpha,
|
56
|
-
span_dict,
|
57
|
-
tksheet_type_error,
|
58
|
-
)
|
59
|
-
from .main_table import MainTable
|
60
|
-
from .other_classes import (
|
61
|
-
DotDict,
|
62
|
-
DraggedRowColumn,
|
63
|
-
DrawnItem,
|
64
|
-
EventDataDict,
|
65
|
-
GeneratedMouseEvent,
|
66
|
-
Selected,
|
67
|
-
Span,
|
68
|
-
SpanRange,
|
69
|
-
TextCfg,
|
70
|
-
)
|
71
|
-
from .row_index import RowIndex
|
72
|
-
from .sheet import Dropdown, Sheet
|
73
|
-
from .sheet_options import new_sheet_options
|
74
|
-
from .text_editor import (
|
75
|
-
TextEditor,
|
76
|
-
TextEditorTkText,
|
77
|
-
)
|
78
|
-
from .themes import (
|
79
|
-
theme_black,
|
80
|
-
theme_dark,
|
81
|
-
theme_dark_blue,
|
82
|
-
theme_dark_green,
|
83
|
-
theme_light_blue,
|
84
|
-
theme_light_green,
|
85
|
-
)
|
86
|
-
from .top_left_rectangle import TopLeftRectangle
|
87
|
-
from .vars import (
|
88
|
-
USER_OS,
|
89
|
-
ctrl_key,
|
90
|
-
emitted_events,
|
91
|
-
falsy,
|
92
|
-
nonelike,
|
93
|
-
rc_binding,
|
94
|
-
symbols_set,
|
95
|
-
truthy,
|
96
|
-
)
|
1
|
+
# ruff: noqa: F401
|
2
|
+
|
3
|
+
"""
|
4
|
+
tksheet - A Python tkinter table widget
|
5
|
+
"""
|
6
|
+
|
7
|
+
__version__ = "7.1.2"
|
8
|
+
|
9
|
+
from .colors import (
|
10
|
+
color_map,
|
11
|
+
)
|
12
|
+
from .column_headers import ColumnHeaders
|
13
|
+
from .formatters import (
|
14
|
+
Formatter,
|
15
|
+
bool_formatter,
|
16
|
+
data_to_str,
|
17
|
+
float_formatter,
|
18
|
+
float_to_str,
|
19
|
+
format_data,
|
20
|
+
formatter,
|
21
|
+
get_clipboard_data,
|
22
|
+
get_data_with_valid_check,
|
23
|
+
int_formatter,
|
24
|
+
is_bool_like,
|
25
|
+
is_none_like,
|
26
|
+
percentage_formatter,
|
27
|
+
percentage_to_str,
|
28
|
+
to_bool,
|
29
|
+
to_float,
|
30
|
+
to_int,
|
31
|
+
to_str,
|
32
|
+
try_to_bool,
|
33
|
+
)
|
34
|
+
from .functions import (
|
35
|
+
alpha2idx,
|
36
|
+
alpha2num,
|
37
|
+
consecutive_chunks,
|
38
|
+
data_to_displayed_idxs,
|
39
|
+
displayed_to_data_idxs,
|
40
|
+
dropdown_search_function,
|
41
|
+
event_dict,
|
42
|
+
get_checkbox_dict,
|
43
|
+
get_checkbox_kwargs,
|
44
|
+
get_checkbox_points,
|
45
|
+
get_dropdown_dict,
|
46
|
+
get_dropdown_kwargs,
|
47
|
+
get_index_of_gap_in_sorted_integer_seq_forward,
|
48
|
+
get_index_of_gap_in_sorted_integer_seq_reverse,
|
49
|
+
get_n2a,
|
50
|
+
get_new_indexes,
|
51
|
+
get_seq_without_gaps_at_index,
|
52
|
+
is_iterable,
|
53
|
+
move_elements_by_mapping,
|
54
|
+
move_elements_to,
|
55
|
+
num2alpha,
|
56
|
+
span_dict,
|
57
|
+
tksheet_type_error,
|
58
|
+
)
|
59
|
+
from .main_table import MainTable
|
60
|
+
from .other_classes import (
|
61
|
+
DotDict,
|
62
|
+
DraggedRowColumn,
|
63
|
+
DrawnItem,
|
64
|
+
EventDataDict,
|
65
|
+
GeneratedMouseEvent,
|
66
|
+
Selected,
|
67
|
+
Span,
|
68
|
+
SpanRange,
|
69
|
+
TextCfg,
|
70
|
+
)
|
71
|
+
from .row_index import RowIndex
|
72
|
+
from .sheet import Dropdown, Sheet
|
73
|
+
from .sheet_options import new_sheet_options
|
74
|
+
from .text_editor import (
|
75
|
+
TextEditor,
|
76
|
+
TextEditorTkText,
|
77
|
+
)
|
78
|
+
from .themes import (
|
79
|
+
theme_black,
|
80
|
+
theme_dark,
|
81
|
+
theme_dark_blue,
|
82
|
+
theme_dark_green,
|
83
|
+
theme_light_blue,
|
84
|
+
theme_light_green,
|
85
|
+
)
|
86
|
+
from .top_left_rectangle import TopLeftRectangle
|
87
|
+
from .vars import (
|
88
|
+
USER_OS,
|
89
|
+
ctrl_key,
|
90
|
+
emitted_events,
|
91
|
+
falsy,
|
92
|
+
nonelike,
|
93
|
+
rc_binding,
|
94
|
+
symbols_set,
|
95
|
+
truthy,
|
96
|
+
)
|
tksheet/functions.py
CHANGED
tksheet/main_table.py
CHANGED
@@ -69,6 +69,7 @@ from .functions import (
|
|
69
69
|
move_elements_by_mapping,
|
70
70
|
pickle_obj,
|
71
71
|
span_idxs_post_move,
|
72
|
+
mod_span_widget,
|
72
73
|
try_binding,
|
73
74
|
unpickle_obj,
|
74
75
|
)
|
@@ -1098,29 +1099,16 @@ class MainTable(tk.Canvas):
|
|
1098
1099
|
def get_max_column_idx(self, maxidx: int | None = None) -> int:
|
1099
1100
|
if maxidx is None:
|
1100
1101
|
maxidx = len_to_idx(self.total_data_cols())
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
(d["from_c"] for d in self.named_spans.values() if isinstance(d["from_c"], int)),
|
1112
|
-
default=0,
|
1113
|
-
)
|
1114
|
-
):
|
1115
|
-
maxidx = maxk
|
1116
|
-
if maxidx < (
|
1117
|
-
maxk := max(
|
1118
|
-
(d["upto_c"] for d in self.named_spans.values() if isinstance(d["upto_c"], int)),
|
1119
|
-
default=0,
|
1120
|
-
)
|
1121
|
-
):
|
1122
|
-
maxidx = maxk
|
1123
|
-
return maxidx
|
1102
|
+
maxiget = partial(max, key=itemgetter(1))
|
1103
|
+
return max(
|
1104
|
+
max(self.cell_options, key=itemgetter(1), default=(0, maxidx))[1],
|
1105
|
+
max(self.col_options, default=maxidx),
|
1106
|
+
max(self.CH.cell_options, default=maxidx),
|
1107
|
+
maxiget(map(maxiget, self.tagged_cells.values()), default=(0, maxidx))[1],
|
1108
|
+
max(map(max, self.tagged_columns.values()), default=maxidx),
|
1109
|
+
max((d.from_c for d in self.named_spans.values() if isinstance(d.from_c, int)), default=maxidx),
|
1110
|
+
max((d.upto_c for d in self.named_spans.values() if isinstance(d.upto_c, int)), default=maxidx),
|
1111
|
+
)
|
1124
1112
|
|
1125
1113
|
def get_args_for_move_rows(
|
1126
1114
|
self,
|
@@ -1328,28 +1316,16 @@ class MainTable(tk.Canvas):
|
|
1328
1316
|
def get_max_row_idx(self, maxidx: int | None = None) -> int:
|
1329
1317
|
if maxidx is None:
|
1330
1318
|
maxidx = len_to_idx(self.total_data_rows())
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
default=0,
|
1342
|
-
)
|
1343
|
-
):
|
1344
|
-
maxidx = maxk
|
1345
|
-
if maxidx < (
|
1346
|
-
maxk := max(
|
1347
|
-
(d["upto_r"] for d in self.named_spans.values() if isinstance(d["upto_r"], int)),
|
1348
|
-
default=0,
|
1349
|
-
)
|
1350
|
-
):
|
1351
|
-
maxidx = maxk
|
1352
|
-
return maxidx
|
1319
|
+
maxiget = partial(max, key=itemgetter(0))
|
1320
|
+
return max(
|
1321
|
+
max(self.cell_options, key=itemgetter(0), default=(maxidx, 0))[0],
|
1322
|
+
max(self.row_options, default=maxidx),
|
1323
|
+
max(self.RI.cell_options, default=maxidx),
|
1324
|
+
maxiget(map(maxiget, self.tagged_cells.values()), default=(maxidx, 0))[0],
|
1325
|
+
max(map(max, self.tagged_rows.values()), default=maxidx),
|
1326
|
+
max((d.from_r for d in self.named_spans.values() if isinstance(d.from_r, int)), default=maxidx),
|
1327
|
+
max((d.upto_r for d in self.named_spans.values() if isinstance(d.upto_r, int)), default=maxidx),
|
1328
|
+
)
|
1353
1329
|
|
1354
1330
|
def get_full_new_idxs(
|
1355
1331
|
self,
|
@@ -1434,7 +1410,15 @@ class MainTable(tk.Canvas):
|
|
1434
1410
|
self.CH.cell_options = modification["options"]["CH_cell_options"]
|
1435
1411
|
if "RI_cell_options" in modification["options"]:
|
1436
1412
|
self.RI.cell_options = modification["options"]["RI_cell_options"]
|
1437
|
-
|
1413
|
+
if "tagged_cells" in modification["options"]:
|
1414
|
+
self.tagged_cells = modification["options"]["tagged_cells"]
|
1415
|
+
if "tagged_rows" in modification["options"]:
|
1416
|
+
self.tagged_rows = modification["options"]["tagged_rows"]
|
1417
|
+
if "tagged_columns" in modification["options"]:
|
1418
|
+
self.tagged_columns = modification["options"]["tagged_columns"]
|
1419
|
+
self.named_spans = {
|
1420
|
+
k: mod_span_widget(unpickle_obj(v), self.PAR) for k, v in modification["named_spans"].items()
|
1421
|
+
}
|
1438
1422
|
|
1439
1423
|
def undo_modification_invert_event(self, modification: EventDataDict, name: str = "undo") -> bytes | EventDataDict:
|
1440
1424
|
self.deselect("all", redraw=False)
|
@@ -1709,7 +1693,7 @@ class MainTable(tk.Canvas):
|
|
1709
1693
|
return False
|
1710
1694
|
|
1711
1695
|
def select_all(self, redraw: bool = True, run_binding_func: bool = True) -> None:
|
1712
|
-
|
1696
|
+
selected = self.selected
|
1713
1697
|
self.deselect("all", redraw=False)
|
1714
1698
|
if len(self.row_positions) > 1 and len(self.col_positions) > 1:
|
1715
1699
|
item = self.create_selection_box(
|
@@ -1719,8 +1703,8 @@ class MainTable(tk.Canvas):
|
|
1719
1703
|
len(self.col_positions) - 1,
|
1720
1704
|
set_current=False,
|
1721
1705
|
)
|
1722
|
-
if
|
1723
|
-
self.set_currently_selected(
|
1706
|
+
if selected:
|
1707
|
+
self.set_currently_selected(selected.row, selected.column, item=item)
|
1724
1708
|
else:
|
1725
1709
|
self.set_currently_selected(0, 0, item=item)
|
1726
1710
|
if redraw:
|
@@ -3973,7 +3957,7 @@ class MainTable(tk.Canvas):
|
|
3973
3957
|
# if to_add then it's an undo/redo and don't
|
3974
3958
|
# need to create fresh options
|
3975
3959
|
if create_ops:
|
3976
|
-
# if
|
3960
|
+
# if cols are none it's a row options span
|
3977
3961
|
if span["from_c"] is None:
|
3978
3962
|
new_ops(
|
3979
3963
|
mod_span(
|
@@ -4531,6 +4515,9 @@ class MainTable(tk.Canvas):
|
|
4531
4515
|
"row_options": self.row_options,
|
4532
4516
|
"CH_cell_options": self.CH.cell_options,
|
4533
4517
|
"RI_cell_options": self.RI.cell_options,
|
4518
|
+
"tagged_cells": self.tagged_cells,
|
4519
|
+
"tagged_rows": self.tagged_rows,
|
4520
|
+
"tagged_columns": self.tagged_columns,
|
4534
4521
|
}
|
4535
4522
|
)
|
4536
4523
|
|
@@ -6252,10 +6239,10 @@ class MainTable(tk.Canvas):
|
|
6252
6239
|
return [(box.coords, box.type) for item, box in self.get_selection_items()]
|
6253
6240
|
|
6254
6241
|
def all_selected(self) -> bool:
|
6255
|
-
|
6256
|
-
|
6257
|
-
|
6258
|
-
|
6242
|
+
return any(
|
6243
|
+
not r1 and not c1 and r2 == len(self.row_positions) - 1 and c2 == len(self.col_positions) - 1
|
6244
|
+
for r1, c1, r2, c2 in self.get_all_selection_boxes()
|
6245
|
+
)
|
6259
6246
|
|
6260
6247
|
def cell_selected(
|
6261
6248
|
self,
|
@@ -6264,31 +6251,35 @@ class MainTable(tk.Canvas):
|
|
6264
6251
|
inc_cols: bool = False,
|
6265
6252
|
inc_rows: bool = False,
|
6266
6253
|
) -> bool:
|
6267
|
-
|
6268
|
-
|
6269
|
-
|
6270
|
-
|
6271
|
-
|
6272
|
-
|
6273
|
-
|
6254
|
+
return (
|
6255
|
+
isinstance(r, int)
|
6256
|
+
and isinstance(c, int)
|
6257
|
+
and any(
|
6258
|
+
box.coords.from_r <= r and box.coords.upto_r > r and box.coords.from_c <= c and box.coords.upto_c > c
|
6259
|
+
for item, box in self.get_selection_items(
|
6260
|
+
rows=inc_rows,
|
6261
|
+
columns=inc_cols,
|
6262
|
+
)
|
6263
|
+
)
|
6264
|
+
)
|
6274
6265
|
|
6275
6266
|
def col_selected(self, c: int) -> bool:
|
6276
|
-
|
6277
|
-
|
6278
|
-
|
6279
|
-
|
6280
|
-
|
6281
|
-
|
6282
|
-
|
6267
|
+
return isinstance(c, int) and any(
|
6268
|
+
box.coords.from_c <= c and box.coords.upto_c > c
|
6269
|
+
for item, box in self.get_selection_items(
|
6270
|
+
cells=False,
|
6271
|
+
rows=False,
|
6272
|
+
)
|
6273
|
+
)
|
6283
6274
|
|
6284
6275
|
def row_selected(self, r: int) -> bool:
|
6285
|
-
|
6286
|
-
|
6287
|
-
|
6288
|
-
|
6289
|
-
|
6290
|
-
|
6291
|
-
|
6276
|
+
return isinstance(r, int) and any(
|
6277
|
+
box.coords.from_r <= r and box.coords.upto_r > r
|
6278
|
+
for item, box in self.get_selection_items(
|
6279
|
+
cells=False,
|
6280
|
+
columns=False,
|
6281
|
+
)
|
6282
|
+
)
|
6292
6283
|
|
6293
6284
|
def anything_selected(
|
6294
6285
|
self,
|
tksheet/row_index.py
CHANGED
@@ -129,7 +129,7 @@ class RowIndex(tk.Canvas):
|
|
129
129
|
self.align = kwargs["row_index_align"]
|
130
130
|
self.default_index = kwargs["default_row_index"].lower()
|
131
131
|
|
132
|
-
self.
|
132
|
+
self.tree_reset()
|
133
133
|
self.basic_bindings()
|
134
134
|
|
135
135
|
def basic_bindings(self, enable: bool = True) -> None:
|
@@ -148,7 +148,7 @@ class RowIndex(tk.Canvas):
|
|
148
148
|
self.unbind("<Double-Button-1>")
|
149
149
|
self.unbind(rc_binding)
|
150
150
|
|
151
|
-
def
|
151
|
+
def tree_reset(self) -> None:
|
152
152
|
# treeview mode
|
153
153
|
self.tree = {}
|
154
154
|
self.tree_open_ids = set()
|
tksheet/sheet.py
CHANGED
@@ -1476,7 +1476,7 @@ class Sheet(tk.Frame):
|
|
1476
1476
|
if sheet_options:
|
1477
1477
|
self.ops = new_sheet_options()
|
1478
1478
|
if tree:
|
1479
|
-
self.RI.
|
1479
|
+
self.RI.tree_reset()
|
1480
1480
|
self.set_refresh_timer(redraw)
|
1481
1481
|
return self
|
1482
1482
|
|
@@ -2998,9 +2998,10 @@ class Sheet(tk.Frame):
|
|
2998
2998
|
|
2999
2999
|
def get_selected_min_max(
|
3000
3000
|
self,
|
3001
|
-
) ->
|
3002
|
-
|
3003
|
-
|
3001
|
+
) -> tuple[int, int, int, int] | tuple[None, None, None, None]:
|
3002
|
+
"""
|
3003
|
+
Returns (min_y, min_x, max_y, max_x) of all selection boxes
|
3004
|
+
"""
|
3004
3005
|
return self.MT.get_selected_min_max()
|
3005
3006
|
|
3006
3007
|
# Modifying Selected Cells
|
@@ -3286,12 +3287,12 @@ class Sheet(tk.Frame):
|
|
3286
3287
|
|
3287
3288
|
def get_column_widths(self, canvas_positions: bool = False) -> list[float]:
|
3288
3289
|
if canvas_positions:
|
3289
|
-
return
|
3290
|
+
return self.MT.col_positions
|
3290
3291
|
return self.MT.get_column_widths()
|
3291
3292
|
|
3292
3293
|
def get_row_heights(self, canvas_positions: bool = False) -> list[float]:
|
3293
3294
|
if canvas_positions:
|
3294
|
-
return
|
3295
|
+
return self.MT.row_positions
|
3295
3296
|
return self.MT.get_row_heights()
|
3296
3297
|
|
3297
3298
|
def set_column_widths(
|
@@ -4391,6 +4392,61 @@ class Sheet(tk.Frame):
|
|
4391
4392
|
)
|
4392
4393
|
return self
|
4393
4394
|
|
4395
|
+
def tree_reset(self) -> Sheet:
|
4396
|
+
self.deselect()
|
4397
|
+
self.RI.tree_reset()
|
4398
|
+
return self
|
4399
|
+
|
4400
|
+
def tree_get_open(self) -> set[str]:
|
4401
|
+
"""
|
4402
|
+
Returns the set[str] of iids that are open in the treeview
|
4403
|
+
"""
|
4404
|
+
return self.RI.tree_open_ids
|
4405
|
+
|
4406
|
+
def tree_set_open(self, open_ids: set[str]) -> Sheet:
|
4407
|
+
"""
|
4408
|
+
Accepts set[str] of iids that are open in the treeview
|
4409
|
+
Closes everything else
|
4410
|
+
"""
|
4411
|
+
self.RI.tree_open_ids = open_ids
|
4412
|
+
self.hide_rows(
|
4413
|
+
set(self.MT.displayed_rows),
|
4414
|
+
redraw=False,
|
4415
|
+
deselect_all=False,
|
4416
|
+
data_indexes=True,
|
4417
|
+
)
|
4418
|
+
self.show_rows(
|
4419
|
+
(self.RI.tree_rns[iid] for iid in self.get_children("")),
|
4420
|
+
redraw=False,
|
4421
|
+
deselect_all=True,
|
4422
|
+
)
|
4423
|
+
self.tree_open(*open_ids)
|
4424
|
+
return self
|
4425
|
+
|
4426
|
+
def tree_open(self, *items) -> Sheet:
|
4427
|
+
"""
|
4428
|
+
If used without args all items are opened
|
4429
|
+
"""
|
4430
|
+
if items:
|
4431
|
+
for item in items:
|
4432
|
+
self.item(item, open_=True)
|
4433
|
+
else:
|
4434
|
+
for item in self.get_children():
|
4435
|
+
self.item(item, open_=True)
|
4436
|
+
return self
|
4437
|
+
|
4438
|
+
def tree_close(self, *items) -> Sheet:
|
4439
|
+
"""
|
4440
|
+
If used without args all items are closed
|
4441
|
+
"""
|
4442
|
+
if items:
|
4443
|
+
for item in items:
|
4444
|
+
self.item(item, open_=False)
|
4445
|
+
else:
|
4446
|
+
for item in self.get_children():
|
4447
|
+
self.item(item, open_=False)
|
4448
|
+
return self
|
4449
|
+
|
4394
4450
|
def insert(
|
4395
4451
|
self,
|
4396
4452
|
parent: str = "",
|
@@ -4460,7 +4516,12 @@ class Sheet(tk.Frame):
|
|
4460
4516
|
text: str | None = None,
|
4461
4517
|
values: list | None = None,
|
4462
4518
|
open_: bool | None = None,
|
4463
|
-
) -> DotDict:
|
4519
|
+
) -> DotDict | Sheet:
|
4520
|
+
"""
|
4521
|
+
Modify options for item
|
4522
|
+
If no options are set then returns DotDict of options for item
|
4523
|
+
Else returns Sheet
|
4524
|
+
"""
|
4464
4525
|
if not (item := item.lower()) or item not in self.RI.tree:
|
4465
4526
|
raise ValueError(f"Item '{item}' does not exist.")
|
4466
4527
|
if isinstance(iid, str):
|
@@ -4479,28 +4540,33 @@ class Sheet(tk.Frame):
|
|
4479
4540
|
if isinstance(values, list):
|
4480
4541
|
self.set_data(self.RI.tree_rns[item], values)
|
4481
4542
|
if isinstance(open_, bool):
|
4482
|
-
if
|
4543
|
+
if self.RI.tree[item].children:
|
4544
|
+
if open_:
|
4545
|
+
self.RI.tree_open_ids.add(item)
|
4546
|
+
self.show_rows(
|
4547
|
+
(self.RI.tree_rns[did] for did in self.RI.get_iid_descendants(item, check_open=True)),
|
4548
|
+
redraw=False,
|
4549
|
+
deselect_all=False,
|
4550
|
+
)
|
4551
|
+
else:
|
4552
|
+
self.RI.tree_open_ids.discard(item)
|
4553
|
+
self.hide_rows(
|
4554
|
+
(self.RI.tree_rns[did] for did in self.RI.get_iid_descendants(item)),
|
4555
|
+
redraw=False,
|
4556
|
+
deselect_all=False,
|
4557
|
+
data_indexes=True,
|
4558
|
+
)
|
4559
|
+
else:
|
4483
4560
|
self.RI.tree_open_ids.discard(item)
|
4484
|
-
|
4485
|
-
|
4486
|
-
|
4487
|
-
|
4488
|
-
|
4489
|
-
|
4490
|
-
|
4491
|
-
|
4492
|
-
|
4493
|
-
(self.RI.tree_rns[did] for did in self.RI.get_iid_descendants(item)),
|
4494
|
-
redraw=False,
|
4495
|
-
deselect_all=False,
|
4496
|
-
data_indexes=True,
|
4497
|
-
)
|
4498
|
-
self.set_refresh_timer(isinstance(text, str) or isinstance(values, list) or isinstance(open_, bool))
|
4499
|
-
return DotDict(
|
4500
|
-
text=self.RI.tree[item].text,
|
4501
|
-
values=self[self.RI.tree_rns[item]].options(ndim=1).data,
|
4502
|
-
open_=item in self.RI.tree_open_ids,
|
4503
|
-
)
|
4561
|
+
get = not (isinstance(iid, str) or isinstance(text, str) or isinstance(values, list) or isinstance(open_, bool))
|
4562
|
+
self.set_refresh_timer(redraw=not get)
|
4563
|
+
if get:
|
4564
|
+
return DotDict(
|
4565
|
+
text=self.RI.tree[item].text,
|
4566
|
+
values=self[self.RI.tree_rns[item]].options(ndim=1).data,
|
4567
|
+
open_=item in self.RI.tree_open_ids,
|
4568
|
+
)
|
4569
|
+
return self
|
4504
4570
|
|
4505
4571
|
def itemrow(self, item: str) -> int:
|
4506
4572
|
return self.RI.tree_rns[item.lower()]
|
@@ -4522,11 +4588,6 @@ class Sheet(tk.Frame):
|
|
4522
4588
|
else:
|
4523
4589
|
yield from (n.iid for n in self.RI.tree[item].children)
|
4524
4590
|
|
4525
|
-
def reset_tree(self) -> Sheet:
|
4526
|
-
self.deselect()
|
4527
|
-
self.RI.reset_tree()
|
4528
|
-
return self
|
4529
|
-
|
4530
4591
|
def del_items(self, *items) -> Sheet:
|
4531
4592
|
"""
|
4532
4593
|
Also deletes all descendants of items
|
@@ -1,20 +1,20 @@
|
|
1
|
-
tksheet/__init__.py,sha256=
|
1
|
+
tksheet/__init__.py,sha256=XdNk6UqANLa3RfjSgcbjOXH8Rjtf-9LLCGU8EESkoMY,1874
|
2
2
|
tksheet/colors.py,sha256=1k06VorynLmnC4FdJg8H4reIA6rXaeXBpdMwXLhN8oc,51594
|
3
3
|
tksheet/column_headers.py,sha256=1I49CQS4unBcJ-y044R-DtYhJ4zUplrOfImOk8qHIj8,99396
|
4
4
|
tksheet/formatters.py,sha256=DXif00aq9DgFpXwkbiqD86KxtDg0Meop51hLY-KcGNQ,10037
|
5
|
-
tksheet/functions.py,sha256=
|
6
|
-
tksheet/main_table.py,sha256=
|
5
|
+
tksheet/functions.py,sha256=NnBFBvTqT6VhCK8pFlXqTwKekKpcsCYeuxaALcJeVzw,38651
|
6
|
+
tksheet/main_table.py,sha256=Kh8ND0JnVHVeiwTt07FJkbP2GTlen3qCS5bt0xpbrdA,318848
|
7
7
|
tksheet/other_classes.py,sha256=s559IxoFEeAgxTKrrHZnAeXUXWIEmiP4tBncIdQIXSQ,13544
|
8
|
-
tksheet/row_index.py,sha256=
|
9
|
-
tksheet/sheet.py,sha256=
|
8
|
+
tksheet/row_index.py,sha256=GzK6Gfi4v6zwALn5IvBz22SdSFLUgxS1yLX4bm7z3sg,104428
|
9
|
+
tksheet/sheet.py,sha256=ZoxxO1VZZzgshmp_3eJkkzXjx6S3M5T95sw3CTfUqHo,255904
|
10
10
|
tksheet/sheet_options.py,sha256=Vcy4RxTKvf2HM-Yc53ex0lpBe6ATXc_pdx4oLhfjDgU,11906
|
11
11
|
tksheet/text_editor.py,sha256=7xsEbgIyAWHDBWroh2wk1VeoVftFALlPZC9OANgD6LA,6662
|
12
12
|
tksheet/themes.py,sha256=OwUe31NRbosjw3ZoZsMyB8lNVyYin9YcKLhCturi5q8,13398
|
13
13
|
tksheet/top_left_rectangle.py,sha256=-2u9GfOvcqhkKwHEtbqdFvXCY3RbvL5k2Sh9l3r_k04,8275
|
14
14
|
tksheet/types.py,sha256=IgoEHMbceKpakcZtanxKaKJ4RdCq7UW6EoEIIz5O59k,340
|
15
15
|
tksheet/vars.py,sha256=Iukk7-MMT9X7vv0m3nQPKzbp2Iw2Pg1wJEW7js919Mo,2092
|
16
|
-
tksheet-7.1.
|
17
|
-
tksheet-7.1.
|
18
|
-
tksheet-7.1.
|
19
|
-
tksheet-7.1.
|
20
|
-
tksheet-7.1.
|
16
|
+
tksheet-7.1.2.dist-info/LICENSE.txt,sha256=ndbcCPe9SlHfweE_W2RAueWUe2k7yudyxYLq6WjFdn4,1101
|
17
|
+
tksheet-7.1.2.dist-info/METADATA,sha256=plUvLhmwtF-WEveHRmf99r4YViVdRJDZTCCJ6noYtZU,6013
|
18
|
+
tksheet-7.1.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
19
|
+
tksheet-7.1.2.dist-info/top_level.txt,sha256=my61PXCcck_HHAc9cq3NAlyAr3A3FXxCy9gptEOaCN8,8
|
20
|
+
tksheet-7.1.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|