8000 remove duplicate code and fix typo · LostRuins/koboldcpp@8573a67 · GitHub
Skip to content

Commit 8573a67

Browse files
committed
remove duplicate code and fix typo
remove duplicate tooltip
1 parent 430986e commit 8573a67

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

koboldcpp.py

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -765,24 +765,6 @@ 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()
786768

787769
from subprocess import run, CalledProcessError
788770
def get_device_names():
@@ -930,7 +912,7 @@ def changerunmode(a,b,c):
930912

931913
runoptbox = ctk.CTkComboBox(quick_tab, values=runopts, width=180,variable=runopts_var, state="readonly")
932914
runoptbox.grid(row=1, column=1,padx=8, stick="nw")
933-
runoptbox.set(runopts[0])
915+
runoptbox.set(runopts[0]) # Set to first available option
934916
# Tell user how many backends are available
935917
num_backends_built = makelabel(quick_tab, str(len(runopts)) + "/6", 5, 2)
936918
num_backends_built.grid(row=1, column=2, padx=0, pady=0)
@@ -968,15 +950,16 @@ def changerunmode(a,b,c):
968950
makelabel(hardware_tab, "Presets:", 1)
969951
runoptbox = ctk.CTkComboBox(hardware_tab, values=runopts, width=180,variable=runopts_var, state="readonly")
970952
runoptbox.grid(row=1, column=1,padx=8, stick="nw")
971-
runoptbox.set(runopts[0])
953+
runoptbox.set(runopts[0]) # Set to first available option
972954
runopts_var.trace('w', changerunmode)
973955
changerunmode(1,1,1)
974956

975957
# Tell user how many backends are available
976958
num_backends_built = makelabel(hardware_tab, str(len(runopts)) + "/6", 5, 2)
977959
num_backends_built.grid(row=1, column=2, padx=0, pady=0)
978960
num_backends_built.configure(text_color="#00ff00")
979-
num_backends_built.bind("<Enter>", show_tooltip)
961+
# Bind the backend count label with the tooltip function
962+
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 "")))
980963
num_backends_built.bind("<Leave>", hide_tooltip)
981964
# threads
982965
makelabelentry(hardware_tab, "Threads:" , threads_var, 8, 50)

0 commit comments

Comments
 (0)
0