tksheet 6.1.8__tar.gz → 6.1.9__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.
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tksheet
3
- Version: 6.1.8
3
+ Version: 6.1.9
4
4
  Summary: Tkinter table / sheet widget
5
5
  Home-page: https://github.com/ragardner/tksheet
6
- Download-URL: https://github.com/ragardner/tksheet/archive/6.1.8.tar.gz
6
+ Download-URL: https://github.com/ragardner/tksheet/archive/6.1.9.tar.gz
7
7
  Author: ragardner
8
8
  Author-email: github@ragardner.simplelogin.com
9
9
  License: MIT
@@ -8,7 +8,7 @@ with open(path.join(this_directory, 'README.md'), encoding = 'utf-8') as f:
8
8
  setup(
9
9
  name = 'tksheet',
10
10
  packages = ['tksheet'],
11
- version = '6.1.8',
11
+ version = '6.1.9',
12
12
  python_requires = '>=3.6',
13
13
  license = 'MIT',
14
14
  description = 'Tkinter table / sheet widget',
@@ -17,7 +17,7 @@ setup(
17
17
  author = 'ragardner',
18
18
  author_email = 'github@ragardner.simplelogin.com',
19
19
  url = 'https://github.com/ragardner/tksheet',
20
- download_url = 'https://github.com/ragardner/tksheet/archive/6.1.8.tar.gz',
20
+ download_url = 'https://github.com/ragardner/tksheet/archive/6.1.9.tar.gz',
21
21
  keywords = ['tkinter', 'table', 'widget', 'sheet', 'grid', 'tk'],
22
22
  install_requires = [],
23
23
  classifiers = [
@@ -1814,7 +1814,7 @@ class MainTable(tk.Canvas):
1814
1814
  self.delete_current()
1815
1815
  deselected = ("deselect_all_cols", deleted_boxes)
1816
1816
  elif r is not None and c is None and cell is None:
1817
- current = self.find_withtag("currently")
1817
+ current = self.find_withtag("selected")
1818
1818
  current_tags = self.gettags(current[0]) if current else tuple()
1819
1819
  if current:
1820
1820
  curr_r1, curr_c1, curr_r2, curr_c2 = tuple(int(e) for e in current_tags[1].split("_") if e)
@@ -1836,7 +1836,7 @@ class MainTable(tk.Canvas):
1836
1836
  self.set_current_to_last()
1837
1837
  deselected = ("deselect_row", deleted_boxes)
1838
1838
  elif c is not None and r is None and cell is None:
1839
- current = self.find_withtag("currently")
1839
+ current = self.find_withtag("selected")
1840
1840
  current_tags = self.gettags(current[0]) if current else tuple()
1841
1841
  if current:
1842
1842
  curr_r1, curr_c1, curr_r2, curr_c2 = tuple(int(e) for e in current_tags[1].split("_") if e)
@@ -1865,7 +1865,7 @@ class MainTable(tk.Canvas):
1865
1865
  self.find_withtag("cells"),
1866
1866
  self.find_withtag("rows"),
1867
1867
  self.find_withtag("columns"),
1868
- self.find_withtag("currently"),
1868
+ self.find_withtag("selected"),
1869
1869
  ):
1870
1870
  alltags = self.gettags(item)
1871
1871
  if alltags:
@@ -3054,7 +3054,7 @@ class MainTable(tk.Canvas):
3054
3054
  else:
3055
3055
  self.select_cell(rowsel, colsel, redraw=False)
3056
3056
  last_selected = tuple(
3057
- int(e) for e in self.gettags(self.find_withtag("currently"))[1].split("_") if e
3057
+ int(e) for e in self.gettags(self.find_withtag("selected"))[1].split("_") if e
3058
3058
  )
3059
3059
  self.main_table_redraw_grid_and_text(redraw_header=True, redraw_row_index=True, redraw_table=True)
3060
3060
  if self.shift_selection_binding_func is not None:
@@ -3628,6 +3628,8 @@ class MainTable(tk.Canvas):
3628
3628
  self.RI.row_height_resize_func(ResizeEvent("row_height_resize", r, old_height, new_height))
3629
3629
  if cell_needs_resize_w or cell_needs_resize_h:
3630
3630
  self.recreate_all_selection_boxes()
3631
+ self.allow_auto_resize_columns = not cell_needs_resize_w
3632
+ self.allow_auto_resize_rows = not cell_needs_resize_h
3631
3633
  if redraw:
3632
3634
  self.refresh()
3633
3635
  return True
@@ -5346,7 +5348,7 @@ class MainTable(tk.Canvas):
5346
5348
  self.hidd_checkbox[t] = False
5347
5349
  if self.show_selected_cells_border:
5348
5350
  self.tag_raise("cellsbd")
5349
- self.tag_raise("currently")
5351
+ self.tag_raise("selected")
5350
5352
  self.tag_raise("rowsbd")
5351
5353
  self.tag_raise("columnsbd")
5352
5354
  if redraw_header and self.show_header:
@@ -5377,7 +5379,7 @@ class MainTable(tk.Canvas):
5377
5379
  self.find_withtag("cells")
5378
5380
  + self.find_withtag("rows")
5379
5381
  + self.find_withtag("columns")
5380
- + self.find_withtag("currently")
5382
+ + self.find_withtag("selected")
5381
5383
  )
5382
5384
 
5383
5385
  def get_boxes(self, include_current=True):
@@ -5390,7 +5392,7 @@ class MainTable(tk.Canvas):
5390
5392
  boxes[tuple(int(e) for e in alltags[1].split("_") if e)] = "rows"
5391
5393
  elif alltags[0] == "columns":
5392
5394
  boxes[tuple(int(e) for e in alltags[1].split("_") if e)] = "columns"
5393
- elif include_current and alltags[0] == "currently":
5395
+ elif include_current and alltags[0] == "selected":
5394
5396
  boxes[tuple(int(e) for e in alltags[1].split("_") if e)] = f"{alltags[2]}"
5395
5397
  return boxes
5396
5398
 
@@ -5467,13 +5469,13 @@ class MainTable(tk.Canvas):
5467
5469
  self.RI.delete("columns", "columnsbd")
5468
5470
  self.CH.delete("columns", "columnsbd")
5469
5471
  if delete_current:
5470
- self.delete("currently")
5471
- self.RI.delete("currently")
5472
- self.CH.delete("currently")
5472
+ self.delete("selected")
5473
+ self.RI.delete("selected")
5474
+ self.CH.delete("selected")
5473
5475
  return deleted_boxes
5474
5476
 
5475
5477
  def currently_selected(self):
5476
- items = self.find_withtag("currently")
5478
+ items = self.find_withtag("selected")
5477
5479
  if not items:
5478
5480
  return tuple()
5479
5481
  alltags = self.gettags(items[0])
@@ -5481,7 +5483,7 @@ class MainTable(tk.Canvas):
5481
5483
  return CurrentlySelectedClass(box[0], box[1], alltags[2])
5482
5484
 
5483
5485
  def get_tags_of_current(self):
5484
- items = self.find_withtag("currently")
5486
+ items = self.find_withtag("selected")
5485
5487
  if items:
5486
5488
  return self.gettags(items[0])
5487
5489
  else:
@@ -5489,17 +5491,17 @@ class MainTable(tk.Canvas):
5489
5491
 
5490
5492
  def set_currently_selected(self, r, c, type_="cell"): # cell, column or row
5491
5493
  r1, c1, r2, c2 = r, c, r + 1, c + 1
5492
- self.delete("currently")
5493
- self.RI.delete("currently")
5494
- self.CH.delete("currently")
5494
+ self.delete("selected")
5495
+ self.RI.delete("selected")
5496
+ self.CH.delete("selected")
5495
5497
  if self.col_positions == [0]:
5496
5498
  c1 = 0
5497
5499
  c2 = 0
5498
5500
  if self.row_positions == [0]:
5499
5501
  r1 = 0
5500
5502
  r2 = 0
5501
- tagr = ("currently", f"{r1}_{c1}_{r2}_{c2}", type_)
5502
- tag_index_header = ("cells", f"{r1}_{c1}_{r2}_{c2}")
5503
+ tagr = ("selected", f"{r1}_{c1}_{r2}_{c2}", type_)
5504
+ tag_index_header = ("cells", f"{r1}_{c1}_{r2}_{c2}", "selected")
5503
5505
  if type_ == "cell":
5504
5506
  outline = self.table_selected_cells_border_fg
5505
5507
  elif type_ == "row":
@@ -5566,9 +5568,9 @@ class MainTable(tk.Canvas):
5566
5568
  return tuple()
5567
5569
 
5568
5570
  def delete_current(self):
5569
- self.delete("currently")
5570
- self.RI.delete("currently")
5571
- self.CH.delete("currently")
5571
+ self.delete("selected")
5572
+ self.RI.delete("selected")
5573
+ self.CH.delete("selected")
5572
5574
 
5573
5575
  def create_selected(
5574
5576
  self,
@@ -5581,21 +5583,22 @@ class MainTable(tk.Canvas):
5581
5583
  state="normal",
5582
5584
  ):
5583
5585
  self.itemconfig("cells", state="normal")
5586
+ coords = f"{r1}_{c1}_{r2}_{c2}"
5584
5587
  if type_ == "cells":
5585
- tagr = ("cells", f"{r1}_{c1}_{r2}_{c2}")
5586
- tagb = ("cellsbd", f"{r1}_{c1}_{r2}_{c2}")
5588
+ tagr = ("cells", coords)
5589
+ tagb = ("cellsbd", coords)
5587
5590
  mt_bg = self.table_selected_cells_bg
5588
5591
  mt_border_col = self.table_selected_cells_border_fg
5589
5592
  elif type_ == "rows":
5590
- tagr = ("rows", f"{r1}_{c1}_{r2}_{c2}")
5591
- tagb = ("rowsbd", f"{r1}_{c1}_{r2}_{c2}")
5592
- tag_index_header = ("cells", f"{r1}_{c1}_{r2}_{c2}")
5593
+ tagr = ("rows", coords)
5594
+ tagb = ("rowsbd", coords)
5595
+ tag_index_header = ("cells", coords)
5593
5596
  mt_bg = self.table_selected_rows_bg
5594
5597
  mt_border_col = self.table_selected_rows_border_fg
5595
5598
  elif type_ == "columns":
5596
- tagr = ("columns", f"{r1}_{c1}_{r2}_{c2}")
5597
- tagb = ("columnsbd", f"{r1}_{c1}_{r2}_{c2}")
5598
- tag_index_header = ("cells", f"{r1}_{c1}_{r2}_{c2}")
5599
+ tagr = ("columns", coords)
5600
+ tagb = ("columnsbd", coords)
5601
+ tag_index_header = ("cells", coords)
5599
5602
  mt_bg = self.table_selected_columns_bg
5600
5603
  mt_border_col = self.table_selected_columns_border_fg
5601
5604
  self.last_selected = (r1, c1, r2, c2, type_)
@@ -5655,15 +5658,16 @@ class MainTable(tk.Canvas):
5655
5658
  return r, b
5656
5659
 
5657
5660
  def recreate_all_selection_boxes(self):
5661
+ curr = self.currently_selected()
5658
5662
  for item in chain(
5659
5663
  self.find_withtag("cells"),
5660
5664
  self.find_withtag("rows"),
5661
5665
  self.find_withtag("columns"),
5662
- self.find_withtag("currently"),
5663
5666
  ):
5664
5667
  tags = self.gettags(item)
5665
5668
  if tags:
5666
5669
  r1, c1, r2, c2 = tuple(int(e) for e in tags[1].split("_") if e)
5670
+ state = self.itemcget(item, "state")
5667
5671
  self.delete(f"{r1}_{c1}_{r2}_{c2}")
5668
5672
  self.RI.delete(f"{r1}_{c1}_{r2}_{c2}")
5669
5673
  self.CH.delete(f"{r1}_{c1}_{r2}_{c2}")
@@ -5673,10 +5677,9 @@ class MainTable(tk.Canvas):
5673
5677
  r2 = len(self.row_positions) - 1
5674
5678
  if c2 > len(self.col_positions) - 1:
5675
5679
  c2 = len(self.col_positions) - 1
5676
- if tags[0] == "currently":
5677
- self.set_currently_selected(r1, c1, tags[2])
5678
- else:
5679
- self.create_selected(r1, c1, r2, c2, tags[0])
5680
+ self.create_selected(r1, c1, r2, c2, tags[0], state=state)
5681
+ if curr:
5682
+ self.set_currently_selected(curr.row, curr.column, curr.type_)
5680
5683
  self.tag_lower("rows")
5681
5684
  self.RI.tag_lower("rows")
5682
5685
  self.tag_lower("columns")
@@ -5685,7 +5688,7 @@ class MainTable(tk.Canvas):
5685
5688
  self.RI.tag_lower("cells")
5686
5689
  self.CH.tag_lower("cells")
5687
5690
  if not self.show_selected_cells_border:
5688
- self.tag_lower("currently")
5691
+ self.tag_lower("selected")
5689
5692
 
5690
5693
  def get_redraw_selections(self, startr, endr, startc, endc):
5691
5694
  d = defaultdict(list)
@@ -5720,7 +5723,7 @@ class MainTable(tk.Canvas):
5720
5723
  self.find_withtag("cells"),
5721
5724
  self.find_withtag("rows"),
5722
5725
  self.find_withtag("columns"),
5723
- self.find_withtag("currently"),
5726
+ self.find_withtag("selected"),
5724
5727
  ):
