mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2025-09-11 17:44:38 +00:00
i already knew zenity would cause issues
This commit is contained in:
parent
78a910be26
commit
305e533dc6
1 changed files with 8 additions and 3 deletions
11
koboldcpp.py
11
koboldcpp.py
|
@ -3549,9 +3549,9 @@ def zenity(filetypes=None, initialdir="", initialfile="", **kwargs) -> Tuple[int
|
||||||
raise Exception("Zenity disabled, attempting to use TK GUI.")
|
raise Exception("Zenity disabled, attempting to use TK GUI.")
|
||||||
if sys.platform != "linux":
|
if sys.platform != "linux":
|
||||||
raise Exception("Zenity GUI is only usable on Linux, attempting to use TK GUI.")
|
raise Exception("Zenity GUI is only usable on Linux, attempting to use TK GUI.")
|
||||||
zenity_bin = shutil.which("zenity")
|
|
||||||
if not zenity_bin:
|
|
||||||
zenity_bin = shutil.which("yad")
|
zenity_bin = shutil.which("yad")
|
||||||
|
if not zenity_bin:
|
||||||
|
zenity_bin = shutil.which("zenity")
|
||||||
if not zenity_bin:
|
if not zenity_bin:
|
||||||
raise Exception("Zenity not present, falling back to TK GUI.")
|
raise Exception("Zenity not present, falling back to TK GUI.")
|
||||||
|
|
||||||
|
@ -4922,10 +4922,15 @@ def show_gui():
|
||||||
|
|
||||||
def load_config_gui(): #this is used to populate the GUI with a config file, whereas load_config_cli simply overwrites cli args
|
def load_config_gui(): #this is used to populate the GUI with a config file, whereas load_config_cli simply overwrites cli args
|
||||||
file_type = [("KoboldCpp Settings", "*.kcpps *.kcppt")]
|
file_type = [("KoboldCpp Settings", "*.kcpps *.kcppt")]
|
||||||
global runmode_untouched
|
global runmode_untouched, zenity_permitted
|
||||||
filename = zentk_askopenfilename(filetypes=file_type, defaultextension=".kcppt", initialdir=None)
|
filename = zentk_askopenfilename(filetypes=file_type, defaultextension=".kcppt", initialdir=None)
|
||||||
if not filename or filename=="":
|
if not filename or filename=="":
|
||||||
return
|
return
|
||||||
|
if not os.path.exists(filename) or os.path.getsize(filename)<4 or os.path.getsize(filename)>50000000: #for sanity, check invaid kcpps
|
||||||
|
print("The selected config file seems to be invalid.")
|
||||||
|
if zenity_permitted:
|
||||||
|
print("You can try using the legacy filepicker instead (in Extra).")
|
||||||
|
return
|
||||||
runmode_untouched = False
|
runmode_untouched = False
|
||||||
with open(filename, 'r', encoding='utf-8', errors='ignore') as f:
|
with open(filename, 'r', encoding='utf-8', errors='ignore') as f:
|
||||||
dict = json.load(f)
|
dict = json.load(f)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue