Skip to content

Commit

Permalink
warn outdated GUI (+1 squashed commits)
Browse files Browse the repository at this point in the history
Squashed commits:

[15aec3d] spelling error
  • Loading branch information
LostRuins committed Jul 7, 2023
1 parent 32102c2 commit 9ee9a77
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions koboldcpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -997,10 +997,18 @@ def switch_old_gui():
time.sleep(2)
sys.exit(2)

def show_gui_warning():
from tkinter import messagebox
import tkinter as tk
root = tk.Tk()
root.attributes("-alpha", 0)
messagebox.showerror(title="New GUI failed, using Old GUI", message="The new GUI failed to load.\n\nTo use new GUI, please install the customtkinter python module.")
root.destroy()

def show_old_gui():
import tkinter as tk
from tkinter.filedialog import askopenfilename
from tkinter import messagebox

if len(sys.argv) == 1:
#no args passed at all. Show nooby gui
Expand Down Expand Up @@ -1078,7 +1086,7 @@ def onDropdownChange(event):

# Create button, it will change label text
tk.Button(root , text = "Launch", font = ("Impact", 18), bg='#54FA9B', command = guilaunch ).grid(row=6,column=0)
tk.Label(root, text = "(Please use the Command Line for more advanced options)",
tk.Label(root, text = "(Please use the Command Line for more advanced options)\nThis GUI is deprecated. Please install customtkinter.",
font = ("Arial", 9)).grid(row=7,column=0)

root.mainloop()
Expand Down Expand Up @@ -1166,9 +1174,11 @@ def main(args):
show_new_gui()
except Exception as ex:
print("Failed to use new GUI. Reason: " + str(ex))
print("Attempting to us old GUI...")
print("Make sure customtkinter is installed!!!")
print("Attempting to use old GUI...")
if not args.model_param:
try:
show_gui_warning()
show_old_gui()
except Exception as ex2:
print("File selection GUI unsupported. Please check command line: script.py --help")
Expand Down

0 comments on commit 9ee9a77

Please sign in to comment.