diff --git a/run.sh b/run.sh index dc3ea8a..2be8fd8 100755 --- a/run.sh +++ b/run.sh @@ -2,4 +2,4 @@ cd "$(dirname "$0")" -python main.py \ No newline at end of file +python main.py "$@" \ No newline at end of file diff --git a/src/mainwindow.py b/src/mainwindow.py index 695cf23..a317f37 100644 --- a/src/mainwindow.py +++ b/src/mainwindow.py @@ -1,5 +1,6 @@ import os import subprocess +import sys from ui.mainwindow import MainWindowUI from translations import gls from PySide6.QtCore import Slot @@ -23,6 +24,8 @@ class MainWindow(MainWindowUI): def __init__(self): super().__init__() + self.ran_from_aep_file = False + self.setWindowTitle(gls('welcome_win_title')) self.install_button.clicked.connect(self.install_button_clicked) self.run_button.clicked.connect(self.run_ae_button_clicked) @@ -71,6 +74,26 @@ class MainWindow(MainWindowUI): self.aed_action.triggered.connect(self.ae_folder_clicked) self.aeg_action.triggered.connect(self.aegnux_folder_clicked) self.cep_action.triggered.connect(self.cep_folder_clicked) + + def try_autoopen_aep(self): + self.run_ae_thread.clear_aep_file_arg() + if self.ran_from_aep_file: + return + + self.ran_from_aep_file = True + + aep_file = '' + + for arg in sys.argv: + if '.aep' in arg: + aep_file = arg + break + + if aep_file == '': + return + + self.run_ae_thread.add_aep_file_arg(aep_file) + self.run_ae_button_clicked() def init_installation(self): if check_aegnux_installed(): @@ -83,6 +106,7 @@ class MainWindow(MainWindowUI): self.kill_action.setEnabled(True) self.plugininst_action.setEnabled(True) self.term_action.setEnabled(True) + self.try_autoopen_aep() else: self.install_button.show() diff --git a/src/runaethread.py b/src/runaethread.py index 7c3bcd7..83cc55e 100644 --- a/src/runaethread.py +++ b/src/runaethread.py @@ -6,5 +6,13 @@ class RunAEThread(RunExeThread): def __init__(self): super().__init__(['AfterFX.exe']) + def add_aep_file_arg(self, aep_file: str): + self.exe_args.append('Z:' + aep_file) + + def clear_aep_file_arg(self): + for arg in self.exe_args: + if '.aep' in arg: + self.exe_args.remove(arg) + def run(self): super().run() \ No newline at end of file