tksheet 7.2.15__tar.gz → 7.2.16__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.15/tksheet.egg-info → tksheet-7.2.16}/PKG-INFO +6 -1
  2. {tksheet-7.2.15 → tksheet-7.2.16}/README.md +5 -0
  3. {tksheet-7.2.15 → tksheet-7.2.16}/pyproject.toml +1 -1
  4. {tksheet-7.2.15 → tksheet-7.2.16}/tksheet/__init__.py +1 -1
  5. {tksheet-7.2.15 → tksheet-7.2.16}/tksheet/row_index.py +3 -2
  6. {tksheet-7.2.15 → tksheet-7.2.16}/tksheet/sheet.py +41 -6
  7. {tksheet-7.2.15 → tksheet-7.2.16}/tksheet/sheet_options.py +1 -1
  8. {tksheet-7.2.15 → tksheet-7.2.16/tksheet.egg-info}/PKG-INFO +6 -1
  9. {tksheet-7.2.15 → tksheet-7.2.16}/LICENSE.txt +0 -0
  10. {tksheet-7.2.15 → tksheet-7.2.16}/setup.cfg +0 -0
  11. {tksheet-7.2.15 → tksheet-7.2.16}/tksheet/colors.py +0 -0
  12. {tksheet-7.2.15 → tksheet-7.2.16}/tksheet/column_headers.py +0 -0
  13. {tksheet-7.2.15 → tksheet-7.2.16}/tksheet/formatters.py +0 -0
  14. {tksheet-7.2.15 → tksheet-7.2.16}/tksheet/functions.py +0 -0
  15. {tksheet-7.2.15 → tksheet-7.2.16}/tksheet/main_table.py +0 -0
  16. {tksheet-7.2.15 → tksheet-7.2.16}/tksheet/other_classes.py +0 -0
  17. {tksheet-7.2.15 → tksheet-7.2.16}/tksheet/text_editor.py +0 -0
  18. {tksheet-7.2.15 → tksheet-7.2.16}/tksheet/themes.py +0 -0
  19. {tksheet-7.2.15 → tksheet-7.2.16}/tksheet/top_left_rectangle.py +0 -0
  20. {tksheet-7.2.15 → tksheet-7.2.16}/tksheet/types.py +0 -0
  21. {tksheet-7.2.15 → tksheet-7.2.16}/tksheet/vars.py +0 -0
  22. {tksheet-7.2.15 → tksheet-7.2.16}/tksheet.egg-info/SOURCES.txt +0 -0
  23. {tksheet-7.2.15 → tksheet-7.2.16}/tksheet.egg-info/dependency_links.txt +0 -0
  24. {tksheet-7.2.15 → tksheet-7.2.16}/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.15
