Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ragardner committed May 23, 2023
1 parent 142d424 commit 4a01c84
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 13 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### Version 6.1.6
### Version 6.1.7
#### Fixed:
- [#183](https://github.com/ragardner/tksheet/issues/183)
- [#184](https://github.com/ragardner/tksheet/issues/184)

### Version 6.1.5
#### Fixed:
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.1.6',
version = '6.1.7',
python_requires = '>=3.6',
license = 'MIT',
description = 'Tkinter table / sheet widget',
Expand All @@ -17,7 +17,7 @@
author = 'ragardner',
author_email = 'github@ragardner.simplelogin.com',
url = 'https://github.com/ragardner/tksheet',
download_url = 'https://github.com/ragardner/tksheet/archive/6.1.6.tar.gz',
download_url = 'https://github.com/ragardner/tksheet/archive/6.1.7.tar.gz',
keywords = ['tkinter', 'table', 'widget', 'sheet', 'grid', 'tk'],
install_requires = [],
classifiers = [
Expand Down
2 changes: 2 additions & 0 deletions tksheet/_tksheet_column_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def __init__(self, *args, **kwargs):
self.MT = None # is set from within MainTable() __init__
self.RI = None # is set from within MainTable() __init__
self.TL = None # is set from within TopLeftRectangle() __init__
self.popup_menu_loc = None
self.extra_begin_edit_cell_func = None
self.extra_end_edit_cell_func = None
self.text_editor = None
Expand Down Expand Up @@ -239,6 +240,7 @@ def rc(self, event):
if self.extra_rc_func is not None:
self.extra_rc_func(event)
if popup_menu is not None:
self.popup_menu_loc = c
popup_menu.tk_popup(event.x_root, event.y_root)

def ctrl_b1_press(self, event=None):
Expand Down
32 changes: 22 additions & 10 deletions tksheet/_tksheet_main_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -4089,20 +4089,25 @@ def insert_rows_rc(self, event=None):
self.extra_end_insert_rows_rc_func(InsertEvent("end_insert_rows", data_ins_row, displayed_ins_row, numrows))
self.parentframe.emit_event("<<SheetModified>>")

def del_cols_rc(self, event=None):
def del_cols_rc(self, event=None, c=None):
seld_cols = sorted(self.get_selected_cols())
curr = self.currently_selected()
if not seld_cols or not curr:
return
seld_cols = get_seq_without_gaps_at_index(seld_cols, curr.column)
self.deselect("all")
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",
)
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:
try:
Expand Down Expand Up @@ -4162,8 +4167,7 @@ def del_cols_rc(self, event=None):
self.CH.cell_options = {
cn if cn < seldmax else cn - numcols: t for cn, t in self.CH.cell_options.items() if cn not in seldset
}
self.deselect("allcols", redraw=False)
self.set_current_to_last()
self.deselect("all", redraw=False)
if not self.all_columns_displayed:
self.displayed_columns = [c for c in self.displayed_columns if c not in seldset]
for c in sorted(seldset):
Expand All @@ -4173,20 +4177,25 @@ def del_cols_rc(self, event=None):
self.extra_end_del_cols_rc_func(DeleteRowColumnEvent("end_delete_columns", seld_cols))
self.parentframe.emit_event("<<SheetModified>>")

def del_rows_rc(self, event=None):
def del_rows_rc(self, event=None, r=None):
seld_rows = sorted(self.get_selected_rows())
curr = self.currently_selected()
if not seld_rows or not curr:
return
seld_rows = get_seq_without_gaps_at_index(seld_rows, curr.row)
self.deselect("all")
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",
)
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:
try:
Expand Down Expand Up @@ -4239,8 +4248,11 @@ def del_rows_rc(self, event=None):
self.RI.cell_options = {
rn if rn < seldmax else rn - numrows: t for rn, t in self.RI.cell_options.items() if rn not in seldset
}
self.deselect("allrows", redraw=False)
self.set_current_to_last()
self.deselect("all", redraw=False)
if not self.all_rows_displayed:
self.displayed_rows = [r for r in self.displayed_rows if r not in seldset]
for r in sorted(seldset):
self.displayed_rows = [dr if r > dr else dr - 1 for dr in self.displayed_rows]
self.refresh()
if self.extra_end_del_rows_rc_func is not None:
self.extra_end_del_rows_rc_func(DeleteRowColumnEvent("end_delete_rows", seld_rows))
Expand Down
2 changes: 2 additions & 0 deletions tksheet/_tksheet_row_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def __init__(self, *args, **kwargs):
self.MT = None # is set from within MainTable() __init__
self.CH = None # is set from within MainTable() __init__
self.TL = None # is set from within TopLeftRectangle() __init__
self.popup_menu_loc = None
self.extra_begin_edit_cell_func = None
self.extra_end_edit_cell_func = None
self.text_editor = None
Expand Down Expand Up @@ -208,6 +209,7 @@ def rc(self, event):
if self.extra_rc_func is not None:
self.extra_rc_func(event)
if popup_menu is not None:
self.popup_menu_loc = r
popup_menu.tk_popup(event.x_root, event.y_root)

def ctrl_b1_press(self, event=None):
Expand Down

0 comments on commit 4a01c84

Please sign in to comment.