def restart(): quit_temp_val = QApplication.quitOnLastWindowClosed() QApplication.setQuitOnLastWindowClosed(False) QApplication.closeAllWindows() windows = QApplication.topLevelWindows() if any(w.isVisible() for w in windows): # if a window close was cancelled QApplication.setQuitOnLastWindowClosed(quit_temp_val) QMessageBox( text="Restart Cancelled", informativeText="Settings will be reset on {}'s next restart" .format(name), icon=QMessageBox.Information ).exec() else: QApplication.exit(96)
def __on_installer_finished(self): if self.__progress is not None: self.__progress.close() self.__progress = None def message_restart(parent): icon = QMessageBox.Information buttons = QMessageBox.Ok | QMessageBox.Cancel title = 'Information' text = 'Orange needs to be restarted for the changes to take effect.' msg_box = QMessageBox(icon, title, text, buttons, parent) msg_box.setDefaultButton(QMessageBox.Ok) msg_box.setInformativeText('Press OK to close Orange now.') msg_box.button(QMessageBox.Cancel).setText('Close later') return msg_box.exec_() if QMessageBox.Ok == message_restart(self): self.accept() QApplication.closeAllWindows() else: self.reject()