tweak tooltips
This commit is contained in:
parent
7ad92dbf4a
commit
6177196052
1 changed files with 18 additions and 17 deletions
35
koboldcpp.py
35
koboldcpp.py
|
@ -1089,6 +1089,8 @@ def show_new_gui():
|
||||||
root.geometry(str(windowwidth) + "x" + str(windowheight))
|
root.geometry(str(windowwidth) + "x" + str(windowheight))
|
||||||
root.title("KoboldCpp v"+KcppVersion)
|
root.title("KoboldCpp v"+KcppVersion)
|
||||||
root.resizable(False,False)
|
root.resizable(False,False)
|
||||||
|
gtooltip_box = None
|
||||||
|
gtooltip_label = None
|
||||||
|
|
||||||
tabs = ctk.CTkFrame(root, corner_radius = 0, width=windowwidth, height=windowheight-50)
|
tabs = ctk.CTkFrame(root, corner_radius = 0, width=windowwidth, height=windowheight-50)
|
||||||
tabs.grid(row=0, stick="nsew")
|
tabs.grid(row=0, stick="nsew")
|
||||||
|
@ -1376,27 +1378,26 @@ def show_new_gui():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def show_tooltip(event, tooltip_text=None):
|
def show_tooltip(event, tooltip_text=None):
|
||||||
if hasattr(show_tooltip, "_tooltip"):
|
nonlocal gtooltip_box, gtooltip_label
|
||||||
tooltip = show_tooltip._tooltip
|
if not gtooltip_box:
|
||||||
tooltip_label = show_tooltip._tooltiplabel
|
gtooltip_box = ctk.CTkToplevel(root)
|
||||||
tooltip_label.configure(text=tooltip_text)
|
gtooltip_box.configure(fg_color="#ffffe0")
|
||||||
|
gtooltip_box.withdraw()
|
||||||
|
gtooltip_box.overrideredirect(True)
|
||||||
|
gtooltip_label = ctk.CTkLabel(gtooltip_box, text=tooltip_text, text_color="#000000", fg_color="#ffffe0")
|
||||||
|
gtooltip_label.pack(expand=True, padx=2, pady=1)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
tooltip = ctk.CTkToplevel(root)
|
gtooltip_label.configure(text=tooltip_text)
|
||||||
tooltip.configure(fg_color="#ffffe0")
|
|
||||||
tooltip.withdraw()
|
|
||||||
tooltip.overrideredirect(True)
|
|
||||||
tooltip_label = ctk.CTkLabel(tooltip, text=tooltip_text, text_color="#000000", fg_color="#ffffe0")
|
|
||||||
tooltip_label.pack(expand=True, padx=2, pady=1)
|
|
||||||
show_tooltip._tooltip = tooltip
|
|
||||||
show_tooltip._tooltiplabel = tooltip_label
|
|
||||||
x, y = root.winfo_pointerxy()
|
x, y = root.winfo_pointerxy()
|
||||||
tooltip.wm_geometry(f"+{x + 10}+{y + 10}")
|
gtooltip_box.wm_geometry(f"+{x + 10}+{y + 10}")
|
||||||
tooltip.deiconify()
|
gtooltip_box.deiconify()
|
||||||
|
|
||||||
def hide_tooltip(event):
|
def hide_tooltip(event):
|
||||||
if hasattr(show_tooltip, "_tooltip"):
|
nonlocal gtooltip_box
|
||||||
tooltip = show_tooltip._tooltip
|
if gtooltip_box:
|
||||||
tooltip.withdraw()
|
gtooltip_box.withdraw()
|
||||||
|
|
||||||
def setup_backend_tooltip(parent):
|
def setup_backend_tooltip(parent):
|
||||||
# backend count label with the tooltip function
|
# backend count label with the tooltip function
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue