|
28 | 28 | QWidget, QDialog, QLabel, QLineEdit, QTreeView, QHeaderView, |
29 | 29 | QTextBrowser, QDialogButtonBox, QProgressDialog, |
30 | 30 | QVBoxLayout, QStyle, QStyledItemDelegate, QStyleOptionViewItem, |
31 | | - QApplication, QHBoxLayout, QPushButton, QFormLayout |
| 31 | + QApplication, QHBoxLayout, QPushButton, QFormLayout, QMessageBox |
32 | 32 | ) |
33 | 33 |
|
34 | 34 | from AnyQt.QtGui import ( |
|
41 | 41 | QSettings) |
42 | 42 | from AnyQt.QtCore import pyqtSignal as Signal, pyqtSlot as Slot |
43 | 43 |
|
44 | | -from ..gui.utils import message_warning, message_information, \ |
45 | | - message_critical as message_error, \ |
46 | | - OSX_NSURL_toLocalFile |
| 44 | +from ..gui.utils import ( |
| 45 | + message_warning, message_critical as message_error, |
| 46 | + OSX_NSURL_toLocalFile |
| 47 | +) |
| 48 | + |
47 | 49 | from ..help.manager import get_dist_meta, trim, parse_meta |
48 | 50 |
|
49 | 51 |
|
@@ -774,9 +776,25 @@ def __on_installer_error(self, command, pkg, retcode, output): |
774 | 776 | self.reject() |
775 | 777 |
|
776 | 778 | def __on_installer_finished(self): |
777 | | - message = "Please restart Orange for changes to take effect." |
778 | | - message_information(message, parent=self) |
779 | | - self.accept() |
| 779 | + |
| 780 | + def message_restart(parent): |
| 781 | + icon = QMessageBox.Information |
| 782 | + buttons = QMessageBox.Ok | QMessageBox.Cancel |
| 783 | + title = 'Information' |
| 784 | + text = 'Orange needs to be restarted for the changes to take effect.' |
| 785 | + |
| 786 | + msg_box = QMessageBox(icon, title, text, buttons, parent) |
| 787 | + msg_box.setDefaultButton(QMessageBox.Ok) |
| 788 | + msg_box.setInformativeText('Press OK to close Orange now.') |
| 789 | + |
| 790 | + msg_box.button(QMessageBox.Cancel).setText('Close later') |
| 791 | + return msg_box.exec_() |
| 792 | + |
| 793 | + if QMessageBox.Ok == message_restart(self): |
| 794 | + self.accept() |
| 795 | + self.parent().close() |
| 796 | + else: |
| 797 | + self.reject() |
780 | 798 |
|
781 | 799 |
|
782 | 800 | def list_available_versions(): |
|
0 commit comments