Mon, 04 Jan 2021 16:39:37 +0100
Changed code to always use the reworked notification system.
--- a/eric6/Debugger/DebugUI.py Mon Jan 04 16:39:09 2021 +0100 +++ b/eric6/Debugger/DebugUI.py Mon Jan 04 16:39:37 2021 +0100 @@ -159,19 +159,19 @@ # Set a flag for the passive debug mode self.passive = Preferences.getDebugger("PassiveDbgEnabled") - def showNotification(self, notification): + def showNotification(self, notification, timeout=None): """ Public method to show some notification message. @param notification message to be shown @type str + @param timeout timeout for the notification (None = use configured + default, 0 = indefinitely) + @type int """ - if self.ui.notificationsEnabled(): - self.ui.showNotification( - UI.PixmapCache.getPixmap("debug48"), - self.tr("Notification"), notification) - else: - self.appendStdout.emit(notification) + self.ui.showNotification( + UI.PixmapCache.getPixmap("debug48"), + self.tr("Notification"), notification, timeout=timeout) def variablesFilter(self, scope): """ @@ -1138,31 +1138,18 @@ Utilities.html_uencode(message)) else: info = "" - if self.ui.notificationsEnabled(): - if program is None: - msg = self.tr( - 'The program has terminated with an exit status of' - ' {0}.\n{1}').format(status, info) - else: - msg = self.tr( - '"{0}" has terminated with an exit status of' - ' {1}.\n{2}').format( - os.path.basename(program), status, info) - self.ui.showNotification( - UI.PixmapCache.getPixmap("debug48"), - self.tr("Program terminated"), msg) + if program is None: + msg = self.tr( + 'The program has terminated with an exit status of' + ' {0}.\n{1}').format(status, info) else: - if program is None: - self.appendStdout.emit(self.tr( - 'The program has terminated with an exit status' - ' of {0}.\n{1}\n').format(status, info) - ) - else: - self.appendStdout.emit(self.tr( - '"{0}" has terminated with an exit status of' - ' {1}.\n{2}\n').format( - os.path.abspath(program), status, info) - ) + msg = self.tr( + '"{0}" has terminated with an exit status of' + ' {1}.\n{2}').format( + os.path.basename(program), status, info) + self.ui.showNotification( + UI.PixmapCache.getPixmap("debug48"), + self.tr("Program terminated"), msg, timeout=0) def __lastClientExited(self): """
--- a/eric6/PluginManager/PluginRepositoryDialog.py Mon Jan 04 16:39:09 2021 +0100 +++ b/eric6/PluginManager/PluginRepositoryDialog.py Mon Jan 04 16:39:37 2021 +0100 @@ -346,7 +346,7 @@ ui = e5App().getObject("UserInterface") else: ui = None - if ui and ui.notificationsEnabled(): + if ui is not None: ui.showNotification( UI.PixmapCache.getPixmap("plugin48"), self.tr("Download Plugin Files"), @@ -355,11 +355,12 @@ if self.__isDownloadInstall: self.closeAndInstall.emit() else: - if ui is None or not ui.notificationsEnabled(): + if ui is None: E5MessageBox.information( self, self.tr("Download Plugin Files"), self.tr("""The requested plugins were downloaded.""")) + self.downloadProgress.setValue(0) # repopulate the list to update the refresh icons
--- a/eric6/PluginManager/PluginUninstallDialog.py Mon Jan 04 16:39:09 2021 +0100 +++ b/eric6/PluginManager/PluginUninstallDialog.py Mon Jan 04 16:39:37 2021 +0100 @@ -186,15 +186,14 @@ if not self.__external: ui = e5App().getObject("UserInterface") - if ui.notificationsEnabled(): - ui.showNotification( - UI.PixmapCache.getPixmap("plugin48"), - self.tr("Plugin Uninstallation"), - self.tr( - """<p>The plugin <b>{0}</b> was uninstalled""" - """ successfully from {1}.</p>""") - .format(pluginName, pluginDirectory)) - return True + ui.showNotification( + UI.PixmapCache.getPixmap("plugin48"), + self.tr("Plugin Uninstallation"), + self.tr( + """<p>The plugin <b>{0}</b> was uninstalled""" + """ successfully from {1}.</p>""") + .format(pluginName, pluginDirectory)) + return True E5MessageBox.information( self,
--- a/eric6/Preferences/ConfigurationPages/IrcPage.ui Mon Jan 04 16:39:09 2021 +0100 +++ b/eric6/Preferences/ConfigurationPages/IrcPage.ui Mon Jan 04 16:39:37 2021 +0100 @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>522</width> - <height>1017</height> + <height>1025</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout_3"> @@ -657,24 +657,7 @@ <bool>true</bool> </property> <layout class="QGridLayout" name="gridLayout_3"> - <item row="0" column="0" colspan="2"> - <widget class="QLabel" name="label_14"> - <property name="text"> - <string><b>Note:</b> Notifications will only be shown, if the global usage of notifications is enabled on the notifications configuration page.</string> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="1" column="0" colspan="2"> - <widget class="Line" name="line"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item row="2" column="0"> + <item row="0" column="0"> <widget class="QCheckBox" name="joinLeaveCheckBox"> <property name="toolTip"> <string>Select to show a notification for join and leave events</string> @@ -684,7 +667,17 @@ </property> </widget> </item> - <item row="2" column="1"> + <item row="1" column="0"> + <widget class="QCheckBox" name="messageCheckBox"> + <property name="toolTip"> + <string>Select to show a notification for every message</string> + </property> + <property name="text"> + <string>Every Message</string> + </property> + </widget> + </item> + <item row="0" column="1"> <widget class="QCheckBox" name="ownNickCheckBox"> <property name="toolTip"> <string>Select to show a notification for every mentioning of your nick</string> @@ -694,16 +687,6 @@ </property> </widget> </item> - <item row="3" column="0"> - <widget class="QCheckBox" name="messageCheckBox"> - <property name="toolTip"> - <string>Select to show a notification for every message</string> - </property> - <property name="text"> - <string>Every Message</string> - </property> - </widget> - </item> </layout> </widget> </item>
--- a/eric6/Preferences/ConfigurationPages/NotificationsPage.py Mon Jan 04 16:39:09 2021 +0100 +++ b/eric6/Preferences/ConfigurationPages/NotificationsPage.py Mon Jan 04 16:39:37 2021 +0100 @@ -39,8 +39,6 @@ self.__firstTime = True # set initial values - self.enableCheckBox.setChecked( - Preferences.getUI("NotificationsEnabled")) self.timeoutSpinBox.setValue(Preferences.getUI("NotificationTimeout")) point = Preferences.getUI("NotificationPosition") self.xSpinBox.setValue(point.x()) @@ -53,8 +51,6 @@ """ Public slot to save the Notifications configuration. """ - Preferences.setUI( - "NotificationsEnabled", self.enableCheckBox.isChecked()) Preferences.setUI("NotificationTimeout", self.timeoutSpinBox.value()) Preferences.setUI("NotificationPosition", QPoint( self.xSpinBox.value(), self.ySpinBox.value()))
--- a/eric6/Preferences/ConfigurationPages/NotificationsPage.ui Mon Jan 04 16:39:09 2021 +0100 +++ b/eric6/Preferences/ConfigurationPages/NotificationsPage.ui Mon Jan 04 16:39:37 2021 +0100 @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>419</width> - <height>249</height> + <height>222</height> </rect> </property> <property name="windowTitle"> @@ -35,16 +35,6 @@ </widget> </item> <item> - <widget class="QCheckBox" name="enableCheckBox"> - <property name="toolTip"> - <string>Select to enable notifications</string> - </property> - <property name="text"> - <string>Enable Notifications</string> - </property> - </widget> - </item> - <item> <layout class="QGridLayout" name="gridLayout_2"> <item row="0" column="0"> <widget class="QLabel" name="label"> @@ -171,7 +161,6 @@ </layout> </widget> <tabstops> - <tabstop>enableCheckBox</tabstop> <tabstop>timeoutSpinBox</tabstop> <tabstop>xSpinBox</tabstop> <tabstop>ySpinBox</tabstop>
--- a/eric6/Preferences/__init__.py Mon Jan 04 16:39:09 2021 +0100 +++ b/eric6/Preferences/__init__.py Mon Jan 04 16:39:37 2021 +0100 @@ -234,7 +234,6 @@ # 3 = QtFatalMsg "LogStdErrColour": QColor(Qt.red), - "NotificationsEnabled": True, "NotificationTimeout": 5, # time in seconds the notification # is shown "NotificationPosition": QPoint(10, 10), @@ -1910,8 +1909,7 @@ "CaptionShowsFilename", "ShowSplash", "SplitOrientationVertical", "UseProxy", "UseSystemProxy", "UseHttpProxyForAll", - "RequestDownloadFilename", - "CheckErrorLog", "NotificationsEnabled", + "RequestDownloadFilename", "CheckErrorLog", "OpenCrashSessionOnStartup", "CrashSessionEnabled", "ShowCodeDocumentationViewer", "ShowPyPIPackageManager", "ShowCondaPackageManager", "ShowCooperation", "ShowIrc",
--- a/eric6/Project/Project.py Mon Jan 04 16:39:09 2021 +0100 +++ b/eric6/Project/Project.py Mon Jan 04 16:39:37 2021 +0100 @@ -5477,21 +5477,18 @@ progress.setValue(len(selectedLists)) if errors: - message = self.tr("<p>The eric6 plugin archive files were " - "created with some errors.</p>") - else: - message = self.tr("<p>The eric6 plugin archive files were " - "created successfully.</p>") - if self.ui.notificationsEnabled(): self.ui.showNotification( UI.PixmapCache.getPixmap("pluginArchive48"), self.tr("Create Plugin Archive"), - message) + self.tr("<p>The eric6 plugin archive files were " + "created with some errors.</p>"), + timeout=0) else: - E5MessageBox.information( - self.ui, + self.ui.showNotification( + UI.PixmapCache.getPixmap("pluginArchive48"), self.tr("Create Plugin Archive"), - message) + self.tr("<p>The eric6 plugin archive files were " + "created successfully.</p>")) def __pluginCreateSnapshotArchives(self): """ @@ -5750,13 +5747,10 @@ """<p>There are changes that require the default""" """ make target to be rebuilt.</p>""") - if self.ui.notificationsEnabled() and not interactive: - self.ui.showNotification( - UI.PixmapCache.getPixmap("makefile48"), - title, - message) - else: - E5MessageBox.information(self.ui, title, message) + self.ui.showNotification( + UI.PixmapCache.getPixmap("makefile48"), + title, + message) elif exitCode > 1: E5MessageBox.critical( self.ui,
--- a/eric6/Project/ProjectFormsBrowser.py Mon Jan 04 16:39:09 2021 +0100 +++ b/eric6/Project/ProjectFormsBrowser.py Mon Jan 04 16:39:37 2021 +0100 @@ -763,45 +763,26 @@ f.write(line + "\n") if self.compiledFile not in self.project.pdata["SOURCES"]: self.project.appendFile(ofn) - if not self.noDialog and not ui.notificationsEnabled(): - E5MessageBox.information( - self, - self.tr("Form Compilation"), - self.tr("The compilation of the form file" - " was successful.")) - else: - ui.showNotification( - UI.PixmapCache.getPixmap("designer48"), - self.tr("Form Compilation"), - self.tr("The compilation of the form file" - " was successful.")) + ui.showNotification( + UI.PixmapCache.getPixmap("designer48"), + self.tr("Form Compilation"), + self.tr("The compilation of the form file" + " was successful.")) self.project.projectFormCompiled.emit(self.compiledFile) except OSError as msg: - if not self.noDialog: - E5MessageBox.information( - self, - self.tr("Form Compilation"), - self.tr( - "<p>The compilation of the form file failed.</p>" - "<p>Reason: {0}</p>").format(str(msg))) - else: - ui.showNotification( - UI.PixmapCache.getPixmap("designer48"), - self.tr("Form Compilation"), - self.tr( - "<p>The compilation of the form file failed.</p>" - "<p>Reason: {0}</p>").format(str(msg))) - else: - if not self.noDialog: - E5MessageBox.information( - self, - self.tr("Form Compilation"), - self.tr("The compilation of the form file failed.")) - else: ui.showNotification( UI.PixmapCache.getPixmap("designer48"), self.tr("Form Compilation"), - self.tr("The compilation of the form file failed.")) + self.tr( + "<p>The compilation of the form file failed.</p>" + "<p>Reason: {0}</p>").format(str(msg)), + timeout=0) + else: + ui.showNotification( + UI.PixmapCache.getPixmap("designer48"), + self.tr("Form Compilation"), + self.tr("The compilation of the form file failed."), + timeout=0) self.compileProc = None def __compileUI(self, fn, noDialog=False, progress=None):
--- a/eric6/Project/ProjectInterfacesBrowser.py Mon Jan 04 16:39:09 2021 +0100 +++ b/eric6/Project/ProjectInterfacesBrowser.py Mon Jan 04 16:39:37 2021 +0100 @@ -524,33 +524,19 @@ fileList += Utilities.direntries(directory, True, "*.py") for file in fileList: self.project.appendFile(file) - if not self.noDialog and not ui.notificationsEnabled(): - E5MessageBox.information( - self, - self.tr("Interface Compilation"), - self.tr( - "The compilation of the interface file was" - " successful.")) - else: - ui.showNotification( - UI.PixmapCache.getPixmap("corba48"), - self.tr("Interface Compilation"), - self.tr( - "The compilation of the interface file was" - " successful.")) + ui.showNotification( + UI.PixmapCache.getPixmap("corba48"), + self.tr("Interface Compilation"), + self.tr( + "The compilation of the interface file was" + " successful.")) else: - if not self.noDialog: - E5MessageBox.information( - self, - self.tr("Interface Compilation"), - self.tr( - "The compilation of the interface file failed.")) - else: - ui.showNotification( - UI.PixmapCache.getPixmap("corba48"), - self.tr("Interface Compilation"), - self.tr( - "The compilation of the interface file failed.")) + ui.showNotification( + UI.PixmapCache.getPixmap("corba48"), + self.tr("Interface Compilation"), + self.tr( + "The compilation of the interface file failed."), + timeout=0) self.compileProc = None def __compileIDL(self, fn, noDialog=False, progress=None):
--- a/eric6/Project/ProjectProtocolsBrowser.py Mon Jan 04 16:39:09 2021 +0100 +++ b/eric6/Project/ProjectProtocolsBrowser.py Mon Jan 04 16:39:37 2021 +0100 @@ -547,41 +547,27 @@ fileList += glob.glob(os.path.join(path, "*_pb2_grpc.py")) for file in fileList: self.project.appendFile(file) - if not self.noDialog and not ui.notificationsEnabled(): - E5MessageBox.information( - self, - self.tr("Protocol Compilation"), - self.tr( - "The compilation of the protocol file was" - " successful.")) + if grpc: + icon = UI.PixmapCache.getPixmap("gRPC48") else: - if grpc: - icon = UI.PixmapCache.getPixmap("gRPC48") - else: - icon = UI.PixmapCache.getPixmap("protobuf48") - ui.showNotification( - icon, - self.tr("Protocol Compilation"), - self.tr( - "The compilation of the protocol file was" - " successful.")) + icon = UI.PixmapCache.getPixmap("protobuf48") + ui.showNotification( + icon, + self.tr("Protocol Compilation"), + self.tr( + "The compilation of the protocol file was" + " successful.")) else: - if not self.noDialog: - E5MessageBox.information( - self, - self.tr("Protocol Compilation"), - self.tr( - "The compilation of the protocol file failed.")) + if grpc: + icon = UI.PixmapCache.getPixmap("gRPC48") else: - if grpc: - icon = UI.PixmapCache.getPixmap("gRPC48") - else: - icon = UI.PixmapCache.getPixmap("protobuf48") - ui.showNotification( - icon, - self.tr("Protocol Compilation"), - self.tr( - "The compilation of the protocol file failed.")) + icon = UI.PixmapCache.getPixmap("protobuf48") + ui.showNotification( + icon, + self.tr("Protocol Compilation"), + self.tr( + "The compilation of the protocol file failed."), + timeout=0) self.compileProc = None def __compileProto(self, fn, noDialog=False, progress=None, grpc=False):
--- a/eric6/Project/ProjectResourcesBrowser.py Mon Jan 04 16:39:09 2021 +0100 +++ b/eric6/Project/ProjectResourcesBrowser.py Mon Jan 04 16:39:37 2021 +0100 @@ -606,18 +606,11 @@ f.write(line + "\n") if self.compiledFile not in self.project.pdata["SOURCES"]: self.project.appendFile(ofn) - if not self.noDialog and not ui.notificationsEnabled(): - E5MessageBox.information( - self, - self.tr("Resource Compilation"), - self.tr("The compilation of the resource file" - " was successful.")) - else: - ui.showNotification( - UI.PixmapCache.getPixmap("resourcesCompiler48"), - self.tr("Resource Compilation"), - self.tr("The compilation of the resource file" - " was successful.")) + ui.showNotification( + UI.PixmapCache.getPixmap("resourcesCompiler48"), + self.tr("Resource Compilation"), + self.tr("The compilation of the resource file" + " was successful.")) except OSError as msg: if not self.noDialog: E5MessageBox.information( @@ -627,18 +620,12 @@ "<p>The compilation of the resource file" " failed.</p><p>Reason: {0}</p>").format(str(msg))) else: - if not self.noDialog: - E5MessageBox.information( - self, - self.tr("Resource Compilation"), - self.tr( - "The compilation of the resource file failed.")) - else: - ui.showNotification( - UI.PixmapCache.getPixmap("resourcesCompiler48"), - self.tr("Resource Compilation"), - self.tr( - "The compilation of the resource file failed.")) + ui.showNotification( + UI.PixmapCache.getPixmap("resourcesCompiler48"), + self.tr("Resource Compilation"), + self.tr( + "The compilation of the resource file failed."), + timeout=0) self.compileProc = None def __compileQRC(self, fn, noDialog=False, progress=None):
--- a/eric6/Project/ProjectTranslationsBrowser.py Mon Jan 04 16:39:09 2021 +0100 +++ b/eric6/Project/ProjectTranslationsBrowser.py Mon Jan 04 16:39:37 2021 +0100 @@ -934,33 +934,26 @@ @param exitStatus exit status of the process @type QProcess.ExitStatus """ + ui = e5App().getObject("UserInterface") if exitStatus == QProcess.NormalExit and exitCode == 0: - ui = e5App().getObject("UserInterface") - if ui.notificationsEnabled(): - ui.showNotification( - UI.PixmapCache.getPixmap("linguist48"), - self.tr("Translation file generation"), - self.tr( - "The generation of the translation files (*.ts)" - " was successful.")) - else: - E5MessageBox.information( - self, - self.tr("Translation file generation"), - self.tr( - "The generation of the translation files (*.ts)" - " was successful.")) + ui.showNotification( + UI.PixmapCache.getPixmap("linguist48"), + self.tr("Translation file generation"), + self.tr( + "The generation of the translation files (*.ts)" + " was successful.")) else: if exitStatus == QProcess.CrashExit: info = self.tr(" The process has crashed.") else: info = "" - E5MessageBox.critical( - self, + ui.showNotification( + UI.PixmapCache.getPixmap("linguist48"), self.tr("Translation file generation"), self.tr( "The generation of the translation files (*.ts) has" - " failed.{0}").format(info)) + " failed.{0}").format(info), + timeout=0) for index in range(len(self.__pylupdateProcesses)): if proc == self.__pylupdateProcesses[index][0]: @@ -1193,20 +1186,13 @@ @param exitStatus exit status of the process @type QProcess.ExitStatus """ + ui = e5App().getObject("UserInterface") if exitStatus == QProcess.NormalExit and exitCode == 0: - ui = e5App().getObject("UserInterface") - if ui.notificationsEnabled(): - ui.showNotification( - UI.PixmapCache.getPixmap("linguist48"), - self.tr("Translation file release"), - self.tr("The release of the translation files (*.qm)" - " was successful.")) - else: - E5MessageBox.information( - self, - self.tr("Translation file release"), - self.tr("The release of the translation files (*.qm)" - " was successful.")) + ui.showNotification( + UI.PixmapCache.getPixmap("linguist48"), + self.tr("Translation file release"), + self.tr("The release of the translation files (*.qm)" + " was successful.")) if self.project.pdata["TRANSLATIONSBINPATH"]: target = os.path.join( self.project.ppath, @@ -1218,11 +1204,12 @@ if os.path.exists(qmFile): shutil.move(qmFile, target) else: - E5MessageBox.critical( - self, + ui.showNotification( + UI.PixmapCache.getPixmap("linguist48"), self.tr("Translation file release"), self.tr( - "The release of the translation files (*.qm) has failed.")) + "The release of the translation files (*.qm) has failed."), + timeout=0) for index in range(len(self.__lreleaseProcesses)): if proc == self.__lreleaseProcesses[index]:
--- a/eric6/UI/UserInterface.py Mon Jan 04 16:39:09 2021 +0100 +++ b/eric6/UI/UserInterface.py Mon Jan 04 16:39:37 2021 +0100 @@ -7431,22 +7431,13 @@ (None = use configured timeout, 0 = indefinitely) @type int """ - if Preferences.getUI("NotificationsEnabled"): - if self.__notification is None: - from .NotificationWidget import NotificationWidget - self.__notification = NotificationWidget(parent=self) - if timeout is None: - timeout = Preferences.getUI("NotificationTimeout") - self.__notification.showNotification(icon, heading, text, - timeout=timeout) - - def notificationsEnabled(self): - """ - Public method to check, if notifications are enabled. - - @return flag indicating, if notifications are enabled (boolean) - """ - return Preferences.getUI("NotificationsEnabled") + if self.__notification is None: + from .NotificationWidget import NotificationWidget + self.__notification = NotificationWidget(parent=self) + if timeout is None: + timeout = Preferences.getUI("NotificationTimeout") + self.__notification.showNotification(icon, heading, text, + timeout=timeout) ######################### ## Support for IRC below
--- a/eric6/ViewManager/ViewManager.py Mon Jan 04 16:39:09 2021 +0100 +++ b/eric6/ViewManager/ViewManager.py Mon Jan 04 16:39:37 2021 +0100 @@ -6627,14 +6627,13 @@ dictionaryFile, str(err))) return - if self.ui.notificationsEnabled(): - self.ui.showNotification( - UI.PixmapCache.getPixmap("spellchecking48"), - QCoreApplication.translate( - 'ViewManager', "Edit Spelling Dictionary"), - QCoreApplication.translate( - 'ViewManager', - "The spelling dictionary was saved successfully.")) + self.ui.showNotification( + UI.PixmapCache.getPixmap("spellchecking48"), + QCoreApplication.translate( + 'ViewManager', "Edit Spelling Dictionary"), + QCoreApplication.translate( + 'ViewManager', + "The spelling dictionary was saved successfully.")) ################################################################## ## Below are general utility methods
--- a/eric6/WebBrowser/Download/DownloadManager.py Mon Jan 04 16:39:09 2021 +0100 +++ b/eric6/WebBrowser/Download/DownloadManager.py Mon Jan 04 16:39:37 2021 +0100 @@ -497,12 +497,11 @@ if self.activeDownloadsCount() == 0: # all active downloads are done if success and e5App().activeWindow() is not self: - if WebBrowserWindow.notificationsEnabled(): - WebBrowserWindow.showNotification( - UI.PixmapCache.getPixmap("downloads48"), - self.tr("Downloads finished"), - self.tr("All files have been downloaded.") - ) + WebBrowserWindow.showNotification( + UI.PixmapCache.getPixmap("downloads48"), + self.tr("Downloads finished"), + self.tr("All files have been downloaded.") + ) if not Preferences.getWebBrowser("DownloadManagerAutoClose"): self.raise_() self.activateWindow()
--- a/eric6/WebBrowser/Feeds/FeedsDialog.py Mon Jan 04 16:39:09 2021 +0100 +++ b/eric6/WebBrowser/Feeds/FeedsDialog.py Mon Jan 04 16:39:37 2021 +0100 @@ -12,8 +12,6 @@ from PyQt5.QtCore import QUrl from PyQt5.QtWidgets import QDialog, QPushButton, QLabel -from E5Gui import E5MessageBox - from .Ui_FeedsDialog import Ui_FeedsDialog import UI.PixmapCache @@ -79,20 +77,15 @@ from WebBrowser.WebBrowserWindow import WebBrowserWindow feedsManager = WebBrowserWindow.feedsManager() if feedsManager.addFeed(urlString, title, self.__browser.icon()): - if WebBrowserWindow.notificationsEnabled(): - WebBrowserWindow.showNotification( - UI.PixmapCache.getPixmap("rss48"), - self.tr("Add RSS Feed"), - self.tr("""The feed was added successfully.""")) - else: - E5MessageBox.information( - self, - self.tr("Add RSS Feed"), - self.tr("""The feed was added successfully.""")) + WebBrowserWindow.showNotification( + UI.PixmapCache.getPixmap("rss48"), + self.tr("Add RSS Feed"), + self.tr("""The feed was added successfully.""")) else: - E5MessageBox.warning( - self, + WebBrowserWindow.showNotification( + UI.PixmapCache.getPixmap("rss48"), self.tr("Add RSS Feed"), - self.tr("""The feed was already added before.""")) - + self.tr("""The feed was already added before."""), + timeout=0) + self.close()
--- a/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyAddScriptDialog.py Mon Jan 04 16:39:09 2021 +0100 +++ b/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyAddScriptDialog.py Mon Jan 04 16:39:37 2021 +0100 @@ -13,8 +13,6 @@ from PyQt5.QtCore import pyqtSlot, QDir, QFile from PyQt5.QtWidgets import QDialog -from E5Gui import E5MessageBox - from .Ui_GreaseMonkeyAddScriptDialog import Ui_GreaseMonkeyAddScriptDialog import UI.PixmapCache @@ -92,13 +90,13 @@ success = False from WebBrowser.WebBrowserWindow import WebBrowserWindow - if success and WebBrowserWindow.notificationsEnabled(): + if success: WebBrowserWindow.showNotification( UI.PixmapCache.getPixmap("greaseMonkey48"), self.tr("GreaseMonkey Script Installation"), msg) else: - E5MessageBox.information( - self, + WebBrowserWindow.showNotification( + UI.PixmapCache.getPixmap("greaseMonkey48"), self.tr("GreaseMonkey Script Installation"), - msg) + msg, timeout=0)
--- a/eric6/WebBrowser/SafeBrowsing/SafeBrowsingManager.py Mon Jan 04 16:39:09 2021 +0100 +++ b/eric6/WebBrowser/SafeBrowsing/SafeBrowsingManager.py Mon Jan 04 16:39:37 2021 +0100 @@ -149,10 +149,6 @@ """ Private method to show some message in a notification widget. - If desktop notifications have been disabled, the message will - be shown in the status bar of the main window (either the main - web browser window or the eric main window) - @param message message to be shown @type str @param timeout amount of time in seconds the message should be shown @@ -161,17 +157,12 @@ """ from WebBrowser.WebBrowserWindow import WebBrowserWindow - if WebBrowserWindow.notificationsEnabled(): - WebBrowserWindow.showNotification( - UI.PixmapCache.getPixmap("safeBrowsing48"), - self.tr("Google Safe Browsing"), - message, - timeout=timeout, - ) - else: - statusBar = WebBrowserWindow.globalStatusBar() - if statusBar is not None: - statusBar.showMessage(message, timeout * 1000) + WebBrowserWindow.showNotification( + UI.PixmapCache.getPixmap("safeBrowsing48"), + self.tr("Google Safe Browsing"), + message, + timeout=timeout, + ) def __setAutoUpdateThreatLists(self): """
--- a/eric6/WebBrowser/WebBrowserWindow.py Mon Jan 04 16:39:09 2021 +0100 +++ b/eric6/WebBrowser/WebBrowserWindow.py Mon Jan 04 16:39:37 2021 +0100 @@ -4732,23 +4732,14 @@ (None = use configured timeout, 0 = indefinitely) @type int """ - if Preferences.getUI("NotificationsEnabled"): - if cls._notification is None: - from UI.NotificationWidget import NotificationWidget - cls._notification = NotificationWidget() - if timeout is None: - timeout = Preferences.getUI("NotificationTimeout") - cls._notification.showNotification(icon, heading, text, - timeout=timeout) - - @classmethod - def notificationsEnabled(cls): - """ - Class method to check, if notifications are enabled. - - @return flag indicating, if notifications are enabled (boolean) - """ - return Preferences.getUI("NotificationsEnabled") + if cls._notification is None: + from UI.NotificationWidget import NotificationWidget + cls._notification = NotificationWidget() + + if timeout is None: + timeout = Preferences.getUI("NotificationTimeout") + cls._notification.showNotification( + icon, heading, text, timeout=timeout) ###################################### ## Support for global status bar below