Skip to content

Commit 83c077a

Browse files
.aep file argument support added
1 parent 969ecd7 commit 83c077a

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
cd "$(dirname "$0")"
44

5-
python main.py
5+
python main.py "$@"

src/mainwindow.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import subprocess
3+
import sys
34
from ui.mainwindow import MainWindowUI
45
from translations import gls
56
from PySide6.QtCore import Slot
@@ -23,6 +24,8 @@ class MainWindow(MainWindowUI):
2324
def __init__(self):
2425
super().__init__()
2526

27+
self.ran_from_aep_file = False
28+
2629
self.setWindowTitle(gls('welcome_win_title'))
2730
self.install_button.clicked.connect(self.install_button_clicked)
2831
self.run_button.clicked.connect(self.run_ae_button_clicked)
@@ -71,6 +74,26 @@ def __init__(self):
7174
self.aed_action.triggered.connect(self.ae_folder_clicked)
7275
self.aeg_action.triggered.connect(self.aegnux_folder_clicked)
7376
self.cep_action.triggered.connect(self.cep_folder_clicked)
77+
78+
def try_autoopen_aep(self):
79+
self.run_ae_thread.clear_aep_file_arg()
80+
if self.ran_from_aep_file:
81+
return
82+
83+
self.ran_from_aep_file = True
84+
85+
aep_file = ''
86+
87+
for arg in sys.argv:
88+
if '.aep' in arg:
89+
aep_file = arg
90+
break
91+
92+
if aep_file == '':
93+
return
94+
95+
self.run_ae_thread.add_aep_file_arg(aep_file)
96+
self.run_ae_button_clicked()
7497

7598
def init_installation(self):
7699
if check_aegnux_installed():
@@ -83,6 +106,7 @@ def init_installation(self):
83106
self.kill_action.setEnabled(True)
84107
self.plugininst_action.setEnabled(True)
85108
self.term_action.setEnabled(True)
109+
self.try_autoopen_aep()
86110

87111
else:
88112
self.install_button.show()

src/runaethread.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,13 @@ class RunAEThread(RunExeThread):
66
def __init__(self):
77
super().__init__(['AfterFX.exe'])
88

9+
def add_aep_file_arg(self, aep_file: str):
10+
self.exe_args.append('Z:' + aep_file)
11+
12+
def clear_aep_file_arg(self):
13+
for arg in self.exe_args:
14+
if '.aep' in arg:
15+
self.exe_args.remove(arg)
16+
917
def run(self):
1018
super().run()

0 commit comments

Comments
 (0)