tksheet 6.3.4__tar.gz → 6.3.5__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,12 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tksheet
3
- Version: 6.3.4
3
+ Version: 6.3.5
4
4
  Summary: Tkinter table / sheet widget
5
5
  Home-page: https://github.com/ragardner/tksheet
6
6
  Author: ragardner
7
7
  Author-email: github@ragardner.simplelogin.com
8
8
  License: MIT
9
- Download-URL: https://github.com/ragardner/tksheet/archive/6.3.4.tar.gz
9
+ Download-URL: https://github.com/ragardner/tksheet/archive/6.3.5.tar.gz
10
10
  Description: # **tksheet** [![PyPI version shields.io](https://img.shields.io/pypi/v/tksheet.svg)](https://pypi.python.org/pypi/tksheet/) ![python](https://img.shields.io/badge/python-3.7+-blue) [![License: MIT](https://img.shields.io/badge/License-MIT%20-blue.svg)](https://github.com/ragardner/tksheet/blob/master/LICENSE.txt) [![GitHub Release Date](https://img.shields.io/github/release-date-pre/ragardner/tksheet.svg)](https://github.com/ragardner/tksheet/releases) [![Downloads](https://img.shields.io/pypi/dm/tksheet.svg)](https://pypi.org/project/tksheet/)
11
11
 
12
12
  ## **Python tkinter table widget**
@@ -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.3.4',
11
+ version = '6.3.5',
12
12
  python_requires = '>=3.7',
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.3.4.tar.gz',
20
+ download_url = 'https://github.com/ragardner/tksheet/archive/6.3.5.tar.gz',
21
21
  keywords = ['tkinter', 'table', 'widget', 'sheet', 'grid', 'tk'],
22
22
  install_requires = [],
23
23
  classifiers = [
@@ -1699,12 +1699,7 @@ class Sheet(tk.Frame):
1699
1699
  return self.MT.currently_selected()
1700
1700
 
1701
1701
  def set_currently_selected(self, row, column, type_="cell", selection_binding=True):
1702
- self.MT.set_currently_selected(
1703
- r=row,
1704
- c=column,
1705
- type_=type_,
1706
- inside=True if self.MT.cell_selected(row, column) else False,
1707
- )
1702
+ self.MT.set_currently_selected(r=row, c=column, type_=type_)
1708
1703
  if selection_binding and self.MT.selection_binding_func is not None:
1709
1704
  self.MT.selection_binding_func(SelectCellEvent("select_cell", row, column))
1710
1705
 
@@ -209,11 +209,6 @@ class ColumnHeaders(tk.Canvas):
209
209
  if binding == "hide_columns":
210
210
  self.hide_columns_enabled = False
211
211
 
212
- def check_mouse_position_width_resizers(self, x, y):
213
- for c, (x1, y1, x2, y2) in self.visible_col_dividers.items():
214
- if x >= x1 and y >= y1 and x <= x2 and y <= y2:
215
- return c
216
-
217
212
  def rc(self, event):
218
213
  self.mouseclick_outside_editor_or_dropdown_all_canvases(inside=True)
219
214
  self.focus_set()
@@ -375,6 +370,12 @@ class ColumnHeaders(tk.Canvas):
375
370
  if sh:
376
371
  self.itemconfig(t, state="hidden")
377
372
  self.hidd_resize_lines[t] = False
373
+
374
+ def check_mouse_position_width_resizers(self, x, y):
375
+ for c, (x1, y1, x2, y2) in self.visible_col_dividers.items():
376
+ if x >= x1 and y >= y1 and x <= x2 and y <= y2:
377
+ return c
378
+ return None
378
379
 
379
380
  def mouse_motion(self, event):
380
381
  if not self.currently_resizing_height and not self.currently_resizing_width:
@@ -386,7 +387,9 @@ class ColumnHeaders(tk.Canvas):
386
387
  c = self.check_mouse_position_width_resizers(x, y)
387
388
  if c is not None:
388
389
  self.rsz_w, mouse_over_resize = c, True
389
- self.config(cursor="sb_h_double_arrow")
390
+ if self.MT.current_cursor != "sb_h_double_arrow":
391
+ self.config(cursor="sb_h_double_arrow")
392
+ self.MT.current_cursor = "sb_h_double_arrow"
390
393
  else:
391
394
  self.rsz_w = None
392
395
  if self.height_resizing_enabled and not mouse_over_resize:
@@ -398,17 +401,20 @@ class ColumnHeaders(tk.Canvas):
398
401
  self.col_height_resize_bbox[3],
399
402
  )
400
403
  if x >= x1 and y >= y1 and x <= x2 and y <= y2:
401
- self.config(cursor="sb_v_double_arrow")
402
- self.rsz_h = True
403
- mouse_over_resize = True
404
+ self.rsz_h, mouse_over_resize = True, True
405
+ if self.MT.current_cursor != "sb_v_double_arrow":
406
+ self.config(cursor="sb_v_double_arrow")
407
+ self.MT.current_cursor = "sb_v_double_arrow"
404
408
  else:
405
409
  self.rsz_h = None
406
410
  except Exception:
407
411
  self.rsz_h = None
408
412
  if not mouse_over_resize:
409
413
  if self.MT.col_selected(self.MT.identify_col(event, allow_end=False)):
410
- self.config(cursor="hand2")
411
414
  mouse_over_selected = True
415
+ if self.MT.current_cursor != "hand2":
416
+ self.config(cursor="hand2")
417
+ self.MT.current_cursor = "hand2"
412
418
  if not mouse_over_resize and not mouse_over_selected:
413
419
  self.MT.reset_mouse_motion_creations()
414
420
  if self.extra_motion_func is not None:
@@ -1257,24 +1263,9 @@ class ColumnHeaders(tk.Canvas):
1257
1263
  t, sh = self.hidd_grid.popitem()
1258
1264
  self.coords(t, points)
1259
1265
  if sh:
1260
- self.itemconfig(
1261
- t,
1262
- fill=fill,
1263
- width=width,
1264
- tag=tag,
1265
- capstyle=tk.BUTT,
1266
- joinstyle=tk.ROUND,
1267
- )
1266
+ self.itemconfig(t, fill=fill, width=width, tag=tag)
1268
1267
  else:
1269
- self.itemconfig(
1270
- t,
1271
- fill=fill,
1272
- width=width,
1273
- tag=tag,
1274
- capstyle=tk.BUTT,
1275
- joinstyle=tk.ROUND,
1276
- state="normal",
1277
- )
1268
+ self.itemconfig(t, fill=fill, width=width, tag=tag, state="normal")
1278
1269
  self.disp_grid[t] = True
1279
1270
  else:
1280
1271
  self.disp_grid[self.create_line(points, fill=fill, width=width, tag=tag)] = True
@@ -59,6 +59,7 @@ class MainTable(tk.Canvas):
59
59
  self.parentframe = kwargs["parentframe"]
60
60
  self.parentframe_width = 0
61
61
  self.parentframe_height = 0
62
+ self.current_cursor = ""
62
63
  self.b1_pressed_loc = None
63
64
  self.existing_dropdown_canvas_id = None
64
65
  self.existing_dropdown_window = None
@@ -211,8 +212,7 @@ class MainTable(tk.Canvas):
211
212
  self.show_selected_cells_border = kwargs["show_selected_cells_border"]
212
213
  self.new_row_width = 0
213
214
  self.new_header_height = 0
214
- self.row_width_resize_bbox = tuple()
215
- self.header_height_resize_bbox = tuple()
215
+
216
216
  self.CH = kwargs["column_headers_canvas"]
217
217
  self.CH.MT = self
218
218
  self.CH.RI = kwargs["row_index_canvas"]
@@ -2655,7 +2655,7 @@ class MainTable(tk.Canvas):
2655
2655
  elif binding == "column_height_resize":
2656
2656
  self.CH.enable_bindings("column_height_resize")
2657
2657
  self.TL.rh_state()
2658
- elif binding == "column_drag_and_drop":
2658
+ elif binding in ("column_drag_and_drop", "move_columns"):
2659
2659
  self.CH.enable_bindings("drag_and_drop")
2660
2660
  elif binding == "double_click_column_resize":
2661
2661
  self.CH.enable_bindings("double_click_column_resize")
@@ -2668,7 +2668,7 @@ class MainTable(tk.Canvas):
2668
2668
  self.TL.rw_state()
2669
2669
  elif binding == "row_select":
2670
2670
  self.RI.enable_bindings("row_select")
2671
- elif binding == "row_drag_and_drop":
2671
+ elif binding in ("row_drag_and_drop", "move_rows"):
2672
2672
  self.RI.enable_bindings("drag_and_drop")
2673
2673
  elif binding == "arrowkeys":
2674
2674
  self.bind_arrowkeys(self.arrowkey_binding_functions)
@@ -2759,7 +2759,7 @@ class MainTable(tk.Canvas):
2759
2759
  elif binding == "column_height_resize":
2760
2760
  self.CH.disable_bindings("column_height_resize")
2761
2761
  self.TL.rh_state("hidden")
2762
- elif binding == "column_drag_and_drop":
2762
+ elif binding in ("column_drag_and_drop", "move_columns"):
2763
2763
  self.CH.disable_bindings("drag_and_drop")
2764
2764
  elif binding == "double_click_column_resize":
2765
2765
  self.CH.disable_bindings("double_click_column_resize")
@@ -2772,7 +2772,7 @@ class MainTable(tk.Canvas):
2772
2772
  self.TL.rw_state("hidden")
2773
2773
  elif binding == "row_select":
2774
2774
  self.RI.disable_bindings("row_select")
2775
- elif binding == "row_drag_and_drop":
2775
+ elif binding in ("row_drag_and_drop", "move_rows"):
2776
2776
  self.RI.disable_bindings("drag_and_drop")
2777
2777
  elif binding == "arrowkeys":
2778
2778
  self.unbind_arrowkeys(self.arrowkey_binding_functions)
@@ -2813,56 +2813,18 @@ class MainTable(tk.Canvas):
2813
2813
  self.create_rc_menus()
2814
2814
 
2815
2815
  def reset_mouse_motion_creations(self, event=None):
2816
- self.config(cursor="")
2817
- self.RI.config(cursor="")
2818
- self.CH.config(cursor="")
2816
+ if self.current_cursor != "":
2817
+ self.config(cursor="")
2818
+ self.RI.config(cursor="")
2819
+ self.CH.config(cursor="")
2820
+ self.current_cursor = ""
2819
2821
  self.RI.rsz_w = None
2820
2822
  self.RI.rsz_h = None
2821
2823
  self.CH.rsz_w = None
2822
2824
  self.CH.rsz_h = None
2823
-
2825
+
2824
2826
  def mouse_motion(self, event):
