mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2025-09-10 17:14:36 +00:00
Improve launcher file dialog initial paths (#740)
- In the launcher, if an existing value is set for a file value (e.g. Model), use that file's directory the initial directory when the file dialog is opened with 'Browse'. - In the launcher always set the intial directory for 'Load' to cwd.
This commit is contained in:
parent
95c8090967
commit
4dd1c2b81a
1 changed files with 4 additions and 2 deletions
|
@ -1573,7 +1573,9 @@ def show_new_gui():
|
|||
def makefileentry(parent, text, searchtext, var, row=0, width=200, filetypes=[], onchoosefile=None, singlerow=False, tooltiptxt=""):
|
||||
makelabel(parent, text, row,0,tooltiptxt)
|
||||
def getfilename(var, text):
|
||||
fnam = askopenfilename(title=text,filetypes=filetypes)
|
||||
initialDir = os.path.dirname(var.get())
|
||||
initialDir = initialDir if os.path.isdir(initialDir) else os.getcwd()
|
||||
fnam = askopenfilename(title=text,filetypes=filetypes, initialdir=initialDir)
|
||||
if fnam:
|
||||
var.set(fnam)
|
||||
if onchoosefile:
|
||||
|
@ -2230,7 +2232,7 @@ def show_new_gui():
|
|||
file_type = [("KoboldCpp Settings", "*.kcpps")]
|
||||
global runmode_untouched
|
||||
runmode_untouched = False
|
||||
filename = askopenfilename(filetypes=file_type, defaultextension=file_type)
|
||||
filename = askopenfilename(filetypes=file_type, defaultextension=file_type, initialdir=os.getcwd())
|
||||
if not filename or filename=="":
|
||||
return
|
||||
with open(filename, 'r') as f:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue