tksheet 7.2.13__tar.gz → 7.2.14__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.
Files changed (24) hide show
  1. {tksheet-7.2.13/tksheet.egg-info → tksheet-7.2.14}/PKG-INFO +4 -4
  2. {tksheet-7.2.13 → tksheet-7.2.14}/README.md +3 -3
  3. {tksheet-7.2.13 → tksheet-7.2.14}/pyproject.toml +1 -1
  4. {tksheet-7.2.13 → tksheet-7.2.14}/tksheet/__init__.py +1 -1
  5. {tksheet-7.2.13 → tksheet-7.2.14}/tksheet/column_headers.py +0 -1
  6. {tksheet-7.2.13 → tksheet-7.2.14}/tksheet/functions.py +52 -0
  7. {tksheet-7.2.13 → tksheet-7.2.14}/tksheet/main_table.py +49 -59
  8. {tksheet-7.2.13 → tksheet-7.2.14}/tksheet/row_index.py +0 -1
  9. {tksheet-7.2.13 → tksheet-7.2.14}/tksheet/sheet.py +2 -0
  10. {tksheet-7.2.13 → tksheet-7.2.14}/tksheet/sheet_options.py +2 -0
  11. {tksheet-7.2.13 → tksheet-7.2.14/tksheet.egg-info}/PKG-INFO +4 -4
  12. {tksheet-7.2.13 → tksheet-7.2.14}/LICENSE.txt +0 -0
  13. {tksheet-7.2.13 → tksheet-7.2.14}/setup.cfg +0 -0
  14. {tksheet-7.2.13 → tksheet-7.2.14}/tksheet/colors.py +0 -0
  15. {tksheet-7.2.13 → tksheet-7.2.14}/tksheet/formatters.py +0 -0
  16. {tksheet-7.2.13 → tksheet-7.2.14}/tksheet/other_classes.py +0 -0
  17. {tksheet-7.2.13 → tksheet-7.2.14}/tksheet/text_editor.py +0 -0
  18. {tksheet-7.2.13 → tksheet-7.2.14}/tksheet/themes.py +0 -0
  19. {tksheet-7.2.13 → tksheet-7.2.14}/tksheet/top_left_rectangle.py +0 -0
  20. {tksheet-7.2.13 → tksheet-7.2.14}/tksheet/types.py +0 -0
  21. {tksheet-7.2.13 → tksheet-7.2.14}/tksheet/vars.py +0 -0
  22. {tksheet-7.2.13 → tksheet-7.2.14}/tksheet.egg-info/SOURCES.txt +0 -0
  23. {tksheet-7.2.13 → tksheet-7.2.14}/tksheet.egg-info/dependency_links.txt +0 -0
  24. {tksheet-7.2.13 → tksheet-7.2.14}/tksheet.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tksheet
3
- Version: 7.2.13
3
+ Version: 7.2.14
4
4
  Summary: Tkinter table / sheet widget
5
5
  Author-email: ragardner <github@ragardner.simplelogin.com>
6
6
  License: Copyright (c) 2019 ragardner and open source contributors
@@ -103,10 +103,10 @@ sheet.insert_columns(columns=2, idx=4, undo=True)
103
103
  sheet.delete_columns(columns=[0, 3], undo=True)
104
104
  ```
105
105
 
106
- ### **light green theme**
106
+ ### **light blue theme**
107
107
 
108
- ![tksheet light green theme](https://github.com/ragardner/tksheet/assets/26602401/790ee9bd-b4de-48df-8c44-33f303061d84)
108
+ ![tksheet light blue theme](https://github.com/user-attachments/assets/f40317d7-8b7f-43c5-9217-a77168b068ed)
109
109
 
110
110
  ### **dark theme**
111
111
 
112
- ![tksheet dark theme](https://github.com/ragardner/tksheet/assets/26602401/fc8a0407-1486-46cf-b852-9bcff23160e5)
112
+ ![tksheet dark theme](https://github.com/user-attachments/assets/288453d6-5ac1-4d45-827f-45b24a3d05ed)
@@ -61,10 +61,10 @@ sheet.insert_columns(columns=2, idx=4, undo=True)
61
61
  sheet.delete_columns(columns=[0, 3], undo=True)
62
62
  ```
