simba-uw-tf-dev 4.7.6__py3-none-any.whl → 4.7.8__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.

Potentially problematic release.


This version of simba-uw-tf-dev might be problematic. Click here for more details.

Files changed (27) hide show
  1. simba/assets/.recent_projects.txt +1 -0
  2. simba/assets/icons/folder_2.png +0 -0
  3. simba/assets/icons/folder_video.png +0 -0
  4. simba/assets/lookups/tooptips.json +35 -2
  5. simba/model/yolo_fit.py +42 -9
  6. simba/sandbox/clean_sleap.py +4 -0
  7. simba/third_party_label_appenders/transform/coco_keypoints_to_yolo.py +1 -2
  8. simba/third_party_label_appenders/transform/sleap_csv_to_yolo.py +21 -13
  9. simba/ui/create_project_ui.py +1 -1
  10. simba/ui/pop_ups/batch_preprocess_pop_up.py +2 -2
  11. simba/ui/pop_ups/simba_to_yolo_keypoints_popup.py +96 -96
  12. simba/ui/pop_ups/sleap_annotations_to_yolo_popup.py +32 -18
  13. simba/ui/pop_ups/sleap_csv_predictions_to_yolo_popup.py +15 -14
  14. simba/ui/pop_ups/video_processing_pop_up.py +8 -7
  15. simba/ui/pop_ups/yolo_plot_results.py +146 -153
  16. simba/ui/pop_ups/yolo_pose_train_popup.py +69 -23
  17. simba/ui/tkinter_functions.py +53 -6
  18. simba/utils/checks.py +2414 -2401
  19. simba/utils/read_write.py +22 -20
  20. simba/video_processors/batch_process_menus.py +22 -22
  21. simba/video_processors/video_processing.py +3 -2
  22. {simba_uw_tf_dev-4.7.6.dist-info → simba_uw_tf_dev-4.7.8.dist-info}/METADATA +1 -1
  23. {simba_uw_tf_dev-4.7.6.dist-info → simba_uw_tf_dev-4.7.8.dist-info}/RECORD +27 -24
  24. {simba_uw_tf_dev-4.7.6.dist-info → simba_uw_tf_dev-4.7.8.dist-info}/LICENSE +0 -0
  25. {simba_uw_tf_dev-4.7.6.dist-info → simba_uw_tf_dev-4.7.8.dist-info}/WHEEL +0 -0
  26. {simba_uw_tf_dev-4.7.6.dist-info → simba_uw_tf_dev-4.7.8.dist-info}/entry_points.txt +0 -0
  27. {simba_uw_tf_dev-4.7.6.dist-info → simba_uw_tf_dev-4.7.8.dist-info}/top_level.txt +0 -0
@@ -17,12 +17,14 @@ try:
17
17
  except:
18
18
  from typing_extensions import Literal
19
19
 
20
+ import numpy as np
20
21
  import PIL.Image
21
22
  from PIL import ImageTk
22
23
 
23
24
  from simba.utils.enums import Defaults, Formats, TkBinds
24
25
  from simba.utils.lookups import get_icons_paths, get_tooltips
25
26
  from simba.utils.read_write import get_fn_ext
27
+ from simba.utils.checks import check_if_valid_img
26
28
 
27
29
  MENU_ICONS = get_icons_paths()
28
30
  TOOLTIPS = get_tooltips()
@@ -593,7 +595,8 @@ def SimbaCheckbox(parent: Union[Frame, Toplevel, LabelFrame, Canvas],
593
595
  state: Literal["disabled", 'normal'] = NORMAL,
594
596
  indicatoron: bool = True,
595
597
  cmd: Optional[Callable] = None,
596
- tooltip_txt: Optional[str] = None):
598
+ tooltip_txt: Optional[str] = None,
599
+ tooltip_key: Optional[str] = None):
597
600
 
598
601
  var = BooleanVar(value=False)
599
602
  if val: var.set(True)
