Skip to content

Commit

Permalink
gui - #392 config option to run game on saving ovl
Browse files Browse the repository at this point in the history
  • Loading branch information
HENDRIX-ZT2 committed Oct 29, 2024
1 parent 35854c4 commit ff44086
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
4 changes: 2 additions & 2 deletions __version__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# this file is auto-generated by the pre-commit hook increment_version.py
VERSION = "2024.10.29"
COMMIT_HASH = "381ecc941"
COMMIT_TIME = "Tue Oct 29 12:01:09 2024 +0100"
COMMIT_HASH = "35854c40a"
COMMIT_TIME = "Tue Oct 29 16:13:55 2024 +0100"
11 changes: 5 additions & 6 deletions gui/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2568,11 +2568,10 @@ def __init__(self, title="", parent=None):
)
self.content_area.setFrameShape(QFrame.Shape.NoFrame)

lay = QVBoxLayout(self)
lay.setSpacing(0)
lay.setContentsMargins(0, 0, 0, 0)
lay.addWidget(self.toggle_button)
lay.addWidget(self.content_area)
pack_in_box(
self.toggle_button,
self.content_area
)

self.toggle_animation.addAnimation(
QPropertyAnimation(self, b"minimumHeight")
Expand Down Expand Up @@ -3633,7 +3632,7 @@ def get_main_window():
return w


def pack_in_vbox(*widgets, margins=(0, 0, 0, 0)):
def pack_in_box(*widgets, margins=(0, 0, 0, 0)):
frame = QtWidgets.QWidget()
box = QtWidgets.QVBoxLayout()
for w in widgets:
Expand Down
10 changes: 7 additions & 3 deletions ovl_tool_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ def __init__(self, opts: GuiOptions):

self.stdout_handler = get_stdout_handler("ovl_tool_gui") # self.log_name not set until after init

left_frame = widgets.pack_in_vbox(
left_frame = widgets.pack_in_box(
self.installed_games.search,
self.installed_games.filters,
self.installed_games.dirs,
self.installed_games,
margins=(0, 0, 1, 0))
right_frame = widgets.pack_in_vbox(
right_frame = widgets.pack_in_box(
self.file_widget,
self.files_container,
self.included_ovls_view,
Expand Down Expand Up @@ -432,10 +432,14 @@ def update_includes(self, includes):
self.ovl_data.included_ovl_names = includes
self.set_dirty()

def run_current_game(self):
if self.cfg.get("play_on_saving", False):
self.installed_games.run_selected_game()

def save(self, filepath):
"""Saves ovl to file_widget.filepath, clears dirty flag"""
if not self.suppress_popups:
self.run_in_threadpool(self.ovl_data.save, (self.set_clean, ), filepath)
self.run_in_threadpool(self.ovl_data.save, (self.set_clean, self.run_current_game), filepath)
else:
try:
self.ovl_data.save(filepath)
Expand Down
1 change: 1 addition & 0 deletions ovl_util/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class Config(dict):
dds_extract = TransientSetting("Keep DDS", "Keep DDS files in extraction", False, (True, False))
lua_decompile = TransientSetting("Decompile LUA", "Try to decompile LUA; does not always work and slows down full extractions", True, (True, False))
motiongraph_rename_sound = TransientSetting("Replace sounds in MOTIONGRAPH", "Rename references to sound events during rename contents. Make sure to refer to existing events only", False, (True, False))
play_on_saving = TransientSetting("Run Game on Saving", "Always run the currently selected game after saving an OVL", False, (True, False))
# GUI appearance
logger_show = RestartSetting("Show Logger", "Show Logger panel", False, (True, False)) # Hides/show the logger panel
logger_orientation = RestartSetting("Logger Orientation", "Set logger orientation", "H", ("H", "V"))
Expand Down

0 comments on commit ff44086

Please sign in to comment.