Add the libs and mods directories to the list in launcher.

This commit is contained in:
Tom Rothamel
2025-01-12 14:11:33 -05:00
parent adf545a199
commit 0c3b419dad
2 changed files with 46 additions and 22 deletions
+5 -3
View File
@@ -157,8 +157,10 @@ screen front_page_project:
label _("Open Directory") style "l_label_small"
frame style "l_indent":
has vbox
for button_name, path in p.data["renpy_launcher"]["open_directory"].items():
has grid 2 max(5, (len(p.get_renpy_launcher()["open_directory"]) + 1) // 2):
transpose True xfill True
for button_name, path in p.get_renpy_launcher()["open_directory"].items():
textbutton button_name action OpenDirectory(os.path.join(p.path, path), absolute=True)
vbox:
@@ -169,7 +171,7 @@ screen front_page_project:
frame style "l_indent":
has vbox
for button_name, path in p.data["renpy_launcher"]["edit_file"].items():
for button_name, path in p.get_renpy_launcher()["edit_file"].items():
textbutton button_name action editor.Edit(path, check=True)
if editor.CanEditProject():
+41 -19
View File
@@ -92,6 +92,10 @@ init python in project:
# The mtime of the last dump file loaded.
self.dump_mtime = 0
# A processed version of data['renpy_launcher'] with missing files
# and directories removed.
self.renpy_launcher = None
def get_dump_filename(self):
if os.path.exists(os.path.join(self.gamedir, "saves")):
@@ -123,25 +127,6 @@ init python in project:
def update_data(self):
data = self.data
data.setdefault("renpy_launcher",
{
"open_directory":
{
"game": "game",
"base": ".",
"images": "game/images",
"audio": "game/audio",
"gui": "game/gui"
},
"edit_file":
{
"script.rpy": "game/script.rpy",
"options.rpy": "game/options.rpy",
"gui.rpy": "game/gui.rpy",
"screens.rpy": "game/screens.rpy"
}
})
data.setdefault("build_update", False)
data.setdefault("packages", [ "pc", "mac" ])
data.setdefault("add_from", True)
@@ -175,6 +160,43 @@ init python in project:
data["renamed_steam"] = True
def get_renpy_launcher(self):
if self.renpy_launcher is not None:
return self.renpy_launcher
rv = { }
default_values = {
"open_directory":
{
"game": "game",
"base": ".",
"images": "game/images",
"audio": "game/audio",
"gui": "game/gui",
"libs": "game/libs",
"mods": "game/mods",
},
"edit_file":
{
"script.rpy": "game/script.rpy",
"options.rpy": "game/options.rpy",
"gui.rpy": "game/gui.rpy",
"screens.rpy": "game/screens.rpy"
}
}
for k, default_d in default_values.items():
d = self.data.get("renpy_launcher", {}).get(k, default_d)
rv[k] = { name : path for name, path in d.items() if os.path.exists(os.path.join(self.path, path)) }
self.renpy_launcher = rv
return rv
def make_tmp(self):
"""
Makes the project's temporary directory, if it doesn't exist