63
63
 
64
- ### **light green theme**
64
+ ### **light blue theme**
65
65
 
66
- ![tksheet light green theme](https://github.com/ragardner/tksheet/assets/26602401/790ee9bd-b4de-48df-8c44-33f303061d84)
66
+ ![tksheet light blue theme](https://github.com/user-attachments/assets/f40317d7-8b7f-43c5-9217-a77168b068ed)
67
67
 
68
68
  ### **dark theme**
69
69
 
70
- ![tksheet dark theme](https://github.com/ragardner/tksheet/assets/26602401/fc8a0407-1486-46cf-b852-9bcff23160e5)
70
+ ![tksheet dark theme](https://github.com/user-attachments/assets/288453d6-5ac1-4d45-827f-45b24a3d05ed)
@@ -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.13"
9
+ version = "7.2.14"
10
10
  authors = [{ name = "ragardner", email = "github@ragardner.simplelogin.com" }]
11
11
  requires-python = ">=3.8"
12
12
  license = {file = "LICENSE.txt"}
@@ -4,7 +4,7 @@
4
4
  tksheet - A Python tkinter table widget
5
5
  """
6
6
 
7
- __version__ = "7.2.12"
7
+ __version__ = "7.2.14"
8
8
 
9
9
  from .colors import (
10
10
  color_map,
@@ -1437,7 +1437,6 @@ class ColumnHeaders(tk.Canvas):
1437
1437
  x_stop,
1438
1438
  self.current_height,
1439
1439
  )
1440
- draw_x = self.MT.col_positions[grid_start_col]
1441
1440
  yend = self.current_height - 5
1442
1441
  if (self.PAR.ops.show_vertical_grid or self.width_resizing_enabled) and col_pos_exists:
1443
1442
  points = [
@@ -439,6 +439,58 @@ def is_contiguous(iterable: Iterator[int]) -> bool:
439
439
  return all(i == (prev := prev + 1) for i in itr)
440
440
 
441
441
 
442
+ def down_cell_within_box(
443
+ r: int,
444
+ c: int,
445
+ r1: int,
446
+ c1: int,
447
+ r2: int,
448
+ c2: int,
449
+ numrows: int,
450
+ numcols: int,
451
+ ) -> tuple[int, int]:
452
+ moved = False
453
+ new_r = r
454
+ new_c = c
455
+ if r + 1 == r2:
456
+ new_r = r1
457
+ elif numrows > 1:
458
+ new_r = r + 1
459
+ moved = True
460
+ if not moved:
461
+ if c + 1 == c2:
462
+ new_c = c1
463
+ elif numcols > 1:
464
+ new_c = c + 1
465
+ return new_r, new_c
466
+
467
+
468
+ def cell_right_within_box(
469
+ r: int,
470
+ c: int,
471
+ r1: int,
472
+ c1: int,
473
+ r2: int,
474
+ c2: int,
475
+ numrows: int,
476
+ numcols: int,
477
+ ) -> tuple[int, int]:
478
+ moved = False
479
+ new_r = r
480
+ new_c = c
481
+ if c + 1 == c2:
482
+ new_c = c1
483
+ elif numcols > 1:
484
+ new_c = c + 1
485
+ moved = True
486
+ if not moved:
487
+ if r + 1 == r2:
488
+ new_r = r1
489
+ elif numrows > 1:
490
+ new_r = r + 1
491
+ return new_r, new_c
492
+
493
+
442
494
  def get_last(
443
495
  it: Iterator,
444
496
  ) -> object:
@@ -54,6 +54,7 @@ from .functions import (
54
54
  decompress_load,
55
55
  diff_gen,
56
56
  diff_list,
57
+ down_cell_within_box,
57
58
  event_dict,
58
59
  gen_formatted,
59
60
  get_data_from_clipboard,
@@ -72,6 +73,7 @@ from .functions import (
72
73
  new_tk_event,
73
74
  pickle_obj,
74
75
  pickled_event_dict,
76
+ cell_right_within_box,
75
77
  rounded_box_coords,
76
78
  span_idxs_post_move,
77
79
  try_binding,
@@ -6782,63 +6784,63 @@ class MainTable(tk.Canvas):
6782
6784
  numrows = r2 - r1
6783
6785
  if numcols == 1 and numrows == 1:
6784
6786
  if event.keysym == "Return":
6785
- self.select_cell(r + 1 if r < len(self.row_positions) - 2 else r, c)
6786
- self.see(
6787
- r + 1 if r < len(self.row_positions) - 2 else r,
6788
- c,
6789
- keep_xscroll=True,
6790
- bottom_right_corner=True,
6791
- check_cell_visibility=True,
6792
- )
6787
+ if self.PAR.ops.edit_cell_return == "right":
6788
+ self.select_right(r, c)
6789
+ if self.PAR.ops.edit_cell_return == "down":
6790
+ self.select_down(r, c)
6791
+ elif event.keysym == "Tab":
6792
+ if self.PAR.ops.edit_cell_tab == "right":
6793
+ self.select_right(r, c)
6794
+ if self.PAR.ops.edit_cell_tab == "down":
6795
+ self.select_down(r, c)
6796
+ else:
6797
+ if event.keysym == "Return":
6798
+ if self.PAR.ops.edit_cell_return == "right":
6799
+ new_r, new_c = cell_right_within_box(r, c, r1, c1, r2, c2, numrows, numcols)
6800
+ elif self.PAR.ops.edit_cell_return == "down":
6801
+ new_r, new_c = down_cell_within_box(r, c, r1, c1, r2, c2, numrows, numcols)
6802
+ else:
6803
+ new_r, new_c = None, None
6793
6804
  elif event.keysym == "Tab":
6794
- self.select_cell(r, c + 1 if c < len(self.col_positions) - 2 else c)
6805
+ if self.PAR.ops.edit_cell_tab == "right":
6806
+ new_r, new_c = cell_right_within_box(r, c, r1, c1, r2, c2, numrows, numcols)
6807
+ elif self.PAR.ops.edit_cell_tab == "down":
6808
+ new_r, new_c = down_cell_within_box(r, c, r1, c1, r2, c2, numrows, numcols)
6809
+ else:
6810
+ new_r, new_c = None, None
6811
+ if isinstance(new_r, int):
6812
+ self.set_currently_selected(new_r, new_c, item=self.selected.fill_iid)
6795
6813
  self.see(
6796
- r,
6797
- c + 1 if c < len(self.col_positions) - 2 else c,
6798
- keep_xscroll=True,
6814
+ new_r,
6815
+ new_c,
6816
+ keep_xscroll=False,
6799
6817
  bottom_right_corner=True,
6800
6818
  check_cell_visibility=True,
6801
6819
  )
6802
- else:
6803
- moved = False
6804
- new_r = r
6805
- new_c = c
6806
- if event.keysym == "Return":
6807
- if r + 1 == r2:
6808
- new_r = r1
6809
- elif numrows > 1:
6810
- new_r = r + 1
6811
- moved = True
6812
- if not moved:
6813
- if c + 1 == c2:
6814
- new_c = c1
6815
- elif numcols > 1:
6816
- new_c = c + 1
6817
- elif event.keysym == "Tab":
6818
- if c + 1 == c2:
6819
- new_c = c1
6820
- elif numcols > 1:
6821
- new_c = c + 1
6822
- moved = True
6823
- if not moved:
6824
- if r + 1 == r2:
6825
- new_r = r1
6826
- elif numrows > 1:
6827
- new_r = r + 1
6828
- self.set_currently_selected(new_r, new_c, item=self.selected.fill_iid)
6829
- self.see(
6830
- new_r,
6831
- new_c,
6832
- keep_xscroll=False,
6833
- bottom_right_corner=True,
6834
- check_cell_visibility=True,
6835
- )
6836
6820
  self.recreate_all_selection_boxes()
6837
6821
  self.hide_text_editor_and_dropdown()
6838
6822
  if event.keysym != "FocusOut":
6839
6823
  self.focus_set()
6840
6824
  return "break"
6841
6825
 
6826
+ def select_right(self, r: int, c: int) -> None:
6827
+ self.select_cell(r, c + 1 if c < len(self.col_positions) - 2 else c)
6828
+ self.see(
6829
+ r,
6830
+ c + 1 if c < len(self.col_positions) - 2 else c,
6831
+ bottom_right_corner=True,
6832
+ check_cell_visibility=True,
6833
+ )
6834
+
6835
+ def select_down(self, r: int, c: int) -> None:
6836
+ self.select_cell(r + 1 if r < len(self.row_positions) - 2 else r, c)
6837
+ self.see(
6838
+ r + 1 if r < len(self.row_positions) - 2 else r,
6839
+ c,
6840
+ bottom_right_corner=True,
6841
+ check_cell_visibility=True,
6842
+ )
6843
+
6842
6844
  def tab_key(self, event: object = None) -> str:
6843
6845
  if not self.selected:
6844
6846
  return
@@ -6851,19 +6853,7 @@ class MainTable(tk.Canvas):
6851
6853
  new_c = c + 1 if c < len(self.col_positions) - 2 else c
6852
6854
  self.select_cell(new_r, new_c)
6853
6855
  else:
6854
- moved = False
6855
- new_r = r
6856
- new_c = c
6857
- if c + 1 == c2:
6858
- new_c = c1
6859
- elif numcols > 1:
6860
- new_c = c + 1
6861
- moved = True
6862
- if not moved:
6863
- if r + 1 == r2:
6864
- new_r = r1
6865
- elif numrows > 1:
6866
- new_r = r + 1
6856
+ new_r, new_c = cell_right_within_box(r, c, r1, c1, r2, c2, numrows, numcols)
6867
6857
  self.set_currently_selected(new_r, new_c, item=self.selected.fill_iid)
6868
6858
  self.see(
6869
6859
  new_r,
@@ -1535,7 +1535,6 @@ class RowIndex(tk.Canvas):
1535
1535
  self.hidd_tree_arrow.update(self.disp_tree_arrow)
1536
1536
  self.disp_tree_arrow = {}
1537
1537
  self.visible_row_dividers = {}
1538
- draw_y = self.MT.row_positions[grid_start_row]
1539
1538
  xend = self.current_width - 6
1540
1539
  self.row_width_resize_bbox = (
1541
1540
  self.current_width - 2,
@@ -188,6 +188,8 @@ class Sheet(tk.Frame):
188
188
  show_horizontal_grid: bool = True,
189
189
  display_selected_fg_over_highlights: bool = False,
190
190
  show_selected_cells_border: bool = True,
191
+ edit_cell_tab: Literal["right", "down", ""] = "right",
192
+ edit_cell_return: Literal["right", "down", ""] = "down",
191
193
  treeview: bool = False,
192
194
  treeview_indent: str | int = "6",
193
195
  rounded_boxes: bool = True,
@@ -239,6 +239,8 @@ def new_sheet_options() -> DotDict:
239
239
  "show_horizontal_grid": True,
240
240
  "display_selected_fg_over_highlights": False,
241
241
  "show_selected_cells_border": True,
242
+ "edit_cell_tab": "right",
243
+ "edit_cell_return": "down",
242
244
  "treeview": False,
243
245
  "treeview_indent": "6",
244
246
  "rounded_boxes": True,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tksheet
3
- Version: 7.2.13
3
+ Version: 7.2.14
4
4
  Summary: Tkinter table / sheet widget
5
5
  Author-email: ragardner <github@ragardner.simplelogin.com>
6
6
  License: Copyright (c) 2019 ragardner and open source contributors
@@ -103,10 +103,10 @@ sheet.insert_columns(columns=2, idx=4, undo=True)
103
103
  sheet.delete_columns(columns=[0, 3], undo=True)
104
104
  ```
105
105
 
106
- ### **light green theme**
106
+ ### **light blue theme**
107
107
 
108
- ![tksheet light green theme](https://github.com/ragardner/tksheet/assets/26602401/790ee9bd-b4de-48df-8c44-33f303061d84)
108
+ ![tksheet light blue theme](https://github.com/user-attachments/assets/f40317d7-8b7f-43c5-9217-a77168b068ed)
109
109
 
110
110
  ### **dark theme**
111
111
 
112
- ![tksheet dark theme](https://github.com/ragardner/tksheet/assets/26602401/fc8a0407-1486-46cf-b852-9bcff23160e5)
112
+ ![tksheet dark theme](https://github.com/user-attachments/assets/288453d6-5ac1-4d45-827f-45b24a3d05ed)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes