tksheet 7.2.5__tar.gz → 7.2.7__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.5/tksheet.egg-info → tksheet-7.2.7}/PKG-INFO +1 -1
- {tksheet-7.2.5 → tksheet-7.2.7}/pyproject.toml +1 -1
- {tksheet-7.2.5 → tksheet-7.2.7}/tksheet/__init__.py +1 -1
- {tksheet-7.2.5 → tksheet-7.2.7}/tksheet/column_headers.py +7 -3
- {tksheet-7.2.5 → tksheet-7.2.7}/tksheet/main_table.py +31 -30
- {tksheet-7.2.5 → tksheet-7.2.7}/tksheet/row_index.py +4 -2
- {tksheet-7.2.5 → tksheet-7.2.7}/tksheet/sheet.py +1 -1
- {tksheet-7.2.5 → tksheet-7.2.7/tksheet.egg-info}/PKG-INFO +1 -1
- {tksheet-7.2.5 → tksheet-7.2.7}/LICENSE.txt +0 -0
- {tksheet-7.2.5 → tksheet-7.2.7}/README.md +0 -0
- {tksheet-7.2.5 → tksheet-7.2.7}/setup.cfg +0 -0
- {tksheet-7.2.5 → tksheet-7.2.7}/tksheet/colors.py +0 -0
- {tksheet-7.2.5 → tksheet-7.2.7}/tksheet/formatters.py +0 -0
- {tksheet-7.2.5 → tksheet-7.2.7}/tksheet/functions.py +0 -0
- {tksheet-7.2.5 → tksheet-7.2.7}/tksheet/other_classes.py +0 -0
- {tksheet-7.2.5 → tksheet-7.2.7}/tksheet/sheet_options.py +0 -0
- {tksheet-7.2.5 → tksheet-7.2.7}/tksheet/text_editor.py +0 -0
- {tksheet-7.2.5 → tksheet-7.2.7}/tksheet/themes.py +0 -0
- {tksheet-7.2.5 → tksheet-7.2.7}/tksheet/top_left_rectangle.py +0 -0
- {tksheet-7.2.5 → tksheet-7.2.7}/tksheet/types.py +0 -0
- {tksheet-7.2.5 → tksheet-7.2.7}/tksheet/vars.py +0 -0
- {tksheet-7.2.5 → tksheet-7.2.7}/tksheet.egg-info/SOURCES.txt +0 -0
- {tksheet-7.2.5 → tksheet-7.2.7}/tksheet.egg-info/dependency_links.txt +0 -0
- {tksheet-7.2.5 → tksheet-7.2.7}/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.7"
|
10
10
|
authors = [{ name = "ragardner", email = "github@ragardner.simplelogin.com" }]
|
11
11
|
requires-python = ">=3.8"
|
12
12
|
license = {file = "LICENSE.txt"}
|
@@ -847,8 +847,10 @@ class ColumnHeaders(tk.Canvas):
|
|
847
847
|
and is_contiguous(self.dragged_col.to_move)
|
848
848
|
)
|
849
849
|
):
|
850
|
-
if c
|
851
|
-
c
|
850
|
+
if c > self.dragged_col.to_move[-1]:
|
851
|
+
c += 1
|
852
|
+
if c > len(self.MT.col_positions) - 1:
|
853
|
+
c = len(self.MT.col_positions) - 1
|
852
854
|
event_data = event_dict(
|
853
855
|
name="move_columns",
|
854
856
|
sheet=self.PAR.name,
|
@@ -1010,7 +1012,9 @@ class ColumnHeaders(tk.Canvas):
|
|
1010
1012
|
txt = self.get_valid_cell_data_as_str(datacn, fix=False)
|
1011
1013
|
if txt:
|
1012
1014
|
self.MT.txt_measure_canvas.itemconfig(
|
1013
|
-
self.MT.txt_measure_canvas_text,
|
1015
|
+
self.MT.txt_measure_canvas_text,
|
1016
|
+
text=txt,
|
1017
|
+
font=self.PAR.ops.header_font,
|
1014
1018
|
)
|
1015
1019
|
b = self.MT.txt_measure_canvas.bbox(self.MT.txt_measure_canvas_text)
|
1016
1020
|
w = b[2] - b[0] + 7
|
@@ -999,25 +999,22 @@ class MainTable(tk.Canvas):
|
|
999
999
|
disp_new_idxs = get_new_indexes(move_to=move_to, to_move=to_move)
|
1000
1000
|
else:
|
1001
1001
|
disp_new_idxs = {}
|
1002
|
+
# at_least_cols should not be len in this case as move_to can be len
|
1003
|
+
fix_len = (move_to - 1) if move_to else move_to
|
1002
1004
|
if not self.all_columns_displayed and not data_indexes:
|
1003
|
-
|
1004
|
-
|
1005
|
-
totalcols = self.equalize_data_row_lengths(at_least_cols=move_to + 1)
|
1005
|
+
fix_len = self.datacn(fix_len)
|
1006
|
+
totalcols = self.equalize_data_row_lengths(at_least_cols=fix_len)
|
1006
1007
|
data_new_idxs = get_new_indexes(move_to=move_to, to_move=to_move)
|
1007
1008
|
if not self.all_columns_displayed and not data_indexes:
|
1008
|
-
moved = {self.displayed_columns[i] for i in to_move}
|
1009
1009
|
data_new_idxs = dict(
|
1010
|
-
|
1011
|
-
|
1012
|
-
zip(
|
1013
|
-
move_elements_by_mapping(
|
1014
|
-
self.displayed_columns,
|
1015
|
-
data_new_idxs,
|
1016
|
-
dict(zip(data_new_idxs.values(), data_new_idxs)),
|
1017
|
-
),
|
1010
|
+
zip(
|
1011
|
+
move_elements_by_mapping(
|
1018
1012
|
self.displayed_columns,
|
1013
|
+
data_new_idxs,
|
1014
|
+
dict(zip(data_new_idxs.values(), data_new_idxs)),
|
1019
1015
|
),
|
1020
|
-
|
1016
|
+
self.displayed_columns,
|
1017
|
+
),
|
1021
1018
|
)
|
1022
1019
|
return data_new_idxs, dict(zip(data_new_idxs.values(), data_new_idxs)), totalcols, disp_new_idxs
|
1023
1020
|
|
@@ -1107,6 +1104,7 @@ class MainTable(tk.Canvas):
|
|
1107
1104
|
tags: {full_new_idxs[k] for k in tagged} for tags, tagged in self.tagged_columns.items()
|
1108
1105
|
}
|
1109
1106
|
self.CH.cell_options = {full_new_idxs[k]: v for k, v in self.CH.cell_options.items()}
|
1107
|
+
self.displayed_columns = sorted(full_new_idxs[k] for k in self.displayed_columns)
|
1110
1108
|
if self.named_spans:
|
1111
1109
|
totalrows = self.total_data_rows()
|
1112
1110
|
new_ops = self.PAR.create_options_from_span
|
@@ -1205,8 +1203,6 @@ class MainTable(tk.Canvas):
|
|
1205
1203
|
del self.cell_options[(r, full_new_idxs[k])][span["type_"]]
|
1206
1204
|
# finally, change the span coords
|
1207
1205
|
span["from_c"], span["upto_c"] = newfrom, newupto
|
1208
|
-
if data_indexes:
|
1209
|
-
self.displayed_columns = sorted(full_new_idxs[k] for k in self.displayed_columns)
|
1210
1206
|
return data_new_idxs, disp_new_idxs, event_data
|
1211
1207
|
|
1212
1208
|
def get_max_column_idx(self, maxidx: int | None = None) -> int:
|
@@ -1221,6 +1217,7 @@ class MainTable(tk.Canvas):
|
|
1221
1217
|
max(map(max, self.tagged_columns.values()), default=maxidx),
|
1222
1218
|
max((d.from_c for d in self.named_spans.values() if isinstance(d.from_c, int)), default=maxidx),
|
1223
1219
|
max((d.upto_c for d in self.named_spans.values() if isinstance(d.upto_c, int)), default=maxidx),
|
1220
|
+
self.displayed_columns[-1] if self.displayed_columns else maxidx,
|
1224
1221
|
)
|
1225
1222
|
|
1226
1223
|
def get_args_for_move_rows(
|
@@ -1233,23 +1230,23 @@ class MainTable(tk.Canvas):
|
|
1233
1230
|
disp_new_idxs = get_new_indexes(move_to=move_to, to_move=to_move)
|
1234
1231
|
else:
|
1235
1232
|
disp_new_idxs = {}
|
1236
|
-
|
1233
|
+
# move_to can be len and fix_data_len() takes index so - 1
|
1234
|
+
fix_len = (move_to - 1) if move_to else move_to
|
1235
|
+
if not self.all_rows_displayed and not data_indexes:
|
1236
|
+
fix_len = self.datarn(fix_len)
|
1237
|
+
self.fix_data_len(fix_len)
|
1237
1238
|
totalrows = max(self.total_data_rows(), len(self.row_positions) - 1)
|
1238
1239
|
data_new_idxs = get_new_indexes(move_to=move_to, to_move=to_move)
|
1239
1240
|
if not self.all_rows_displayed and not data_indexes:
|
1240
|
-
moved = {self.displayed_rows[i] for i in to_move}
|
1241
1241
|
data_new_idxs = dict(
|
1242
|
-
|
1243
|
-
|
1244
|
-
zip(
|
1245
|
-
move_elements_by_mapping(
|
1246
|
-
self.displayed_rows,
|
1247
|
-
data_new_idxs,
|
1248
|
-
dict(zip(data_new_idxs.values(), data_new_idxs)),
|
1249
|
-
),
|
1242
|
+
zip(
|
1243
|
+
move_elements_by_mapping(
|
1250
1244
|
self.displayed_rows,
|
1245
|
+
data_new_idxs,
|
1246
|
+
dict(zip(data_new_idxs.values(), data_new_idxs)),
|
1251
1247
|
),
|
1252
|
-
|
1248
|
+
self.displayed_rows,
|
1249
|
+
),
|
1253
1250
|
)
|
1254
1251
|
return data_new_idxs, dict(zip(data_new_idxs.values(), data_new_idxs)), totalrows, disp_new_idxs
|
1255
1252
|
|
@@ -1337,6 +1334,7 @@ class MainTable(tk.Canvas):
|
|
1337
1334
|
self.row_options = {full_new_idxs[k]: v for k, v in self.row_options.items()}
|
1338
1335
|
self.RI.cell_options = {full_new_idxs[k]: v for k, v in self.RI.cell_options.items()}
|
1339
1336
|
self.RI.tree_rns = {v: full_new_idxs[k] for v, k in self.RI.tree_rns.items()}
|
1337
|
+
self.displayed_rows = sorted(full_new_idxs[k] for k in self.displayed_rows)
|
1340
1338
|
if self.named_spans:
|
1341
1339
|
totalcols = self.total_data_cols()
|
1342
1340
|
new_ops = self.PAR.create_options_from_span
|
@@ -1435,8 +1433,6 @@ class MainTable(tk.Canvas):
|
|
1435
1433
|
del self.cell_options[(full_new_idxs[k], c)][span["type_"]]
|
1436
1434
|
# finally, change the span coords
|
1437
1435
|
span["from_r"], span["upto_r"] = newfrom, newupto
|
1438
|
-
if data_indexes:
|
1439
|
-
self.displayed_rows = sorted(full_new_idxs[k] for k in self.displayed_rows)
|
1440
1436
|
return data_new_idxs, disp_new_idxs, event_data
|
1441
1437
|
|
1442
1438
|
def get_max_row_idx(self, maxidx: int | None = None) -> int:
|
@@ -1451,6 +1447,7 @@ class MainTable(tk.Canvas):
|
|
1451
1447
|
max(map(max, self.tagged_rows.values()), default=maxidx),
|
1452
1448
|
max((d.from_r for d in self.named_spans.values() if isinstance(d.from_r, int)), default=maxidx),
|
1453
1449
|
max((d.upto_r for d in self.named_spans.values() if isinstance(d.upto_r, int)), default=maxidx),
|
1450
|
+
self.displayed_rows[-1] if self.displayed_rows else maxidx,
|
1454
1451
|
)
|
1455
1452
|
|
1456
1453
|
def get_full_new_idxs(
|
@@ -3691,10 +3688,13 @@ class MainTable(tk.Canvas):
|
|
3691
3688
|
else:
|
3692
3689
|
return False
|
3693
3690
|
|
3694
|
-
def set_all_cell_sizes_to_text(
|
3691
|
+
def set_all_cell_sizes_to_text(
|
3692
|
+
self,
|
3693
|
+
width: int | None = None,
|
3694
|
+
slim: bool = False,
|
3695
|
+
) -> tuple[list[float], list[float]]:
|
3695
3696
|
min_column_width = int(self.min_column_width)
|
3696
3697
|
min_rh = int(self.min_row_height)
|
3697
|
-
w = min_column_width if w is None else w
|
3698
3698
|
h = min_rh
|
3699
3699
|
rhs = defaultdict(lambda: int(min_rh))
|
3700
3700
|
cws = []
|
@@ -3724,6 +3724,7 @@ class MainTable(tk.Canvas):
|
|
3724
3724
|
rhs[datarn] = h
|
3725
3725
|
added_w_space = 1 if slim else 7
|
3726
3726
|
for datacn in itercols:
|
3727
|
+
w = min_column_width if width is None else width
|
3727
3728
|
if (hw := self.CH.get_cell_dimensions(datacn)[0]) > w:
|
3728
3729
|
w = hw
|
3729
3730
|
else:
|
@@ -846,8 +846,10 @@ class RowIndex(tk.Canvas):
|
|
846
846
|
and is_contiguous(self.dragged_row.to_move)
|
847
847
|
)
|
848
848
|
):
|
849
|
-
if r
|
850
|
-
r
|
849
|
+
if r > self.dragged_row.to_move[-1]:
|
850
|
+
r += 1
|
851
|
+
if r > len(self.MT.row_positions) - 1:
|
852
|
+
r = len(self.MT.row_positions) - 1
|
851
853
|
event_data = event_dict(
|
852
854
|
name="move_rows",
|
853
855
|
sheet=self.PAR.name,
|
@@ -3362,7 +3362,7 @@ class Sheet(tk.Frame):
|
|
3362
3362
|
width: int | None = None,
|
3363
3363
|
slim: bool = False,
|
3364
3364
|
) -> tuple[list[float], list[float]]:
|
3365
|
-
self.MT.set_all_cell_sizes_to_text(
|
3365
|
+
self.MT.set_all_cell_sizes_to_text(width=width, slim=slim)
|
3366
3366
|
self.set_refresh_timer(redraw)
|
3367
3367
|
return self.MT.row_positions, self.MT.col_positions
|
3368
3368
|
|
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
|
File without changes
|