2825
- if (
2826
- not self.RI.currently_resizing_height
2827
- and not self.RI.currently_resizing_width
2828
- and not self.CH.currently_resizing_height
2829
- and not self.CH.currently_resizing_width
2830
- ):
2831
- mouse_over_resize = False
2832
- x = self.canvasx(event.x)
2833
- y = self.canvasy(event.y)
2834
- if self.RI.width_resizing_enabled and self.show_index and not mouse_over_resize:
2835
- try:
2836
- x1, y1, x2, y2 = (
2837
- self.row_width_resize_bbox[0],
2838
- self.row_width_resize_bbox[1],
2839
- self.row_width_resize_bbox[2],
2840
- self.row_width_resize_bbox[3],
2841
- )
2842
- if x >= x1 and y >= y1 and x <= x2 and y <= y2:
2843
- self.config(cursor="sb_h_double_arrow")
2844
- self.RI.config(cursor="sb_h_double_arrow")
2845
- self.RI.rsz_w = True
2846
- mouse_over_resize = True
2847
- except Exception:
2848
- pass
2849
- if self.CH.height_resizing_enabled and self.show_header and not mouse_over_resize:
2850
- try:
2851
- x1, y1, x2, y2 = (
2852
- self.header_height_resize_bbox[0],
2853
- self.header_height_resize_bbox[1],
2854
- self.header_height_resize_bbox[2],
2855
- self.header_height_resize_bbox[3],
2856
- )
2857
- if x >= x1 and y >= y1 and x <= x2 and y <= y2:
2858
- self.config(cursor="sb_v_double_arrow")
2859
- self.CH.config(cursor="sb_v_double_arrow")
2860
- self.CH.rsz_h = True
2861
- mouse_over_resize = True
2862
- except Exception:
2863
- pass
2864
- if not mouse_over_resize:
2865
- self.reset_mouse_motion_creations()
2827
+ self.reset_mouse_motion_creations()
2866
2828
  if self.extra_motion_func is not None:
2867
2829
  self.extra_motion_func(event)
2868
2830
 
@@ -2942,16 +2904,6 @@ class MainTable(tk.Canvas):
2942
2904
  c = self.identify_col(x=event.x)
2943
2905
  if r < len(self.row_positions) - 1 and c < len(self.col_positions) - 1:
2944
2906
  self.toggle_select_cell(r, c, redraw=True)
2945
- elif self.RI.width_resizing_enabled and self.show_index and self.RI.rsz_h is None and self.RI.rsz_w:
2946
- self.RI.currently_resizing_width = True
2947
- self.new_row_width = self.RI.current_width + event.x
2948
- x = self.canvasx(event.x)
2949
- self.create_resize_line(x, y1, x, y2, width=1, fill=self.RI.resizing_line_fg, tag="rwl")
2950
- elif self.CH.height_resizing_enabled and self.show_header and self.CH.rsz_w is None and self.CH.rsz_h:
2951
- self.CH.currently_resizing_height = True
2952
- self.new_header_height = self.CH.current_height + event.y
2953
- y = self.canvasy(event.y)
2954
- self.create_resize_line(x1, y, x2, y, width=1, fill=self.RI.resizing_line_fg, tag="rhl")
2955
2907
  self.b1_pressed_loc = (r, c)
2956
2908
  if self.extra_b1_press_func is not None:
2957
2909
  self.extra_b1_press_func(event)
@@ -3082,7 +3034,6 @@ class MainTable(tk.Canvas):
3082
3034
  return None
3083
3035
 
3084
3036
  def b1_motion(self, event):
3085
- x1, y1, x2, y2 = self.get_canvas_visible_area()
3086
3037
  if self.drag_selection_enabled and all(
3087
3038
  v is None for v in (self.RI.rsz_h, self.RI.rsz_w, self.CH.rsz_h, self.CH.rsz_w)
3088
3039
  ):
@@ -3111,37 +3062,10 @@ class MainTable(tk.Canvas):
3111
3062
  need_redraw = True
3112
3063
  if need_redraw:
3113
3064
  self.main_table_redraw_grid_and_text(redraw_header=True, redraw_row_index=True, redraw_table=True)
3114
- elif self.RI.width_resizing_enabled and self.RI.rsz_w is not None and self.RI.currently_resizing_width:
3115
- self.RI.delete_resize_lines()
3116
- self.delete_resize_lines()
3117
- if event.x >= 0:
3118
- x = self.canvasx(event.x)
3119
- self.new_row_width = self.RI.current_width + event.x
3120
- self.create_resize_line(x, y1, x, y2, width=1, fill=self.RI.resizing_line_fg, tag="rwl")
3121
- else:
3122
- x = self.RI.current_width + event.x
3123
- if x < self.min_column_width:
3124
- x = int(self.min_column_width)
3125
- self.new_row_width = x
3126
- self.RI.create_resize_line(x, y1, x, y2, width=1, fill=self.RI.resizing_line_fg, tag="rwl")
3127
- elif self.CH.height_resizing_enabled and self.CH.rsz_h is not None and self.CH.currently_resizing_height:
3128
- self.CH.delete_resize_lines()
3129
- self.delete_resize_lines()
3130
- if event.y >= 0:
3131
- y = self.canvasy(event.y)
3132
- self.new_header_height = self.CH.current_height + event.y
3133
- self.create_resize_line(x1, y, x2, y, width=1, fill=self.RI.resizing_line_fg, tag="rhl")
3134
- else:
3135
- y = self.CH.current_height + event.y
3136
- if y < self.min_header_height:
3137
- y = int(self.min_header_height)
3138
- self.new_header_height = y
3139
- self.CH.create_resize_line(x1, y, x2, y, width=1, fill=self.RI.resizing_line_fg, tag="rhl")
3140
3065
  if self.extra_b1_motion_func is not None:
3141
3066
  self.extra_b1_motion_func(event)
3142
3067
 
3143
3068
  def ctrl_b1_motion(self, event):
3144
- x1, y1, x2, y2 = self.get_canvas_visible_area()
3145
3069
  if (
3146
3070
  self.ctrl_select_enabled
3147
3071
  and self.drag_selection_enabled
@@ -3234,7 +3158,6 @@ class MainTable(tk.Canvas):
3234
3158
  def double_b1(self, event=None):
3235
3159
  self.mouseclick_outside_editor_or_dropdown_all_canvases()
3236
3160
  self.focus_set()
3237
- x1, y1, x2, y2 = self.get_canvas_visible_area()
3238
3161
  if (
3239
3162
  self.identify_col(x=event.x, allow_end=False) is None
3240
3163
  or self.identify_row(y=event.y, allow_end=False) is None
@@ -5035,18 +4958,6 @@ class MainTable(tk.Canvas):
5035
4958
  start_row = bisect.bisect_left(self.row_positions, scrollpos_top)
5036
4959
  start_col = bisect.bisect_left(self.col_positions, scrollpos_left)
5037
4960
  end_col = bisect.bisect_right(self.col_positions, scrollpos_right)
5038
- self.row_width_resize_bbox = (
5039
- scrollpos_left,
5040
- scrollpos_top,
5041
- scrollpos_left + 2,
5042
- scrollpos_bot,
5043
- )
5044
- self.header_height_resize_bbox = (
5045
- scrollpos_left + 6,
5046
- scrollpos_top,
5047
- scrollpos_right,
5048
- scrollpos_top + 2,
5049
- )
5050
4961
  self.hidd_text.update(self.disp_text)
5051
4962
  self.disp_text = {}
5052
4963
  self.hidd_high.update(self.disp_high)
@@ -177,11 +177,6 @@ class RowIndex(tk.Canvas):
177
177
  elif binding == "drag_and_drop":
178
178
  self.drag_and_drop_enabled = False
179
179
 
180
- def check_mouse_position_height_resizers(self, x, y):
181
- for r, (x1, y1, x2, y2) in self.visible_row_dividers.items():
182
- if x >= x1 and y >= y1 and x <= x2 and y <= y2:
183
- return r
184
-
185
180
  def rc(self, event):
186
181
  self.mouseclick_outside_editor_or_dropdown_all_canvases(inside=True)
187
182
  self.focus_set()
@@ -319,6 +314,12 @@ class RowIndex(tk.Canvas):
319
314
  if sh:
320
315
  self.itemconfig(t, state="hidden")
321
316
  self.hidd_resize_lines[t] = False
317
+
318
+ def check_mouse_position_height_resizers(self, x, y):
319
+ for r, (x1, y1, x2, y2) in self.visible_row_dividers.items():
320
+ if x >= x1 and y >= y1 and x <= x2 and y <= y2:
321
+ return r
322
+ return None
322
323
 
323
324
  def mouse_motion(self, event):
324
325
  if not self.currently_resizing_height and not self.currently_resizing_width:
@@ -329,9 +330,10 @@ class RowIndex(tk.Canvas):
329
330
  if self.height_resizing_enabled and not mouse_over_resize:
330
331
  r = self.check_mouse_position_height_resizers(x, y)
331
332
  if r is not None:
332
- self.config(cursor="sb_v_double_arrow")
333
- self.rsz_h = r
334
- mouse_over_resize = True
333
+ self.rsz_h, mouse_over_resize = r, True
334
+ if self.MT.current_cursor != "sb_v_double_arrow":
335
+ self.config(cursor="sb_v_double_arrow")
336
+ self.MT.current_cursor = "sb_v_double_arrow"
335
337
  else:
336
338
  self.rsz_h = None
337
339
  if self.width_resizing_enabled and not mouse_over_resize:
@@ -343,17 +345,20 @@ class RowIndex(tk.Canvas):
343
345
  self.row_width_resize_bbox[3],
344
346
  )
345
347
  if x >= x1 and y >= y1 and x <= x2 and y <= y2:
346
- self.config(cursor="sb_h_double_arrow")
347
- self.rsz_w = True
348
- mouse_over_resize = True
348
+ self.rsz_w, mouse_over_resize = True, True
349
+ if self.MT.current_cursor != "sb_h_double_arrow":
350
+ self.config(cursor="sb_h_double_arrow")
351
+ self.MT.current_cursor = "sb_h_double_arrow"
349
352
  else:
350
353
  self.rsz_w = None
351
354
  except Exception:
352
355
  self.rsz_w = None
353
356
  if not mouse_over_resize:
354
357
  if self.MT.row_selected(self.MT.identify_row(event, allow_end=False)):
355
- self.config(cursor="hand2")
356
358
  mouse_over_selected = True
359
+ if self.MT.current_cursor != "hand2":
360
+ self.config(cursor="hand2")
361
+ self.MT.current_cursor = "hand2"
357
362
  if not mouse_over_resize and not mouse_over_selected:
358
363
  self.MT.reset_mouse_motion_creations()
359
364
  if self.extra_motion_func is not None:
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tksheet
3
- Version: 6.3.4
3
+ Version: 6.3.5
4
4
  Summary: Tkinter table / sheet widget
5
5
  Home-page: https://github.com/ragardner/tksheet
6
6
  Author: ragardner
7
7
  Author-email: github@ragardner.simplelogin.com
8
8
  License: MIT
9
- Download-URL: https://github.com/ragardner/tksheet/archive/6.3.4.tar.gz
9
+ Download-URL: https://github.com/ragardner/tksheet/archive/6.3.5.tar.gz
10
10
  Description: # **tksheet** [![PyPI version shields.io](https://img.shields.io/pypi/v/tksheet.svg)](https://pypi.python.org/pypi/tksheet/) ![python](https://img.shields.io/badge/python-3.7+-blue) [![License: MIT](https://img.shields.io/badge/License-MIT%20-blue.svg)](https://github.com/ragardner/tksheet/blob/master/LICENSE.txt) [![GitHub Release Date](https://img.shields.io/github/release-date-pre/ragardner/tksheet.svg)](https://github.com/ragardner/tksheet/releases) [![Downloads](https://img.shields.io/pypi/dm/tksheet.svg)](https://pypi.org/project/tksheet/)
11
11
 
12
12
  ## **Python tkinter table widget**
File without changes
File without changes
File without changes