1
0
Fork 0
mirror of synced 2024-06-02 02:34:40 +12:00

RareLauncher: Enable terminate and kill buttons

This commit is contained in:
loathingKernel 2023-08-18 23:20:57 +03:00
parent 70af132da1
commit 6460e8724e
No known key found for this signature in database
GPG key ID: CE0C72D0B53821FD
2 changed files with 15 additions and 15 deletions

View file

@ -60,23 +60,23 @@ class PreLaunchThread(QRunnable):
return
self.signals.ready_to_launch.emit(args)
def prepare_launch(self, args: InitArgs) -> Union[LaunchArgs, None]:
def prepare_launch(self, args: InitArgs) -> Optional[LaunchArgs]:
try:
args = get_launch_args(self.core, args)
launch_args = get_launch_args(self.core, args)
except Exception as e:
self.signals.error_occurred.emit(str(e))
return None
if not args:
if not launch_args:
return None
if args.pre_launch_command:
if launch_args.pre_launch_command:
proc = get_configured_process()
proc.setProcessEnvironment(args.env)
proc.setProcessEnvironment(launch_args.env)
self.signals.started_pre_launch_command.emit()
proc.start(args.pre_launch_command[0], args.pre_launch_command[1:])
if args.pre_launch_wait:
proc.start(launch_args.pre_launch_command[0], launch_args.pre_launch_command[1:])
if launch_args.pre_launch_wait:
proc.waitForFinished(-1)
return args
return launch_args
class SyncCheckWorker(QRunnable):

View file

@ -48,15 +48,15 @@ class Console(QDialog):
button_layout.addItem(QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Fixed))
# self.terminate_button = QPushButton(self.tr("Terminate"))
self.terminate_button = QPushButton(self.tr("Terminate"))
# self.terminate_button.setVisible(platform.system() == "Windows")
# button_layout.addWidget(self.terminate_button)
# self.terminate_button.clicked.connect(lambda: self.term.emit())
#
# self.kill_button = QPushButton(self.tr("Kill"))
button_layout.addWidget(self.terminate_button)
self.terminate_button.clicked.connect(lambda: self.term.emit())
self.kill_button = QPushButton(self.tr("Kill"))
# self.kill_button.setVisible(platform.system() == "Windows")
# button_layout.addWidget(self.kill_button)
# self.kill_button.clicked.connect(lambda: self.kill.emit())
button_layout.addWidget(self.kill_button)
self.kill_button.clicked.connect(lambda: self.kill.emit())
layout.addLayout(button_layout)