diff --git a/Orange/canvas/__main__.py b/Orange/canvas/__main__.py
index 49fafc1192f..e501ff854be 100644
--- a/Orange/canvas/__main__.py
+++ b/Orange/canvas/__main__.py
@@ -273,23 +273,32 @@ def ua_string():
def compare_versions(latest):
version = pkg_resources.parse_version
- if version(latest) <= version(current):
+ skipped = settings.value('startup/latest-skipped-version', "", type=str)
+ if version(latest) <= version(current) or \
+ latest == skipped:
return
- question = QMessageBox(
- QMessageBox.Information,
- 'Orange Update Available',
- 'A newer version of Orange is available.
'
- 'Current version: {}
'
- 'Latest version: {}'.format(current, latest),
- textFormat=Qt.RichText)
- ok = question.addButton('Download Now', question.AcceptRole)
- question.setDefaultButton(ok)
- question.addButton('Remind Later', question.RejectRole)
- question.finished.connect(
- lambda:
- question.clickedButton() == ok and
- QDesktopServices.openUrl(QUrl("https://orange.biolab.si/download/")))
- question.show()
+
+ from Orange.canvas.utils.overlay import NotificationWidget
+
+ questionButtons = NotificationWidget.Ok | NotificationWidget.Close
+ question = NotificationWidget(icon=QIcon('Orange/widgets/icons/Dlg_down3.png'),
+ title='Orange Update Available',
+ text='Current version: {}
'
+ 'Latest version: {}'.format(current, latest),
+ standardButtons=questionButtons,
+ acceptLabel="Download",
+ rejectLabel="Skip this Version")
+ question.setTextFormat(Qt.RichText)
+
+ def handle_click(b):
+ if question.buttonRole(b) != question.DismissRole:
+ settings.setValue('startup/latest-skipped-version', latest)
+ if question.buttonRole(b) == question.AcceptRole:
+ QDesktopServices.openUrl(QUrl("https://orange.biolab.si/download/"))
+
+ question.clicked.connect(handle_click)
+
+ NotificationOverlay.registerNotification(question)
thread = GetLatestVersion()
thread.resultReady.connect(compare_versions)
diff --git a/Orange/canvas/config.py b/Orange/canvas/config.py
index 806d5f8ebaf..8f8413d407e 100644
--- a/Orange/canvas/config.py
+++ b/Orange/canvas/config.py
@@ -56,7 +56,8 @@ def init():
("startup/check-updates", bool, True,
"Check for updates"),
- ("startup/launch-count", int, 0, ""),
+ ("startup/launch-count", int, 0,
+ ""),
("startup/show-short-survey", bool, True,
"Has the user not been asked to take a short survey yet"),
diff --git a/Orange/canvas/utils/overlay.py b/Orange/canvas/utils/overlay.py
index a0060c21e20..ce0b201cd65 100644
--- a/Orange/canvas/utils/overlay.py
+++ b/Orange/canvas/utils/overlay.py
@@ -36,7 +36,7 @@ class ButtonRole(enum.IntEnum):
_Button = namedtuple("_Button", ["button", "role", "stdbutton"])
def __init__(self, parent=None, icon=QIcon(), title="", text="", wordWrap=False,
- textFormat=Qt.AutoText, standardButtons=NoButton, acceptLabel="Ok",
+ textFormat=Qt.PlainText, standardButtons=NoButton, acceptLabel="Ok",
rejectLabel="No", **kwargs):
super().__init__(parent, **kwargs)
self._title = title
@@ -53,7 +53,6 @@ def __init__(self, parent=None, icon=QIcon(), title="", text="", wordWrap=False,
wordWrap=wordWrap, textFormat=textFormat)
self._textlabel = QLabel(objectName="text-label", text=text,
wordWrap=wordWrap, textFormat=textFormat)
- self._textlabel.setTextFormat(Qt.RichText)
self._textlabel.setTextInteractionFlags(Qt.TextBrowserInteraction)
self._textlabel.setOpenExternalLinks(True)