tksheet 7.0.6__py3-none-any.whl → 7.1.0__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/column_headers.py +252 -270
- tksheet/functions.py +37 -9
- tksheet/main_table.py +743 -795
- tksheet/other_classes.py +129 -4
- tksheet/row_index.py +470 -316
- tksheet/sheet.py +994 -177
- tksheet/sheet_options.py +34 -0
- tksheet/text_editor.py +93 -78
- tksheet/themes.py +104 -0
- tksheet/vars.py +35 -0
- {tksheet-7.0.6.dist-info → tksheet-7.1.0.dist-info}/METADATA +1 -1
- tksheet-7.1.0.dist-info/RECORD +20 -0
- {tksheet-7.0.6.dist-info → tksheet-7.1.0.dist-info}/WHEEL +1 -1
- tksheet-7.0.6.dist-info/RECORD +0 -20
- {tksheet-7.0.6.dist-info → tksheet-7.1.0.dist-info}/LICENSE.txt +0 -0
- {tksheet-7.0.6.dist-info → tksheet-7.1.0.dist-info}/top_level.txt +0 -0
tksheet/other_classes.py
CHANGED
@@ -4,14 +4,11 @@ import pickle
|
|
4
4
|
from collections import namedtuple
|
5
5
|
from collections.abc import Callable, Generator, Hashable, Iterator
|
6
6
|
from functools import partial
|
7
|
+
from typing import Literal
|
7
8
|
|
8
9
|
pickle_obj = partial(pickle.dumps, protocol=pickle.HIGHEST_PROTOCOL)
|
9
10
|
|
10
11
|
FontTuple = namedtuple("FontTuple", "family size style")
|
11
|
-
CurrentlySelectedClass = namedtuple(
|
12
|
-
"CurrentlySelectedClass",
|
13
|
-
"row column type_ tags",
|
14
|
-
)
|
15
12
|
Box_nt = namedtuple(
|
16
13
|
"Box_nt",
|
17
14
|
"from_r from_c upto_r upto_c",
|
@@ -219,6 +216,21 @@ class Span(dict):
|
|
219
216
|
self["widget"].clear(self, redraw=redraw)
|
220
217
|
return self
|
221
218
|
|
219
|
+
def tag(self, *tags) -> Span:
|
220
|
+
self["widget"].tag(self, tags=tags)
|
221
|
+
return self
|
222
|
+
|
223
|
+
def untag(self) -> Span:
|
224
|
+
if self.kind == "cell":
|
225
|
+
for r in self.rows:
|
226
|
+
for c in self.columns:
|
227
|
+
self["widget"].untag(cell=(r, c))
|
228
|
+
elif self.kind == "row":
|
229
|
+
self["widget"].untag(rows=self.rows)
|
230
|
+
elif self.kind == "column":
|
231
|
+
self["widget"].untag(columns=self.columns)
|
232
|
+
return self
|
233
|
+
|
222
234
|
def options(
|
223
235
|
self,
|
224
236
|
type_: str | None = None,
|
@@ -344,3 +356,116 @@ class GeneratedMouseEvent:
|
|
344
356
|
def __init__(self):
|
345
357
|
self.keycode = "??"
|
346
358
|
self.num = 1
|
359
|
+
|
360
|
+
|
361
|
+
class Node:
|
362
|
+
__slots__ = ("text", "iid", "parent", "children")
|
363
|
+
|
364
|
+
def __init__(
|
365
|
+
self,
|
366
|
+
text: str,
|
367
|
+
iid: str,
|
368
|
+
parent: Node | Literal[""] | None = None,
|
369
|
+
) -> None:
|
370
|
+
self.text = text
|
371
|
+
self.iid = iid
|
372
|
+
self.parent = parent
|
373
|
+
self.children = []
|
374
|
+
|
375
|
+
def __str__(self) -> str:
|
376
|
+
return self.text
|
377
|
+
|
378
|
+
|
379
|
+
class DropdownStorage:
|
380
|
+
__slots__ = ("canvas_id", "window", "open")
|
381
|
+
|
382
|
+
def __init__(self) -> None:
|
383
|
+
self.canvas_id = None
|
384
|
+
self.window = None
|
385
|
+
self.open = False
|
386
|
+
|
387
|
+
def get_coords(self) -> int | tuple[int, int] | None:
|
388
|
+
"""
|
389
|
+
Returns None if not open or window is None
|
390
|
+
"""
|
391
|
+
if self.open and self.window is not None:
|
392
|
+
return self.window.get_coords()
|
393
|
+
return None
|
394
|
+
|
395
|
+
|
396
|
+
class TextEditorStorage:
|
397
|
+
__slots__ = ("canvas_id", "window", "open")
|
398
|
+
|
399
|
+
def __init__(self) -> None:
|
400
|
+
self.canvas_id = None
|
401
|
+
self.window = None
|
402
|
+
self.open = False
|
403
|
+
|
404
|
+
def focus(self) -> None:
|
405
|
+
if self.window:
|
406
|
+
self.window.tktext.focus_set()
|
407
|
+
|
408
|
+
def get(self) -> str:
|
409
|
+
if self.window:
|
410
|
+
return self.window.get()
|
411
|
+
return ""
|
412
|
+
|
413
|
+
@property
|
414
|
+
def tktext(self) -> object:
|
415
|
+
if self.window:
|
416
|
+
return self.window.tktext
|
417
|
+
return self.window
|
418
|
+
|
419
|
+
@property
|
420
|
+
def coords(self) -> tuple[int, int]:
|
421
|
+
return self.window.r, self.window.c
|
422
|
+
|
423
|
+
@property
|
424
|
+
def row(self) -> int:
|
425
|
+
return self.window.r
|
426
|
+
|
427
|
+
@property
|
428
|
+
def column(self) -> int:
|
429
|
+
return self.window.c
|
430
|
+
|
431
|
+
|
432
|
+
class SelectionBox:
|
433
|
+
__slots__ = ("fill_iid", "bd_iid", "index", "header", "coords", "type_")
|
434
|
+
|
435
|
+
def __init__(
|
436
|
+
self,
|
437
|
+
fill_iid: int | None = None,
|
438
|
+
bd_iid: int | None = None,
|
439
|
+
index: int | None = None,
|
440
|
+
header: int | None = None,
|
441
|
+
coords: tuple[int, int, int, int] = None,
|
442
|
+
type_: Literal["cells", "rows", "columns"] = "cells",
|
443
|
+
) -> None:
|
444
|
+
self.fill_iid = fill_iid
|
445
|
+
self.bd_iid = bd_iid
|
446
|
+
self.index = index
|
447
|
+
self.header = header
|
448
|
+
self.coords = coords
|
449
|
+
self.type_ = type_
|
450
|
+
|
451
|
+
|
452
|
+
Selected = namedtuple(
|
453
|
+
"Selected",
|
454
|
+
(
|
455
|
+
"row",
|
456
|
+
"column",
|
457
|
+
"type_",
|
458
|
+
"box",
|
459
|
+
"iid",
|
460
|
+
"fill_iid",
|
461
|
+
),
|
462
|
+
defaults=(
|
463
|
+
None,
|
464
|
+
None,
|
465
|
+
None,
|
466
|
+
None,
|
467
|
+
None,
|
468
|
+
None,
|
469
|
+
),
|
470
|
+
)
|
471
|
+
|