Skip to content

Commit 077bfb5

Browse files
committed
python_install_dialog: require user to restart app after python support installed
Signed-off-by: Jack Lau <[email protected]>
1 parent 9b53249 commit 077bfb5

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

src/component/src/python_install_dialog.cpp

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,30 @@ void PythonInstallDialog::OnPackagesInstalled() {
187187
progressBar->setValue(100);
188188
statusLabel->setText(tr("Installation complete! AI Processing is now ready."));
189189

190-
QMessageBox::information(
191-
this,
192-
tr("Success"),
193-
tr("Python and all required packages have been installed successfully.\n\n"
194-
"You can now use AI Processing features.")
195-
);
190+
QMessageBox msgBox(this);
191+
msgBox.setIcon(QMessageBox::Information);
192+
msgBox.setWindowTitle(tr("Installation Complete"));
193+
msgBox.setText(tr(
194+
"Python and all required packages have been installed successfully.\n\n"
195+
"A restart is required to enable AI Processing features."
196+
));
197+
198+
QPushButton *restartButton =
199+
msgBox.addButton(tr("Restart Now"), QMessageBox::AcceptRole);
200+
QPushButton *laterButton =
201+
msgBox.addButton(tr("Restart Later"), QMessageBox::RejectRole);
202+
203+
msgBox.exec();
204+
205+
if (msgBox.clickedButton() == restartButton) {
206+
// Relaunch the application
207+
const QString program = QCoreApplication::applicationFilePath();
208+
const QStringList arguments = QCoreApplication::arguments();
209+
210+
QProcess::startDetached(program, arguments);
211+
QCoreApplication::quit();
212+
return;
213+
}
196214

197215
accept();
198216
}

0 commit comments

Comments
 (0)