tksheet 7.1.2__py3-none-any.whl → 7.1.3__py3-none-any.whl

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.
tksheet/__init__.py CHANGED
@@ -4,7 +4,7 @@
4
4
  tksheet - A Python tkinter table widget
5
5
  """
6
6
 
7
- __version__ = "7.1.2"
7
+ __version__ = "7.1.3"
8
8
 
9
9
  from .colors import (
10
10
  color_map,
tksheet/functions.py CHANGED
@@ -628,6 +628,7 @@ def span_dict(
628
628
  ndim: int | None = None,
629
629
  convert: Callable | None = None,
630
630
  undo: bool = False,
631
+ emit_event: bool = False,
631
632
  widget: object = None,
632
633
  ) -> Span:
633
634
  d: Span = Span(
@@ -648,6 +649,7 @@ def span_dict(
648
649
  ndim=ndim,
649
650
  convert=convert,
650
651
  undo=undo,
652
+ emit_event=emit_event,
651
653
  widget=widget,
652
654
  )
653
655
  return d
tksheet/main_table.py CHANGED
@@ -2699,42 +2699,22 @@ class MainTable(tk.Canvas):
2699
2699
  self.mouseclick_outside_editor_or_dropdown_all_canvases()
2700
2700
  self.focus_set()
2701
2701
  popup_menu = None
2702
- if self.single_selection_enabled and self.not_currently_resizing():
2702
+ if (self.single_selection_enabled or self.toggle_selection_enabled) and self.not_currently_resizing():
2703
2703
  r = self.identify_row(y=event.y)
2704
2704
  c = self.identify_col(x=event.x)
2705
2705
  if r < len(self.row_positions) - 1 and c < len(self.col_positions) - 1:
2706
- if self.col_selected(c):
2707
- if self.rc_popup_menus_enabled:
2708
- popup_menu = self.CH.ch_rc_popup_menu
2709
- elif self.row_selected(r):
2710
- if self.rc_popup_menus_enabled:
2711
- popup_menu = self.RI.ri_rc_popup_menu
2712
- elif self.cell_selected(r, c):
2713
- if self.rc_popup_menus_enabled:
2714
- popup_menu = self.rc_popup_menu
2715
- else:
2716
- if self.rc_select_enabled:
2717
- self.select_cell(r, c, redraw=True)
2718
- if self.rc_popup_menus_enabled:
2719
- popup_menu = self.rc_popup_menu
2720
- else:
2721
- popup_menu = self.empty_rc_popup_menu
2722
- elif self.toggle_selection_enabled and self.not_currently_resizing():
2723
- r = self.identify_row(y=event.y)
2724
- c = self.identify_col(x=event.x)
2725
- if r < len(self.row_positions) - 1 and c < len(self.col_positions) - 1:
2726
- if self.col_selected(c):
2727
- if self.rc_popup_menus_enabled:
2728
- popup_menu = self.CH.ch_rc_popup_menu
2729
- elif self.row_selected(r):
2730
- if self.rc_popup_menus_enabled:
2731
- popup_menu = self.RI.ri_rc_popup_menu
2732
- elif self.cell_selected(r, c):
2733
- if self.rc_popup_menus_enabled:
2734
- popup_menu = self.rc_popup_menu
2706
+ if self.col_selected(c) and self.rc_popup_menus_enabled:
2707
+ popup_menu = self.CH.ch_rc_popup_menu
2708
+ elif self.row_selected(r) and self.rc_popup_menus_enabled:
2709
+ popup_menu = self.RI.ri_rc_popup_menu
2710
+ elif self.cell_selected(r, c) and self.rc_popup_menus_enabled:
2711
+ popup_menu = self.rc_popup_menu
2735
2712
  else:
2736
2713
  if self.rc_select_enabled:
2737
- self.toggle_select_cell(r, c, redraw=True)
2714
+ if self.single_selection_enabled:
2715
+ self.select_cell(r, c, redraw=True)
2716
+ elif self.toggle_selection_enabled:
2717
+ self.toggle_select_cell(r, c, redraw=True)
2738
2718
  if self.rc_popup_menus_enabled:
2739
2719
  popup_menu = self.rc_popup_menu
2740
2720
  else:
@@ -6236,7 +6216,7 @@ class MainTable(tk.Canvas):
6236
6216
  return tuple(box.coords for item, box in self.get_selection_items())
6237
6217
 
6238
6218
  def get_all_selection_boxes_with_types(self) -> list[tuple[tuple[int, int, int, int], str]]:
6239
- return [(box.coords, box.type) for item, box in self.get_selection_items()]
6219
+ return [(box.coords, box.type_) for item, box in self.get_selection_items()]
6240
6220
 
6241
6221
  def all_selected(self) -> bool:
6242
6222
  return any(
tksheet/sheet.py CHANGED
@@ -4420,7 +4420,8 @@ class Sheet(tk.Frame):
4420
4420
  redraw=False,
4421
4421
  deselect_all=True,
4422
4422
  )
4423
- self.tree_open(*open_ids)
4423
+ if open_ids:
4424
+ self.tree_open(*open_ids)
4424
4425
  return self
4425
4426
 
4426
4427
  def tree_open(self, *items) -> Sheet:
@@ -4428,7 +4429,7 @@ class Sheet(tk.Frame):
4428
4429
  If used without args all items are opened
4429
4430
  """
