Skip to content

Commit

Permalink
addons: add option to restart Orange after new add-on is installed
Browse files Browse the repository at this point in the history
  • Loading branch information
JakaKokosar committed Feb 15, 2019
1 parent e74da1f commit 8412ba9
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions Orange/canvas/application/addons.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
QWidget, QDialog, QLabel, QLineEdit, QTreeView, QHeaderView,
QTextBrowser, QDialogButtonBox, QProgressDialog,
QVBoxLayout, QStyle, QStyledItemDelegate, QStyleOptionViewItem,
QApplication, QHBoxLayout, QPushButton, QFormLayout
QApplication, QHBoxLayout, QPushButton, QFormLayout, QMessageBox
)

from AnyQt.QtGui import (
Expand Down Expand Up @@ -774,9 +774,25 @@ def __on_installer_error(self, command, pkg, retcode, output):
self.reject()

def __on_installer_finished(self):
message = "Please restart Orange for changes to take effect."
message_information(message, parent=self)
self.accept()

def message_restart(parent):
icon = QMessageBox.Information
buttons = QMessageBox.Ok | QMessageBox.Cancel
title = 'Information'
text = 'A restart of the application is necessary for the ' \
'changes to take effect.'

msg_box = QMessageBox(icon, title, text, buttons, parent)
msg_box.setDefaultButton(QMessageBox.Ok)
msg_box.button(QMessageBox.Ok).setText('Restart now')
msg_box.button(QMessageBox.Cancel).setText('Restart later')
return msg_box.exec_()

if QMessageBox.Ok == message_restart(self):
self.accept()
self.parent().close()
else:
self.reject()


def list_available_versions():
Expand Down

0 comments on commit 8412ba9

Please sign in to comment.