Skip to content

Commit

Permalink
Added a menu option to set path to demos folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel committed Mar 20, 2018
1 parent f048195 commit ec63a98
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ def __play_demo_name_widget_update(self, dem: str):

def __ask_demofile(self):
demo = fd.askopenfilename(
title="Locate demo to play", initialdir=".",
title="Locate demo to play", initialdir=Shell.demopath,
filetypes=[("Demo lumps", "*.lmp"), ("All files", "*.*")]
)
if bool(demo):
Expand Down Expand Up @@ -594,6 +594,9 @@ def __deploy_paths_menu(self):
label="Auto create save subfolders", variable=self.__make_savedirs,
command=lambda: setattr(Shell, "make_savedirs", self.__make_savedirs.get())
)
self.__paths_menu.add_command(
label="Demos location...", command=DirPath("Locate demos folder:", "demopath").request
)
self.__paths_menu.add_command(
label="Executables", command=lambda: GUIPopupExeSet(self.__master.winfo_toplevel())
)
Expand Down
7 changes: 5 additions & 2 deletions shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class Shell(BaseShell):
nrftlpath = "."
pwadpath = "."
savepath = "./saves"
demopath = "."
make_savedirs = True # whether to autogenerate save file subfolders for each specific game/mod combination

prboom = "prboom-plus" # software renderer executable
Expand Down Expand Up @@ -147,6 +148,7 @@ def default_settings(cls):
"nrftlpath": ".",
"pwadpath": ".",
"savepath": "./saves",
"demopath": ".",
"make_savedirs": True,
"opengl": False,
"res_x": WIDTH_DEF,
Expand Down Expand Up @@ -528,7 +530,7 @@ def __init__(
self._arg_savedir("")
self._arg_playdemo(self.__demofile)
else:
self._arg_recorddemo('./{}.lmp'.format(self.__demofile))
self._arg_recorddemo('{}/{}.lmp'.format(Shell.demopath, self.__demofile))


class IniManager(object):
Expand All @@ -548,7 +550,8 @@ def __init__(self, custommgr: ShellCustom):
self.__default_ini_file = '{}/{}'.format(self.INI_DIR, self.INI_DEFAULT)

self.string_globals = (
"prboom", "glboom", "iwadpath", "mlpath", "nrftlpath", "pwadpath", "savepath", "conf"
"prboom", "glboom", "iwadpath", "mlpath", "nrftlpath",
"pwadpath", "savepath", "demopath", "conf"
)
self.int_globals = ("res_x", "res_y", "gl_res_x", "gl_res_y")
self.bool_globals = ("make_savedirs", "opengl", "fullscreen", "gl_fullscreen", "fsdesktop")
Expand Down

0 comments on commit ec63a98

Please sign in to comment.