tksheet 7.5.5__py3-none-any.whl → 7.5.7__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/column_headers.py +230 -87
- tksheet/constants.py +1 -0
- tksheet/find_window.py +4 -4
- tksheet/formatters.py +4 -2
- tksheet/functions.py +91 -35
- tksheet/main_table.py +360 -631
- tksheet/menus.py +494 -0
- tksheet/other_classes.py +3 -0
- tksheet/row_index.py +229 -91
- tksheet/sheet.py +99 -39
- tksheet/sheet_options.py +5 -1
- tksheet/tksheet_types.py +1 -0
- tksheet/tooltip.py +335 -0
- {tksheet-7.5.5.dist-info → tksheet-7.5.7.dist-info}/METADATA +1 -1
- tksheet-7.5.7.dist-info/RECORD +24 -0
- {tksheet-7.5.5.dist-info → tksheet-7.5.7.dist-info}/WHEEL +1 -1
- tksheet-7.5.5.dist-info/RECORD +0 -22
- {tksheet-7.5.5.dist-info → tksheet-7.5.7.dist-info}/licenses/LICENSE.txt +0 -0
- {tksheet-7.5.5.dist-info → tksheet-7.5.7.dist-info}/top_level.txt +0 -0
tksheet/menus.py
ADDED
@@ -0,0 +1,494 @@
|
|
1
|
+
import tkinter as tk
|
2
|
+
from tkinter import TclError
|
3
|
+
|
4
|
+
from .functions import get_menu_kwargs
|
5
|
+
|
6
|
+
|
7
|
+
def menu_add_command(menu: tk.Menu, **kwargs) -> None:
|
8
|
+
if "label" not in kwargs:
|
9
|
+
return
|
10
|
+
try:
|
11
|
+
index = menu.index(kwargs["label"])
|
12
|
+
menu.delete(index)
|
13
|
+
except TclError:
|
14
|
+
pass
|
15
|
+
menu.add_command(**kwargs)
|
16
|
+
|
17
|
+
|
18
|
+
def build_table_rc_menu(MT, popup_menu: tk.Menu, r: int, c: int) -> None:
|
19
|
+
datarn, datacn = MT.datarn(r), MT.datacn(c)
|
20
|
+
popup_menu.delete(0, "end")
|
21
|
+
mnkwgs = get_menu_kwargs(MT.PAR.ops)
|
22
|
+
if MT.table_edit_cell_enabled() and not MT.is_readonly(datarn, datacn):
|
23
|
+
menu_add_command(
|
24
|
+
popup_menu,
|
25
|
+
label=MT.PAR.ops.edit_cell_label,
|
26
|
+
command=lambda: MT.open_cell(event="rc"),
|
27
|
+
image=MT.PAR.ops.edit_cell_image,
|
28
|
+
compound=MT.PAR.ops.edit_cell_compound,
|
29
|
+
**mnkwgs,
|
30
|
+
)
|
31
|
+
if MT.cut_enabled and any(x in MT.enabled_bindings_menu_entries for x in ("all", "cut", "edit_bindings", "edit")):
|
32
|
+
menu_add_command(
|
33
|
+
popup_menu,
|
34
|
+
label=MT.PAR.ops.cut_label,
|
35
|
+
accelerator=MT.PAR.ops.cut_accelerator,
|
36
|
+
command=MT.ctrl_x,
|
37
|
+
image=MT.PAR.ops.cut_image,
|
38
|
+
compound=MT.PAR.ops.cut_compound,
|
39
|
+
**mnkwgs,
|
40
|
+
)
|
41
|
+
if MT.copy_enabled and any(x in MT.enabled_bindings_menu_entries for x in ("all", "copy", "edit_bindings", "edit")):
|
42
|
+
menu_add_command(
|
43
|
+
popup_menu,
|
44
|
+
label=MT.PAR.ops.copy_label,
|
45
|
+
accelerator=MT.PAR.ops.copy_accelerator,
|
46
|
+
command=MT.ctrl_c,
|
47
|
+
image=MT.PAR.ops.copy_image,
|
48
|
+
compound=MT.PAR.ops.copy_compound,
|
49
|
+
**mnkwgs,
|
50
|
+
)
|
51
|
+
if MT.paste_enabled and any(
|
52
|
+
x in MT.enabled_bindings_menu_entries for x in ("all", "paste", "edit_bindings", "edit")
|
53
|
+
):
|
54
|
+
menu_add_command(
|
55
|
+
popup_menu,
|
56
|
+
label=MT.PAR.ops.paste_label,
|
57
|
+
accelerator=MT.PAR.ops.paste_accelerator,
|
58
|
+
command=MT.ctrl_v,
|
59
|
+
image=MT.PAR.ops.paste_image,
|
60
|
+
compound=MT.PAR.ops.paste_compound,
|
61
|
+
**mnkwgs,
|
62
|
+
)
|
63
|
+
if MT.delete_key_enabled and any(
|
64
|
+
x in MT.enabled_bindings_menu_entries for x in ("all", "delete", "edit_bindings", "edit")
|
65
|
+
):
|
66
|
+
menu_add_command(
|
67
|
+
popup_menu,
|
68
|
+
label=MT.PAR.ops.delete_label,
|
69
|
+
accelerator=MT.PAR.ops.delete_accelerator,
|
70
|
+
command=MT.delete_key,
|
71
|
+
image=MT.PAR.ops.delete_image,
|
72
|
+
compound=MT.PAR.ops.delete_compound,
|
73
|
+
**mnkwgs,
|
74
|
+
)
|
75
|
+
if MT.rc_sort_cells_enabled:
|
76
|
+
menu_add_command(
|
77
|
+
popup_menu,
|
78
|
+
label=MT.PAR.ops.sort_cells_label,
|
79
|
+
accelerator=MT.PAR.ops.sort_cells_accelerator,
|
80
|
+
command=MT.sort_boxes,
|
81
|
+
image=MT.PAR.ops.sort_cells_image,
|
82
|
+
compound=MT.PAR.ops.sort_cells_compound,
|
83
|
+
**mnkwgs,
|
84
|
+
)
|
85
|
+
menu_add_command(
|
86
|
+
popup_menu,
|
87
|
+
label=MT.PAR.ops.sort_cells_reverse_label,
|
88
|
+
accelerator=MT.PAR.ops.sort_cells_reverse_accelerator,
|
89
|
+
command=lambda: MT.sort_boxes(reverse=True),
|
90
|
+
image=MT.PAR.ops.sort_cells_reverse_image,
|
91
|
+
compound=MT.PAR.ops.sort_cells_reverse_compound,
|
92
|
+
**mnkwgs,
|
93
|
+
)
|
94
|
+
menu_add_command(
|
95
|
+
popup_menu,
|
96
|
+
label=MT.PAR.ops.sort_cells_x_label,
|
97
|
+
accelerator=MT.PAR.ops.sort_cells_x_accelerator,
|
98
|
+
command=lambda: MT.sort_boxes(row_wise=True),
|
99
|
+
image=MT.PAR.ops.sort_cells_x_image,
|
100
|
+
compound=MT.PAR.ops.sort_cells_x_compound,
|
101
|
+
**mnkwgs,
|
102
|
+
)
|
103
|
+
menu_add_command(
|
104
|
+
popup_menu,
|
105
|
+
label=MT.PAR.ops.sort_cells_x_reverse_label,
|
106
|
+
accelerator=MT.PAR.ops.sort_cells_x_reverse_accelerator,
|
107
|
+
command=lambda: MT.sort_boxes(reverse=True, row_wise=True),
|
108
|
+
image=MT.PAR.ops.sort_cells_x_reverse_image,
|
109
|
+
compound=MT.PAR.ops.sort_cells_x_reverse_compound,
|
110
|
+
**mnkwgs,
|
111
|
+
)
|
112
|
+
if MT.undo_enabled and any(
|
113
|
+
x in MT.enabled_bindings_menu_entries for x in ("all", "undo", "redo", "edit_bindings", "edit")
|
114
|
+
):
|
115
|
+
if MT.undo_stack:
|
116
|
+
menu_add_command(
|
117
|
+
popup_menu,
|
118
|
+
label=MT.PAR.ops.undo_label,
|
119
|
+
accelerator=MT.PAR.ops.undo_accelerator,
|
120
|
+
command=MT.undo,
|
121
|
+
image=MT.PAR.ops.undo_image,
|
122
|
+
compound=MT.PAR.ops.undo_compound,
|
123
|
+
**mnkwgs,
|
124
|
+
)
|
125
|
+
if MT.redo_stack:
|
126
|
+
menu_add_command(
|
127
|
+
popup_menu,
|
128
|
+
label=MT.PAR.ops.redo_label,
|
129
|
+
accelerator=MT.PAR.ops.redo_accelerator,
|
130
|
+
command=MT.redo,
|
131
|
+
image=MT.PAR.ops.redo_image,
|
132
|
+
compound=MT.PAR.ops.redo_compound,
|
133
|
+
**mnkwgs,
|
134
|
+
)
|
135
|
+
for label, kws in MT.extra_table_rc_menu_funcs.items():
|
136
|
+
menu_add_command(popup_menu, label=label, **{**mnkwgs, **kws})
|
137
|
+
|
138
|
+
|
139
|
+
def build_index_rc_menu(MT, popup_menu: tk.Menu, r: int) -> None:
|
140
|
+
datarn = MT.datarn(r)
|
141
|
+
popup_menu.delete(0, "end")
|
142
|
+
mnkwgs = get_menu_kwargs(MT.PAR.ops)
|
143
|
+
if MT.index_edit_cell_enabled() and not MT.RI.is_readonly(datarn):
|
144
|
+
menu_add_command(
|
145
|
+
popup_menu,
|
146
|
+
label=MT.PAR.ops.edit_index_label,
|
147
|
+
command=lambda: MT.RI.open_cell(event="rc"),
|
148
|
+
image=MT.PAR.ops.edit_index_image,
|
149
|
+
compound=MT.PAR.ops.edit_index_compound,
|
150
|
+
**mnkwgs,
|
151
|
+
)
|
152
|
+
if MT.cut_enabled and any(x in MT.enabled_bindings_menu_entries for x in ("all", "cut", "edit_bindings", "edit")):
|
153
|
+
menu_add_command(
|
154
|
+
popup_menu,
|
155
|
+
label=MT.PAR.ops.cut_contents_label,
|
156
|
+
accelerator=MT.PAR.ops.cut_contents_accelerator,
|
157
|
+
command=MT.ctrl_x,
|
158
|
+
image=MT.PAR.ops.cut_contents_image,
|
159
|
+
compound=MT.PAR.ops.cut_contents_compound,
|
160
|
+
**mnkwgs,
|
161
|
+
)
|
162
|
+
if MT.copy_enabled and any(x in MT.enabled_bindings_menu_entries for x in ("all", "copy", "edit_bindings", "edit")):
|
163
|
+
menu_add_command(
|
164
|
+
popup_menu,
|
165
|
+
label=MT.PAR.ops.copy_contents_label,
|
166
|
+
accelerator=MT.PAR.ops.copy_contents_accelerator,
|
167
|
+
command=MT.ctrl_c,
|
168
|
+
image=MT.PAR.ops.copy_contents_image,
|
169
|
+
compound=MT.PAR.ops.copy_contents_compound,
|
170
|
+
**mnkwgs,
|
171
|
+
)
|
172
|
+
if MT.paste_enabled and any(
|
173
|
+
x in MT.enabled_bindings_menu_entries for x in ("all", "paste", "edit_bindings", "edit")
|
174
|
+
):
|
175
|
+
menu_add_command(
|
176
|
+
popup_menu,
|
177
|
+
label=MT.PAR.ops.paste_label,
|
178
|
+
accelerator=MT.PAR.ops.paste_accelerator,
|
179
|
+
command=MT.ctrl_v,
|
180
|
+
image=MT.PAR.ops.paste_image,
|
181
|
+
compound=MT.PAR.ops.paste_compound,
|
182
|
+
**mnkwgs,
|
183
|
+
)
|
184
|
+
if MT.delete_key_enabled and any(
|
185
|
+
x in MT.enabled_bindings_menu_entries for x in ("all", "delete", "edit_bindings", "edit")
|
186
|
+
):
|
187
|
+
menu_add_command(
|
188
|
+
popup_menu,
|
189
|
+
label=MT.PAR.ops.clear_contents_label,
|
190
|
+
accelerator=MT.PAR.ops.clear_contents_accelerator,
|
191
|
+
command=MT.delete_key,
|
192
|
+
image=MT.PAR.ops.clear_contents_image,
|
193
|
+
compound=MT.PAR.ops.clear_contents_compound,
|
194
|
+
**mnkwgs,
|
195
|
+
)
|
196
|
+
if MT.rc_delete_row_enabled:
|
197
|
+
menu_add_command(
|
198
|
+
popup_menu,
|
199
|
+
label=MT.PAR.ops.delete_rows_label,
|
200
|
+
command=MT.delete_rows,
|
201
|
+
image=MT.PAR.ops.delete_rows_image,
|
202
|
+
compound=MT.PAR.ops.delete_rows_compound,
|
203
|
+
**mnkwgs,
|
204
|
+
)
|
205
|
+
if MT.rc_insert_row_enabled:
|
206
|
+
menu_add_command(
|
207
|
+
popup_menu,
|
208
|
+
label=MT.PAR.ops.insert_rows_above_label,
|
209
|
+
command=lambda: MT.rc_add_rows("above"),
|
210
|
+
image=MT.PAR.ops.insert_rows_above_image,
|
211
|
+
compound=MT.PAR.ops.insert_rows_above_compound,
|
212
|
+
**mnkwgs,
|
213
|
+
)
|
214
|
+
menu_add_command(
|
215
|
+
popup_menu,
|
216
|
+
label=MT.PAR.ops.insert_rows_below_label,
|
217
|
+
command=lambda: MT.rc_add_rows("below"),
|
218
|
+
image=MT.PAR.ops.insert_rows_below_image,
|
219
|
+
compound=MT.PAR.ops.insert_rows_below_compound,
|
220
|
+
**mnkwgs,
|
221
|
+
)
|
222
|
+
if MT.rc_sort_row_enabled:
|
223
|
+
menu_add_command(
|
224
|
+
popup_menu,
|
225
|
+
label=MT.PAR.ops.sort_row_label,
|
226
|
+
accelerator=MT.PAR.ops.sort_row_accelerator,
|
227
|
+
command=MT.RI._sort_rows,
|
228
|
+
image=MT.PAR.ops.sort_row_image,
|
229
|
+
compound=MT.PAR.ops.sort_row_compound,
|
230
|
+
**mnkwgs,
|
231
|
+
)
|
232
|
+
menu_add_command(
|
233
|
+
popup_menu,
|
234
|
+
label=MT.PAR.ops.sort_row_reverse_label,
|
235
|
+
accelerator=MT.PAR.ops.sort_row_reverse_accelerator,
|
236
|
+
command=lambda: MT.RI._sort_rows(reverse=True),
|
237
|
+
image=MT.PAR.ops.sort_row_reverse_image,
|
238
|
+
compound=MT.PAR.ops.sort_row_reverse_compound,
|
239
|
+
**mnkwgs,
|
240
|
+
)
|
241
|
+
if MT.rc_sort_columns_enabled:
|
242
|
+
menu_add_command(
|
243
|
+
popup_menu,
|
244
|
+
label=MT.PAR.ops.sort_columns_label,
|
245
|
+
accelerator=MT.PAR.ops.sort_columns_accelerator,
|
246
|
+
command=MT.RI._sort_columns_by_row,
|
247
|
+
image=MT.PAR.ops.sort_columns_image,
|
248
|
+
compound=MT.PAR.ops.sort_columns_compound,
|
249
|
+
**mnkwgs,
|
250
|
+
)
|
251
|
+
menu_add_command(
|
252
|
+
popup_menu,
|
253
|
+
label=MT.PAR.ops.sort_columns_reverse_label,
|
254
|
+
accelerator=MT.PAR.ops.sort_columns_reverse_accelerator,
|
255
|
+
command=lambda: MT.RI._sort_columns_by_row(reverse=True),
|
256
|
+
image=MT.PAR.ops.sort_columns_reverse_image,
|
257
|
+
compound=MT.PAR.ops.sort_columns_reverse_compound,
|
258
|
+
**mnkwgs,
|
259
|
+
)
|
260
|
+
if MT.undo_enabled and any(
|
261
|
+
x in MT.enabled_bindings_menu_entries for x in ("all", "undo", "redo", "edit_bindings", "edit")
|
262
|
+
):
|
263
|
+
if MT.undo_stack:
|
264
|
+
menu_add_command(
|
265
|
+
popup_menu,
|
266
|
+
label=MT.PAR.ops.undo_label,
|
267
|
+
accelerator=MT.PAR.ops.undo_accelerator,
|
268
|
+
command=MT.undo,
|
269
|
+
image=MT.PAR.ops.undo_image,
|
270
|
+
compound=MT.PAR.ops.undo_compound,
|
271
|
+
**mnkwgs,
|
272
|
+
)
|
273
|
+
if MT.redo_stack:
|
274
|
+
menu_add_command(
|
275
|
+
popup_menu,
|
276
|
+
label=MT.PAR.ops.redo_label,
|
277
|
+
accelerator=MT.PAR.ops.redo_accelerator,
|
278
|
+
command=MT.redo,
|
279
|
+
image=MT.PAR.ops.redo_image,
|
280
|
+
compound=MT.PAR.ops.redo_compound,
|
281
|
+
**mnkwgs,
|
282
|
+
)
|
283
|
+
for label, kws in MT.extra_index_rc_menu_funcs.items():
|
284
|
+
menu_add_command(popup_menu, label=label, **{**mnkwgs, **kws})
|
285
|
+
|
286
|
+
|
287
|
+
def build_header_rc_menu(MT, popup_menu: tk.Menu, c: int) -> None:
|
288
|
+
datacn = MT.datacn(c)
|
289
|
+
popup_menu.delete(0, "end")
|
290
|
+
mnkwgs = get_menu_kwargs(MT.PAR.ops)
|
291
|
+
if MT.header_edit_cell_enabled() and not MT.CH.is_readonly(datacn):
|
292
|
+
menu_add_command(
|
293
|
+
popup_menu,
|
294
|
+
label=MT.PAR.ops.edit_header_label,
|
295
|
+
command=lambda: MT.CH.open_cell(event="rc"),
|
296
|
+
image=MT.PAR.ops.edit_header_image,
|
297
|
+
compound=MT.PAR.ops.edit_header_compound,
|
298
|
+
**mnkwgs,
|
299
|
+
)
|
300
|
+
if MT.cut_enabled and any(x in MT.enabled_bindings_menu_entries for x in ("all", "cut", "edit_bindings", "edit")):
|
301
|
+
menu_add_command(
|
302
|
+
popup_menu,
|
303
|
+
label=MT.PAR.ops.cut_contents_label,
|
304
|
+
accelerator=MT.PAR.ops.cut_contents_accelerator,
|
305
|
+
command=MT.ctrl_x,
|
306
|
+
image=MT.PAR.ops.cut_contents_image,
|
307
|
+
compound=MT.PAR.ops.cut_contents_compound,
|
308
|
+
**mnkwgs,
|
309
|
+
)
|
310
|
+
if MT.copy_enabled and any(x in MT.enabled_bindings_menu_entries for x in ("all", "copy", "edit_bindings", "edit")):
|
311
|
+
menu_add_command(
|
312
|
+
popup_menu,
|
313
|
+
label=MT.PAR.ops.copy_contents_label,
|
314
|
+
accelerator=MT.PAR.ops.copy_contents_accelerator,
|
315
|
+
command=MT.ctrl_c,
|
316
|
+
image=MT.PAR.ops.copy_contents_image,
|
317
|
+
compound=MT.PAR.ops.copy_contents_compound,
|
318
|
+
**mnkwgs,
|
319
|
+
)
|
320
|
+
if MT.paste_enabled and any(
|
321
|
+
x in MT.enabled_bindings_menu_entries for x in ("all", "paste", "edit_bindings", "edit")
|
322
|
+
):
|
323
|
+
menu_add_command(
|
324
|
+
popup_menu,
|
325
|
+
label=MT.PAR.ops.paste_label,
|
326
|
+
accelerator=MT.PAR.ops.paste_accelerator,
|
327
|
+
command=MT.ctrl_v,
|
328
|
+
image=MT.PAR.ops.paste_image,
|
329
|
+
compound=MT.PAR.ops.paste_compound,
|
330
|
+
**mnkwgs,
|
331
|
+
)
|
332
|
+
if MT.delete_key_enabled and any(
|
333
|
+
x in MT.enabled_bindings_menu_entries for x in ("all", "delete", "edit_bindings", "edit")
|
334
|
+
):
|
335
|
+
menu_add_command(
|
336
|
+
popup_menu,
|
337
|
+
label=MT.PAR.ops.clear_contents_label,
|
338
|
+
accelerator=MT.PAR.ops.clear_contents_accelerator,
|
339
|
+
command=MT.delete_key,
|
340
|
+
image=MT.PAR.ops.clear_contents_image,
|
341
|
+
compound=MT.PAR.ops.clear_contents_compound,
|
342
|
+
**mnkwgs,
|
343
|
+
)
|
344
|
+
if MT.rc_delete_column_enabled:
|
345
|
+
menu_add_command(
|
346
|
+
popup_menu,
|
347
|
+
label=MT.PAR.ops.delete_columns_label,
|
348
|
+
command=MT.delete_columns,
|
349
|
+
image=MT.PAR.ops.delete_columns_image,
|
350
|
+
compound=MT.PAR.ops.delete_columns_compound,
|
351
|
+
**mnkwgs,
|
352
|
+
)
|
353
|
+
if MT.rc_insert_column_enabled:
|
354
|
+
menu_add_command(
|
355
|
+
popup_menu,
|
356
|
+
label=MT.PAR.ops.insert_columns_left_label,
|
357
|
+
command=lambda: MT.rc_add_columns("left"),
|
358
|
+
image=MT.PAR.ops.insert_columns_left_image,
|
359
|
+
compound=MT.PAR.ops.insert_columns_left_compound,
|
360
|
+
**mnkwgs,
|
361
|
+
)
|
362
|
+
menu_add_command(
|
363
|
+
popup_menu,
|
364
|
+
label=MT.PAR.ops.insert_columns_right_label,
|
365
|
+
command=lambda: MT.rc_add_columns("right"),
|
366
|
+
image=MT.PAR.ops.insert_columns_right_image,
|
367
|
+
compound=MT.PAR.ops.insert_columns_right_compound,
|
368
|
+
**mnkwgs,
|
369
|
+
)
|
370
|
+
if MT.rc_sort_column_enabled:
|
371
|
+
menu_add_command(
|
372
|
+
popup_menu,
|
373
|
+
label=MT.PAR.ops.sort_column_label,
|
374
|
+
accelerator=MT.PAR.ops.sort_column_accelerator,
|
375
|
+
command=MT.CH._sort_columns,
|
376
|
+
image=MT.PAR.ops.sort_column_image,
|
377
|
+
compound=MT.PAR.ops.sort_column_compound,
|
378
|
+
**mnkwgs,
|
379
|
+
)
|
380
|
+
menu_add_command(
|
381
|
+
popup_menu,
|
382
|
+
label=MT.PAR.ops.sort_column_reverse_label,
|
383
|
+
accelerator=MT.PAR.ops.sort_column_reverse_accelerator,
|
384
|
+
command=lambda: MT.CH._sort_columns(reverse=True),
|
385
|
+
image=MT.PAR.ops.sort_column_reverse_image,
|
386
|
+
compound=MT.PAR.ops.sort_column_reverse_compound,
|
387
|
+
**mnkwgs,
|
388
|
+
)
|
389
|
+
if MT.rc_sort_rows_enabled:
|
390
|
+
menu_add_command(
|
391
|
+
popup_menu,
|
392
|
+
label=MT.PAR.ops.sort_rows_label,
|
393
|
+
accelerator=MT.PAR.ops.sort_rows_accelerator,
|
394
|
+
command=MT.CH._sort_rows_by_column,
|
395
|
+
image=MT.PAR.ops.sort_rows_image,
|
396
|
+
compound=MT.PAR.ops.sort_rows_compound,
|
397
|
+
**mnkwgs,
|
398
|
+
)
|
399
|
+
menu_add_command(
|
400
|
+
popup_menu,
|
401
|
+
label=MT.PAR.ops.sort_rows_reverse_label,
|
402
|
+
accelerator=MT.PAR.ops.sort_rows_reverse_accelerator,
|
403
|
+
command=lambda: MT.CH._sort_rows_by_column(reverse=True),
|
404
|
+
image=MT.PAR.ops.sort_rows_reverse_image,
|
405
|
+
compound=MT.PAR.ops.sort_rows_reverse_compound,
|
406
|
+
**mnkwgs,
|
407
|
+
)
|
408
|
+
if MT.undo_enabled and any(
|
409
|
+
x in MT.enabled_bindings_menu_entries for x in ("all", "undo", "redo", "edit_bindings", "edit")
|
410
|
+
):
|
411
|
+
if MT.undo_stack:
|
412
|
+
menu_add_command(
|
413
|
+
popup_menu,
|
414
|
+
label=MT.PAR.ops.undo_label,
|
415
|
+
accelerator=MT.PAR.ops.undo_accelerator,
|
416
|
+
command=MT.undo,
|
417
|
+
image=MT.PAR.ops.undo_image,
|
418
|
+
compound=MT.PAR.ops.undo_compound,
|
419
|
+
**mnkwgs,
|
420
|
+
)
|
421
|
+
if MT.redo_stack:
|
422
|
+
menu_add_command(
|
423
|
+
popup_menu,
|
424
|
+
label=MT.PAR.ops.redo_label,
|
425
|
+
accelerator=MT.PAR.ops.redo_accelerator,
|
426
|
+
command=MT.redo,
|
427
|
+
image=MT.PAR.ops.redo_image,
|
428
|
+
compound=MT.PAR.ops.redo_compound,
|
429
|
+
**mnkwgs,
|
430
|
+
)
|
431
|
+
for label, kws in MT.extra_header_rc_menu_funcs.items():
|
432
|
+
menu_add_command(popup_menu, label=label, **{**mnkwgs, **kws})
|
433
|
+
|
434
|
+
|
435
|
+
def build_empty_rc_menu(MT, popup_menu: tk.Menu) -> None:
|
436
|
+
popup_menu.delete(0, "end")
|
437
|
+
mnkwgs = get_menu_kwargs(MT.PAR.ops)
|
438
|
+
if (
|
439
|
+
MT.paste_enabled
|
440
|
+
and any(x in MT.enabled_bindings_menu_entries for x in ("all", "paste", "edit_bindings", "edit"))
|
441
|
+
and (MT.PAR.ops.paste_can_expand_x or MT.PAR.ops.paste_can_expand_y)
|
442
|
+
):
|
443
|
+
menu_add_command(
|
444
|
+
popup_menu,
|
445
|
+
label=MT.PAR.ops.paste_label,
|
446
|
+
accelerator=MT.PAR.ops.paste_accelerator,
|
447
|
+
command=MT.ctrl_v,
|
448
|
+
image=MT.PAR.ops.paste_image,
|
449
|
+
compound=MT.PAR.ops.paste_compound,
|
450
|
+
**mnkwgs,
|
451
|
+
)
|
452
|
+
if MT.rc_insert_column_enabled:
|
453
|
+
menu_add_command(
|
454
|
+
popup_menu,
|
455
|
+
label=MT.PAR.ops.insert_column_label,
|
456
|
+
command=lambda: MT.rc_add_columns("left"),
|
457
|
+
image=MT.PAR.ops.insert_column_image,
|
458
|
+
compound=MT.PAR.ops.insert_column_compound,
|
459
|
+
**mnkwgs,
|
460
|
+
)
|
461
|
+
if MT.rc_insert_row_enabled:
|
462
|
+
menu_add_command(
|
463
|
+
popup_menu,
|
464
|
+
label=MT.PAR.ops.insert_row_label,
|
465
|
+
command=lambda: MT.rc_add_rows("below"),
|
466
|
+
image=MT.PAR.ops.insert_row_image,
|
467
|
+
compound=MT.PAR.ops.insert_row_compound,
|
468
|
+
**mnkwgs,
|
469
|
+
)
|
470
|
+
if MT.undo_enabled and any(
|
471
|
+
x in MT.enabled_bindings_menu_entries for x in ("all", "undo", "redo", "edit_bindings", "edit")
|
472
|
+
):
|
473
|
+
if MT.undo_stack:
|
474
|
+
menu_add_command(
|
475
|
+
popup_menu,
|
476
|
+
label=MT.PAR.ops.undo_label,
|
477
|
+
accelerator=MT.PAR.ops.undo_accelerator,
|
478
|
+
command=MT.undo,
|
479
|
+
image=MT.PAR.ops.undo_image,
|
480
|
+
compound=MT.PAR.ops.undo_compound,
|
481
|
+
**mnkwgs,
|
482
|
+
)
|
483
|
+
if MT.redo_stack:
|
484
|
+
menu_add_command(
|
485
|
+
popup_menu,
|
486
|
+
label=MT.PAR.ops.redo_label,
|
487
|
+
accelerator=MT.PAR.ops.redo_accelerator,
|
488
|
+
command=MT.redo,
|
489
|
+
image=MT.PAR.ops.redo_image,
|
490
|
+
compound=MT.PAR.ops.redo_compound,
|
491
|
+
**mnkwgs,
|
492
|
+
)
|
493
|
+
for label, kws in MT.extra_empty_space_rc_menu_funcs.items():
|
494
|
+
menu_add_command(popup_menu, label=label, **{**mnkwgs, **kws})
|
tksheet/other_classes.py
CHANGED
@@ -204,6 +204,9 @@ class Span(dict):
|
|
204
204
|
def del_format(self) -> Span:
|
205
205
|
return self["widget"].del_format(self)
|
206
206
|
|
207
|
+
def note(self, note: str | None = None, readonly: bool = True) -> Span:
|
208
|
+
return self["widget"].note(self, note=note, readonly=readonly)
|
209
|
+
|
207
210
|
def highlight(
|
208
211
|
self,
|
209
212
|
bg: bool | None | str = False,
|