Skip to content

Commit dd0db72

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
1 parent 43fffb6 commit dd0db72

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

koboldcpp.py

+19-19
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,24 @@ def getfilename(var, text):
765765
button = ctk.CTkButton(parent, 50, text="Browse", command= lambda a=var,b=searchtext:getfilename(a,b))
766766
button.grid(row=row+1, column=1, stick="nw")
767767
return
768+
def show_tooltip(event, tooltip_text=None):
769+
if hasattr(show_tooltip, "_tooltip"):
770+
tooltip = show_tooltip._tooltip
771+
else:
772+
tooltip = ctk.CTkToplevel(root)
773+
tooltip.configure(fg_color="#ffffe0")
774+
tooltip.withdraw()
775+
tooltip.overrideredirect(True)
776+
tooltip_label = ctk.CTkLabel(tooltip, text=tooltip_text, text_color="#000000", fg_color="#ffffe0")
777+
tooltip_label.pack(expand=True, padx=2, pady=1)
778+
show_tooltip._tooltip = tooltip
779+
x, y = root.winfo_pointerxy()
780+
tooltip.wm_geometry(f"+{x + 10}+{y + 10}")
781+
tooltip.deiconify()
782+
def hide_tooltip(event):
783+
if hasattr(show_tooltip, "_tooltip"):
784+
tooltip = show_tooltip._tooltip
785+
tooltip.withdraw()
768786

769787
from subprocess import run, CalledProcessError
770788
def get_device_names():
@@ -851,24 +869,6 @@ def get_device_names():
851869
CUDA_quick_gpu_selector_box = ctk.CTkComboBox(quick_tab, values=CUdevices, width=180, variable=gpu_choice_var, state="readonly")
852870
quick_lowvram_box = makecheckbox(quick_tab, "Low VRAM", lowvram_var, 5)
853871

854-
def show_tooltip(event, tooltip_text=None):
855-
if hasattr(show_tooltip, "_tooltip"):
856-
tooltip = show_tooltip._tooltip
857-
else:
858-
tooltip = ctk.CTkToplevel(root)
859-
tooltip.configure(fg_color="#ffffe0")
860-
tooltip.withdraw()
861-
tooltip.overrideredirect(True)
862-
tooltip_label = ctk.CTkLabel(tooltip, text=tooltip_text, text_color="#000000", fg_color="#ffffe0")
863-
tooltip_label.pack(expand=True, padx=2, pady=1)
864-
show_tooltip._tooltip = tooltip
865-
x, y = root.winfo_pointerxy()
866-
tooltip.wm_geometry(f"+{x + 10}+{y + 10}")
867-
tooltip.deiconify()
868-
def hide_tooltip(event):
869-
if hasattr(show_tooltip, "_tooltip"):
870-
tooltip = show_tooltip._tooltip
871-
tooltip.withdraw()
872872
def changerunmode(a,b,c):
873873
index = runopts_var.get()
874874
if index == "Use CLBlast" or index == "Use CuBLAS/hipBLAS":
@@ -916,7 +916,7 @@ def changerunmode(a,b,c):
916916
num_backends_built = makelabel(quick_tab, str(len(runopts)) + "/6", 5, 2)
917917
num_backends_built.grid(row=1, column=2, padx=0, pady=0)
918918
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.\nMissing: {', '.join(antirunopts)}"))
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)}"))
920920
num_backends_built.bind("<Leave>", hide_tooltip)
921921
# threads
922922
makelabelentry(quick_tab, "Threads:" , threads_var, 8, 50)

0 commit comments

Comments
 (0)