4430
4431
  if items:
4431
- for item in items:
4432
+ for item in unpack(items):
4432
4433
  self.item(item, open_=True)
4433
4434
  else:
4434
4435
  for item in self.get_children():
@@ -4440,7 +4441,7 @@ class Sheet(tk.Frame):
4440
4441
  If used without args all items are closed
4441
4442
  """
4442
4443
  if items:
4443
- for item in items:
4444
+ for item in unpack(items):
4444
4445
  self.item(item, open_=False)
4445
4446
  else:
4446
4447
  for item in self.get_children():
@@ -4525,8 +4526,6 @@ class Sheet(tk.Frame):
4525
4526
  if not (item := item.lower()) or item not in self.RI.tree:
4526
4527
  raise ValueError(f"Item '{item}' does not exist.")
4527
4528
  if isinstance(iid, str):
4528
- if not (iid := iid.lower()):
4529
- raise ValueError(f"iid '{iid}' does not exist.")
4530
4529
  if iid in self.RI.tree:
4531
4530
  raise ValueError(f"Cannot rename '{iid}', it already exists.")
4532
4531
  iid = iid.lower()
@@ -4538,7 +4537,7 @@ class Sheet(tk.Frame):
4538
4537
  if isinstance(text, str):
4539
4538
  self.RI.tree[item].text = text
4540
4539
  if isinstance(values, list):
4541
- self.set_data(self.RI.tree_rns[item], values)
4540
+ self.set_data(self.RI.tree_rns[item], data=values)
4542
4541
  if isinstance(open_, bool):
4543
4542
  if self.RI.tree[item].children:
4544
4543
  if open_:
@@ -4569,10 +4568,15 @@ class Sheet(tk.Frame):
4569
4568
  return self
4570
4569
 
4571
4570
  def itemrow(self, item: str) -> int:
4572
- return self.RI.tree_rns[item.lower()]
4571
+ try:
4572
+ return self.RI.tree_rns[item.lower()]
4573
+ except Exception:
4574
+ raise ValueError(f"item '{item.lower()}' does not exist.")
4573
4575
 
4574
- def rowitem(self, row: int) -> str | None:
4575
- if len(self.MT._row_index) > row:
4576
+ def rowitem(self, row: int, data_index: bool = False) -> str | None:
4577
+ if not data_index:
4578
+ row = self.data_r(row)
4579
+ if isinstance(row, int) and len(self.MT._row_index) > row:
4576
4580
  return self.MT._row_index[row].iid
4577
4581
  return None
4578
4582
 
@@ -4797,7 +4801,7 @@ class Sheet(tk.Frame):
4797
4801
  def selection_add(self, *items) -> Sheet:
4798
4802
  for item in unpack(items):
4799
4803
  if (item := item.lower()) not in self.RI.tree:
4800
- raise ValueError(f"Item '{item}' does not exist.")
4804
+ continue
4801
4805
  if not self.item_displayed(item):
4802
4806
  self.display_item(item)
4803
4807
  self.add_row_selection(bisect_left(self.MT.displayed_rows, self.RI.tree_rns[item]))
@@ -4806,7 +4810,7 @@ class Sheet(tk.Frame):
4806
4810
  def selection_remove(self, *items) -> Sheet:
4807
4811
  for item in unpack(items):
4808
4812
  if (item := item.lower()) not in self.RI.tree:
4809
- raise ValueError(f"Item '{item}' does not exist.")
4813
+ continue
4810
4814
  try:
4811
4815
  self.deselect(bisect_left(self.MT.displayed_rows, self.RI.tree_rns[item]))
4812
4816
  except Exception:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tksheet
3
- Version: 7.1.2
3
+ Version: 7.1.3
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
@@ -1,20 +1,20 @@
1
- tksheet/__init__.py,sha256=XdNk6UqANLa3RfjSgcbjOXH8Rjtf-9LLCGU8EESkoMY,1874
1
+ tksheet/__init__.py,sha256=12WUGUlSqVLgEpsMVTdgp8OZ60dVldHopXMgu4ZY_FU,1874
2
2
  tksheet/colors.py,sha256=1k06VorynLmnC4FdJg8H4reIA6rXaeXBpdMwXLhN8oc,51594
3
3
  tksheet/column_headers.py,sha256=1I49CQS4unBcJ-y044R-DtYhJ4zUplrOfImOk8qHIj8,99396
4
4
  tksheet/formatters.py,sha256=DXif00aq9DgFpXwkbiqD86KxtDg0Meop51hLY-KcGNQ,10037
5
- tksheet/functions.py,sha256=NnBFBvTqT6VhCK8pFlXqTwKekKpcsCYeuxaALcJeVzw,38651
6
- tksheet/main_table.py,sha256=Kh8ND0JnVHVeiwTt07FJkbP2GTlen3qCS5bt0xpbrdA,318848
5
+ tksheet/functions.py,sha256=7S4cQDIQ-1JqwQCgJSeVUA6bui_CK09zTHrtg2H7UeU,38714
6
+ tksheet/main_table.py,sha256=Di80IjcLbHtS0_G6iLYst1Uj-jD7FURLYYnZJwNqNNk,317950
7
7
  tksheet/other_classes.py,sha256=s559IxoFEeAgxTKrrHZnAeXUXWIEmiP4tBncIdQIXSQ,13544
8
8
  tksheet/row_index.py,sha256=GzK6Gfi4v6zwALn5IvBz22SdSFLUgxS1yLX4bm7z3sg,104428
9
- tksheet/sheet.py,sha256=ZoxxO1VZZzgshmp_3eJkkzXjx6S3M5T95sw3CTfUqHo,255904
9
+ tksheet/sheet.py,sha256=mEb_DHSkp_eRri0Lk7CHnaXRj_0FR7luIxy_Tl4A3wg,255991
10
10
  tksheet/sheet_options.py,sha256=Vcy4RxTKvf2HM-Yc53ex0lpBe6ATXc_pdx4oLhfjDgU,11906
11
11
  tksheet/text_editor.py,sha256=7xsEbgIyAWHDBWroh2wk1VeoVftFALlPZC9OANgD6LA,6662
12
12
  tksheet/themes.py,sha256=OwUe31NRbosjw3ZoZsMyB8lNVyYin9YcKLhCturi5q8,13398
13
13
  tksheet/top_left_rectangle.py,sha256=-2u9GfOvcqhkKwHEtbqdFvXCY3RbvL5k2Sh9l3r_k04,8275
14
14
  tksheet/types.py,sha256=IgoEHMbceKpakcZtanxKaKJ4RdCq7UW6EoEIIz5O59k,340
15
15
  tksheet/vars.py,sha256=Iukk7-MMT9X7vv0m3nQPKzbp2Iw2Pg1wJEW7js919Mo,2092
16
- tksheet-7.1.2.dist-info/LICENSE.txt,sha256=ndbcCPe9SlHfweE_W2RAueWUe2k7yudyxYLq6WjFdn4,1101
17
- tksheet-7.1.2.dist-info/METADATA,sha256=plUvLhmwtF-WEveHRmf99r4YViVdRJDZTCCJ6noYtZU,6013
18
- tksheet-7.1.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
19
- tksheet-7.1.2.dist-info/top_level.txt,sha256=my61PXCcck_HHAc9cq3NAlyAr3A3FXxCy9gptEOaCN8,8
20
- tksheet-7.1.2.dist-info/RECORD,,
16
+ tksheet-7.1.3.dist-info/LICENSE.txt,sha256=ndbcCPe9SlHfweE_W2RAueWUe2k7yudyxYLq6WjFdn4,1101
17
+ tksheet-7.1.3.dist-info/METADATA,sha256=P0uPdX4DxlWtwLB-i_3uqzndcS06_-UnyWDDBuU0FWI,6013
18
+ tksheet-7.1.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
19
+ tksheet-7.1.3.dist-info/top_level.txt,sha256=my61PXCcck_HHAc9cq3NAlyAr3A3FXxCy9gptEOaCN8,8
20
+ tksheet-7.1.3.dist-info/RECORD,,