Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
- Editing header and overflowing text editor so text wraps while using `auto_resize_columns` causes text editor to be out of position
- `insert_columns()` when using an `int` for number of blank columns creates incorrect list layout
  • Loading branch information
ragardner committed Jun 5, 2023
1 parent 9cd4193 commit 2a195dd
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 19 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### Version 6.2.1
#### Fixed:
- Editing header and overflowing text editor so text wraps while using `auto_resize_columns` causes text editor to be out of position
- `insert_columns()` when using an `int` for number of blank columns creates incorrect list layout

### Version 6.2.0
#### Fixed:
- Removed some type hinting that was only available to python versions >= 3.9
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
setup(
name = 'tksheet',
packages = ['tksheet'],
version = '6.2.0',
version = '6.2.1',
python_requires = '>=3.6',
license = 'MIT',
description = 'Tkinter table / sheet widget',
Expand All @@ -17,7 +17,7 @@
author = 'ragardner',
author_email = '[email protected]',
url = 'https://github.com/ragardner/tksheet',
download_url = 'https://github.com/ragardner/tksheet/archive/6.2.0.tar.gz',
download_url = 'https://github.com/ragardner/tksheet/archive/6.2.1.tar.gz',
keywords = ['tkinter', 'table', 'widget', 'sheet', 'grid', 'tk'],
install_requires = [],
classifiers = [
Expand Down
6 changes: 4 additions & 2 deletions tksheet/_tksheet.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import tkinter as tk
from collections import deque
from itertools import accumulate, chain, islice
Expand Down Expand Up @@ -2738,8 +2740,8 @@ def insert_columns(
total_rows = self.MT.total_data_rows()
start = old_total if idx == "end" else idx
data = [
self.MT.get_empty_row_seq(rn, end=start + columns, start=start, c_ops=idx == "end")
for rn in range(total_rows)
[self.MT.get_value_for_empty_cell(datarn, datacn, c_ops=idx == "end") for datarn in range(total_rows)]
for datacn in range(start, start + columns)
]
numcols = columns
else:
Expand Down
3 changes: 3 additions & 0 deletions tksheet/_tksheet_column_headers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import pickle
import tkinter as tk
import zlib
Expand Down Expand Up @@ -1894,6 +1896,7 @@ def text_editor_has_wrapped(self, r=0, c=0, check_lines=None):
kwargs["window"].update_idletasks()
kwargs["window"]._reselect()
self.MT.main_table_redraw_grid_and_text(redraw_header=True, redraw_row_index=False, redraw_table=True)
self.coords(self.text_editor_id, self.MT.col_positions[c] + 1, 0)

# displayed indexes
def text_editor_newline_binding(self, r=0, c=0, event=None, check_lines=True):
Expand Down
2 changes: 2 additions & 0 deletions tksheet/_tksheet_formatters.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from typing import Any, Union, Dict

from ._tksheet_vars import (
Expand Down
45 changes: 30 additions & 15 deletions tksheet/_tksheet_main_table.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import bisect
import csv as csv
import io
Expand Down Expand Up @@ -4112,19 +4114,23 @@ def del_cols_rc(self, event=None, c=None):
curr = self.currently_selected()
if not seld_cols or not curr:
return
if self.CH.popup_menu_loc is None or self.CH.popup_menu_loc < seld_cols[0] or self.CH.popup_menu_loc > seld_cols[-1]:
if (
self.CH.popup_menu_loc is None
or self.CH.popup_menu_loc < seld_cols[0]
or self.CH.popup_menu_loc > seld_cols[-1]
):
c = seld_cols[0]
else:
c = self.CH.popup_menu_loc
seld_cols = get_seq_without_gaps_at_index(seld_cols, c)
self.deselect("all", redraw=False)
self.create_selected(
0,
seld_cols[0],
len(self.row_positions) - 1,
seld_cols[-1] + 1,
"columns",
)
0,
seld_cols[0],
len(self.row_positions) - 1,
seld_cols[-1] + 1,
"columns",
)
self.set_currently_selected(0, seld_cols[0], type_="column")
seldmax = seld_cols[-1] if self.all_columns_displayed else self.displayed_columns[seld_cols[-1]]
if self.extra_begin_del_cols_rc_func is not None:
Expand Down Expand Up @@ -4200,19 +4206,23 @@ def del_rows_rc(self, event=None, r=None):
curr = self.currently_selected()
if not seld_rows or not curr:
return
if self.RI.popup_menu_loc is None or self.RI.popup_menu_loc < seld_rows[0] or self.RI.popup_menu_loc > seld_rows[-1]:
if (
self.RI.popup_menu_loc is None
or self.RI.popup_menu_loc < seld_rows[0]
or self.RI.popup_menu_loc > seld_rows[-1]
):
r = seld_rows[0]
else:
r = self.RI.popup_menu_loc
seld_rows = get_seq_without_gaps_at_index(seld_rows, r)
self.deselect("all", redraw=False)
self.create_selected(
seld_rows[0],
0,
seld_rows[-1] + 1,
len(self.col_positions) - 1,
"rows",
)
seld_rows[0],
0,
seld_rows[-1] + 1,
len(self.col_positions) - 1,
"rows",
)
self.set_currently_selected(seld_rows[0], 0, type_="row")
seldmax = seld_rows[-1] if self.all_rows_displayed else self.displayed_rows[seld_rows[-1]]
if self.extra_begin_del_rows_rc_func is not None:
Expand Down Expand Up @@ -4786,7 +4796,12 @@ def redraw_checkbox(self, x1, y1, x2, y2, fill, outline, tag, draw_check=False):
t = self.create_polygon(points, fill=fill, outline=outline, tag=tag, smooth=True)
self.disp_checkbox[t] = True

def main_table_redraw_grid_and_text(self, redraw_header=False, redraw_row_index=False, redraw_table=True,):
def main_table_redraw_grid_and_text(
self,
redraw_header=False,
redraw_row_index=False,
redraw_table=True,
):
try:
can_width = self.winfo_width()
can_height = self.winfo_height()
Expand Down
2 changes: 2 additions & 0 deletions tksheet/_tksheet_other_classes.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import bisect
import tkinter as tk
from collections import namedtuple
Expand Down
3 changes: 3 additions & 0 deletions tksheet/_tksheet_row_index.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import pickle
import tkinter as tk
import zlib
Expand Down Expand Up @@ -1832,6 +1834,7 @@ def text_editor_newline_binding(self, r=0, c=0, event=None, check_lines=True):
self.set_row_height(datarn, new_height)
self.MT.refresh()
self.text_editor.config(height=new_height)
self.coords(self.text_editor_id, 0, self.MT.row_positions[r] + 1)
kwargs = self.get_cell_kwargs(datarn, key="dropdown")
if kwargs:
text_editor_h = self.text_editor.winfo_height()
Expand Down
2 changes: 2 additions & 0 deletions tksheet/_tksheet_top_left_rectangle.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import tkinter as tk

from ._tksheet_vars import (
Expand Down
2 changes: 2 additions & 0 deletions tksheet/_tksheet_vars.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

# for mac bindings
from platform import system as get_os

Expand Down

0 comments on commit 2a195dd

Please sign in to comment.