mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2024-12-12 08:36:28 +01:00
d632976fbf
Help text added to settings items. Settings now saved to client file when changed. Separated transformers settings and InferKit settings. Reorganized model select list.
52 lines
1.5 KiB
Python
52 lines
1.5 KiB
Python
import tkinter as tk
|
|
from tkinter import filedialog
|
|
|
|
#==================================================================#
|
|
# Generic Method for prompting for file path
|
|
#==================================================================#
|
|
def getsavepath(dir, title, types):
|
|
root = tk.Tk()
|
|
root.attributes("-topmost", True)
|
|
path = tk.filedialog.asksaveasfile(
|
|
initialdir=dir,
|
|
title=title,
|
|
filetypes = types
|
|
)
|
|
root.destroy()
|
|
if(path != "" and path != None):
|
|
return path.name
|
|
else:
|
|
return None
|
|
|
|
#==================================================================#
|
|
# Generic Method for prompting for file path
|
|
#==================================================================#
|
|
def getloadpath(dir, title, types):
|
|
root = tk.Tk()
|
|
root.attributes("-topmost", True)
|
|
path = tk.filedialog.askopenfilename(
|
|
initialdir=dir,
|
|
title=title,
|
|
filetypes = types
|
|
)
|
|
root.destroy()
|
|
if(path != "" and path != None):
|
|
return path
|
|
else:
|
|
return None
|
|
|
|
#==================================================================#
|
|
# Generic Method for prompting for directory path
|
|
#==================================================================#
|
|
def getdirpath(dir, title):
|
|
root = tk.Tk()
|
|
root.attributes("-topmost", True)
|
|
path = filedialog.askdirectory(
|
|
initialdir=dir,
|
|
title=title
|
|
)
|
|
root.destroy()
|
|
if(path != "" and path != None):
|
|
return path
|
|
else:
|
|
return None |