11import os
22import subprocess
3+ import sys
34from ui .mainwindow import MainWindowUI
45from translations import gls
56from 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 ()
0 commit comments