Repository: biolab/orange3

Issue:
Orange quits after "Reset Widget Settings..."
##### Orange version
3.5.0

##### Expected behavior
Reset Widget Settings ("Clear all widget settings on next restart") warns the user that the "A restart of the application is necessary for the changes to take effect", but does that not imply that Orange will quit after pressing Ok. It implies that upon quitting by the user the settings will be cleared.

##### Actual behavior
Orange quits after clicking Ok in Reset Widget Settings dialog.


##### Steps to reproduce the behavior



##### Additional info (worksheets, data, screenshots, ...)





Discussion:

Resolving patch:
diff --git a/Orange/canvas/application/addons.py b/Orange/canvas/application/addons.py
--- a/Orange/canvas/application/addons.py
+++ b/Orange/canvas/application/addons.py
@@ -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 (
@@ -41,9 +41,11 @@
     QSettings)
 from AnyQt.QtCore import pyqtSignal as Signal, pyqtSlot as Slot
 
-from ..gui.utils import message_warning, message_information, \
-                        message_critical as message_error, \
-                        OSX_NSURL_toLocalFile
+from ..gui.utils import (
+    message_warning, message_critical as message_error,
+    OSX_NSURL_toLocalFile
+)
+
 from ..help.manager import get_dist_meta, trim, parse_meta
 
 
@@ -774,9 +776,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 = '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()
+            self.parent().close()
+        else:
+            self.reject()
 
 
 def list_available_versions():
diff --git a/Orange/canvas/application/canvasmain.py b/Orange/canvas/application/canvasmain.py
--- a/Orange/canvas/application/canvasmain.py
+++ b/Orange/canvas/application/canvasmain.py
@@ -1706,12 +1706,10 @@ def open_addons(self):
         return dlg.exec_()
 
     def reset_widget_settings(self):
-        res = message_question(
-            "Clear all widget settings on next restart",
+        res = message_information(
+            "Orange needs to be restarted for the changes to take effect.",
             title="Clear settings",
-            informative_text=(
-                "A restart of the application is necessary " +
-                "for the changes to take effect"),
+            informative_text="Press OK to close Orange now.",
             buttons=QMessageBox.Ok | QMessageBox.Cancel,
             default_button=QMessageBox.Ok,
             parent=self


Test patch: