Skip to content

Commit de6dedc

Browse files
committed
hiding grid and using highlights caused gaps resembling grid
address #313
1 parent 51d10c1 commit de6dedc

File tree

6 files changed

+29
-20
lines changed

6 files changed

+29
-20
lines changed

docs/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### Version 7.5.15
2+
#### Addressed:
3+
- [#313](https://github.com/ragardner/tksheet/issues/313).
4+
15
### Version 7.5.14
26
#### Removed:
37
- Removed settings for cut_contents, copy_contents and the new plain equivalent added in `7.5.13`. These settings now use the same as the usual cut and copy settings.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
66
name = "tksheet"
77
description = "Tkinter table / sheet and treeview widget"
88
readme = "README.md"
9-
version = "7.5.14"
9+
version = "7.5.15"
1010
authors = [{ name = "ragardner", email = "[email protected]" }]
1111
requires-python = ">=3.8"
1212
license = {file = "LICENSE.txt"}

tksheet/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
tksheet - A Python tkinter table widget
55
"""
66

7-
__version__ = "7.5.14"
7+
__version__ = "7.5.15"
88

99
from .colors import (
1010
color_map,

tksheet/column_headers.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,16 +1380,17 @@ def redraw_highlight(
13801380
outline: str,
13811381
tags: str | tuple[str],
13821382
) -> bool:
1383-
coords = (x1, y1, x2, y2)
1383+
if not self.ops.show_vertical_grid:
1384+
x2 += 1
13841385
if self.hidd_high:
13851386
iid, showing = self.hidd_high.popitem()
1386-
self.coords(iid, coords)
1387+
self.coords(iid, x1, y1, x2, y2)
13871388
if showing:
13881389
self.itemconfig(iid, fill=fill, outline=outline, tags=tags)
13891390
else:
13901391
self.itemconfig(iid, fill=fill, outline=outline, state="normal", tags=tags)
13911392
else:
1392-
iid = self.create_rectangle(coords, fill=fill, outline=outline, tags=tags)
1393+
iid = self.create_rectangle(x1, y1, x2, y2, fill=fill, outline=outline, tags=tags)
13931394
self.disp_high[iid] = True
13941395
return True
13951396

tksheet/main_table.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5783,7 +5783,6 @@ def redraw_highlight_get_text_fg(
57835783
has_dd: bool,
57845784
tags: str | tuple[str],
57855785
) -> tuple[str, bool]:
5786-
redrawn = False
57875786
if (datarn, datacn) in self.progress_bars:
57885787
kwargs = self.progress_bars[(datarn, datacn)]
57895788
else:
@@ -5816,7 +5815,7 @@ def redraw_highlight_get_text_fg(
58165815
if kwargs[1] is None or self.PAR.ops.display_selected_fg_over_highlights
58175816
else kwargs[1]
58185817
)
5819-
redrawn = self.redraw_highlight(
5818+
self.redraw_highlight(
58205819
x1=fc + 1,
58215820
y1=fr + 1,
58225821
x2=sc,
@@ -5843,7 +5842,7 @@ def redraw_highlight_get_text_fg(
58435842
if kwargs[1] is None or self.PAR.ops.display_selected_fg_over_highlights
58445843
else kwargs[1]
58455844
)
5846-
redrawn = self.redraw_highlight(
5845+
self.redraw_highlight(
58475846
x1=fc + 1,
58485847
y1=fr + 1,
58495848
x2=sc,
@@ -5870,7 +5869,7 @@ def redraw_highlight_get_text_fg(
58705869
if kwargs[1] is None or self.PAR.ops.display_selected_fg_over_highlights
58715870
else kwargs[1]
58725871
)
5873-
redrawn = self.redraw_highlight(
5872+
self.redraw_highlight(
58745873
x1=fc + 1,
58755874
y1=fr + 1,
58765875
x2=sc,
@@ -5895,7 +5894,7 @@ def redraw_highlight_get_text_fg(
58955894
txtfg = self.PAR.ops.table_fg if kwargs[1] is None else kwargs[1]
58965895
if high_bg: # Only draw if fill exists
58975896
if not isinstance(kwargs, ProgressBar):
5898-
redrawn = self.redraw_highlight(
5897+
self.redraw_highlight(
58995898
x1=fc + 1,
59005899
y1=fr + 1,
59015900
x2=sc,
@@ -5910,7 +5909,7 @@ def redraw_highlight_get_text_fg(
59105909
if kwargs.del_when_done and kwargs.percent >= 100:
59115910
del self.progress_bars[(datarn, datacn)]
59125911
else:
5913-
redrawn = self.redraw_highlight(
5912+
self.redraw_highlight(
59145913
x1=fc + 1,
59155914
y1=fr + 1,
59165915
x2=sc,
@@ -5925,7 +5924,7 @@ def redraw_highlight_get_text_fg(
59255924
elif not kwargs:
59265925
if "cells" in selections and (r, c) in selections["cells"]:
59275926
txtfg = self.PAR.ops.table_selected_cells_fg
5928-
redrawn = self.redraw_highlight(
5927+
self.redraw_highlight(
59295928
x1=fc + 1,
59305929
y1=fr + 1,
59315930
x2=sc,
@@ -5938,7 +5937,7 @@ def redraw_highlight_get_text_fg(
59385937
)
59395938
elif "rows" in selections and r in selections["rows"]:
59405939
txtfg = self.PAR.ops.table_selected_rows_fg
5941-
redrawn = self.redraw_highlight(
5940+
self.redraw_highlight(
59425941
x1=fc + 1,
59435942
y1=fr + 1,
59445943
x2=sc,
@@ -5951,7 +5950,7 @@ def redraw_highlight_get_text_fg(
59515950
)
59525951
elif "columns" in selections and c in selections["columns"]:
59535952
txtfg = self.PAR.ops.table_selected_columns_fg
5954-
redrawn = self.redraw_highlight(
5953+
self.redraw_highlight(
59555954
x1=fc + 1,
59565955
y1=fr + 1,
59575956
x2=sc,
@@ -5964,7 +5963,7 @@ def redraw_highlight_get_text_fg(
59645963
)
59655964
else:
59665965
txtfg = self.PAR.ops.table_fg
5967-
redrawn = self.redraw_highlight(
5966+
self.redraw_highlight(
59685967
x1=fc + 1,
59695968
y1=fr + 1,
59705969
x2=sc,
@@ -5975,7 +5974,7 @@ def redraw_highlight_get_text_fg(
59755974
can_width=None,
59765975
pc=None,
59775976
)
5978-
return txtfg, redrawn
5977+
return txtfg
59795978

59805979
def redraw_highlight(
59815980
self,
@@ -5989,6 +5988,10 @@ def redraw_highlight(
59895988
can_width: None | float = None,
59905989
pc: None | float = None,
59915990
) -> bool:
5991+
if not self.PAR.ops.show_horizontal_grid:
5992+
y2 += 1
5993+
if not self.PAR.ops.show_vertical_grid:
5994+
x2 += 1
59925995
if not is_type_int(pc) or pc >= 100:
59935996
coords = (
59945997
x1 - 1 if outline else x1,
@@ -6332,7 +6335,7 @@ def redraw_grid_and_text(
63326335
disp_loc = (r, c)
63336336
loc = (datarn, datacn)
63346337
tag = f"{r}_{c}"
6335-
fill, _ = self.redraw_highlight_get_text_fg(
6338+
fill = self.redraw_highlight_get_text_fg(
63366339
r=r,
63376340
c=c,
63386341
fc=cleftgridln,

tksheet/row_index.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,16 +1427,17 @@ def redraw_highlight(
14271427
outline: str,
14281428
tags: str | tuple[str],
14291429
) -> bool:
1430-
coords = (x1, y1, x2, y2)
1430+
if not self.ops.show_horizontal_grid:
1431+
y2 += 1
14311432
if self.hidd_high:
14321433
iid, showing = self.hidd_high.popitem()
1433-
self.coords(iid, coords)
1434+
self.coords(iid, x1, y1, x2, y2)
14341435
if showing:
14351436
self.itemconfig(iid, fill=fill, outline=outline, tags=tags)
14361437
else:
14371438
self.itemconfig(iid, fill=fill, outline=outline, state="normal", tags=tags)
14381439
else:
1439-
iid = self.create_rectangle(coords, fill=fill, outline=outline, tags=tags)
1440+
iid = self.create_rectangle(x1, y1, x2, y2, fill=fill, outline=outline, tags=tags)
14401441
self.disp_high[iid] = True
14411442
return True
14421443

0 commit comments

Comments
 (0)