zentk - folder select workaround (#1478)

* zentk - folder select workaround

* kcppt extention fix
This commit is contained in:
henk717
2025-04-11 16:37:07 +02:00
committed by GitHub
parent 8fd70f37bd
commit f6b7fea979
+5 -1
View File
@@ -3528,7 +3528,11 @@ def zenity(typ, filetypes=None, initialdir="", initialfile="", **kwargs) -> Tupl
def zentk_askopenfilename(**options):
try:
from os.path import isfile
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:
from tkinter.filedialog import askopenfilename
result = askopenfilename(**options)
@@ -4420,7 +4424,7 @@ def show_gui():
return
filenamestr = str(filename).strip()
if not filenamestr.endswith(".kcppt"):
filenamestr += ".kcpps"
filenamestr += ".kcppt"
file = open(filenamestr, 'w')
file.write(json.dumps(savdict))
file.close()