@@ -610,6 +613,8 @@ def SimbaCheckbox(parent: Union[Frame, Toplevel, LabelFrame, Canvas],
610
613
 
611
614
  if isinstance(tooltip_txt, str):
612
615
  CreateToolTip(widget=cb, text=tooltip_txt)
616
+ elif isinstance(tooltip_key, str) and tooltip_key in TOOLTIPS.keys():
617
+ CreateToolTip(widget=cb, text=TOOLTIPS[tooltip_key])
613
618
 
614
619
  return cb, var
615
620
 
@@ -630,14 +635,56 @@ def SimBALabel(parent: Union[Frame, Canvas, LabelFrame, Toplevel],
630
635
  cursor: Optional[str] = None,
631
636
  img: Optional[str] = None,
632
637
  anchor: Optional[str] = None,
633
- tooltip_key: Optional[str] = None):
634
-
638
+ tooltip_key: Optional[str] = None,
639
+ hover_img: Optional[np.ndarray] = None):
640
+
641
+
642
+ def _hover_enter(e):
643
+ w = e.widget
644
+ if hover_img is not None and check_if_valid_img(data=hover_img, raise_error=False):
645
+ arr = np.asarray(hover_img, dtype=np.uint8)
646
+ if arr.ndim == 3 and arr.shape[2] == 3:
647
+ arr = arr[:, :, ::-1]
648
+ pil_img = PIL.Image.fromarray(arr)
649
+ photo = ImageTk.PhotoImage(pil_img)
650
+ tw = Toplevel(w)
651
+ tw.wm_overrideredirect(True)
652
+ tw.attributes("-topmost", True)
653
+ tw.wm_geometry("+%d+%d" % (w.winfo_rootx() + w.winfo_width() + 4, w.winfo_rooty()))
654
+ frm = Frame(tw, relief="solid", bd=2, bg="#f0f0f0")
655
+ frm.pack(padx=2, pady=2)
656
+ lbl_hover = Label(frm, image=photo, bg="#f0f0f0")
657
+ lbl_hover.image = photo
658
+ lbl_hover.pack(padx=4, pady=(4, 2))
659
+ caption_lbl = Label(frm, text=txt, font=font, fg=txt_clr, bg=bg_clr)
660
+ caption_lbl.pack(pady=(0, 4))
661
+ tw.lift()
662
+ w._hover_toplevel = tw
663
+ elif hover_fg_clr is not None or hover_font is not None:
664
+ w.config(fg=hover_fg_clr, font=hover_font)
665
+
666
+ def _hover_leave(e):
667
+ w = e.widget
668
+ if getattr(w, "_hover_toplevel", None) is not None:
669
+ try:
670
+ w._hover_toplevel.destroy()
671
+ except tkinter.TclError:
672
+ pass
673
+ w._hover_toplevel = None
674
+ if hover_fg_clr is not None or hover_font is not None:
675
+ w.config(fg=txt_clr, bg=bg_clr, font=font)
635
676
 
636
677
  def on_enter(e):
637
- e.widget.config(fg=hover_fg_clr, font=hover_font)
678
+ if hover_img is not None:
679
+ _hover_enter(e)
680
+ else:
681
+ e.widget.config(fg=hover_fg_clr, font=hover_font)
638
682
 
639
683
  def on_leave(e):
640
- e.widget.config(fg=txt_clr, bg=bg_clr, font=font)
684
+ if hover_img is not None:
685
+ _hover_leave(e)
686
+ else:
687
+ e.widget.config(fg=txt_clr, bg=bg_clr, font=font)
641
688
 
642
689
  anchor = 'w' if anchor is None else anchor
643
690
  if isinstance(img, str) and img in MENU_ICONS.keys():
@@ -673,7 +720,7 @@ def SimBALabel(parent: Union[Frame, Canvas, LabelFrame, Toplevel],
673
720
  elif tooltip_key in TOOLTIPS.keys():
674
721
  CreateToolTip(widget=lbl, text=TOOLTIPS[tooltip_key])
675
722
 
676
- if hover_font is not None or hover_fg_clr is not None:
723
+ if hover_font is not None or hover_fg_clr is not None or hover_img is not None:
677
724
  lbl.bind(TkBinds.ENTER.value, on_enter)
678
725
  lbl.bind(TkBinds.LEAVE.value, on_leave)
679
726