@@ -273,23 +273,32 @@ def ua_string():
273273
274274 def compare_versions (latest ):
275275 version = pkg_resources .parse_version
276- if version (latest ) <= version (current ):
276+ skipped = settings .value ('startup/latest-skipped-version' , "" , type = str )
277+ if version (latest ) <= version (current ) or \
278+ latest == skipped :
277279 return
278- question = QMessageBox (
279- QMessageBox .Information ,
280- 'Orange Update Available' ,
281- 'A newer version of Orange is available.<br><br>'
282- '<b>Current version:</b> {}<br>'
283- '<b>Latest version:</b> {}' .format (current , latest ),
284- textFormat = Qt .RichText )
285- ok = question .addButton ('Download Now' , question .AcceptRole )
286- question .setDefaultButton (ok )
287- question .addButton ('Remind Later' , question .RejectRole )
288- question .finished .connect (
289- lambda :
290- question .clickedButton () == ok and
291- QDesktopServices .openUrl (QUrl ("https://orange.biolab.si/download/" )))
292- question .show ()
280+
281+ from Orange .canvas .utils .overlay import NotificationWidget
282+
283+ questionButtons = NotificationWidget .Ok | NotificationWidget .Close
284+ question = NotificationWidget (icon = QIcon ('Orange/widgets/icons/Dlg_down3.png' ),
285+ title = 'Orange Update Available' ,
286+ text = 'Current version: <b>{}</b><br>'
287+ 'Latest version: <b>{}</b>' .format (current , latest ),
288+ standardButtons = questionButtons ,
289+ acceptLabel = "Download" ,
290+ rejectLabel = "Skip this Version" )
291+ question .setTextFormat (Qt .RichText )
292+
293+ def handle_click (b ):
294+ if question .buttonRole (b ) != question .DismissRole :
295+ settings .setValue ('startup/latest-skipped-version' , latest )
296+ if question .buttonRole (b ) == question .AcceptRole :
297+ QDesktopServices .openUrl (QUrl ("https://orange.biolab.si/download/" ))
298+
299+ question .clicked .connect (handle_click )
300+
301+ NotificationOverlay .registerNotification (question )
293302
294303 thread = GetLatestVersion ()
295304 thread .resultReady .connect (compare_versions )
0 commit comments