3
+ Version: 7.2.16
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
@@ -83,6 +83,7 @@ This library is maintained with the help of **[others](https://github.com/ragard
83
83
  - Change fonts and font size (not for individual cells)
84
84
  - Change any colors in the sheet
85
85
  - Dropdowns, check boxes, progress bars
86
+ - Treeview mode
86
87
  - [Hide rows and/or columns](https://github.com/ragardner/tksheet/wiki/Version-7#example-header-dropdown-boxes-and-row-filtering)
87
88
  - Left `"w"`, Center `"center"` or Right `"e"` text alignment for any cell/row/column
88
89
 
@@ -110,3 +111,7 @@ sheet.delete_columns(columns=[0, 3], undo=True)
110
111
  ### **dark theme**
111
112
 
112
113
  ![tksheet dark theme](https://github.com/user-attachments/assets/288453d6-5ac1-4d45-827f-45b24a3d05ed)
114
+
115
+ ### **treeview mode**
116
+
117
+ ![tksheet treeview](https://github.com/user-attachments/assets/201f2d9d-7ffb-43e2-81ba-91da806aaab0)
@@ -41,6 +41,7 @@ This library is maintained with the help of **[others](https://github.com/ragard
41
41
  - Change fonts and font size (not for individual cells)
42
42
  - Change any colors in the sheet
43
43
  - Dropdowns, check boxes, progress bars
44
+ - Treeview mode
44
45
  - [Hide rows and/or columns](https://github.com/ragardner/tksheet/wiki/Version-7#example-header-dropdown-boxes-and-row-filtering)
45
46
  - Left `"w"`, Center `"center"` or Right `"e"` text alignment for any cell/row/column
46
47
 
@@ -68,3 +69,7 @@ sheet.delete_columns(columns=[0, 3], undo=True)
68
69
  ### **dark theme**
69
70
 
70
71
  ![tksheet dark theme](https://github.com/user-attachments/assets/288453d6-5ac1-4d45-827f-45b24a3d05ed)
72
+
73
+ ### **treeview mode**
74
+
75
+ ![tksheet treeview](https://github.com/user-attachments/assets/201f2d9d-7ffb-43e2-81ba-91da806aaab0)
@@ -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.15"
9
+ version = "7.2.16"
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.15"
7
+ __version__ = "7.2.16"
8
8
 
9
9
  from .colors import (
10
10
  color_map,
@@ -921,11 +921,12 @@ class RowIndex(tk.Canvas):
921
921
  eventx: int,
922
922
  ) -> bool:
923
923
  if self.PAR.ops.treeview and (
924
- canvasy < self.MT.row_positions[r] + self.MT.index_txt_height + 3
924
+ canvasy < self.MT.row_positions[r] + self.MT.index_txt_height + 5
925
925
  and isinstance(self.MT._row_index, list)
926
926
  and (datarn := self.MT.datarn(r)) < len(self.MT._row_index)
927
927
  and eventx
928
- < self.get_treeview_indent((iid := self.MT._row_index[datarn].iid)) + self.MT.index_txt_height + 1
928
+ < (indent := self.get_treeview_indent((iid := self.MT._row_index[datarn].iid))) + self.MT.index_txt_height + 4
929
+ and eventx >= indent + 1
929
930
  ):
930
931
  return iid
931
932
  return None
@@ -10,6 +10,7 @@ from collections.abc import (
10
10
  Iterator,
11
11
  Sequence,
12
12
  )
13
+ from functools import partial
13
14
  from itertools import (
14
15
  accumulate,
15
16
  chain,
@@ -4714,6 +4715,8 @@ class Sheet(tk.Frame):
4714
4715
  open_ids: Iterator[str] | None = None,
4715
4716
  safety: bool = True,
4716
4717
  ncols: int | None = None,
4718
+ include_iid_column: bool = True,
4719
+ include_parent_column: bool = True,
4717
4720
  ) -> Sheet:
4718
4721
  self.reset(cell_options=False, column_widths=False, header=False, redraw=False)
4719
4722
  if text_column is None:
@@ -4759,8 +4762,9 @@ class Sheet(tk.Frame):
4759
4762
  newrow[iid_column] = n.iid
4760
4763
  self.RI.tree_rns[n.iid] = len(data)
4761
4764
  data.append(newrow)
4762
- self.insert_rows(
4763
- rows=[[self.RI.tree[iid]] + data[self.RI.tree_rns[iid]] for iid in self.get_children()],
4765
+
4766
+ insert_rows = partial(
4767
+ self.insert_rows,
4764
4768
  idx=0,
4765
4769
  heights={} if row_heights is False else row_heights,
4766
4770
  row_index=True,
@@ -4769,6 +4773,37 @@ class Sheet(tk.Frame):
4769
4773
  push_ops=push_ops,
4770
4774
  redraw=False,
4771
4775
  )
4776
+
4777
+ if include_iid_column and include_parent_column:
4778
+ insert_rows(rows=[[self.RI.tree[iid]] + data[self.RI.tree_rns[iid]] for iid in self.get_children()])
4779
+
4780
+ elif include_iid_column and not include_parent_column:
4781
+ exclude = {parent_column}
4782
+ insert_rows(
4783
+ rows=[
4784
+ [self.RI.tree[iid]] + [e for i, e in enumerate(data[self.RI.tree_rns[iid]]) if i not in exclude]
4785
+ for iid in self.get_children()
4786
+ ]
4787
+ )
4788
+
4789
+ elif include_parent_column and not include_iid_column:
4790
+ exclude = {iid_column}
4791
+ insert_rows(
4792
+ rows=[
4793
+ [self.RI.tree[iid]] + [e for i, e in enumerate(data[self.RI.tree_rns[iid]]) if i not in exclude]
4794
+ for iid in self.get_children()
4795
+ ]
4796
+ )
4797
+
4798
+ elif not include_iid_column and not include_parent_column:
4799
+ exclude = {iid_column, parent_column}
4800
+ insert_rows(
4801
+ rows=[
4802
+ [self.RI.tree[iid]] + [e for i, e in enumerate(data[self.RI.tree_rns[iid]]) if i not in exclude]
4803
+ for iid in self.get_children()
4804
+ ]
4805
+ )
4806
+
4772
4807
  self.MT.all_rows_displayed = False
4773
4808
  self.MT.displayed_rows = list(range(len(self.MT._row_index)))
4774
4809
  self.RI.tree_rns = {n.iid: i for i, n in enumerate(self.MT._row_index)}
@@ -4886,12 +4921,12 @@ class Sheet(tk.Frame):
4886
4921
  index: None | int | Literal["end"] = None,
4887
4922
  iid: None | str = None,
4888
4923
  text: None | str = None,
4889
- values: None | list = None,
4924
+ values: None | list[object] = None,
4890
4925
  create_selections: bool = False,
4891
4926
  ) -> str:
4892
4927
  if iid is None:
4893
4928
  i = 0
4894
- while (iid := f"{i}") in self.RI.tree:
4929
+ while (iid := f"{num2alpha(i)}") in self.RI.tree:
4895
4930
  i += 1
4896
4931
  iid, pid = iid.lower(), parent.lower()
4897
4932
  if not iid:
@@ -5214,7 +5249,7 @@ class Sheet(tk.Frame):
5214
5249
  raise ValueError(f"Item '{item}' does not exist.")
5215
5250
  return self.RI.tree_rns[item] in self.MT.displayed_rows
5216
5251
 
5217
- def display_item(self, item: str, redraw=False) -> Sheet:
5252
+ def display_item(self, item: str, redraw: bool = False) -> Sheet:
5218
5253
  """
5219
5254
  Ensure that item is displayed in the tree
5220
5255
  - Opens all of an item's ancestors
@@ -5231,7 +5266,7 @@ class Sheet(tk.Frame):
5231
5266
  )
5232
5267
  return self.set_refresh_timer(redraw)
5233
5268
 
5234
- def scroll_to_item(self, item: str, redraw=False) -> Sheet:
5269
+ def scroll_to_item(self, item: str, redraw: bool = False) -> Sheet:
5235
5270
  """
5236
5271
  Scrolls to an item and ensures that it is displayed
5237
5272
  """
@@ -242,7 +242,7 @@ def new_sheet_options() -> DotDict:
242
242
  "edit_cell_return": "down",
243
243
  "editor_del_key": "forward",
244
244
  "treeview": False,
245
- "treeview_indent": "6",
245
+ "treeview_indent": "5",
246
246
  "rounded_boxes": True,
247
247
  "alternate_color": "",
248
248
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tksheet
3
- Version: 7.2.15
3
+ Version: 7.2.16
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
@@ -83,6 +83,7 @@ This library is maintained with the help of **[others](https://github.com/ragard
83
83
  - Change fonts and font size (not for individual cells)
84
84
  - Change any colors in the sheet
85
85
  - Dropdowns, check boxes, progress bars
86
+ - Treeview mode
86
87
  - [Hide rows and/or columns](https://github.com/ragardner/tksheet/wiki/Version-7#example-header-dropdown-boxes-and-row-filtering)
87
88
  - Left `"w"`, Center `"center"` or Right `"e"` text alignment for any cell/row/column
88
89
 
@@ -110,3 +111,7 @@ sheet.delete_columns(columns=[0, 3], undo=True)
110
111
  ### **dark theme**
111
112
 
112
113
  ![tksheet dark theme](https://github.com/user-attachments/assets/288453d6-5ac1-4d45-827f-45b24a3d05ed)
114
+
115
+ ### **treeview mode**
116
+
117
+ ![tksheet treeview](https://github.com/user-attachments/assets/201f2d9d-7ffb-43e2-81ba-91da806aaab0)
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