Skip to content

Commit 430986e

Browse files
committed
hide "missing" if all are built
move tooltip functions to helper functions section. hides the string "Missing: ..." from showing if all backends are available " if len(runopts)==6 else + "
1 parent dd0db72 commit 430986e

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

koboldcpp.py

+21-1
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,25 @@ def get_device_names():
811811
if not CLdevices: CLdevices.extend(['1', '2', '3'])
812812
return CUdevices, CLdevices
813813

814+
def show_tooltip(event, tooltip_text=None):
815+
if hasattr(show_tooltip, "_tooltip"):
816+
tooltip = show_tooltip._tooltip
817+
else:
818+
tooltip = ctk.CTkToplevel(root)
819+
tooltip.configure(fg_color="#ffffe0")
820+
tooltip.withdraw()
821+
tooltip.overrideredirect(True)
822+
tooltip_label = ctk.CTkLabel(tooltip, text=tooltip_text, text_color="#000000", fg_color="#ffffe0")
823+
tooltip_label.pack(expand=True, padx=2, pady=1)
824+
show_tooltip._tooltip = tooltip
825+
x, y = root.winfo_pointerxy()
826+
tooltip.wm_geometry(f"+{x + 10}+{y + 10}")
827+
tooltip.deiconify()
828+
def hide_tooltip(event):
829+
if hasattr(show_tooltip, "_tooltip"):
830+
tooltip = show_tooltip._tooltip
831+
tooltip.withdraw()
832+
814833
# Vars - should be in scope to be used by multiple widgets
815834
CUdevices, CLdevices = get_device_names()
816835
gpulayers_var = ctk.StringVar(value="0")
@@ -916,7 +935,8 @@ def changerunmode(a,b,c):
916935
num_backends_built = makelabel(quick_tab, str(len(runopts)) + "/6", 5, 2)
917936
num_backends_built.grid(row=1, column=2, padx=0, pady=0)
918937
num_backends_built.configure(text_color="#00ff00")
919-
num_backends_built.bind("<Enter>", lambda event: show_tooltip(event, f"This is the number of backends you have built and available." if len(runopts)==6 else + "\nMissing: {', '.join(antirunopts)}"))
938+
# Bind the backend count label with the tooltip function
939+
num_backends_built.bind("<Enter>", lambda event: show_tooltip(event, f"This is the number of backends you have built and available." + (f"\nMissing: {', '.join(antirunopts)}" if len(runopts) != 6 else "")))
920940
num_backends_built.bind("<Leave>", hide_tooltip)
921941
# threads
922942
makelabelentry(quick_tab, "Threads:" , threads_var, 8, 50)

0 commit comments

Comments
 (0)