def __finished(self, success): """ Private slot to handle a finished download. @param success flag indicating a successful download @type bool """ if self.isVisible(): QApplication.alert(self) self.downloadsCountChanged.emit() 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.png"), self.tr("Downloads finished"), self.tr("All files have been downloaded.")) if not Preferences.getWebBrowser("DownloadManagerAutoClose"): self.raise_() self.activateWindow() self.__stopUpdateTimer() self.infoLabel.clear() self.setWindowTitle(self.tr("Download Manager")) if Globals.isWindowsPlatform(): self.__taskbarButton().progress().hide() if Preferences.getWebBrowser("DownloadManagerAutoClose"): self.close()
def __showNotificationMessage(self, message, timeout=5): """ 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 (0 = indefinitely) @type int """ from WebBrowser.WebBrowserWindow import WebBrowserWindow if WebBrowserWindow.notificationsEnabled(): WebBrowserWindow.showNotification( UI.PixmapCache.getPixmap("safeBrowsing48.png"), self.tr("Google Safe Browsing"), message, timeout=timeout, ) else: statusBar = WebBrowserWindow.globalStatusBar() if statusBar is not None: statusBar.showMessage(message, timeout * 1000)
def __addFeed(self, button): """ Private slot to add a RSS feed. @param button reference to the feed button @type QPushButton """ urlString = button.feed[1] url = QUrl(urlString) if url.isRelative(): url = self.__browser.url().resolved(url) urlString = url.toDisplayString(QUrl.FullyDecoded) if not url.isValid(): return if button.feed[0]: title = button.feed[0] else: title = self.__browser.url().host() 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.png"), 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.""")) else: E5MessageBox.warning( self, self.tr("Add RSS Feed"), self.tr("""The feed was already added before.""")) self.close()
def __accepted(self): """ Private slot handling the accepted signal. """ if self.__manager.addScript(self.__script): msg = self.tr( "<p><b>{0}</b> installed successfully.</p>").format( self.__script.name()) success = True else: msg = self.tr("<p>Cannot install script.</p>") success = False from WebBrowser.WebBrowserWindow import WebBrowserWindow if success and WebBrowserWindow.notificationsEnabled(): WebBrowserWindow.showNotification( UI.PixmapCache.getPixmap("greaseMonkey48.png"), self.tr("GreaseMonkey Script Installation"), msg) else: E5MessageBox.information( self, self.tr("GreaseMonkey Script Installation"), msg)