5725
5728
  r1, c1, r2, c2 = tuple(int(e) for e in self.gettags(item)[1].split("_") if e)
5726
5729
  if r1 < min_y:
@@ -5963,7 +5966,7 @@ class MainTable(tk.Canvas):
5963
5966
  return True
5964
5967
  return False
5965
5968
 
5966
- # don't have to use "currently" because you can't have a current without a selection box
5969
+ # don't have to use "selected" because you can't have a current without a selection box
5967
5970
  def cell_selected(self, r, c, inc_cols=False, inc_rows=False):
5968
5971
  if not isinstance(r, int) or not isinstance(c, int):
5969
5972
  return False
@@ -6024,11 +6027,11 @@ class MainTable(tk.Canvas):
6024
6027
  return tuple()
6025
6028
 
6026
6029
  def hide_current(self):
6027
- for item in self.find_withtag("currently"):
6030
+ for item in self.find_withtag("selected"):
6028
6031
  self.itemconfig(item, state="hidden")
6029
6032
 
6030
6033
  def show_current(self):
6031
- for item in self.find_withtag("currently"):
6034
+ for item in self.find_withtag("selected"):
6032
6035
  self.itemconfig(item, state="normal")
6033
6036
 
6034
6037
  def open_cell(self, event=None, ignore_existing_editor=False):
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tksheet
3
- Version: 6.1.8
3
+ Version: 6.1.9
4
4
  Summary: Tkinter table / sheet widget
5
5
  Home-page: https://github.com/ragardner/tksheet
6
- Download-URL: https://github.com/ragardner/tksheet/archive/6.1.8.tar.gz
6
+ Download-URL: https://github.com/ragardner/tksheet/archive/6.1.9.tar.gz
7
7
  Author: ragardner
8
8
  Author-email: github@ragardner.simplelogin.com
9
9
  License: MIT
File without changes
File without changes
File without changes
File without changes
File without changes