def test_queued_notifications(self): notif2 = Notification( title="Hello universe!", text= "I'm another notif! I'm about to queue behind my older brother.") def handle_click(role): self.assertEqual(role, Notification.DismissRole) self.notif.clicked.connect(handle_click) self.server.registerNotification(self.notif) notif1 = self.overlay.currentWidget() button = notif1.dismissButton self.server.registerNotification(notif2) notif2 = self.overlay._widgets[1] self.container.show() self.assertTrue(notif1.isVisible()) self.assertFalse(notif2.isVisible()) QTest.mouseClick(button, Qt.LeftButton) self.assertFalse(notif1.isVisible()) self.assertTrue(notif2.isVisible())
def compare_versions(latest): version = pkg_resources.parse_version skipped = settings.value('startup/latest-skipped-version', "", type=str) if version(latest) <= version(current) or \ latest == skipped: return notif = Notification( title='Orange Update Available', text='Current version: <b>{}</b><br>' 'Latest version: <b>{}</b>'.format(current, latest), accept_button_label="Download", reject_button_label="Skip this Version", icon=QIcon(resource_filename("canvas/icons/update.png"))) def handle_click(role): if role == notif.RejectRole: settings.setValue('startup/latest-skipped-version', latest) if role == notif.AcceptRole: QDesktopServices.openUrl( QUrl("https://orange.biolab.si/download/")) notif.clicked.connect(handle_click) canvas.notification_server_instance.registerNotification(notif)
def setup_notifications(): settings = QSettings() # data collection permission if not settings.value( "error-reporting/permission-requested", False, type=bool): notif = Notification(icon=QIcon( resource_filename("canvas/icons/statistics-request.png")), title="Anonymous Usage Statistics", text="Do you wish to opt-in to sharing " "statistics about how you use Orange? " "All data is anonymized and used " "exclusively for understanding how users " "interact with Orange.", accept_button_label="Allow", reject_button_label="No") def handle_permission_response(role): if role != notif.DismissRole: settings.setValue("error-reporting/permission-requested", True) if role == notif.AcceptRole: UsageStatistics.set_enabled(True) settings.setValue("error-reporting/send-statistics", True) notif.clicked.connect(handle_permission_response) canvas.notification_server_instance.registerNotification(notif)
def toNotification(self): return Notification( title=self.title, text=self.text, accept_button_label=self.accept_button_label, reject_button_label=self.reject_button_label, icon=QIcon(resource_filename(self.icon)), )
def setUp(self) -> None: self.container = QWidget() self.overlay = NotificationOverlay(self.container) self.server = NotificationServer() self.server.newNotification.connect(self.overlay.addNotification) self.server.nextNotification.connect(self.overlay.nextWidget) self.notif = Notification( title="Hello world!", text="Welcome to the testing grounds – this is where your resolve" "and stability will be tried and tested.", accept_button_label="Ok")
def compare_versions(latest): version = pkg_resources.parse_version skipped = settings.value("startup/latest-skipped-version", "", type=str) if version(latest) <= version(current) or latest == skipped: return notif = Notification( title="橙现智能有更新版本", text="菜单栏点击: 选项 -> 升级与插件, 选中 orange3-zh 升级", icon=QIcon(resource_filename("canvas/icons/update.png")), ) def handle_click(role): if role == notif.RejectRole: settings.setValue("startup/latest-skipped-version", latest) if role == notif.AcceptRole: QDesktopServices.openUrl(QUrl("chegnxianzn.one")) notif.clicked.connect(handle_click) canvas.notification_server_instance.registerNotification(notif)
def compare_versions(latest): version = pkg_resources.parse_version skipped = settings.value('startup/latest-skipped-version', "", type=str) if version(latest) <= version(current) or \ latest == skipped: return notif = Notification( title='橙现智能有更新版本', text='菜单栏点击: 选项 -> 升级与插件, 选中 orange3-zh 升级', icon=QIcon(resource_filename("canvas/icons/update.png"))) def handle_click(role): if role == notif.RejectRole: settings.setValue('startup/latest-skipped-version', latest) if role == notif.AcceptRole: QDesktopServices.openUrl( QUrl("https://orange.biolab.si/download/")) notif.clicked.connect(handle_click) canvas.notification_server_instance.registerNotification(notif)