mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2025-09-10 17:14:36 +00:00
zentk - folder select workaround (#1478)
* zentk - folder select workaround * kcppt extention fix
This commit is contained in:
parent
8fd70f37bd
commit
f6b7fea979
1 changed files with 5 additions and 1 deletions
|
@ -3528,7 +3528,11 @@ def zenity(typ, filetypes=None, initialdir="", initialfile="", **kwargs) -> Tupl
|
||||||
|
|
||||||
def zentk_askopenfilename(**options):
|
def zentk_askopenfilename(**options):
|
||||||
try:
|
try:
|
||||||
|
from os.path import isfile
|
||||||
result = zenity('file-selection', filetypes=options.get("filetypes"), initialdir=options.get("initialdir"), title=options.get("title"))[1]
|
result = zenity('file-selection', filetypes=options.get("filetypes"), initialdir=options.get("initialdir"), title=options.get("title"))[1]
|
||||||
|
if result and not isfile(result):
|
||||||
|
print("A folder was selected while we need a file, ignoring selection.")
|
||||||
|
return ''
|
||||||
except:
|
except:
|
||||||
from tkinter.filedialog import askopenfilename
|
from tkinter.filedialog import askopenfilename
|
||||||
result = askopenfilename(**options)
|
result = askopenfilename(**options)
|
||||||
|
@ -4420,7 +4424,7 @@ def show_gui():
|
||||||
return
|
return
|
||||||
filenamestr = str(filename).strip()
|
filenamestr = str(filename).strip()
|
||||||
if not filenamestr.endswith(".kcppt"):
|
if not filenamestr.endswith(".kcppt"):
|
||||||
filenamestr += ".kcpps"
|
filenamestr += ".kcppt"
|
||||||
file = open(filenamestr, 'w')
|
file = open(filenamestr, 'w')
|
||||||
file.write(json.dumps(savdict))
|
file.write(json.dumps(savdict))
|
||||||
file.close()
|
file.close()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue