@@ -53,14 +53,14 @@ def user_documents_path():
5353 return QDesktopServices .storageLocation (
5454 QDesktopServices .DocumentsLocation )
5555
56- from ...widgets .utils .overlay import MessageOverlayWidget
57-
5856from ..gui .dropshadow import DropShadowFrame
5957from ..gui .dock import CollapsibleDockWidget
6058from ..gui .quickhelp import QuickHelpTipEvent
6159from ..gui .utils import message_critical , message_question , \
6260 message_warning , message_information
6361
62+ from ..utils .overlay import NotificationWidget , NotificationOverlay
63+
6464from ..document .usagestatistics import UsageStatistics
6565
6666from ..help import HelpManager
@@ -384,15 +384,48 @@ def touch():
384384
385385 self .setMinimumSize (600 , 500 )
386386
387- # ask for anonymous data collection permission
388- def requestDataCollectionPermission ():
389- permDialogButtons = MessageOverlayWidget .AcceptRole | MessageOverlayWidget .RejectRole
390- permDialog = MessageOverlayWidget (parent = w ,
391- text = "Do you wish to share anonymous usage "
392- "statistics to help improve Orange?" ,
387+ self .notification_overlay = NotificationOverlay (self .scheme_widget )
388+
389+ self .setup_notifications ()
390+
391+ def setup_notifications (self ):
392+ settings = config .settings ()
393+
394+ # If run for the first time, prompt short survey
395+ show_survey = settings ["startup/show-survey" ]
396+ if show_survey :
397+ surveyDialogButtons = NotificationWidget .Ok | NotificationWidget .Close
398+ surveyDialog = NotificationWidget (parent = self .scheme_widget ,
399+ icon = QIcon ("Orange/Dlg_down3.png" ),
400+ title = "Survey" ,
401+ text = "We want to get to know our users better.\n "
402+ "Would you care to fill out a "
403+ "1-minute survey?" ,
393404 wordWrap = True ,
394- standardButtons = permDialogButtons )
395- btnOK = permDialog .button (MessageOverlayWidget .AcceptRole )
405+ standardButtons = surveyDialogButtons )
406+
407+ def handle_response (button ):
408+ if surveyDialog .buttonRole (button ) == NotificationWidget .AcceptRole :
409+ success = QDesktopServices .openUrl (
410+ QUrl ("https://orange.biolab.si/survey/short.html" ))
411+ settings ["startup/show-survey" ] = not success
412+ elif surveyDialog .buttonRole (button ) == NotificationWidget .RejectRole :
413+ settings ["startup/show-survey" ] = False
414+
415+ surveyDialog .clicked .connect (handle_response )
416+
417+ surveyDialog .setWidget (self .scheme_widget )
418+ surveyDialog .show ()
419+
420+ # data collection permission
421+ if not settings ["error-reporting/permission-requested" ]:
422+ permDialogButtons = NotificationWidget .AcceptRole | NotificationWidget .RejectRole
423+ permDialog = NotificationWidget (parent = self .scheme_widget ,
424+ text = "Do you wish to share anonymous usage "
425+ "statistics to help improve Orange?" ,
426+ wordWrap = True ,
427+ standardButtons = permDialogButtons )
428+ btnOK = permDialog .button (NotificationWidget .AcceptRole )
396429 btnOK .setText ("Allow" )
397430
398431 def respondToRequest ():
@@ -405,22 +438,18 @@ def shareData():
405438 permDialog .accepted .connect (shareData )
406439
407440 permDialog .setStyleSheet ("""
408- MessageOverlayWidget {
409- background: qlineargradient(
410- x1: 0, y1: 0, x2: 0, y2: 1,
411- stop:0 #666, stop:0.3 #6D6D6D, stop:1 #666)
412- }
413- MessageOverlayWidget QLabel#text-label {
414- color: white;
415- }""" )
416-
417- permDialog .setWidget (w )
441+ MessageOverlayWidget {
442+ background: qlineargradient(
443+ x1: 0, y1: 0, x2: 0, y2: 1,
444+ stop:0 #666, stop:0.3 #6D6D6D, stop:1 #666)
445+ }
446+ MessageOverlayWidget QLabel#text-label {
447+ color: white;
448+ }""" )
449+
450+ permDialog .setWidget (self . scheme_widget )
418451 permDialog .show ()
419452
420- settings = config .settings ()
421- if not settings ["error-reporting/permission-requested" ]:
422- requestDataCollectionPermission ()
423-
424453 def setup_actions (self ):
425454 """Initialize main window actions.
426455 """
@@ -1912,6 +1941,7 @@ def closeEvent(self, event):
19121941 settings .endGroup ()
19131942 self .help_dock .close ()
19141943 self .log_dock .close ()
1944+ self .notification_overlay .close ()
19151945 super ().closeEvent (event )
19161946
19171947 __did_restore = False
0 commit comments