Thu, 10 Oct 2013 18:35:45 +0200
Continued to shorten the code lines to max. 79 characters.
--- a/Helpviewer/Bookmarks/BookmarksDialog.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Bookmarks/BookmarksDialog.py Thu Oct 10 18:35:45 2013 +0200 @@ -30,7 +30,8 @@ Constructor @param parent reference to the parent widget (QWidget - @param manager reference to the bookmarks manager object (BookmarksManager) + @param manager reference to the bookmarks manager object + (BookmarksManager) """ super().__init__(parent) self.setupUi(self) @@ -38,14 +39,16 @@ self.__bookmarksManager = manager if self.__bookmarksManager is None: import Helpviewer.HelpWindow - self.__bookmarksManager = Helpviewer.HelpWindow.HelpWindow.bookmarksManager() + self.__bookmarksManager = Helpviewer.HelpWindow.HelpWindow\ + .bookmarksManager() self.__bookmarksModel = self.__bookmarksManager.bookmarksModel() self.__proxyModel = E5TreeSortFilterProxyModel(self) self.__proxyModel.setFilterKeyColumn(-1) self.__proxyModel.setSourceModel(self.__bookmarksModel) - self.searchEdit.textChanged.connect(self.__proxyModel.setFilterFixedString) + self.searchEdit.textChanged.connect( + self.__proxyModel.setFilterFixedString) self.bookmarksTree.setModel(self.__proxyModel) self.bookmarksTree.setExpanded(self.__proxyModel.index(0, 0), True) @@ -59,7 +62,8 @@ self.bookmarksTree.customContextMenuRequested.connect( self.__customContextMenuRequested) - self.removeButton.clicked[()].connect(self.bookmarksTree.removeSelected) + self.removeButton.clicked[()].connect( + self.bookmarksTree.removeSelected) self.addFolderButton.clicked[()].connect(self.__newFolder) self.__expandNodes(self.__bookmarksManager.bookmarks()) @@ -135,15 +139,18 @@ sourceIndex = self.__proxyModel.mapToSource(idx) node = self.__bookmarksModel.node(sourceIndex) if idx.isValid() and node.type() != BookmarkNode.Folder: - menu.addAction(self.trUtf8("&Open"), self.__openBookmarkInCurrentTab) - menu.addAction(self.trUtf8("Open in New &Tab"), self.__openBookmarkInNewTab) + menu.addAction( + self.trUtf8("&Open"), self.__openBookmarkInCurrentTab) + menu.addAction( + self.trUtf8("Open in New &Tab"), self.__openBookmarkInNewTab) menu.addSeparator() act = menu.addAction(self.trUtf8("Edit &Name"), self.__editName) act.setEnabled(idx.flags() & Qt.ItemIsEditable) if idx.isValid() and node.type() != BookmarkNode.Folder: menu.addAction(self.trUtf8("Edit &Address"), self.__editAddress) menu.addSeparator() - act = menu.addAction(self.trUtf8("&Delete"), self.bookmarksTree.removeSelected) + act = menu.addAction( + self.trUtf8("&Delete"), self.bookmarksTree.removeSelected) act.setEnabled(idx.flags() & Qt.ItemIsDragEnabled) menu.addSeparator() act = menu.addAction(self.trUtf8("&Properties..."), self.__edit) @@ -156,7 +163,8 @@ @param idx reference to the entry index (QModelIndex) """ - self.__openBookmark(QApplication.keyboardModifiers() & Qt.ControlModifier) + self.__openBookmark( + QApplication.keyboardModifiers() & Qt.ControlModifier) def __openBookmarkInCurrentTab(self): """ @@ -174,7 +182,8 @@ """ Private method to open a bookmark. - @param newTab flag indicating to open the bookmark in a new tab (boolean) + @param newTab flag indicating to open the bookmark in a new tab + (boolean) """ from .BookmarkNode import BookmarkNode from .BookmarksModel import BookmarksModel
--- a/Helpviewer/Bookmarks/BookmarksImportDialog.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Bookmarks/BookmarksImportDialog.py Thu Oct 10 18:35:45 2013 +0200 @@ -56,7 +56,8 @@ Private slot to set the enabled state of the next button. """ if self.__currentPage == 0: - self.nextButton.setEnabled(len(self.sourcesList.selectedItems()) == 1) + self.nextButton.setEnabled( + len(self.sourcesList.selectedItems()) == 1) elif self.__currentPage == 1: self.nextButton.setEnabled(self.fileEdit.text() != "") @@ -112,15 +113,17 @@ if self.__currentPage == 0: self.__selectedSource = self.sourcesList.currentItem().data( self.SourcesListIdRole) - pixmap, sourceName, self.__sourceFile, info, prompt, self.__sourceDir = \ - BookmarksImporters.getImporterInfo(self.__selectedSource) + (pixmap, sourceName, self.__sourceFile, info, prompt, + self.__sourceDir) = BookmarksImporters.getImporterInfo( + self.__selectedSource) self.iconLabel.setPixmap(pixmap) self.importingFromLabel.setText( self.trUtf8("<b>Importing from {0}</b>").format(sourceName)) self.fileLabel1.setText(info) self.fileLabel2.setText(prompt) - self.standardDirLabel.setText("<i>{0}</i>".format(self.__sourceDir)) + self.standardDirLabel.setText( + "<i>{0}</i>".format(self.__sourceDir)) self.nextButton.setText(self.trUtf8("Finish"))
--- a/Helpviewer/Bookmarks/BookmarksImporters/ChromeImporter.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Bookmarks/BookmarksImporters/ChromeImporter.py Thu Oct 10 18:35:45 2013 +0200 @@ -25,13 +25,15 @@ @param id id of the browser ("chrome" or "chromium") @return tuple with an icon (QPixmap), readable name (string), name of the default bookmarks file (string), an info text (string), - a prompt (string) and the default directory of the bookmarks file (string) + a prompt (string) and the default directory of the bookmarks file + (string) @exception ValueError raised to indicate an invalid browser ID """ if id == "chrome": if Globals.isWindowsPlatform(): standardDir = os.path.expandvars( - "%USERPROFILE%\\AppData\\Local\\Google\\Chrome\\User Data\\Default") + "%USERPROFILE%\\AppData\\Local\\Google\\Chrome\\" + "User Data\\Default") elif Globals.isMacPlatform(): standardDir = os.path.expanduser( "~/Library/Application Support/Google/Chrome/Default") @@ -41,9 +43,11 @@ UI.PixmapCache.getPixmap("chrome.png"), "Google Chrome", "Bookmarks", - QCoreApplication.translate("ChromeImporter", - """Google Chrome stores its bookmarks in the <b>Bookmarks</b> """ - """text file. This file is usually located in"""), + QCoreApplication.translate( + "ChromeImporter", + """Google Chrome stores its bookmarks in the""" + """ <b>Bookmarks</b> text file. This file is usually""" + """ located in"""), QCoreApplication.translate("ChromeImporter", """Please choose the file to begin importing bookmarks."""), standardDir, @@ -51,16 +55,18 @@ elif id == "chromium": if Globals.isWindowsPlatform(): standardDir = os.path.expandvars( - "%USERPROFILE%\\AppData\\Local\\Google\\Chrome\\User Data\\Default") + "%USERPROFILE%\\AppData\\Local\\Google\\Chrome\\" + "User Data\\Default") else: standardDir = os.path.expanduser("~/.config/chromium/Default") return ( UI.PixmapCache.getPixmap("chromium.png"), "Chromium", "Bookmarks", - QCoreApplication.translate("ChromeImporter", - """Chromium stores its bookmarks in the <b>Bookmarks</b> text file. """ - """This file is usually located in"""), + QCoreApplication.translate( + "ChromeImporter", + """Chromium stores its bookmarks in the <b>Bookmarks</b>""" + """ text file. This file is usually located in"""), QCoreApplication.translate("ChromeImporter", """Please choose the file to begin importing bookmarks."""), standardDir, @@ -100,8 +106,8 @@ """ if not os.path.exists(self.__fileName): self._error = True - self._errorString = self.trUtf8("File '{0}' does not exist.")\ - .format(self.__fileName) + self._errorString = self.trUtf8( + "File '{0}' does not exist.").format(self.__fileName) return False return True @@ -117,7 +123,8 @@ f.close() except IOError as err: self._error = True - self._errorString = self.trUtf8("File '{0}' cannot be read.\nReason: {1}")\ + self._errorString = self.trUtf8( + "File '{0}' cannot be read.\nReason: {1}")\ .format(self.__fileName, str(err)) return None
--- a/Helpviewer/Bookmarks/BookmarksImporters/FirefoxImporter.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Bookmarks/BookmarksImporters/FirefoxImporter.py Thu Oct 10 18:35:45 2013 +0200 @@ -25,7 +25,8 @@ @param id id of the browser ("chrome" or "chromium") @return tuple with an icon (QPixmap), readable name (string), name of the default bookmarks file (string), an info text (string), - a prompt (string) and the default directory of the bookmarks file (string) + a prompt (string) and the default directory of the bookmarks file + (string) @exception ValueError raised to indicate an invalid browser ID """ if id == "firefox": @@ -42,8 +43,9 @@ "Mozilla Firefox", "places.sqlite", QCoreApplication.translate("FirefoxImporter", - """Mozilla Firefox stores its bookmarks in the <b>places.sqlite</b> """ - """SQLite database. This file is usually located in"""), + """Mozilla Firefox stores its bookmarks in the""" + """ <b>places.sqlite</b> SQLite database. This file is""" + """ usually located in"""), QCoreApplication.translate("FirefoxImporter", """Please choose the file to begin importing bookmarks."""), standardDir, @@ -92,8 +94,8 @@ self.__db = sqlite3.connect(self.__fileName) except sqlite3.DatabaseError as err: self._error = True - self._errorString = self.trUtf8("Unable to open database.\nReason: {0}")\ - .format(str(err)) + self._errorString = self.trUtf8( + "Unable to open database.\nReason: {0}").format(str(err)) return False return True @@ -127,8 +129,8 @@ folders[id_] = folder except sqlite3.DatabaseError as err: self._error = True - self._errorString = self.trUtf8("Unable to open database.\nReason: {0}")\ - .format(str(err)) + self._errorString = self.trUtf8( + "Unable to open database.\nReason: {0}").format(str(err)) return None try: @@ -143,23 +145,27 @@ cursor2 = self.__db.cursor() cursor2.execute( - "SELECT url FROM moz_places WHERE id = {0}".format(placesId)) + "SELECT url FROM moz_places WHERE id = {0}" + .format(placesId)) row2 = cursor2.fetchone() if row2: url = QUrl(row2[0]) - if not title or url.isEmpty() or url.scheme() in ["place", "about"]: + if not title or url.isEmpty() or \ + url.scheme() in ["place", "about"]: continue if parent in folders: - bookmark = BookmarkNode(BookmarkNode.Bookmark, folders[parent]) + bookmark = BookmarkNode(BookmarkNode.Bookmark, + folders[parent]) else: - bookmark = BookmarkNode(BookmarkNode.Bookmark, importRootNode) + bookmark = BookmarkNode(BookmarkNode.Bookmark, + importRootNode) bookmark.url = url.toString() bookmark.title = title.replace("&", "&&") except sqlite3.DatabaseError as err: self._error = True - self._errorString = self.trUtf8("Unable to open database.\nReason: {0}")\ - .format(str(err)) + self._errorString = self.trUtf8( + "Unable to open database.\nReason: {0}").format(str(err)) return None importRootNode.setType(BookmarkNode.Folder)
--- a/Helpviewer/Bookmarks/BookmarksImporters/HtmlImporter.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Bookmarks/BookmarksImporters/HtmlImporter.py Thu Oct 10 18:35:45 2013 +0200 @@ -23,19 +23,24 @@ @param id id of the browser ("chrome" or "chromium") @return tuple with an icon (QPixmap), readable name (string), name of the default bookmarks file (string), an info text (string), - a prompt (string) and the default directory of the bookmarks file (string) + a prompt (string) and the default directory of the bookmarks file + (string) @exception ValueError raised to indicate an invalid browser ID """ if id == "html": return ( UI.PixmapCache.getPixmap("html.png"), "HTML Netscape Bookmarks", - QCoreApplication.translate("HtmlImporter", + QCoreApplication.translate( + "HtmlImporter", "HTML Netscape Bookmarks") + " (*.htm *.html)", - QCoreApplication.translate("HtmlImporter", - """You can import bookmarks from any browser that supports HTML """ - """exporting. This file has usually the extension .htm or .html."""), - QCoreApplication.translate("HtmlImporter", + QCoreApplication.translate( + "HtmlImporter", + """You can import bookmarks from any browser that supports""" + """ HTML exporting. This file has usually the extension""" + """ .htm or .html."""), + QCoreApplication.translate( + "HtmlImporter", """Please choose the file to begin importing bookmarks."""), "", )
--- a/Helpviewer/Bookmarks/BookmarksImporters/IExplorerImporter.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Bookmarks/BookmarksImporters/IExplorerImporter.py Thu Oct 10 18:35:45 2013 +0200 @@ -24,7 +24,8 @@ @param id id of the browser ("chrome" or "chromium") @return tuple with an icon (QPixmap), readable name (string), name of the default bookmarks file (string), an info text (string), - a prompt (string) and the default directory of the bookmarks file (string) + a prompt (string) and the default directory of the bookmarks file + (string) @exception ValueError raised to indicate an invalid browser ID """ if id == "ie": @@ -37,10 +38,13 @@ UI.PixmapCache.getPixmap("internet_explorer.png"), "Internet Explorer", "", - QCoreApplication.translate("IExplorerImporter", - """Internet Explorer stores its bookmarks in the <b>Favorites</b> """ - """folder This folder is usually located in"""), - QCoreApplication.translate("IExplorerImporter", + QCoreApplication.translate( + "IExplorerImporter", + """Internet Explorer stores its bookmarks in the""" + """ <b>Favorites</b> folder This folder is usually""" + """ located in"""), + QCoreApplication.translate( + "IExplorerImporter", """Please choose the folder to begin importing bookmarks."""), standardDir, ) @@ -128,9 +132,11 @@ break if url: if dir in folders: - bookmark = BookmarkNode(BookmarkNode.Bookmark, folders[dir]) + bookmark = BookmarkNode(BookmarkNode.Bookmark, + folders[dir]) else: - bookmark = BookmarkNode(BookmarkNode.Bookmark, importRootNode) + bookmark = BookmarkNode(BookmarkNode.Bookmark, + importRootNode) bookmark.url = url bookmark.title = name.replace("&", "&&")
--- a/Helpviewer/Bookmarks/BookmarksImporters/OperaImporter.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Bookmarks/BookmarksImporters/OperaImporter.py Thu Oct 10 18:35:45 2013 +0200 @@ -24,7 +24,8 @@ @param id id of the browser ("chrome" or "chromium") @return tuple with an icon (QPixmap), readable name (string), name of the default bookmarks file (string), an info text (string), - a prompt (string) and the default directory of the bookmarks file (string) + a prompt (string) and the default directory of the bookmarks file + (string) @exception ValueError raised to indicate an invalid browser ID """ if id == "opera": @@ -98,7 +99,8 @@ f.close() except IOError as err: self._error = True - self._errorString = self.trUtf8("File '{0}' cannot be read.\nReason: {1}")\ + self._errorString = self.trUtf8( + "File '{0}' cannot be read.\nReason: {1}")\ .format(self.__fileName, str(err)) return None
--- a/Helpviewer/Bookmarks/BookmarksImporters/SafariImporter.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Bookmarks/BookmarksImporters/SafariImporter.py Thu Oct 10 18:35:45 2013 +0200 @@ -26,7 +26,8 @@ @param id id of the browser ("chrome" or "chromium") @return tuple with an icon (QPixmap), readable name (string), name of the default bookmarks file (string), an info text (string), - a prompt (string) and the default directory of the bookmarks file (string) + a prompt (string) and the default directory of the bookmarks file + (string) @exception ValueError raised to indicate an invalid browser ID """ if id == "safari": @@ -41,9 +42,11 @@ UI.PixmapCache.getPixmap("safari.png"), "Apple Safari", "Bookmarks.plist", - QCoreApplication.translate("SafariImporter", - """Apple Safari stores its bookmarks in the <b>Bookmarks.plist</b> """ - """file. This file is usually located in"""), + QCoreApplication.translate( + "SafariImporter", + """Apple Safari stores its bookmarks in the""" + """ <b>Bookmarks.plist</b> file. This file is usually""" + """ located in"""), QCoreApplication.translate("SafariImporter", """Please choose the file to begin importing bookmarks."""), standardDir, @@ -136,4 +139,5 @@ bookmark = BookmarkNode(BookmarkNode.Bookmark, rootNode) bookmark.url = url - bookmark.title = child["URIDictionary"]["title"].replace("&", "&&") + bookmark.title = child["URIDictionary"]["title"]\ + .replace("&", "&&")
--- a/Helpviewer/Bookmarks/BookmarksImporters/XbelImporter.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Bookmarks/BookmarksImporters/XbelImporter.py Thu Oct 10 18:35:45 2013 +0200 @@ -23,7 +23,8 @@ @param id id of the browser ("chrome" or "chromium") @return tuple with an icon (QPixmap), readable name (string), name of the default bookmarks file (string), an info text (string), - a prompt (string) and the default directory of the bookmarks file (string) + a prompt (string) and the default directory of the bookmarks file + (string) @exception ValueError raised to indicate an invalid browser ID """ if id == "e5browser": @@ -33,9 +34,10 @@ UI.PixmapCache.getPixmap("ericWeb48.png"), "eric5 Web Browser", os.path.basename(bookmarksFile), - QCoreApplication.translate("XbelImporter", - """eric5 Web Browser stores its bookmarks in the <b>{0}</b> XML file. """ - """This file is usually located in""" + QCoreApplication.translate( + "XbelImporter", + """eric5 Web Browser stores its bookmarks in the""" + """ <b>{0}</b> XML file. This file is usually located in""" ).format(os.path.basename(bookmarksFile)), QCoreApplication.translate("XbelImporter", """Please choose the file to begin importing bookmarks."""), @@ -52,9 +54,11 @@ UI.PixmapCache.getPixmap("konqueror.png"), "Konqueror", "bookmarks.xml", - QCoreApplication.translate("XbelImporter", - """Konqueror stores its bookmarks in the <b>bookmarks.xml</b> XML """ - """file. This file is usually located in"""), + QCoreApplication.translate( + "XbelImporter", + """Konqueror stores its bookmarks in the""" + """ <b>bookmarks.xml</b> XML file. This file is usually""" + """ located in"""), QCoreApplication.translate("XbelImporter", """Please choose the file to begin importing bookmarks."""), standardDir, @@ -63,12 +67,15 @@ return ( UI.PixmapCache.getPixmap("xbel.png"), "XBEL Bookmarks", - QCoreApplication.translate("XbelImporter", "XBEL Bookmarks") + \ - " (*.xbel *.xml)", - QCoreApplication.translate("XbelImporter", - """You can import bookmarks from any browser that supports XBEL """ - """exporting. This file has usually the extension .xbel or .xml."""), - QCoreApplication.translate("XbelImporter", + QCoreApplication.translate( + "XbelImporter", "XBEL Bookmarks") + " (*.xbel *.xml)", + QCoreApplication.translate( + "XbelImporter", + """You can import bookmarks from any browser that supports""" + """ XBEL exporting. This file has usually the extension""" + """ .xbel or .xml."""), + QCoreApplication.translate( + "XbelImporter", """Please choose the file to begin importing bookmarks."""), "", ) @@ -126,7 +133,8 @@ if reader.error() != QXmlStreamReader.NoError: self._error = True self._errorString = self.trUtf8( - """Error when importing bookmarks on line {0}, column {1}:\n{2}""")\ + """Error when importing bookmarks on line {0},""" + """ column {1}:\n{2}""")\ .format(reader.lineNumber(), reader.columnNumber(), reader.errorString())
--- a/Helpviewer/Bookmarks/BookmarksManager.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Bookmarks/BookmarksManager.py Thu Oct 10 18:35:45 2013 +0200 @@ -9,8 +9,9 @@ import os -from PyQt4.QtCore import pyqtSignal, Qt, QT_TRANSLATE_NOOP, QObject, QFile, QByteArray, \ - QBuffer, QIODevice, QXmlStreamReader, QDate, QDateTime, QFileInfo, QUrl +from PyQt4.QtCore import pyqtSignal, Qt, QT_TRANSLATE_NOOP, QObject, QFile, \ + QByteArray, QBuffer, QIODevice, QXmlStreamReader, QDate, QDateTime, \ + QFileInfo, QUrl from PyQt4.QtGui import QUndoStack, QUndoCommand, QApplication, QDialog from E5Gui import E5MessageBox, E5FileDialog @@ -33,10 +34,12 @@ """ Class implementing the bookmarks manager. - @signal entryAdded(BookmarkNode) emitted after a bookmark node has been added - @signal entryRemoved(BookmarkNode, int, BookmarkNode) emitted after a bookmark - node has been removed - @signal entryChanged(BookmarkNode) emitted after a bookmark node has been changed + @signal entryAdded(BookmarkNode) emitted after a bookmark node has been + added + @signal entryRemoved(BookmarkNode, int, BookmarkNode) emitted after a + bookmark node has been removed + @signal entryChanged(BookmarkNode) emitted after a bookmark node has been + changed @signal bookmarksSaved() emitted after the bookmarks were saved @signal bookmarksReloaded() emitted after the bookmarks were reloaded """ @@ -79,7 +82,8 @@ @return name of the bookmark file (string) """ - return os.path.join(Utilities.getConfigDir(), "browser", "bookmarks.xbel") + return os.path.join(Utilities.getConfigDir(), "browser", + "bookmarks.xbel") def close(self): """ @@ -134,14 +138,16 @@ if reader.error() != QXmlStreamReader.NoError: E5MessageBox.warning(None, self.trUtf8("Loading Bookmarks"), - self.trUtf8("""Error when loading bookmarks on line {0}, column {1}:\n""" - """{2}""")\ + self.trUtf8( + """Error when loading bookmarks on line {0},""" + """ column {1}:\n {2}""")\ .format(reader.lineNumber(), reader.columnNumber(), reader.errorString())) others = [] - for index in range(len(self.__bookmarkRootNode.children()) - 1, -1, -1): + for index in range( + len(self.__bookmarkRootNode.children()) - 1, -1, -1): node = self.__bookmarkRootNode.children()[index] if node.type() == BookmarkNode.Folder: if (node.title == self.trUtf8("Toolbar Bookmarks") or \ @@ -163,13 +169,15 @@ raise RuntimeError("Error loading bookmarks.") if self.__toolbar is None: - self.__toolbar = BookmarkNode(BookmarkNode.Folder, self.__bookmarkRootNode) + self.__toolbar = BookmarkNode(BookmarkNode.Folder, + self.__bookmarkRootNode) self.__toolbar.title = self.trUtf8(BOOKMARKBAR) else: self.__bookmarkRootNode.add(self.__toolbar) if self.__menu is None: - self.__menu = BookmarkNode(BookmarkNode.Folder, self.__bookmarkRootNode) + self.__menu = BookmarkNode(BookmarkNode.Folder, + self.__bookmarkRootNode) self.__menu.title = self.trUtf8(BOOKMARKMENU) else: self.__bookmarkRootNode.add(self.__menu) @@ -216,7 +224,8 @@ if not self.__loaded: return - self.setTimestamp(node, BookmarkNode.TsAdded, QDateTime.currentDateTime()) + self.setTimestamp(node, BookmarkNode.TsAdded, + QDateTime.currentDateTime()) command = InsertBookmarksCommand(self, parent, node, row) self.__commands.push(command) @@ -394,9 +403,11 @@ if len(bmNames) == len(bmFiles): convertedRootNode = BookmarkNode(BookmarkNode.Folder) convertedRootNode.title = self.trUtf8("Converted {0}")\ - .format(QDate.currentDate().toString(Qt.SystemLocaleShortDate)) + .format(QDate.currentDate().toString( + Qt.SystemLocaleShortDate)) for i in range(len(bmNames)): - node = BookmarkNode(BookmarkNode.Bookmark, convertedRootNode) + node = BookmarkNode(BookmarkNode.Bookmark, + convertedRootNode) node.title = bmNames[i] url = QUrl(bmFiles[i]) if not url.scheme(): @@ -446,7 +457,8 @@ Private method get a bookmark node for a given URL. @param url URL of the bookmark to search for (string) - @param startNode reference to the node to start searching (BookmarkNode) + @param startNode reference to the node to start searching + (BookmarkNode) @return bookmark node for the given url (BookmarkNode) """ bm = None @@ -488,7 +500,8 @@ Private method get a list of bookmark nodes for a given URL. @param url URL of the bookmarks to search for (string) - @param startNode reference to the node to start searching (BookmarkNode) + @param startNode reference to the node to start searching + (BookmarkNode) @return list of bookmark nodes for the given url (list of BookmarkNode) """ bm = [] @@ -509,7 +522,8 @@ """ Constructor - @param bookmarksManager reference to the bookmarks manager (BookmarksManager) + @param bookmarksManager reference to the bookmarks manager + (BookmarksManager) @param parent reference to the parent node (BookmarkNode) @param row row number of bookmark (integer) """ @@ -536,7 +550,8 @@ Public slot to perform the redo action. """ self._parent.remove(self._node) - self._bookmarksManager.entryRemoved.emit(self._parent, self._row, self._node) + self._bookmarksManager.entryRemoved.emit( + self._parent, self._row, self._node) class InsertBookmarksCommand(RemoveBookmarksCommand): @@ -547,13 +562,15 @@ """ Constructor - @param bookmarksManager reference to the bookmarks manager (BookmarksManager) + @param bookmarksManager reference to the bookmarks manager + (BookmarksManager) @param parent reference to the parent node (BookmarkNode) @param node reference to the node to be inserted (BookmarkNode) @param row row number of bookmark (integer) """ RemoveBookmarksCommand.__init__(self, bookmarksManager, parent, row) - self.setText(QApplication.translate("BookmarksManager", "Insert Bookmark")) + self.setText(QApplication.translate( + "BookmarksManager", "Insert Bookmark")) self._node = node def undo(self): @@ -577,7 +594,8 @@ """ Constructor - @param bookmarksManager reference to the bookmarks manager (BookmarksManager) + @param bookmarksManager reference to the bookmarks manager + (BookmarksManager) @param node reference to the node to be changed (BookmarkNode) @param newValue new value to be set (string) @param title flag indicating a change of the title (True) or @@ -592,10 +610,12 @@ if self._title: self._oldValue = self._node.title - self.setText(QApplication.translate("BookmarksManager", "Name Change")) + self.setText(QApplication.translate( + "BookmarksManager", "Name Change")) else: self._oldValue = self._node.url - self.setText(QApplication.translate("BookmarksManager", "Address Change")) + self.setText(QApplication.translate( + "BookmarksManager", "Address Change")) def undo(self): """
--- a/Helpviewer/Bookmarks/BookmarksMenu.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Bookmarks/BookmarksMenu.py Thu Oct 10 18:35:45 2013 +0200 @@ -20,8 +20,8 @@ """ Class implementing the bookmarks menu base class. - @signal openUrl(QUrl, str) emitted to open a URL with the given title in the - current tab + @signal openUrl(QUrl, str) emitted to open a URL with the given title in + the current tab @signal newUrl(QUrl, str) emitted to open a URL with the given title in a new tab """ @@ -134,18 +134,22 @@ menu = QMenu() v = act.data() - menuAction = menu.addAction(self.trUtf8("&Open"), self.__openBookmark) + menuAction = menu.addAction( + self.trUtf8("&Open"), self.__openBookmark) menuAction.setData(v) - menuAction = menu.addAction(self.trUtf8("Open in New &Tab\tCtrl+LMB"), + menuAction = menu.addAction( + self.trUtf8("Open in New &Tab\tCtrl+LMB"), self.__openBookmarkInNewTab) menuAction.setData(v) menu.addSeparator() - menuAction = menu.addAction(self.trUtf8("&Remove"), self.__removeBookmark) + menuAction = menu.addAction( + self.trUtf8("&Remove"), self.__removeBookmark) menuAction.setData(v) menu.addSeparator() - menuAction = menu.addAction(self.trUtf8("&Properties..."), self.__edit) + menuAction = menu.addAction( + self.trUtf8("&Properties..."), self.__edit) menuAction.setData(v) execAct = menu.exec_(QCursor.pos()) @@ -194,15 +198,15 @@ dlg = BookmarkPropertiesDialog(node) dlg.exec_() -########################################################################################## +############################################################################## class BookmarksMenuBarMenu(BookmarksMenu): """ Class implementing a dynamically populated menu for bookmarks. - @signal openUrl(QUrl, str) emitted to open a URL with the given title in the - current tab + @signal openUrl(QUrl, str) emitted to open a URL with the given title in + the current tab """ openUrl = pyqtSignal(QUrl, str) @@ -225,7 +229,8 @@ """ import Helpviewer.HelpWindow - self.__bookmarksManager = Helpviewer.HelpWindow.HelpWindow.bookmarksManager() + self.__bookmarksManager = Helpviewer.HelpWindow.HelpWindow\ + .bookmarksManager() self.setModel(self.__bookmarksManager.bookmarksModel()) self.setRootIndex(self.__bookmarksManager.bookmarksModel()\ .nodeIndex(self.__bookmarksManager.menu())) @@ -279,7 +284,8 @@ def setInitialActions(self, actions): """ - Public method to set the list of actions that should appear first in the menu. + Public method to set the list of actions that should appear first in + the menu. @param actions list of initial actions (list of QAction) """
--- a/Helpviewer/Bookmarks/BookmarksModel.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Bookmarks/BookmarksModel.py Thu Oct 10 18:35:45 2013 +0200 @@ -7,8 +7,8 @@ Module implementing the bookmark model class. """ -from PyQt4.QtCore import Qt, QAbstractItemModel, QModelIndex, QUrl, QByteArray, \ - QDataStream, QIODevice, QBuffer, QMimeData +from PyQt4.QtCore import Qt, QAbstractItemModel, QModelIndex, QUrl, \ + QByteArray, QDataStream, QIODevice, QBuffer, QMimeData import UI.PixmapCache @@ -28,7 +28,8 @@ """ Constructor - @param manager reference to the bookmark manager object (BookmarksManager) + @param manager reference to the bookmark manager object + (BookmarksManager) @param parent reference to the parent object (QObject) """ super().__init__(parent) @@ -255,7 +256,8 @@ else: parentNode = itemNode.parent() - if parentNode is None or parentNode == self.__bookmarksManager.bookmarks(): + if parentNode is None or \ + parentNode == self.__bookmarksManager.bookmarks(): return QModelIndex() # get the parent's row @@ -409,7 +411,8 @@ for bookmarkNode in rootNode.children(): rootNode.remove(bookmarkNode) row = max(0, row) - self.__bookmarksManager.addBookmark(parentNode, bookmarkNode, row) + self.__bookmarksManager.addBookmark( + parentNode, bookmarkNode, row) self.__endMacro = True return True
--- a/Helpviewer/Bookmarks/BookmarksToolBar.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Bookmarks/BookmarksToolBar.py Thu Oct 10 18:35:45 2013 +0200 @@ -63,7 +63,8 @@ Private slot to rebuild the toolbar. """ self.__bookmarksModel = \ - Helpviewer.HelpWindow.HelpWindow.bookmarksManager().bookmarksModel() + Helpviewer.HelpWindow.HelpWindow.bookmarksManager()\ + .bookmarksModel() self.setModel(self.__bookmarksModel) self.setRootIndex(self.__bookmarksModel.nodeIndex( Helpviewer.HelpWindow.HelpWindow.bookmarksManager().toolbar())) @@ -82,18 +83,22 @@ v = act.data() if act.menu() is None: - menuAction = menu.addAction(self.trUtf8("&Open"), self.__openBookmark) + menuAction = menu.addAction( + self.trUtf8("&Open"), self.__openBookmark) menuAction.setData(v) - menuAction = menu.addAction(self.trUtf8("Open in New &Tab\tCtrl+LMB"), + menuAction = menu.addAction( + self.trUtf8("Open in New &Tab\tCtrl+LMB"), self.__openBookmarkInNewTab) menuAction.setData(v) menu.addSeparator() - menuAction = menu.addAction(self.trUtf8("&Remove"), self.__removeBookmark) + menuAction = menu.addAction( + self.trUtf8("&Remove"), self.__removeBookmark) menuAction.setData(v) menu.addSeparator() - menuAction = menu.addAction(self.trUtf8("&Properties..."), self.__edit) + menuAction = menu.addAction( + self.trUtf8("&Properties..."), self.__edit) menuAction.setData(v) menu.addSeparator()
--- a/Helpviewer/Bookmarks/NsHtmlReader.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Bookmarks/NsHtmlReader.py Thu Oct 10 18:35:45 2013 +0200 @@ -44,7 +44,8 @@ self.__addedRx = QRegExp('ADD_DATE="(\d*)"', Qt.CaseInsensitive) self.__addedRx.setMinimal(True) - self.__modifiedRx = QRegExp('LAST_MODIFIED="(\d*)"', Qt.CaseInsensitive) + self.__modifiedRx = QRegExp( + 'LAST_MODIFIED="(\d*)"', Qt.CaseInsensitive) self.__modifiedRx.setMinimal(True) self.__visitedRx = QRegExp('LAST_VISIT="(\d*)"', Qt.CaseInsensitive) @@ -85,7 +86,8 @@ node.title = Utilities.html_udecode(name) node.expanded = self.__foldedRx.indexIn(arguments) == -1 if self.__addedRx.indexIn(arguments) != -1: - node.added = QDateTime.fromTime_t(int(self.__addedRx.cap(1))) + node.added = QDateTime.fromTime_t( + int(self.__addedRx.cap(1))) folders.append(node) lastNode = node @@ -102,17 +104,21 @@ if self.__urlRx.indexIn(arguments) != -1: node.url = self.__urlRx.cap(1) if self.__addedRx.indexIn(arguments) != -1: - node.added = QDateTime.fromTime_t(int(self.__addedRx.cap(1))) + node.added = QDateTime.fromTime_t( + int(self.__addedRx.cap(1))) if self.__modifiedRx.indexIn(arguments) != -1: - node.modified = QDateTime.fromTime_t(int(self.__modifiedRx.cap(1))) + node.modified = QDateTime.fromTime_t( + int(self.__modifiedRx.cap(1))) if self.__visitedRx.indexIn(arguments) != -1: - node.visited = QDateTime.fromTime_t(int(self.__visitedRx.cap(1))) + node.visited = QDateTime.fromTime_t( + int(self.__visitedRx.cap(1))) lastNode = node elif self.__descRx.indexIn(line) != -1: # description if lastNode: - lastNode.desc = Utilities.html_udecode(self.__descRx.cap(1)) + lastNode.desc = Utilities.html_udecode( + self.__descRx.cap(1)) elif self.__separatorRx.indexIn(line) != -1: # separator definition
--- a/Helpviewer/Bookmarks/NsHtmlWriter.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Bookmarks/NsHtmlWriter.py Thu Oct 10 18:35:45 2013 +0200 @@ -16,7 +16,8 @@ class NsHtmlWriter(QObject): """ - Class implementing a writer object to generate Netscape HTML bookmark files. + Class implementing a writer object to generate Netscape HTML bookmark + files. """ indentSize = 4 @@ -56,7 +57,8 @@ "<!-- This is an automatically generated file.\n" " It will be read and overwritten.\n" " DO NOT EDIT! -->\n" - "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=UTF-8\">\n" + "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html;" + " charset=UTF-8\">\n" "<TITLE>Bookmarks</TITLE>\n" "<H1>Bookmarks</H1>\n" "\n" @@ -104,7 +106,8 @@ else: added = "" if node.modified.isValid(): - modified = " LAST_MODIFIED=\"{0}\"".format(node.modified.toTime_t()) + modified = " LAST_MODIFIED=\"{0}\"".format( + node.modified.toTime_t()) else: modified = "" if node.visited.isValid(): @@ -114,7 +117,8 @@ self.__dev.write(" " * indent) self.__dev.write("<DT><A HREF=\"{0}\"{1}{2}{3}>{4}</A>\n".format( - node.url, added, modified, visited, Utilities.html_uencode(node.title) + node.url, added, modified, visited, + Utilities.html_uencode(node.title) )) if node.desc: @@ -146,7 +150,8 @@ if node.desc: self.__dev.write(" " * indent) - self.__dev.write("<DD>{0}\n".format("".join(node.desc.splitlines()))) + self.__dev.write("<DD>{0}\n".format( + "".join(node.desc.splitlines()))) self.__dev.write(" " * indent) self.__dev.write("<DL><p>\n")
--- a/Helpviewer/Bookmarks/XbelReader.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Bookmarks/XbelReader.py Thu Oct 10 18:35:45 2013 +0200 @@ -7,8 +7,9 @@ Module implementing a class to read XBEL bookmark files. """ -from PyQt4.QtCore import QXmlStreamReader, QXmlStreamEntityResolver, QIODevice, \ - QFile, QCoreApplication, QXmlStreamNamespaceDeclaration, QDateTime, Qt +from PyQt4.QtCore import QXmlStreamReader, QXmlStreamEntityResolver, \ + QIODevice, QFile, QCoreApplication, QXmlStreamNamespaceDeclaration, \ + QDateTime, Qt from .BookmarkNode import BookmarkNode @@ -69,7 +70,8 @@ self.__readXBEL(root) else: self.raiseError(QCoreApplication.translate( - "XbelReader", "The file is not an XBEL version 1.0 file.")) + "XbelReader", + "The file is not an XBEL version 1.0 file.")) return root @@ -108,7 +110,8 @@ folder = BookmarkNode(BookmarkNode.Folder, node) folder.expanded = self.attributes().value("folded") == "no" - folder.added = QDateTime.fromString(self.attributes().value("added"), Qt.ISODate) + folder.added = QDateTime.fromString( + self.attributes().value("added"), Qt.ISODate) while not self.atEnd(): self.readNext() @@ -135,7 +138,8 @@ """ Private method to read the title element. - @param node reference to the bookmark node title belongs to (BookmarkNode) + @param node reference to the bookmark node title belongs to + (BookmarkNode) """ if not self.isStartElement() and self.name() != "title": return @@ -146,7 +150,8 @@ """ Private method to read the desc element. - @param node reference to the bookmark node desc belongs to (BookmarkNode) + @param node reference to the bookmark node desc belongs to + (BookmarkNode) """ if not self.isStartElement() and self.name() != "desc": return @@ -157,10 +162,12 @@ """ Private method to read a separator element. - @param node reference to the bookmark node the separator belongs to (BookmarkNode) + @param node reference to the bookmark node the separator belongs to + (BookmarkNode) """ sep = BookmarkNode(BookmarkNode.Separator, node) - sep.added = QDateTime.fromString(self.attributes().value("added"), Qt.ISODate) + sep.added = QDateTime.fromString( + self.attributes().value("added"), Qt.ISODate) # empty elements have a start and end element while not self.atEnd(): @@ -208,14 +215,15 @@ self.__skipUnknownElement() if not bookmark.title: - bookmark.title = QCoreApplication.translate("XbelReader", "Unknown title") + bookmark.title = QCoreApplication.translate( + "XbelReader", "Unknown title") def __readInfo(self): """ Private method to read and parse an info subtree. """ - self.addExtraNamespaceDeclaration( - QXmlStreamNamespaceDeclaration("bookmark", "http://www.python.org")) + self.addExtraNamespaceDeclaration(QXmlStreamNamespaceDeclaration( + "bookmark", "http://www.python.org")) self.skipCurrentElement() def __skipUnknownElement(self):
--- a/Helpviewer/Bookmarks/XbelWriter.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Bookmarks/XbelWriter.py Thu Oct 10 18:35:45 2013 +0200 @@ -85,9 +85,11 @@ if node.added.isValid(): self.writeAttribute("added", node.added.toString(Qt.ISODate)) if node.modified.isValid(): - self.writeAttribute("modified", node.modified.toString(Qt.ISODate)) + self.writeAttribute( + "modified", node.modified.toString(Qt.ISODate)) if node.visited.isValid(): - self.writeAttribute("visited", node.visited.toString(Qt.ISODate)) + self.writeAttribute( + "visited", node.visited.toString(Qt.ISODate)) self.writeTextElement("title", node.title) if node.desc: self.writeTextElement("desc", node.desc)
--- a/Helpviewer/CookieJar/CookieExceptionsModel.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/CookieJar/CookieExceptionsModel.py Thu Oct 10 18:35:45 2013 +0200 @@ -179,16 +179,19 @@ from .CookieJar import CookieJar if rule == CookieJar.Allow: - self.__addHost(host, - self.__allowedCookies, self.__blockedCookies, self.__sessionCookies) + self.__addHost( + host, self.__allowedCookies, self.__blockedCookies, + self.__sessionCookies) return elif rule == CookieJar.Block: - self.__addHost(host, - self.__blockedCookies, self.__allowedCookies, self.__sessionCookies) + self.__addHost( + host, self.__blockedCookies, self.__allowedCookies, + self.__sessionCookies) return elif rule == CookieJar.AllowForSession: - self.__addHost(host, - self.__sessionCookies, self.__allowedCookies, self.__blockedCookies) + self.__addHost( + host, self.__sessionCookies, self.__allowedCookies, + self.__blockedCookies) return def __addHost(self, host, addList, removeList1, removeList2): @@ -197,8 +200,10 @@ @param host name of the host to add (string) @param addList reference to the list to add it to (list of strings) - @param removeList1 reference to first list to remove it from (list of strings) - @param removeList2 reference to second list to remove it from (list of strings) + @param removeList1 reference to first list to remove it from + (list of strings) + @param removeList2 reference to second list to remove it from + (list of strings) """ if host not in addList: addList.append(host)
--- a/Helpviewer/CookieJar/CookieJar.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/CookieJar/CookieJar.py Thu Oct 10 18:35:45 2013 +0200 @@ -9,8 +9,8 @@ import os -from PyQt4.QtCore import pyqtSignal, QByteArray, QDataStream, QIODevice, QSettings, \ - QDateTime +from PyQt4.QtCore import pyqtSignal, QByteArray, QDataStream, QIODevice, \ + QSettings, QDateTime from PyQt4.QtNetwork import QNetworkCookieJar, QNetworkCookie from PyQt4.QtWebKit import QWebSettings @@ -21,7 +21,8 @@ class CookieJar(QNetworkCookieJar): """ - Class implementing a QNetworkCookieJar subclass with various accept policies. + Class implementing a QNetworkCookieJar subclass with various accept + policies. @signal cookiesChanged() emitted after the cookies have been changed """ @@ -186,7 +187,8 @@ Preferences.setHelp("AcceptCookies", self.__acceptCookies) Preferences.setHelp("KeepCookiesUntil", self.__keepCookies) - Preferences.setHelp("FilterTrackingCookies", self.__filterTrackingCookies) + Preferences.setHelp("FilterTrackingCookies", + self.__filterTrackingCookies) def __purgeOldCookies(self): """ @@ -244,7 +246,8 @@ self.__isOnDomainList(self.__exceptionsAllow, host) eAllowSession = not eBlock and \ not eAllow and \ - self.__isOnDomainList(self.__exceptionsAllowForSession, host) + self.__isOnDomainList( + self.__exceptionsAllowForSession, host) addedCookies = False acceptInitially = self.__acceptCookies != self.AcceptNever @@ -463,7 +466,8 @@ if self.__isOnDomainList(self.__exceptionsBlock, cookie.domain()): del cookiesList[index] changed = True - elif self.__isOnDomainList(self.__exceptionsAllowForSession, cookie.domain()): + elif self.__isOnDomainList(self.__exceptionsAllowForSession, + cookie.domain()): cookie.setExpirationDate(QDateTime()) changed = True
--- a/Helpviewer/CookieJar/CookiesConfigurationDialog.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/CookieJar/CookiesConfigurationDialog.py Thu Oct 10 18:35:45 2013 +0200 @@ -47,7 +47,8 @@ elif keepPolicy == CookieJar.KeepUntilTimeLimit: self.keepUntilCombo.setCurrentIndex(2) - self.filterTrackingCookiesCheckbox.setChecked(jar.filterTrackingCookies()) + self.filterTrackingCookiesCheckbox.setChecked( + jar.filterTrackingCookies()) def accept(self): """ @@ -72,7 +73,8 @@ jar = self.__mw.cookieJar() jar.setAcceptPolicy(acceptPolicy) jar.setKeepPolicy(keepPolicy) - jar.setFilterTrackingCookies(self.filterTrackingCookiesCheckbox.isChecked()) + jar.setFilterTrackingCookies( + self.filterTrackingCookiesCheckbox.isChecked()) super().accept()
--- a/Helpviewer/CookieJar/CookiesDialog.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/CookieJar/CookiesDialog.py Thu Oct 10 18:35:45 2013 +0200 @@ -40,7 +40,8 @@ model = CookieModel(cookieJar, self) self.__proxyModel = QSortFilterProxyModel(self) self.__proxyModel.setSourceModel(model) - self.searchEdit.textChanged.connect(self.__proxyModel.setFilterFixedString) + self.searchEdit.textChanged.connect( + self.__proxyModel.setFilterFixedString) self.cookiesTable.setModel(self.__proxyModel) self.cookiesTable.doubleClicked.connect(self.__showCookieDetails) self.cookiesTable.selectionModel().selectionChanged.connect( @@ -52,13 +53,15 @@ self.cookiesTable.verticalHeader().setDefaultSectionSize(height) self.cookiesTable.verticalHeader().setMinimumSectionSize(-1) for section in range(model.columnCount()): - header = self.cookiesTable.horizontalHeader().sectionSizeHint(section) + header = self.cookiesTable.horizontalHeader()\ + .sectionSizeHint(section) if section == 0: header = fm.width("averagebiglonghost.averagedomain.info") elif section == 1: header = fm.width("_session_id") elif section == 4: - header = fm.width(QDateTime.currentDateTime().toString(Qt.LocalDate)) + header = fm.width( + QDateTime.currentDateTime().toString(Qt.LocalDate)) buffer = fm.width("mm") header += buffer self.cookiesTable.horizontalHeader().resizeSection(section, header) @@ -91,12 +94,14 @@ secure = model.data(model.index(row, 3)) expires = model.data(model.index(row, 4)).toString("yyyy-MM-dd hh:mm") value = bytes( - QByteArray.fromPercentEncoding(model.data(model.index(row, 5)))).decode() + QByteArray.fromPercentEncoding( + model.data(model.index(row, 5)))).decode() if self.__detailsDialog is None: from .CookieDetailsDialog import CookieDetailsDialog self.__detailsDialog = CookieDetailsDialog(self) - self.__detailsDialog.setData(domain, name, path, secure, expires, value) + self.__detailsDialog.setData(domain, name, path, secure, expires, + value) self.__detailsDialog.show() @pyqtSlot()
--- a/Helpviewer/CookieJar/CookiesExceptionsDialog.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/CookieJar/CookiesExceptionsDialog.py Thu Oct 10 18:35:45 2013 +0200 @@ -8,7 +8,8 @@ """ from PyQt4.QtCore import pyqtSlot -from PyQt4.QtGui import QDialog, QSortFilterProxyModel, QCompleter, QFont, QFontMetrics +from PyQt4.QtGui import QDialog, QSortFilterProxyModel, QCompleter, QFont, \ + QFontMetrics from .CookieExceptionsModel import CookieExceptionsModel from .CookieModel import CookieModel @@ -32,14 +33,17 @@ self.__cookieJar = cookieJar - self.removeButton.clicked[()].connect(self.exceptionsTable.removeSelected) - self.removeAllButton.clicked[()].connect(self.exceptionsTable.removeAll) + self.removeButton.clicked[()].connect( + self.exceptionsTable.removeSelected) + self.removeAllButton.clicked[()].connect( + self.exceptionsTable.removeAll) self.exceptionsTable.verticalHeader().hide() self.__exceptionsModel = CookieExceptionsModel(cookieJar) self.__proxyModel = QSortFilterProxyModel(self) self.__proxyModel.setSourceModel(self.__exceptionsModel) - self.searchEdit.textChanged.connect(self.__proxyModel.setFilterFixedString) + self.searchEdit.textChanged.connect( + self.__proxyModel.setFilterFixedString) self.exceptionsTable.setModel(self.__proxyModel) cookieModel = CookieModel(cookieJar, self) @@ -52,14 +56,16 @@ self.exceptionsTable.verticalHeader().setDefaultSectionSize(height) self.exceptionsTable.verticalHeader().setMinimumSectionSize(-1) for section in range(self.__exceptionsModel.columnCount()): - header = self.exceptionsTable.horizontalHeader().sectionSizeHint(section) + header = self.exceptionsTable.horizontalHeader()\ + .sectionSizeHint(section) if section == 0: header = fm.width("averagebiglonghost.averagedomain.info") elif section == 1: header = fm.width(self.trUtf8("Allow For Session")) buffer = fm.width("mm") header += buffer - self.exceptionsTable.horizontalHeader().resizeSection(section, header) + self.exceptionsTable.horizontalHeader()\ + .resizeSection(section, header) def setDomainName(self, domain): """ @@ -95,7 +101,8 @@ Private slot to allow cookies of a domain for the current session only. """ from .CookieJar import CookieJar - self.__exceptionsModel.addRule(self.domainEdit.text(), CookieJar.AllowForSession) + self.__exceptionsModel.addRule(self.domainEdit.text(), + CookieJar.AllowForSession) @pyqtSlot() def on_allowButton_clicked(self):
--- a/Helpviewer/Download/DownloadItem.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Download/DownloadItem.py Thu Oct 10 18:35:45 2013 +0200 @@ -7,8 +7,8 @@ Module implementing a widget controlling a download. """ -from PyQt4.QtCore import pyqtSlot, pyqtSignal, Qt, QTime, QFile, QFileInfo, QUrl, \ - QIODevice, QCryptographicHash +from PyQt4.QtCore import pyqtSlot, pyqtSignal, Qt, QTime, QFile, QFileInfo, \ + QUrl, QIODevice, QCryptographicHash from PyQt4.QtGui import QWidget, QPalette, QStyle, QDesktopServices, QDialog from PyQt4.QtNetwork import QNetworkRequest, QNetworkReply @@ -44,9 +44,10 @@ Constructor @keyparam reply reference to the network reply object (QNetworkReply) - @keyparam requestFilename flag indicating to ask the user for a filename (boolean) - @keyparam webPage reference to the web page object the download originated - from (QWebPage) + @keyparam requestFilename flag indicating to ask the user for a + filename (boolean) + @keyparam webPage reference to the web page object the download + originated from (QWebPage) @keyparam download flag indicating a download operation (boolean) @keyparam parent reference to the parent widget (QWidget) @keyparam mainWindow reference to the main window (HelpWindow) @@ -60,7 +61,8 @@ self.progressBar.setMaximum(0) - self.__isFtpDownload = reply is not None and reply.url().scheme() == "ftp" + self.__isFtpDownload = reply is not None and \ + reply.url().scheme() == "ftp" self.tryAgainButton.setIcon(UI.PixmapCache.getIcon("restart.png")) self.tryAgainButton.setEnabled(False) @@ -103,7 +105,8 @@ self.__md5Hash = QCryptographicHash(QCryptographicHash.Md5) if not requestFilename: - self.__requestFilename = Preferences.getUI("RequestDownloadFilename") + self.__requestFilename = \ + Preferences.getUI("RequestDownloadFilename") self.__initialize() @@ -163,7 +166,8 @@ self.__toDownload = True ask = False else: - defaultFileName, originalFileName = self.__saveFileName(downloadDirectory) + defaultFileName, originalFileName = \ + self.__saveFileName(downloadDirectory) fileName = defaultFileName self.__originalFileName = originalFileName ask = True @@ -180,8 +184,9 @@ self.progressBar.setVisible(False) self.__reply.close() self.on_stopButton_clicked() - self.filenameLabel.setText(self.trUtf8("Download canceled: {0}").format( - QFileInfo(defaultFileName).fileName())) + self.filenameLabel.setText( + self.trUtf8("Download canceled: {0}").format( + QFileInfo(defaultFileName).fileName())) self.__canceledFileSelect = True return @@ -198,8 +203,9 @@ return self.__autoOpen = dlg.getAction() == "open" - fileName = QDesktopServices.storageLocation(QDesktopServices.TempLocation) + \ - '/' + QFileInfo(fileName).completeBaseName() + fileName = QDesktopServices.storageLocation( + QDesktopServices.TempLocation) + \ + '/' + QFileInfo(fileName).completeBaseName() if ask and not self.__autoOpen and self.__requestFilename: self.__gettingFileName = True @@ -213,14 +219,15 @@ self.progressBar.setVisible(False) self.__reply.close() self.on_stopButton_clicked() - self.filenameLabel.setText(self.trUtf8("Download canceled: {0}")\ - .format(QFileInfo(defaultFileName).fileName())) + self.filenameLabel.setText( + self.trUtf8("Download canceled: {0}")\ + .format(QFileInfo(defaultFileName).fileName())) self.__canceledFileSelect = True return fileInfo = QFileInfo(fileName) - Helpviewer.HelpWindow.HelpWindow.downloadManager().setDownloadDirectory( - fileInfo.absoluteDir().absolutePath()) + Helpviewer.HelpWindow.HelpWindow.downloadManager()\ + .setDownloadDirectory(fileInfo.absoluteDir().absolutePath()) self.filenameLabel.setText(fileInfo.fileName()) self.__output.setFileName(fileName + ".part") @@ -232,8 +239,8 @@ if not saveDirPath.mkpath(saveDirPath.absolutePath()): self.progressBar.setVisible(False) self.on_stopButton_clicked() - self.infoLabel.setText( - self.trUtf8("Download directory ({0}) couldn't be created.")\ + self.infoLabel.setText(self.trUtf8( + "Download directory ({0}) couldn't be created.")\ .format(saveDirPath.absolutePath())) return @@ -250,7 +257,8 @@ """ path = "" if self.__reply.hasRawHeader("Content-Disposition"): - header = bytes(self.__reply.rawHeader("Content-Disposition")).decode() + header = bytes(self.__reply.rawHeader("Content-Disposition"))\ + .decode() if header: pos = header.find("filename=") if pos != -1: @@ -407,7 +415,8 @@ if not self.__requestFilename: self.__getFileName() if not self.__output.open(QIODevice.WriteOnly): - self.infoLabel.setText(self.trUtf8("Error opening save file: {0}")\ + self.infoLabel.setText( + self.trUtf8("Error opening save file: {0}")\ .format(self.__output.errorString())) self.on_stopButton_clicked() self.statusChanged.emit() @@ -445,8 +454,8 @@ if locationHeader and locationHeader.isValid(): self.__url = QUrl(locationHeader) import Helpviewer.HelpWindow - self.__reply = Helpviewer.HelpWindow.HelpWindow.networkAccessManager().get( - QNetworkRequest(self.__url)) + self.__reply = Helpviewer.HelpWindow.HelpWindow\ + .networkAccessManager().get(QNetworkRequest(self.__url)) self.__initialize() def __downloadProgress(self, bytesReceived, bytesTotal): @@ -476,7 +485,8 @@ @return total number of bytes (integer) """ if self.__bytesTotal == -1: - self.__bytesTotal = self.__reply.header(QNetworkRequest.ContentLengthHeader) + self.__bytesTotal = self.__reply.header( + QNetworkRequest.ContentLengthHeader) if self.__bytesTotal is None: self.__bytesTotal = -1 return self.__bytesTotal @@ -501,7 +511,8 @@ if self.bytesTotal() == -1: return -1.0 - timeRemaining = (self.bytesTotal() - self.bytesReceived()) / self.currentSpeed() + timeRemaining = (self.bytesTotal() - + self.bytesReceived()) / self.currentSpeed() # ETA should never be 0 if timeRemaining == 0: @@ -551,8 +562,11 @@ if self.__bytesReceived == bytesTotal or bytesTotal == -1: info = self.trUtf8("{0} downloaded\nSHA1: {1}\nMD5: {2}")\ .format(dataString(self.__output.size()), - str(self.__sha1Hash.result().toHex(), encoding="ascii"), - str(self.__md5Hash.result().toHex(), encoding="ascii")) + str(self.__sha1Hash.result().toHex(), + encoding="ascii"), + str(self.__md5Hash.result().toHex(), + encoding="ascii") + ) else: info = self.trUtf8("{0} of {1} - Stopped")\ .format(dataString(self.__bytesReceived),
--- a/Helpviewer/Download/DownloadManager.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Download/DownloadManager.py Thu Oct 10 18:35:45 2013 +0200 @@ -5,7 +5,8 @@ """ from PyQt4.QtCore import pyqtSlot, Qt, QModelIndex, QFileInfo -from PyQt4.QtGui import QDialog, QStyle, QFileIconProvider, QMenu, QCursor, QApplication +from PyQt4.QtGui import QDialog, QStyle, QFileIconProvider, QMenu, QCursor, \ + QApplication from PyQt4.QtNetwork import QNetworkRequest from PyQt4.QtWebKit import QWebSettings @@ -42,7 +43,8 @@ self.__saveTimer = AutoSaver(self, self.save) self.__model = DownloadModel(self) - self.__manager = Helpviewer.HelpWindow.HelpWindow.networkAccessManager() + self.__manager = Helpviewer.HelpWindow.HelpWindow\ + .networkAccessManager() self.__iconProvider = None self.__downloads = [] @@ -71,7 +73,8 @@ """ menu = QMenu() - selectedRowsCount = len(self.downloadsView.selectionModel().selectedRows()) + selectedRowsCount = len( + self.downloadsView.selectionModel().selectedRows()) if selectedRowsCount == 1: row = self.downloadsView.selectionModel().selectedRows()[0].row() @@ -285,7 +288,8 @@ (DownloadManager.RemoveExit, DownloadManager.RemoveNever, DownloadManager.RemoveSuccessFullDownload) """ - assert policy in (DownloadManager.RemoveExit, DownloadManager.RemoveNever, + assert policy in (DownloadManager.RemoveExit, + DownloadManager.RemoveNever, DownloadManager.RemoveSuccessFullDownload) if policy == self.removePolicy(): @@ -372,7 +376,8 @@ """ count = self.activeDownloads() if count > 0: - self.setWindowTitle(self.trUtf8("Downloading %n file(s)", "", count)) + self.setWindowTitle( + self.trUtf8("Downloading %n file(s)", "", count)) else: self.setWindowTitle(self.trUtf8("Downloads")) @@ -425,9 +430,9 @@ self.__saveTimer.changeOccurred() self.__updateItemCount() - ############################################################################ + ########################################################################### ## Context menu related methods below - ############################################################################ + ########################################################################### def __currentItem(self): """
--- a/Helpviewer/Download/DownloadModel.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Download/DownloadModel.py Thu Oct 10 18:35:45 2013 +0200 @@ -37,7 +37,8 @@ return None if role == Qt.ToolTipRole: - if self.__manager.downloads()[index.row()].downloadedSuccessfully(): + if self.__manager.downloads()[index.row()]\ + .downloadedSuccessfully(): return self.__manager.downloads()[index.row()].getInfoData() return None
--- a/Helpviewer/Feeds/FeedsDialog.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Feeds/FeedsDialog.py Thu Oct 10 18:35:45 2013 +0200 @@ -25,7 +25,8 @@ """ Constructor - @param availableFeeds list of available RSS feeds (list of tuple of two strings) + @param availableFeeds list of available RSS feeds (list of tuple of + two strings) @param browser reference to the browser widget (HelpBrowser) @param parent reference to the parent widget (QWidget) """
--- a/Helpviewer/Feeds/FeedsManager.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Feeds/FeedsManager.py Thu Oct 10 18:35:45 2013 +0200 @@ -8,7 +8,8 @@ """ from PyQt4.QtCore import pyqtSlot, pyqtSignal, Qt, QUrl, QXmlStreamReader -from PyQt4.QtGui import QDialog, QIcon, QTreeWidgetItem, QMenu, QCursor, QApplication +from PyQt4.QtGui import QDialog, QIcon, QTreeWidgetItem, QMenu, QCursor, \ + QApplication from PyQt4.QtNetwork import QNetworkRequest, QNetworkReply from PyQt4.QtWebKit import QWebSettings @@ -86,7 +87,8 @@ # step 2: add the feed if icon.isNull() or \ - icon == QIcon(QWebSettings.webGraphic(QWebSettings.DefaultFrameIconGraphic)): + icon == QIcon(QWebSettings.webGraphic( + QWebSettings.DefaultFrameIconGraphic)): icon = UI.PixmapCache.getIcon("rss16.png") feed = (urlString, title, icon) self.__feeds.append(feed) @@ -172,8 +174,9 @@ if feed[0] == urlString: E5MessageBox.critical(self, self.trUtf8("Duplicate Feed URL"), - self.trUtf8("""A feed with the URL {0} exists already.""" - """ Aborting...""".format(urlString))) + self.trUtf8( + """A feed with the URL {0} exists already.""" + """ Aborting...""".format(urlString))) return self.__feeds[feedIndex] = (urlString, title, feedToChange[2]) @@ -193,8 +196,8 @@ res = E5MessageBox.yesNo(self, self.trUtf8("Delete Feed"), self.trUtf8( - """<p>Do you really want to delete the feed <b>{0}</b>?</p>""".format( - title))) + """<p>Do you really want to delete the feed""" + """ <b>{0}</b>?</p>""".format(title))) if res: urlString = itm.data(0, FeedsManager.UrlStringRole) if urlString: @@ -249,7 +252,8 @@ import Helpviewer.HelpWindow request = QNetworkRequest(QUrl(urlString)) - reply = Helpviewer.HelpWindow.HelpWindow.networkAccessManager().get(request) + reply = Helpviewer.HelpWindow.HelpWindow.networkAccessManager()\ + .get(request) reply.finished[()].connect(self.__feedLoaded) self.__replies[id(reply)] = (reply, itm) @@ -299,7 +303,8 @@ itm = QTreeWidgetItem(topItem) itm.setText(0, self.trUtf8("Error fetching feed")) itm.setData(0, FeedsManager.UrlStringRole, "") - itm.setData(0, FeedsManager.ErrorDataRole, str(xmlData, encoding="utf-8")) + itm.setData(0, FeedsManager.ErrorDataRole, + str(xmlData, encoding="utf-8")) topItem.setExpanded(True) else: @@ -326,8 +331,10 @@ urlString = itm.data(0, FeedsManager.UrlStringRole) if urlString: menu = QMenu() - menu.addAction(self.trUtf8("&Open"), self.__openMessageInCurrentTab) - menu.addAction(self.trUtf8("Open in New &Tab"), self.__openMessageInNewTab) + menu.addAction( + self.trUtf8("&Open"), self.__openMessageInCurrentTab) + menu.addAction( + self.trUtf8("Open in New &Tab"), self.__openMessageInNewTab) menu.addSeparator() menu.addAction(self.trUtf8("&Copy URL to Clipboard"), self.__copyUrlToClipboard) @@ -336,7 +343,8 @@ errorString = itm.data(0, FeedsManager.ErrorDataRole) if errorString: menu = QMenu() - menu.addAction(self.trUtf8("&Show error data"), self.__showError) + menu.addAction( + self.trUtf8("&Show error data"), self.__showError) menu.exec_(QCursor.pos()) def __itemActivated(self, itm, column): @@ -350,7 +358,8 @@ return self.__openMessage( - QApplication.keyboardModifiers() & Qt.ControlModifier == Qt.ControlModifier) + QApplication.keyboardModifiers() & + Qt.ControlModifier == Qt.ControlModifier) def __openMessageInCurrentTab(self): """ @@ -368,7 +377,8 @@ """ Private method to open a feed message. - @param newTab flag indicating to open the feed message in a new tab (boolean) + @param newTab flag indicating to open the feed message in a new tab + (boolean) """ itm = self.feedsTree.currentItem() if itm is None:
--- a/Helpviewer/GreaseMonkey/GreaseMonkeyAddScriptDialog.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/GreaseMonkey/GreaseMonkeyAddScriptDialog.py Thu Oct 10 18:35:45 2013 +0200 @@ -28,14 +28,16 @@ """ Constructor - @param manager reference to the GreaseMonkey manager (GreaseMonkeyManager) + @param manager reference to the GreaseMonkey manager + (GreaseMonkeyManager) @param script GreaseMonkey script to be added (GreaseMonkeyScript) @param parent reference to the parent widget (QWidget) """ super().__init__(parent) self.setupUi(self) - self.iconLabel.setPixmap(UI.PixmapCache.getPixmap("greaseMonkey48.png")) + self.iconLabel.setPixmap( + UI.PixmapCache.getPixmap("greaseMonkey48.png")) self.__manager = manager self.__script = script @@ -51,11 +53,13 @@ "<br/>".join(include)) if exclude: - doesNotRunAt = self.trUtf8("<p>does not run at:<br/><i>{0}</i></p>").format( - "<br/>".join(exclude)) + doesNotRunAt = self.trUtf8( + "<p>does not run at:<br/><i>{0}</i></p>").format( + "<br/>".join(exclude)) scriptInfoTxt = "<p><b>{0}</b> {1}<br/>{2}</p>{3}{4}".format( - script.name(), script.version(), script.description(), runsAt, doesNotRunAt) + script.name(), script.version(), script.description(), runsAt, + doesNotRunAt) self.scriptInfo.setHtml(scriptInfoTxt) self.accepted.connect(self.__accepted) @@ -79,7 +83,8 @@ Private slot handling the accepted signal. """ if self.__manager.addScript(self.__script): - msg = self.trUtf8("<p><b>{0}</b> installed successfully.</p>").format( + msg = self.trUtf8( + "<p><b>{0}</b> installed successfully.</p>").format( self.__script.name()) success = True else:
--- a/Helpviewer/GreaseMonkey/GreaseMonkeyConfiguration/GreaseMonkeyConfigurationDialog.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/GreaseMonkey/GreaseMonkeyConfiguration/GreaseMonkeyConfigurationDialog.py Thu Oct 10 18:35:45 2013 +0200 @@ -12,12 +12,14 @@ from E5Gui import E5MessageBox -from .Ui_GreaseMonkeyConfigurationDialog import Ui_GreaseMonkeyConfigurationDialog +from .Ui_GreaseMonkeyConfigurationDialog import \ + Ui_GreaseMonkeyConfigurationDialog import UI.PixmapCache -class GreaseMonkeyConfigurationDialog(QDialog, Ui_GreaseMonkeyConfigurationDialog): +class GreaseMonkeyConfigurationDialog( + QDialog, Ui_GreaseMonkeyConfigurationDialog): """ Class implementing the GreaseMonkey scripts configuration dialog. """ @@ -35,7 +37,8 @@ super().__init__(parent) self.setupUi(self) - self.iconLabel.setPixmap(UI.PixmapCache.getPixmap("greaseMonkey48.png")) + self.iconLabel.setPixmap( + UI.PixmapCache.getPixmap("greaseMonkey48.png")) self.__manager = manager @@ -49,7 +52,8 @@ """ Private slot to open the GreaseMonkey scripts directory. """ - QDesktopServices.openUrl(QUrl.fromLocalFile(self.__manager.scriptsDirectory())) + QDesktopServices.openUrl( + QUrl.fromLocalFile(self.__manager.scriptsDirectory())) @pyqtSlot(str) def on_downloadLabel_linkActivated(self, link): @@ -139,7 +143,8 @@ removeIt = E5MessageBox.yesNo(self, self.trUtf8("Remove Script"), - self.trUtf8("""<p>Are you sure you want to remove <b>{0}</b>?</p>""") + self.trUtf8( + """<p>Are you sure you want to remove <b>{0}</b>?</p>""") .format(script.name())) if removeIt and self.__manager.removeScript(script): self.scriptsList.takeItem(self.scriptsList.row(itm))
--- a/Helpviewer/GreaseMonkey/GreaseMonkeyConfiguration/GreaseMonkeyConfigurationListDelegate.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/GreaseMonkey/GreaseMonkeyConfiguration/GreaseMonkeyConfigurationListDelegate.py Thu Oct 10 18:35:45 2013 +0200 @@ -4,12 +4,13 @@ # """ -Module implementing a delegate for the special list widget for GreaseMonkey scripts. +Module implementing a delegate for the special list widget for GreaseMonkey +scripts. """ from PyQt4.QtCore import Qt, QSize, QRect -from PyQt4.QtGui import QStyle, QStyledItemDelegate, QApplication, QFontMetrics, \ - QPalette, QFont, QStyleOptionViewItemV4 +from PyQt4.QtGui import QStyle, QStyledItemDelegate, QApplication, \ + QFontMetrics, QPalette, QFont, QStyleOptionViewItemV4 import UI.PixmapCache import Globals @@ -17,7 +18,8 @@ class GreaseMonkeyConfigurationListDelegate(QStyledItemDelegate): """ - Class implementing a delegate for the special list widget for GreaseMonkey scripts. + Class implementing a delegate for the special list widget for GreaseMonkey + scripts. """ IconSize = 32 RemoveIconSize = 16 @@ -33,8 +35,9 @@ """ super().__init__(parent) - self.__removePixmap = UI.PixmapCache.getIcon("greaseMonkeyTrash.png").pixmap( - GreaseMonkeyConfigurationListDelegate.RemoveIconSize) + self.__removePixmap = \ + UI.PixmapCache.getIcon("greaseMonkeyTrash.png").pixmap( + GreaseMonkeyConfigurationListDelegate.RemoveIconSize) self.__rowHeight = 0 self.__padding = 0 @@ -82,7 +85,8 @@ style.drawPrimitive(QStyle.PE_PanelItemViewItem, opt, painter, widget) # Draw checkbox - checkBoxYPos = center - GreaseMonkeyConfigurationListDelegate.CheckBoxSize // 2 + checkBoxYPos = center - \ + GreaseMonkeyConfigurationListDelegate.CheckBoxSize // 2 opt2 = QStyleOptionViewItemV4(opt) if opt2.checkState == Qt.Checked: opt2.state |= QStyle.State_On @@ -92,7 +96,8 @@ QStyle.SE_ViewItemCheckIndicator, opt2, widget) opt2.rect = QRect(leftPos, checkBoxYPos, styleCheckBoxRect.width(), styleCheckBoxRect.height()) - style.drawPrimitive(QStyle.PE_IndicatorViewItemCheck, opt2, painter, widget) + style.drawPrimitive(QStyle.PE_IndicatorViewItemCheck, opt2, painter, + widget) leftPos = opt2.rect.right() + self.__padding # Draw icon @@ -122,15 +127,15 @@ rightTitleEdge - leftTitleEdge, titleMetrics.height()) versionFont = titleFont painter.setFont(versionFont) - style.drawItemText(painter, versionRect, Qt.AlignLeft, opt.palette, True, - version, colorRole) + style.drawItemText(painter, versionRect, Qt.AlignLeft, opt.palette, + True, version, colorRole) # Draw description infoYPos = nameRect.bottom() + opt.fontMetrics.leading() infoRect = QRect(nameRect.x(), infoYPos, nameRect.width(), opt.fontMetrics.height()) - info = opt.fontMetrics.elidedText(index.data(Qt.UserRole + 1), Qt.ElideRight, - infoRect.width()) + info = opt.fontMetrics.elidedText( + index.data(Qt.UserRole + 1), Qt.ElideRight, infoRect.width()) painter.setFont(opt.font) style.drawItemText(painter, infoRect, Qt.AlignLeft | Qt.TextSingleLine, opt.palette, True, info, colorRole) @@ -156,7 +161,8 @@ self.initStyleOption(opt, index) widget = opt.widget - style = widget.style() if widget is not None else QApplication.style() + style = widget.style() if widget is not None \ + else QApplication.style() padding = style.pixelMetric(QStyle.PM_FocusFrameHMargin) + 1 titleFont = opt.font @@ -164,8 +170,8 @@ titleFont.setPointSize(titleFont.pointSize() + 1) self.__padding = padding \ - if padding > GreaseMonkeyConfigurationListDelegate.MinPadding else \ - GreaseMonkeyConfigurationListDelegate.MinPadding + if padding > GreaseMonkeyConfigurationListDelegate.MinPadding \ + else GreaseMonkeyConfigurationListDelegate.MinPadding titleMetrics = QFontMetrics(titleFont) @@ -174,4 +180,5 @@ opt.fontMetrics.height() + \ titleMetrics.height() - return QSize(GreaseMonkeyConfigurationListDelegate.ItemWidth, self.__rowHeight) + return QSize(GreaseMonkeyConfigurationListDelegate.ItemWidth, + self.__rowHeight)
--- a/Helpviewer/GreaseMonkey/GreaseMonkeyConfiguration/GreaseMonkeyConfigurationListWidget.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/GreaseMonkey/GreaseMonkeyConfiguration/GreaseMonkeyConfigurationListWidget.py Thu Oct 10 18:35:45 2013 +0200 @@ -10,7 +10,8 @@ from PyQt4.QtCore import pyqtSignal, QRect from PyQt4.QtGui import QListWidget, QListWidgetItem -from .GreaseMonkeyConfigurationListDelegate import GreaseMonkeyConfigurationListDelegate +from .GreaseMonkeyConfigurationListDelegate import \ + GreaseMonkeyConfigurationListDelegate class GreaseMonkeyConfigurationListWidget(QListWidget): @@ -32,7 +33,8 @@ def __containsRemoveIcon(self, pos): """ - Private method to check, if the given position is inside the remove icon. + Private method to check, if the given position is inside the remove + icon. @param pos position to check for (QPoint) @return flag indicating success (boolean) @@ -47,7 +49,8 @@ center = rect.height() // 2 + rect.top() removeIconYPos = center - iconSize // 2 - removeIconRect = QRect(removeIconXPos, removeIconYPos, iconSize, iconSize) + removeIconRect = QRect(removeIconXPos, removeIconYPos, + iconSize, iconSize) return removeIconRect.contains(pos) def mousePressEvent(self, evt):
--- a/Helpviewer/GreaseMonkey/GreaseMonkeyConfiguration/GreaseMonkeyConfigurationScriptInfoDialog.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/GreaseMonkey/GreaseMonkeyConfiguration/GreaseMonkeyConfigurationScriptInfoDialog.py Thu Oct 10 18:35:45 2013 +0200 @@ -33,11 +33,13 @@ super().__init__(parent) self.setupUi(self) - self.iconLabel.setPixmap(UI.PixmapCache.getPixmap("greaseMonkey48.png")) + self.iconLabel.setPixmap( + UI.PixmapCache.getPixmap("greaseMonkey48.png")) self.__scriptFileName = script.fileName() - self.setWindowTitle(self.trUtf8("Script Details of {0}").format(script.name())) + self.setWindowTitle( + self.trUtf8("Script Details of {0}").format(script.name())) self.nameLabel.setText(script.fullName()) self.versionLabel.setText(script.version())
--- a/Helpviewer/GreaseMonkey/GreaseMonkeyDownloader.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/GreaseMonkey/GreaseMonkeyDownloader.py Thu Oct 10 18:35:45 2013 +0200 @@ -30,7 +30,8 @@ Constructor @param request reference to the request object (QNetworkRequest) - @param manager reference to the GreaseMonkey manager (GreaseMonkeyManager) + @param manager reference to the GreaseMonkey manager + (GreaseMonkeyManager) """ super().__init__() @@ -65,17 +66,19 @@ except (IOError, OSError) as err: E5MessageBox.critical(None, self.trUtf8("GreaseMonkey Download"), - self.trUtf8("""<p>The file <b>{0}</b> could not be opened""" - """ for writing.<br/>Reason: {1}</p>""").format( - self.__fileName, str(err))) + self.trUtf8( + """<p>The file <b>{0}</b> could not be opened""" + """ for writing.<br/>Reason: {1}</p>""").format( + self.__fileName, str(err))) self.finished.emit() return f.write(response) f.close() - settings = QSettings(os.path.join(self.__manager.requireScriptsDirectory(), - "requires.ini"), - QSettings.IniFormat) + settings = QSettings( + os.path.join(self.__manager.requireScriptsDirectory(), + "requires.ini"), + QSettings.IniFormat) settings.beginGroup("Files") rx = QRegExp("@require(.*)\\n") @@ -113,17 +116,19 @@ except (IOError, OSError) as err: E5MessageBox.critical(None, self.trUtf8("GreaseMonkey Download"), - self.trUtf8("""<p>The file <b>{0}</b> could not be opened""" - """ for writing.<br/>Reason: {1}</p>""").format( - fileName, str(err))) + self.trUtf8( + """<p>The file <b>{0}</b> could not be opened""" + """ for writing.<br/>Reason: {1}</p>""").format( + fileName, str(err))) self.finished.emit() return f.write(response) f.close() - settings = QSettings(os.path.join(self.__manager.requireScriptsDirectory(), - "requires.ini"), - QSettings.IniFormat) + settings = QSettings( + os.path.join(self.__manager.requireScriptsDirectory(), + "requires.ini"), + QSettings.IniFormat) settings.beginGroup("Files") settings.setValue(self.__reply.originalUrl().toString(), fileName) @@ -147,13 +152,15 @@ if script.isValid(): if not self.__manager.containsScript(script.fullName()): - from .GreaseMonkeyAddScriptDialog import GreaseMonkeyAddScriptDialog + from .GreaseMonkeyAddScriptDialog import \ + GreaseMonkeyAddScriptDialog dlg = GreaseMonkeyAddScriptDialog(self.__manager, script) deleteScript = dlg.exec_() != QDialog.Accepted else: E5MessageBox.information(None, self.trUtf8("GreaseMonkey Download"), - self.trUtf8("""<p><b>{0}</b> is already installed.</p>""") + self.trUtf8( + """<p><b>{0}</b> is already installed.</p>""") .format(script.name())) if deleteScript:
--- a/Helpviewer/GreaseMonkey/GreaseMonkeyJavaScript.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/GreaseMonkey/GreaseMonkeyJavaScript.py Thu Oct 10 18:35:45 2013 +0200 @@ -21,7 +21,9 @@ // run it if(oXhr) { if("onreadystatechange" in details) - oXhr.onreadystatechange = function() { details.onreadystatechange(oXhr) }; + oXhr.onreadystatechange = function() { + details.onreadystatechange(oXhr) + }; if("onload" in details) oXhr.onload = function() { details.onload(oXhr) }; if("onerror" in details) @@ -48,10 +50,10 @@ if (head === undefined) { document.onreadystatechange = function() { if (document.readyState == "interactive") { - var oStyle = document.createElement("style"); - oStyle.setAttribute("type", "text\/css"); - oStyle.appendChild(document.createTextNode(styles)); - document.getElementsByTagName("head")[0].appendChild(oStyle); + var oStyle = document.createElement("style"); + oStyle.setAttribute("type", "text\/css"); + oStyle.appendChild(document.createTextNode(styles)); + document.getElementsByTagName("head")[0].appendChild(oStyle); } } }
--- a/Helpviewer/GreaseMonkey/GreaseMonkeyManager.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/GreaseMonkey/GreaseMonkeyManager.py Thu Oct 10 18:35:45 2013 +0200 @@ -9,8 +9,8 @@ import os -from PyQt4.QtCore import pyqtSignal, QObject, QTimer, QFile, QDir, QSettings, QUrl, \ - QByteArray +from PyQt4.QtCore import pyqtSignal, QObject, QTimer, QFile, QDir, QSettings, \ + QUrl, QByteArray from PyQt4.QtNetwork import QNetworkAccessManager import Utilities @@ -44,8 +44,8 @@ @param parent reference to the parent widget (QWidget) """ - from .GreaseMonkeyConfiguration.GreaseMonkeyConfigurationDialog import \ - GreaseMonkeyConfigurationDialog + from .GreaseMonkeyConfiguration.GreaseMonkeyConfigurationDialog \ + import GreaseMonkeyConfigurationDialog self.__configDiaolg = GreaseMonkeyConfigurationDialog(self, parent) self.__configDiaolg.show() @@ -76,7 +76,8 @@ @return path of the scripts directory (string) """ - return os.path.join(Utilities.getConfigDir(), "browser", "greasemonkey") + return os.path.join( + Utilities.getConfigDir(), "browser", "greasemonkey") def requireScriptsDirectory(self): """ @@ -99,8 +100,9 @@ script = "" - settings = QSettings(os.path.join(self.requireScriptsDirectory(), "requires.ini"), - QSettings.IniFormat) + settings = QSettings( + os.path.join(self.requireScriptsDirectory(), "requires.ini"), + QSettings.IniFormat) settings.beginGroup("Files") for url in urlList: if settings.contains(url): @@ -119,7 +121,8 @@ """ Public method to save the configuration. """ - Preferences.setHelp("GreaseMonkeyDisabledScripts", self.__disabledScripts) + Preferences.setHelp("GreaseMonkeyDisabledScripts", + self.__disabledScripts) def allScripts(self): """ @@ -261,7 +264,8 @@ if not scriptsDir.exists("requires"): scriptsDir.mkdir("requires") - self.__disabledScripts = Preferences.getHelp("GreaseMonkeyDisabledScripts") + self.__disabledScripts = \ + Preferences.getHelp("GreaseMonkeyDisabledScripts") from .GreaseMonkeyScript import GreaseMonkeyScript for fileName in scriptsDir.entryList(["*.js"], QDir.Files): @@ -282,13 +286,15 @@ @param page reference to the web page (HelpWebPage) """ - page.mainFrame().javaScriptWindowObjectCleared.connect(self.pageLoadStarted) + page.mainFrame().javaScriptWindowObjectCleared.connect( + self.pageLoadStarted) def createRequest(self, op, request, outgoingData=None): """ Public method to create a request. - @param op the operation to be performed (QNetworkAccessManager.Operation) + @param op the operation to be performed + (QNetworkAccessManager.Operation) @param request reference to the request object (QNetworkRequest) @param outgoingData reference to an IODevice containing data to be sent (QIODevice) @@ -296,10 +302,12 @@ """ if op == QNetworkAccessManager.GetOperation and \ request.rawHeader("X-Eric5-UserLoadAction") == QByteArray("1"): - urlString = request.url().toString(QUrl.RemoveFragment | QUrl.RemoveQuery) + urlString = request.url().toString( + QUrl.RemoveFragment | QUrl.RemoveQuery) if urlString.endswith(".user.js"): self.downloadScript(request) - from Helpviewer.Network.EmptyNetworkReply import EmptyNetworkReply + from Helpviewer.Network.EmptyNetworkReply import \ + EmptyNetworkReply return EmptyNetworkReply(self) return None
--- a/Helpviewer/GreaseMonkey/GreaseMonkeyScript.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/GreaseMonkey/GreaseMonkeyScript.py Thu Oct 10 18:35:45 2013 +0200 @@ -186,7 +186,8 @@ def __parseScript(self, path): """ - Private method to parse the given script and populate the data structure. + Private method to parse the given script and populate the data + structure. @param path path of the Javascript file (string) """
--- a/Helpviewer/GreaseMonkey/GreaseMonkeyUrlMatcher.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/GreaseMonkey/GreaseMonkeyUrlMatcher.py Thu Oct 10 18:35:45 2013 +0200 @@ -93,14 +93,18 @@ self.__regExp = QRegExp(pattern, Qt.CaseInsensitive) self.__useRegExp = True elif ".tld" in pattern: - pattern = re.sub(r"(\W)", r"\\\1", pattern) # escape special symbols - pattern = re.sub(r"\*+", "*", pattern) # remove multiple wildcards - pattern = re.sub(r"^\\\|", "^", pattern) # process anchor at expression - # start - pattern = re.sub(r"\\\|$", "$", pattern) # process anchor at expression - # end - pattern = re.sub(r"\\\*", ".*", pattern) # replace wildcards by .* - pattern = re.sub(r"\.tld", r"\.[a-z.]{2,6}") # replace domain pattern + # escape special symbols + pattern = re.sub(r"(\W)", r"\\\1", pattern) + # remove multiple wildcards + pattern = re.sub(r"\*+", "*", pattern) + # process anchor at expression start + pattern = re.sub(r"^\\\|", "^", pattern) + # process anchor at expression end + pattern = re.sub(r"\\\|$", "$", pattern) + # replace wildcards by .* + pattern = re.sub(r"\\\*", ".*", pattern) + # replace domain pattern + pattern = re.sub(r"\.tld", r"\.[a-z.]{2,6}") self.__useRegExp = True self.__regExp = QRegExp(pattern, Qt.CaseInsensitive)
--- a/Helpviewer/History/HistoryCompleter.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/History/HistoryCompleter.py Thu Oct 10 18:35:45 2013 +0200 @@ -76,7 +76,8 @@ super().__init__(parent) self.__searchString = "" - self.__searchMatcher = QRegExp("", Qt.CaseInsensitive, QRegExp.FixedString) + self.__searchMatcher = QRegExp( + "", Qt.CaseInsensitive, QRegExp.FixedString) self.__wordMatcher = QRegExp("", Qt.CaseInsensitive) self.__isValid = False @@ -90,8 +91,8 @@ @param role data role (integer) @return history entry data """ - # If the model is valid, tell QCompleter that everything we have filtered - # matches what the user typed; if not, nothing matches + # If the model is valid, tell QCompleter that everything we have + # filtered matches what the user typed; if not, nothing matches if role == self.HistoryCompletionRole and index.isValid(): if self.isValid(): return "t" @@ -125,7 +126,8 @@ self.__searchString = string self.__searchMatcher.setPattern(self.__searchString) - self.__wordMatcher.setPattern("\\b" + QRegExp.escape(self.__searchString)) + self.__wordMatcher.setPattern( + "\\b" + QRegExp.escape(self.__searchString)) self.invalidateFilter() def isValid(self): @@ -148,7 +150,8 @@ self.__isValid = valid # tell the history completer that the model has changed - self.dataChanged.emit(self.index(0, 0), self.index(0, self.rowCount() - 1)) + self.dataChanged.emit(self.index(0, 0), self.index(0, + self.rowCount() - 1)) def filterAcceptsRow(self, sourceRow, sourceParent): """ @@ -250,8 +253,8 @@ def splitPath(self, path): """ - Public method to split the given path into strings, that are used to match - at each level in the model. + Public method to split the given path into strings, that are used to + match at each level in the model. @param path path to be split (string) @return list of path elements (list of strings) @@ -260,7 +263,8 @@ return ["t"] # Queue an update to the search string. Wait a bit, so that if the user - # is quickly typing, the completer doesn't try to complete until they pause. + # is quickly typing, the completer doesn't try to complete until they + # pause. if self.__filterTimer.isActive(): self.__filterTimer.stop() self.__filterTimer.start(150) @@ -273,7 +277,8 @@ self.__searchString = path # The actual filtering is done by the HistoryCompletionModel. Just - # return a short dummy here so that QCompleter thinks everything matched. + # return a short dummy here so that QCompleter thinks everything + # matched. return ["t"] def __updateFilter(self): @@ -291,6 +296,7 @@ # Mark it valid. completionModel.setValid(True) - # Now update the QCompleter widget, but only if the user is still typing a URL. + # Now update the QCompleter widget, but only if the user is still + # typing a URL. if self.widget() is not None and self.widget().hasFocus(): self.complete()
--- a/Helpviewer/History/HistoryDialog.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/History/HistoryDialog.py Thu Oct 10 18:35:45 2013 +0200 @@ -40,7 +40,8 @@ self.__historyManager = manager if self.__historyManager is None: import Helpviewer.HelpWindow - self.__historyManager = Helpviewer.HelpWindow.HelpWindow.historyManager() + self.__historyManager = \ + Helpviewer.HelpWindow.HelpWindow.historyManager() self.__model = self.__historyManager.historyTreeModel() self.__proxyModel = E5TreeSortFilterProxyModel(self) @@ -59,7 +60,8 @@ self.historyTree.customContextMenuRequested.connect( self.__customContextMenuRequested) - self.searchEdit.textChanged.connect(self.__proxyModel.setFilterFixedString) + self.searchEdit.textChanged.connect( + self.__proxyModel.setFilterFixedString) self.removeButton.clicked[()].connect(self.historyTree.removeSelected) self.removeAllButton.clicked[()].connect(self.__historyManager.clear) @@ -81,8 +83,10 @@ idx = self.historyTree.indexAt(pos) idx = idx.sibling(idx.row(), 0) if idx.isValid() and not self.historyTree.model().hasChildren(idx): - menu.addAction(self.trUtf8("&Open"), self.__openHistoryInCurrentTab) - menu.addAction(self.trUtf8("Open in New &Tab"), self.__openHistoryInNewTab) + menu.addAction( + self.trUtf8("&Open"), self.__openHistoryInCurrentTab) + menu.addAction( + self.trUtf8("Open in New &Tab"), self.__openHistoryInNewTab) menu.addSeparator() menu.addAction(self.trUtf8("&Copy"), self.__copyHistory) menu.addAction(self.trUtf8("&Remove"), self.historyTree.removeSelected) @@ -94,7 +98,8 @@ @param idx reference to the entry index (QModelIndex) """ - self.__openHistory(QApplication.keyboardModifiers() & Qt.ControlModifier) + self.__openHistory( + QApplication.keyboardModifiers() & Qt.ControlModifier) def __openHistoryInCurrentTab(self): """ @@ -112,7 +117,8 @@ """ Private method to open a history entry. - @param newTab flag indicating to open the history entry in a new tab (boolean) + @param newTab flag indicating to open the history entry in a new tab + (boolean) """ idx = self.historyTree.currentIndex() if newTab:
--- a/Helpviewer/History/HistoryFilterModel.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/History/HistoryFilterModel.py Thu Oct 10 18:35:45 2013 +0200 @@ -42,8 +42,8 @@ """ Special method determining less relation. - Note: Like the actual history entries the index mapping is sorted in reverse - order by offset + Note: Like the actual history entries the index mapping is sorted in + reverse order by offset @param other reference to the history data object to compare against (HistoryEntry) @@ -120,7 +120,8 @@ if self.sourceModel() is not None: self.sourceModel().modelReset.disconnect(self.__sourceReset) self.sourceModel().dataChanged.disconnect(self.__sourceDataChanged) - self.sourceModel().rowsInserted.disconnect(self.__sourceRowsInserted) + self.sourceModel().rowsInserted.disconnect( + self.__sourceRowsInserted) self.sourceModel().rowsRemoved.disconnect(self.__sourceRowsRemoved) super().setSourceModel(sourceModel) @@ -233,7 +234,8 @@ column < 0 or column >= self.columnCount(parent): return QModelIndex() - return self.createIndex(row, column, self.__filteredRows[row].tailOffset) + return self.createIndex(row, column, + self.__filteredRows[row].tailOffset) def parent(self, index): """ @@ -265,8 +267,10 @@ self.__historyDict[url] = sourceOffset else: # the url is known already, so just update the frequency score - row = self.__filteredRows.index(HistoryData(self.__historyDict[url], -1)) - self.__filteredRows[row].frequency += self.__frequencyScore(idx) + row = self.__filteredRows.index( + HistoryData(self.__historyDict[url], -1)) + self.__filteredRows[row].frequency += \ + self.__frequencyScore(idx) self.__loaded = True @@ -286,7 +290,8 @@ url = idx.data(HistoryModel.UrlStringRole) currentFrequency = 0 if url in self.__historyDict: - row = self.__filteredRows.index(HistoryData(self.__historyDict[url], -1)) + row = self.__filteredRows.index( + HistoryData(self.__historyDict[url], -1)) currentFrequency = self.__filteredRows[row].frequency self.beginRemoveRows(QModelIndex(), row, row) del self.__filteredRows[row] @@ -294,7 +299,8 @@ self.endRemoveRows() self.beginInsertRows(QModelIndex(), 0, 0) - self.__filteredRows.insert(0, HistoryData(self.sourceModel().rowCount(), + self.__filteredRows.insert( + 0, HistoryData(self.sourceModel().rowCount(), self.__frequencyScore(idx) + currentFrequency)) self.__historyDict[url] = self.sourceModel().rowCount() self.endInsertRows() @@ -328,8 +334,10 @@ self.sourceModel().rowsRemoved.disconnect(self.__sourceRowsRemoved) self.beginRemoveRows(parent, row, lastRow) oldCount = self.rowCount() - start = self.sourceModel().rowCount() - self.__filteredRows[row].tailOffset - end = self.sourceModel().rowCount() - self.__filteredRows[lastRow].tailOffset + start = self.sourceModel().rowCount() - \ + self.__filteredRows[row].tailOffset + end = self.sourceModel().rowCount() - \ + self.__filteredRows[lastRow].tailOffset self.sourceModel().removeRows(start, end - start + 1) self.endRemoveRows() self.sourceModel().rowsRemoved.connect(self.__sourceRowsRemoved)
--- a/Helpviewer/History/HistoryManager.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/History/HistoryManager.py Thu Oct 10 18:35:45 2013 +0200 @@ -9,8 +9,8 @@ import os -from PyQt4.QtCore import pyqtSignal, QFileInfo, QDateTime, QDate, QTime, QUrl, QTimer, \ - QFile, QIODevice, QByteArray, QDataStream, QTemporaryFile +from PyQt4.QtCore import pyqtSignal, QFileInfo, QDateTime, QDate, QTime, \ + QUrl, QTimer, QFile, QIODevice, QByteArray, QDataStream, QTemporaryFile from PyQt4.QtWebKit import QWebHistoryInterface, QWebSettings from E5Gui import E5MessageBox @@ -42,7 +42,8 @@ """ Special method determining equality. - @param other reference to the history entry to compare against (HistoryEntry) + @param other reference to the history entry to compare against + (HistoryEntry) @return flag indicating equality (boolean) """ return other.title == self.title and \ @@ -55,7 +56,8 @@ Note: History is sorted in reverse order by date and time - @param other reference to the history entry to compare against (HistoryEntry) + @param other reference to the history entry to compare against + (HistoryEntry) @return flag indicating less (boolean) """ return self.dateTime > other.dateTime @@ -80,8 +82,10 @@ @signal historyCleared() emitted after the history has been cleared @signal historyReset() emitted after the history has been reset - @signal entryAdded(HistoryEntry) emitted after a history entry has been added - @signal entryRemoved(HistoryEntry) emitted after a history entry has been removed + @signal entryAdded(HistoryEntry) emitted after a history entry has been + added + @signal entryRemoved(HistoryEntry) emitted after a history entry has been + removed @signal entryUpdated(int) emitted after a history entry has been updated @signal historySaved() emitted after the history was saved """ @@ -123,8 +127,10 @@ from .HistoryTreeModel import HistoryTreeModel self.__historyModel = HistoryModel(self, self) - self.__historyFilterModel = HistoryFilterModel(self.__historyModel, self) - self.__historyTreeModel = HistoryTreeModel(self.__historyFilterModel, self) + self.__historyFilterModel = \ + HistoryFilterModel(self.__historyModel, self) + self.__historyTreeModel = \ + HistoryTreeModel(self.__historyFilterModel, self) super().setDefaultInterface(self) self.__startFrequencyTimer() @@ -152,7 +158,8 @@ @param history reference to the list of history entries to be set (list of HistoryEntry) - @param loadedAndSorted flag indicating that the list is sorted (boolean) + @param loadedAndSorted flag indicating that the list is sorted + (boolean) """ self.__history = history[:] if not loadedAndSorted: @@ -217,7 +224,8 @@ cleanurl.setPassword("") if cleanurl.host(): cleanurl.setHost(cleanurl.host().lower()) - itm = HistoryEntry(cleanurl.toString(), QDateTime.currentDateTime()) + itm = HistoryEntry(cleanurl.toString(), + QDateTime.currentDateTime()) self._addHistoryEntry(itm) def updateHistoryEntry(self, url, title): @@ -287,7 +295,8 @@ while self.__history: checkForExpired = QDateTime(self.__history[-1].dateTime) - checkForExpired.setDate(checkForExpired.date().addDays(self.__daysToExpire)) + checkForExpired.setDate( + checkForExpired.date().addDays(self.__daysToExpire)) if now.daysTo(checkForExpired) > 7: nextTimeout = 7 * 86400 else: @@ -342,7 +351,8 @@ else: breakMS = QDateTime.currentMSecsSinceEpoch() - period while self.__history and \ - QDateTime(self.__history[0].dateTime).toMSecsSinceEpoch() > breakMS: + (QDateTime(self.__history[0].dateTime).toMSecsSinceEpoch() > + breakMS): itm = self.__history.pop(0) self.entryRemoved.emit(itm) self.__lastSavedUrl = "" @@ -374,8 +384,9 @@ if not historyFile.open(QIODevice.ReadOnly): E5MessageBox.warning(None, self.trUtf8("Loading History"), - self.trUtf8("""<p>Unable to open history file <b>{0}</b>.<br/>""" - """Reason: {1}</p>""")\ + self.trUtf8( + """<p>Unable to open history file <b>{0}</b>.<br/>""" + """Reason: {1}</p>""")\ .format(historyFile.fileName, historyFile.errorString())) return @@ -452,8 +463,9 @@ if not opened: E5MessageBox.warning(None, self.trUtf8("Saving History"), - self.trUtf8("""<p>Unable to open history file <b>{0}</b>.<br/>""" - """Reason: {1}</p>""")\ + self.trUtf8( + """<p>Unable to open history file <b>{0}</b>.<br/>""" + """Reason: {1}</p>""")\ .format(f.fileName(), f.errorString())) return @@ -473,14 +485,17 @@ if historyFile.exists() and not historyFile.remove(): E5MessageBox.warning(None, self.trUtf8("Saving History"), - self.trUtf8("""<p>Error removing old history file <b>{0}</b>.""" - """<br/>Reason: {1}</p>""")\ - .format(historyFile.fileName(), historyFile.errorString())) + self.trUtf8( + """<p>Error removing old history file <b>{0}</b>.""" + """<br/>Reason: {1}</p>""")\ + .format(historyFile.fileName(), + historyFile.errorString())) if not f.copy(historyFile.fileName()): E5MessageBox.warning(None, self.trUtf8("Saving History"), - self.trUtf8("""<p>Error moving new history file over old one """ - """(<b>{0}</b>).<br/>Reason: {1}</p>""")\ + self.trUtf8( + """<p>Error moving new history file over old one """ + """(<b>{0}</b>).<br/>Reason: {1}</p>""")\ .format(historyFile.fileName(), f.errorString())) self.historySaved.emit() try: @@ -500,4 +515,5 @@ Private method to start the timer to recalculate the frequencies. """ tomorrow = QDateTime(QDate.currentDate().addDays(1), QTime(3, 0)) - self.__frequencyTimer.start(QDateTime.currentDateTime().secsTo(tomorrow) * 1000) + self.__frequencyTimer.start( + QDateTime.currentDateTime().secsTo(tomorrow) * 1000)
--- a/Helpviewer/History/HistoryMenu.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/History/HistoryMenu.py Thu Oct 10 18:35:45 2013 +0200 @@ -75,7 +75,8 @@ folders = self.sourceModel().rowCount() bumpedItems = self.bumpedRows() if bumpedItems <= self.MOVEDROWS and \ - bumpedItems == self.sourceModel().rowCount(self.sourceModel().index(0, 0)): + bumpedItems == self.sourceModel().rowCount( + self.sourceModel().index(0, 0)): folders -= 1 return bumpedItems + folders @@ -98,7 +99,8 @@ @return proxy model index (QModelIndex) """ sourceRow = self.__treeModel.mapToSource(sourceIndex).row() - return self.createIndex(sourceIndex.row(), sourceIndex.column(), sourceRow) + return self.createIndex( + sourceIndex.row(), sourceIndex.column(), sourceRow) def mapToSource(self, proxyIndex): """ @@ -113,10 +115,12 @@ if proxyIndex.internalId() == sys.maxsize: bumpedItems = self.bumpedRows() if proxyIndex.row() < bumpedItems: - return self.__treeModel.index(proxyIndex.row(), proxyIndex.column(), + return self.__treeModel.index( + proxyIndex.row(), proxyIndex.column(), self.__treeModel.index(0, 0)) if bumpedItems <= self.MOVEDROWS and \ - bumpedItems == self.sourceModel().rowCount(self.__treeModel.index(0, 0)): + bumpedItems == self.sourceModel().rowCount( + self.__treeModel.index(0, 0)): bumpedItems -= 1 return self.__treeModel.index(proxyIndex.row() - bumpedItems, proxyIndex.column()) @@ -149,7 +153,8 @@ bumpedItems = 0 if treeIndexParent == self.sourceModel().index(0, 0): bumpedItems = self.bumpedRows() - treeIndex = self.__treeModel.index(row + bumpedItems, column, treeIndexParent) + treeIndex = self.__treeModel.index( + row + bumpedItems, column, treeIndexParent) historyIndex = self.__treeModel.mapToSource(treeIndex) historyRow = historyIndex.row() if historyRow == -1: @@ -167,14 +172,16 @@ if offset == sys.maxsize or not index.isValid(): return QModelIndex() - historyIndex = self.__treeModel.sourceModel().index(index.internalId(), 0) + historyIndex = self.__treeModel.sourceModel().index( + index.internalId(), 0) treeIndex = self.__treeModel.mapFromSource(historyIndex) treeIndexParent = treeIndex.parent() sourceRow = self.sourceModel().mapToSource(treeIndexParent).row() bumpedItems = self.bumpedRows() if bumpedItems <= self.MOVEDROWS and \ - bumpedItems == self.sourceModel().rowCount(self.sourceModel().index(0, 0)): + bumpedItems == self.sourceModel().rowCount( + self.sourceModel().index(0, 0)): bumpedItems -= 1 return self.createIndex(bumpedItems + treeIndexParent.row(), @@ -232,8 +239,8 @@ dateTime_R = \ self.sourceModel().data(right, HistoryModel.DateTimeRole) - # Sort results in descending frequency-derived score. If frequencies are equal, - # sort on most recently viewed + # Sort results in descending frequency-derived score. If frequencies + # are equal, sort on most recently viewed if frequency_R == frequency_L: return dateTime_R < dateTime_L @@ -268,7 +275,8 @@ self.__mostVisitedMenu = None self.__closedTabsMenu = QMenu(self.trUtf8("Closed Tabs")) - self.__closedTabsMenu.aboutToShow.connect(self.__aboutToShowClosedTabsMenu) + self.__closedTabsMenu.aboutToShow.connect( + self.__aboutToShowClosedTabsMenu) self.__tabWidget.closedTabsManager().closedTabAvailable.connect( self.__closedTabAvailable) @@ -300,9 +308,10 @@ """ if self.__historyManager is None: import Helpviewer.HelpWindow - self.__historyManager = Helpviewer.HelpWindow.HelpWindow.historyManager() - self.__historyMenuModel = \ - HistoryMenuModel(self.__historyManager.historyTreeModel(), self) + self.__historyManager = \ + Helpviewer.HelpWindow.HelpWindow.historyManager() + self.__historyMenuModel = HistoryMenuModel( + self.__historyManager.historyTreeModel(), self) self.setModel(self.__historyMenuModel) # initial actions @@ -341,7 +350,8 @@ def setInitialActions(self, actions): """ - Public method to set the list of actions that should appear first in the menu. + Public method to set the list of actions that should appear first in + the menu. @param actions list of initial actions (list of QAction) """ @@ -451,8 +461,8 @@ if self.__historyMenuModel is None: import Helpviewer.HelpWindow historyManager = Helpviewer.HelpWindow.HelpWindow.historyManager() - self.__historyMenuModel = \ - HistoryMostVisitedMenuModel(historyManager.historyFilterModel(), self) + self.__historyMenuModel = HistoryMostVisitedMenuModel( + historyManager.historyFilterModel(), self) self.setModel(self.__historyMenuModel) self.__historyMenuModel.sort(0)
--- a/Helpviewer/History/HistoryModel.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/History/HistoryModel.py Thu Oct 10 18:35:45 2013 +0200 @@ -27,7 +27,8 @@ """ Constructor - @param historyManager reference to the history manager object (HistoryManager) + @param historyManager reference to the history manager object + (HistoryManager) @param parent reference to the parent object (QObject) """ super().__init__(parent)
--- a/Helpviewer/History/HistoryTreeModel.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/History/HistoryTreeModel.py Thu Oct 10 18:35:45 2013 +0200 @@ -66,7 +66,8 @@ return date.toString("yyyy-MM-dd") if index.column() == 1: return self.trUtf8( - "%n item(s)", "", self.rowCount(index.sibling(index.row(), 0))) + "%n item(s)", "", + self.rowCount(index.sibling(index.row(), 0))) elif role == Qt.DecorationRole: if index.column() == 0 and not index.parent().isValid(): @@ -111,8 +112,8 @@ totalRows = self.sourceModel().rowCount() for row in range(totalRows): - rowDate = \ - self.sourceModel().index(row, 0).data(HistoryModel.DateRole) + rowDate = self.sourceModel().index(row, 0)\ + .data(HistoryModel.DateRole) if rowDate != currentDate: self.__sourceRowCache.append(row) currentDate = rowDate @@ -211,7 +212,8 @@ """ if not index.isValid(): return Qt.ItemFlags(Qt.NoItemFlags) - return Qt.ItemFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsDragEnabled) + return Qt.ItemFlags( + Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsDragEnabled) def setSourceModel(self, sourceModel): """ @@ -222,7 +224,8 @@ if self.sourceModel() is not None: self.sourceModel().modelReset.disconnect(self.__sourceReset) self.sourceModel().layoutChanged.disconnect(self.__sourceReset) - self.sourceModel().rowsInserted.disconnect(self.__sourceRowsInserted) + self.sourceModel().rowsInserted.disconnect( + self.__sourceRowsInserted) self.sourceModel().rowsRemoved.disconnect(self.__sourceRowsRemoved) super().setSourceModel(sourceModel) @@ -264,7 +267,8 @@ self.beginInsertRows(QModelIndex(), 0, 0) self.endInsertRows() else: - self.beginInsertRows(treeParent, treeIndex.row(), treeIndex.row()) + self.beginInsertRows(treeParent, treeIndex.row(), + treeIndex.row()) self.endInsertRows() def mapFromSource(self, sourceIndex): @@ -319,7 +323,8 @@ for i in range(row + count - 1, row - 1, -1): dateParent = self.index(i, 0) offset = self.__sourceDateRow(dateParent.row()) - if not self.sourceModel().removeRows(offset, self.rowCount(dateParent)): + if not self.sourceModel().removeRows( + offset, self.rowCount(dateParent)): return False return True
--- a/Helpviewer/Network/AboutAccessHandler.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Network/AboutAccessHandler.py Thu Oct 10 18:35:45 2013 +0200 @@ -18,11 +18,13 @@ """ Protected method to create a request. - @param op the operation to be performed (QNetworkAccessManager.Operation) + @param op the operation to be performed + (QNetworkAccessManager.Operation) @param request reference to the request object (QNetworkRequest) @param outgoingData reference to an IODevice containing data to be sent (QIODevice) @return reference to the created reply object (QNetworkReply) """ - from .NetworkProtocolUnknownErrorReply import NetworkProtocolUnknownErrorReply + from .NetworkProtocolUnknownErrorReply import \ + NetworkProtocolUnknownErrorReply return NetworkProtocolUnknownErrorReply("about", self.parent())
--- a/Helpviewer/Network/EricAccessHandler.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Network/EricAccessHandler.py Thu Oct 10 18:35:45 2013 +0200 @@ -23,14 +23,16 @@ """ Protected method to create a request. - @param op the operation to be performed (QNetworkAccessManager.Operation) + @param op the operation to be performed + (QNetworkAccessManager.Operation) @param request reference to the request object (QNetworkRequest) @param outgoingData reference to an IODevice containing data to be sent (QIODevice) @return reference to the created reply object (QNetworkReply) """ from .NetworkReply import NetworkReply - from .NetworkProtocolUnknownErrorReply import NetworkProtocolUnknownErrorReply + from .NetworkProtocolUnknownErrorReply import \ + NetworkProtocolUnknownErrorReply if request.url().toString() == "eric:home": return NetworkReply(request, self.__createHomePage(), @@ -90,10 +92,13 @@ html.replace("@TITLE-EDIT@", self.trUtf8("Edit")) html.replace("@TITLE-REMOVE@", self.trUtf8("Remove")) html.replace("@TITLE-RELOAD@", self.trUtf8("Reload")) - html.replace("@TITLE-FETCHTITLE@", self.trUtf8("Load title from page")) - html.replace("@SETTINGS-TITLE@", self.trUtf8("Speed Dial Settings")) + html.replace( + "@TITLE-FETCHTITLE@", self.trUtf8("Load title from page")) + html.replace( + "@SETTINGS-TITLE@", self.trUtf8("Speed Dial Settings")) html.replace("@ADD-TITLE@", self.trUtf8("Add New Page")) - html.replace("@TXT_NRROWS@", self.trUtf8("Maximum pages in a row:")) + html.replace( + "@TXT_NRROWS@", self.trUtf8("Maximum pages in a row:")) html.replace("@TXT_SDSIZE@", self.trUtf8("Change size of pages:")) self._speedDialPage = html
--- a/Helpviewer/Network/FileAccessHandler.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Network/FileAccessHandler.py Thu Oct 10 18:35:45 2013 +0200 @@ -29,7 +29,8 @@ """ Protected method to create a request. - @param op the operation to be performed (QNetworkAccessManager.Operation) + @param op the operation to be performed + (QNetworkAccessManager.Operation) @param request reference to the request object (QNetworkRequest) @param outgoingData reference to an IODevice containing data to be sent (QIODevice)
--- a/Helpviewer/Network/FileReply.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Network/FileReply.py Thu Oct 10 18:35:45 2013 +0200 @@ -27,7 +27,8 @@ <style type="text/css"> body {{ padding: 3em 0em; - background: -webkit-gradient(linear, left top, left bottom, from(#85784A), to(#FDFDFD), color-stop(0.5, #FDFDFD)); + background: -webkit-gradient(linear, left top, left bottom, from(#85784A), + to(#FDFDFD), color-stop(0.5, #FDFDFD)); background-repeat: repeat-x; }} #box {{ @@ -107,7 +108,8 @@ super().__init__(parent) self.__content = QByteArray() - self.__units = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"] + self.__units = ["Bytes", "KB", "MB", "GB", "TB", + "PB", "EB", "ZB", "YB"] if url.path() == "": url.setPath("/") @@ -162,7 +164,8 @@ cssString = \ """a.{{0}} {{{{\n"""\ """ padding-left: {0}px;\n"""\ - """ background: transparent url(data:image/png;base64,{1}) no-repeat center left;\n"""\ + """ background: transparent url(data:image/png;base64,{1})"""\ + """ no-repeat center left;\n"""\ """ font-weight: bold;\n"""\ """}}}}\n""" pixmap = icon.pixmap(size, size) @@ -182,8 +185,9 @@ Private slot loading the directory and preparing the listing page. """ dir = QDir(self.url().toLocalFile()) - dirItems = dir.entryInfoList(QDir.AllEntries | QDir.Hidden | QDir.NoDotAndDotDot, - QDir.Name | QDir.DirsFirst) + dirItems = dir.entryInfoList( + QDir.AllEntries | QDir.Hidden | QDir.NoDotAndDotDot, + QDir.Name | QDir.DirsFirst) u = self.url() if not u.path().endswith("/"): @@ -193,7 +197,8 @@ basePath = u.path() linkClasses = {} - iconSize = QWebSettings.globalSettings().fontSize(QWebSettings.DefaultFontSize) + iconSize = QWebSettings.globalSettings().fontSize( + QWebSettings.DefaultFontSize) parent = u.resolved(QUrl("..")) if parent.isParentOf(u): @@ -274,11 +279,14 @@ self.__content.append(512 * b' ') self.open(QIODevice.ReadOnly | QIODevice.Unbuffered) - self.setHeader(QNetworkRequest.ContentTypeHeader, "text/html; charset=UTF-8") - self.setHeader(QNetworkRequest.ContentLengthHeader, self.__content.size()) + self.setHeader( + QNetworkRequest.ContentTypeHeader, "text/html; charset=UTF-8") + self.setHeader( + QNetworkRequest.ContentLengthHeader, self.__content.size()) self.setAttribute(QNetworkRequest.HttpStatusCodeAttribute, 200) self.setAttribute(QNetworkRequest.HttpReasonPhraseAttribute, "Ok") self.metaDataChanged.emit() - self.downloadProgress.emit(self.__content.size(), self.__content.size()) + self.downloadProgress.emit( + self.__content.size(), self.__content.size()) self.readyRead.emit() self.finished.emit()
--- a/Helpviewer/Network/FollowRedirectReply.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Network/FollowRedirectReply.py Thu Oct 10 18:35:45 2013 +0200 @@ -22,7 +22,8 @@ Constructor @param url URL to get (QUrl) - @param manager reference to the network access manager (QNetworkAccessManager) + @param manager reference to the network access manager + (QNetworkAccessManager) @keyparam maxRedirects maximum allowed redirects (integer) """ super().__init__() @@ -92,7 +93,8 @@ """ Private slot handling the receipt of the requested data. """ - replyStatus = self.__reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) + replyStatus = self.__reply.attribute( + QNetworkRequest.HttpStatusCodeAttribute) if (replyStatus != 301 and replyStatus != 302) or \ self.__redirectCount == self.__maxRedirects: self.finished.emit() @@ -100,9 +102,9 @@ self.__redirectCount += 1 - redirectUrl = self.__reply.attribute(QNetworkRequest.RedirectionTargetAttribute) + redirectUrl = self.__reply.attribute( + QNetworkRequest.RedirectionTargetAttribute) self.__reply.close() -## self.__reply.finished[()].disconnect(self.__replyFinished) self.__reply.deleteLater() self.__reply = None
--- a/Helpviewer/Network/FtpAccessHandler.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Network/FtpAccessHandler.py Thu Oct 10 18:35:45 2013 +0200 @@ -31,7 +31,8 @@ """ Protected method to create a request. - @param op the operation to be performed (QNetworkAccessManager.Operation) + @param op the operation to be performed + (QNetworkAccessManager.Operation) @param request reference to the request object (QNetworkRequest) @param outgoingData reference to an IODevice containing data to be sent (QIODevice) @@ -48,8 +49,9 @@ Public method to add or change an authenticator in our cache. @param realm name of the realm the authenticator belongs to (string) - @param authenticator authenticator to add to the cache (QAuthenticator). - If it is None, the entry will be deleted from the cache. + @param authenticator authenticator to add to the cache + (QAuthenticator). If it is None, the entry will be deleted from + the cache. """ if realm: if authenticator:
--- a/Helpviewer/Network/FtpReply.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Network/FtpReply.py Thu Oct 10 18:35:45 2013 +0200 @@ -37,7 +37,8 @@ <style type="text/css"> body {{ padding: 3em 0em; - background: -webkit-gradient(linear, left top, left bottom, from(#85784A), to(#FDFDFD), color-stop(0.5, #FDFDFD)); + background: -webkit-gradient(linear, left top, left bottom, from(#85784A), + to(#FDFDFD), color-stop(0.5, #FDFDFD)); background-repeat: repeat-x; }} #box {{ @@ -124,7 +125,8 @@ self.__items = [] self.__content = QByteArray() - self.__units = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"] + self.__units = ["Bytes", "KB", "MB", "GB", "TB", + "PB", "EB", "ZB", "YB"] self.__dirLineParser = FtpDirLineParser() self.__fileBytesReceived = 0 @@ -187,7 +189,8 @@ def __doFtpCommands(self): """ - Private slot doing the sequence of FTP commands to get the requested result. + Private slot doing the sequence of FTP commands to get the requested + result. """ retry = True try: @@ -214,7 +217,8 @@ else: retry = False if ok: - self.__ftp.retrlines("LIST " + self.url().path(), self.__dirCallback) + self.__ftp.retrlines("LIST " + self.url().path(), + self.__dirCallback) if len(self.__items) == 1 and \ self.__items[0].isFile(): self.__fileBytesReceived = 0 @@ -229,7 +233,8 @@ except ftplib.all_errors as err: if isinstance(err, socket.gaierror): errCode = QNetworkReply.HostNotFoundError - elif isinstance(err, socket.error) and err.errno == errno.ECONNREFUSED: + elif isinstance(err, socket.error) and \ + err.errno == errno.ECONNREFUSED: errCode = QNetworkReply.ConnectionRefusedError else: errCode = QNetworkReply.ProtocolFailure @@ -239,8 +244,8 @@ def __doFtpLogin(self, username, password, byAuth=False): """ - Private method to do the FTP login with asking for a username and password, - if the login fails with an error 530. + Private method to do the FTP login with asking for a username and + password, if the login fails with an error 530. @param username user name to use for the login (string) @param password password to use for the login (string) @@ -260,17 +265,22 @@ if lines[1][:3] == "530": if "usage" in "\n".join(lines[1:].lower()): # found a not supported proxy - self.setError(QNetworkReply.ProxyConnectionRefusedError, + self.setError( + QNetworkReply.ProxyConnectionRefusedError, self.trUtf8("The proxy type seems to be wrong." - " If it is not in the list of supported" - " proxy types please report it with the" - " instructions given by the proxy.\n{0}").format( + " If it is not in the list of" + " supported proxy types please report" + " it with the instructions given by" + " the proxy.\n{0}").format( "\n".join(lines[1:]))) - self.error.emit(QNetworkReply.ProxyConnectionRefusedError) + self.error.emit( + QNetworkReply.ProxyConnectionRefusedError) return False, False else: - from UI.AuthenticationDialog import AuthenticationDialog - info = self.trUtf8("<b>Connect to proxy '{0}' using:</b>")\ + from UI.AuthenticationDialog import \ + AuthenticationDialog + info = self.trUtf8( + "<b>Connect to proxy '{0}' using:</b>")\ .format(Utilities.html_encode( Preferences.getUI("ProxyHost/Ftp"))) dlg = AuthenticationDialog(info, @@ -281,15 +291,18 @@ username, password = dlg.getData() if dlg.shallSave(): Preferences.setUI("ProxyUser/Ftp", username) - Preferences.setUI("ProxyPassword/Ftp", password) - self.__ftp.setProxyAuthentication(username, password) + Preferences.setUI( + "ProxyPassword/Ftp", password) + self.__ftp.setProxyAuthentication(username, + password) return False, True return False, False except (ftplib.error_perm, ftplib.error_temp) as err: code = err.args[0].strip()[:3] if code in ["530", "421"]: # error 530 -> Login incorrect - # error 421 -> Login may be incorrect (reported by some proxies) + # error 421 -> Login may be incorrect (reported by some + # proxies) if byAuth: self.__handler.setAuthenticator(self.url().host(), None) auth = None @@ -300,7 +313,8 @@ self.__manager.authenticationRequired.emit(self, auth) if not auth.isNull(): if auth.user(): - self.__handler.setAuthenticator(self.url().host(), auth) + self.__handler.setAuthenticator(self.url().host(), + auth) return False, True return False, False return False, True @@ -332,7 +346,8 @@ """ self.__content += QByteArray(data) self.__fileBytesReceived += len(data) - self.downloadProgress.emit(self.__fileBytesReceived, self.__items[0].size()) + self.downloadProgress.emit( + self.__fileBytesReceived, self.__items[0].size()) self.readyRead.emit() QCoreApplication.processEvents() @@ -343,7 +358,8 @@ """ mtype, encoding = mimetypes.guess_type(self.url().toString()) self.open(QIODevice.ReadOnly | QIODevice.Unbuffered) - self.setHeader(QNetworkRequest.ContentLengthHeader, self.__items[0].size()) + self.setHeader(QNetworkRequest.ContentLengthHeader, + self.__items[0].size()) if mtype: self.setHeader(QNetworkRequest.ContentTypeHeader, mtype) self.setAttribute(QNetworkRequest.HttpStatusCodeAttribute, 200) @@ -361,7 +377,8 @@ cssString = \ """a.{{0}} {{{{\n"""\ """ padding-left: {0}px;\n"""\ - """ background: transparent url(data:image/png;base64,{1}) no-repeat center left;\n"""\ + """ background: transparent url(data:image/png;base64,{1})"""\ + """ no-repeat center left;\n"""\ """ font-weight: bold;\n"""\ """}}}}\n""" pixmap = icon.pixmap(size, size) @@ -388,7 +405,8 @@ basePath = u.path() linkClasses = {} - iconSize = QWebSettings.globalSettings().fontSize(QWebSettings.DefaultFontSize) + iconSize = QWebSettings.globalSettings().fontSize( + QWebSettings.DefaultFontSize) parent = u.resolved(QUrl("..")) if parent.isParentOf(u): @@ -469,10 +487,13 @@ self.__content.append(512 * b' ') self.open(QIODevice.ReadOnly | QIODevice.Unbuffered) - self.setHeader(QNetworkRequest.ContentTypeHeader, "text/html; charset=UTF-8") - self.setHeader(QNetworkRequest.ContentLengthHeader, self.__content.size()) + self.setHeader( + QNetworkRequest.ContentTypeHeader, "text/html; charset=UTF-8") + self.setHeader( + QNetworkRequest.ContentLengthHeader, self.__content.size()) self.setAttribute(QNetworkRequest.HttpStatusCodeAttribute, 200) self.setAttribute(QNetworkRequest.HttpReasonPhraseAttribute, "Ok") self.metaDataChanged.emit() - self.downloadProgress.emit(self.__content.size(), self.__content.size()) + self.downloadProgress.emit( + self.__content.size(), self.__content.size()) self.readyRead.emit()
--- a/Helpviewer/Network/NetworkAccessManager.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Network/NetworkAccessManager.py Thu Oct 10 18:35:45 2013 +0200 @@ -11,7 +11,8 @@ from PyQt4.QtCore import pyqtSignal, QByteArray, qVersion from PyQt4.QtGui import QDialog -from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply +from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest, \ + QNetworkReply from E5Network.E5NetworkProxyFactory import E5NetworkProxyFactory, \ proxyAuthenticationRequired @@ -30,7 +31,8 @@ """ Class implementing a QNetworkAccessManager subclass. - @signal requestCreated(QNetworkAccessManager.Operation, QNetworkRequest, QNetworkReply) + @signal requestCreated(QNetworkAccessManager.Operation, QNetworkRequest, + QNetworkReply) emitted after the request has been created """ requestCreated = pyqtSignal( @@ -76,7 +78,8 @@ from .AboutAccessHandler import AboutAccessHandler self.setSchemeHandler("about", AboutAccessHandler(self)) - from Helpviewer.AdBlock.AdBlockAccessHandler import AdBlockAccessHandler + from Helpviewer.AdBlock.AdBlockAccessHandler import \ + AdBlockAccessHandler self.setSchemeHandler("abp", AdBlockAccessHandler(self)) from .FtpAccessHandler import FtpAccessHandler @@ -90,7 +93,8 @@ Public method to register a scheme handler. @param scheme access scheme (string) - @param handler reference to the scheme handler object (SchemeAccessHandler) + @param handler reference to the scheme handler object + (SchemeAccessHandler) """ self.__schemeHandlers[scheme] = handler @@ -98,20 +102,24 @@ """ Protected method to create a request. - @param op the operation to be performed (QNetworkAccessManager.Operation) + @param op the operation to be performed + (QNetworkAccessManager.Operation) @param request reference to the request object (QNetworkRequest) @param outgoingData reference to an IODevice containing data to be sent (QIODevice) @return reference to the created reply object (QNetworkReply) """ scheme = request.url().scheme() - if scheme == "https" and (not SSL_AVAILABLE or not QSslSocket.supportsSsl()): - from .NetworkProtocolUnknownErrorReply import NetworkProtocolUnknownErrorReply + if scheme == "https" and \ + (not SSL_AVAILABLE or not QSslSocket.supportsSsl()): + from .NetworkProtocolUnknownErrorReply import \ + NetworkProtocolUnknownErrorReply return NetworkProtocolUnknownErrorReply(scheme, self) import Helpviewer.HelpWindow - if op == QNetworkAccessManager.PostOperation and outgoingData is not None: + if op == QNetworkAccessManager.PostOperation and \ + outgoingData is not None: outgoingDataByteArray = outgoingData.peek(1024 * 1024) Helpviewer.HelpWindow.HelpWindow.passwordManager().post( request, outgoingDataByteArray) @@ -124,8 +132,8 @@ return reply # give GreaseMonkey the chance to create a request - reply = Helpviewer.HelpWindow.HelpWindow.greaseMonkeyManager().createRequest( - op, request, outgoingData) + reply = Helpviewer.HelpWindow.HelpWindow.greaseMonkeyManager()\ + .createRequest(op, request, outgoingData) if reply is not None: return reply @@ -134,10 +142,12 @@ req.setRawHeader("X-Eric5-UserLoadAction", QByteArray()) req.setAttribute(QNetworkRequest.User + 200, "") else: - req.setAttribute(QNetworkRequest.User + 200, req.rawHeader("Referer")) + req.setAttribute( + QNetworkRequest.User + 200, req.rawHeader("Referer")) if hasattr(QNetworkRequest, 'HttpPipeliningAllowedAttribute'): - req.setAttribute(QNetworkRequest.HttpPipeliningAllowedAttribute, True) + req.setAttribute( + QNetworkRequest.HttpPipeliningAllowedAttribute, True) if not self.__acceptLanguage.isEmpty(): req.setRawHeader("Accept-Language", self.__acceptLanguage) @@ -175,7 +185,8 @@ req.url().host() not in Preferences.getHelp("SendRefererWhitelist"): req.setRawHeader("Referer", "") - reply = QNetworkAccessManager.createRequest(self, op, req, outgoingData) + reply = QNetworkAccessManager.createRequest( + self, op, req, outgoingData) self.requestCreated.emit(op, req, reply) return reply @@ -246,8 +257,9 @@ from PyQt4.QtWebKit import qWebKitVersion from .NetworkDiskCache import NetworkDiskCache diskCache = NetworkDiskCache(self) - location = os.path.join(Utilities.getConfigDir(), "browser", 'cache', - "{0}-Qt{1}".format(qWebKitVersion(), qVersion())) + location = os.path.join( + Utilities.getConfigDir(), "browser", 'cache', + "{0}-Qt{1}".format(qWebKitVersion(), qVersion())) size = Preferences.getHelp("DiskCacheSize") * 1024 * 1024 diskCache.setCacheDirectory(location) diskCache.setMaximumCacheSize(size)
--- a/Helpviewer/Network/NetworkAccessManagerProxy.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Network/NetworkAccessManagerProxy.py Thu Oct 10 18:35:45 2013 +0200 @@ -65,7 +65,8 @@ """ Protected method to create a request. - @param op the operation to be performed (QNetworkAccessManager.Operation) + @param op the operation to be performed + (QNetworkAccessManager.Operation) @param request reference to the request object (QNetworkRequest) @param outgoingData reference to an IODevice containing data to be sent (QIODevice) @@ -75,6 +76,8 @@ pageRequest = QNetworkRequest(request) if self.__webPage is not None: self.__webPage.populateNetworkRequest(pageRequest) - return self.primaryManager.createRequest(op, pageRequest, outgoingData) + return self.primaryManager.createRequest( + op, pageRequest, outgoingData) else: - return QNetworkAccessManager.createRequest(self, op, request, outgoingData) + return QNetworkAccessManager.createRequest( + self, op, request, outgoingData)
--- a/Helpviewer/Network/NetworkProtocolUnknownErrorReply.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Network/NetworkProtocolUnknownErrorReply.py Thu Oct 10 18:35:45 2013 +0200 @@ -4,7 +4,8 @@ # """ -Module implementing a QNetworkReply subclass reporting an unknown protocol error. +Module implementing a QNetworkReply subclass reporting an unknown protocol +error. """ from PyQt4.QtCore import QTimer @@ -13,7 +14,8 @@ class NetworkProtocolUnknownErrorReply(QNetworkReply): """ - Class implementing a QNetworkReply subclass reporting an unknown protocol error. + Class implementing a QNetworkReply subclass reporting an unknown protocol + error. """ def __init__(self, protocol, parent=None): """ @@ -23,8 +25,9 @@ @param parent reference to the parent object (QObject) """ super().__init__(parent) - self.setError(QNetworkReply.ProtocolUnknownError, - self.trUtf8("Protocol '{0}' not supported.").format(protocol)) + self.setError( + QNetworkReply.ProtocolUnknownError, + self.trUtf8("Protocol '{0}' not supported.").format(protocol)) QTimer.singleShot(0, self.__fireSignals) def __fireSignals(self):
--- a/Helpviewer/Network/NoCacheHostsDialog.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Network/NoCacheHostsDialog.py Thu Oct 10 18:35:45 2013 +0200 @@ -29,14 +29,16 @@ super().__init__(parent) self.setupUi(self) - self.__model = QStringListModel(Preferences.getHelp("NoCacheHosts"), self) + self.__model = QStringListModel( + Preferences.getHelp("NoCacheHosts"), self) self.__model.sort(0) self.__proxyModel = QSortFilterProxyModel(self) self.__proxyModel.setFilterCaseSensitivity(Qt.CaseInsensitive) self.__proxyModel.setSourceModel(self.__model) self.noCacheList.setModel(self.__proxyModel) - self.searchEdit.textChanged.connect(self.__proxyModel.setFilterFixedString) + self.searchEdit.textChanged.connect( + self.__proxyModel.setFilterFixedString) self.removeButton.clicked[()].connect(self.noCacheList.removeSelected) self.removeAllButton.clicked[()].connect(self.noCacheList.removeAll)
--- a/Helpviewer/Network/QtHelpAccessHandler.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Network/QtHelpAccessHandler.py Thu Oct 10 18:35:45 2013 +0200 @@ -84,7 +84,8 @@ """ Protected method to create a request. - @param op the operation to be performed (QNetworkAccessManager.Operation) + @param op the operation to be performed + (QNetworkAccessManager.Operation) @param request reference to the request object (QNetworkRequest) @param outgoingData reference to an IODevice containing data to be sent (QIODevice) @@ -94,10 +95,10 @@ strUrl = url.toString() # For some reason the url to load is already wrong (passed from webkit) - # though the css file and the references inside should work that way. One - # possible problem might be that the css is loaded at the same level as the - # html, thus a path inside the css like (../images/foo.png) might cd out of - # the virtual folder + # though the css file and the references inside should work that way. + # One possible problem might be that the css is loaded at the same + # level as the html, thus a path inside the css like + # (../images/foo.png) might cd out of the virtual folder if not self.__engine.findFile(url).isValid(): if strUrl.startswith(QtDocPath): newUrl = request.url()
--- a/Helpviewer/Network/SendRefererWhitelistDialog.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Network/SendRefererWhitelistDialog.py Thu Oct 10 18:35:45 2013 +0200 @@ -29,14 +29,16 @@ super().__init__(parent) self.setupUi(self) - self.__model = QStringListModel(Preferences.getHelp("SendRefererWhitelist"), self) + self.__model = QStringListModel( + Preferences.getHelp("SendRefererWhitelist"), self) self.__model.sort(0) self.__proxyModel = QSortFilterProxyModel(self) self.__proxyModel.setFilterCaseSensitivity(Qt.CaseInsensitive) self.__proxyModel.setSourceModel(self.__model) self.whitelist.setModel(self.__proxyModel) - self.searchEdit.textChanged.connect(self.__proxyModel.setFilterFixedString) + self.searchEdit.textChanged.connect( + self.__proxyModel.setFilterFixedString) self.removeButton.clicked[()].connect(self.whitelist.removeSelected) self.removeAllButton.clicked[()].connect(self.whitelist.removeAll)
--- a/Helpviewer/OfflineStorage/WebDatabasesDialog.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/OfflineStorage/WebDatabasesDialog.py Thu Oct 10 18:35:45 2013 +0200 @@ -38,7 +38,8 @@ self.__proxyModel.setFilterKeyColumn(-1) self.__proxyModel.setSourceModel(model) - self.searchEdit.textChanged.connect(self.__proxyModel.setFilterFixedString) + self.searchEdit.textChanged.connect( + self.__proxyModel.setFilterFixedString) self.databasesTree.setModel(self.__proxyModel) fm = QFontMetrics(self.font())
--- a/Helpviewer/OfflineStorage/WebDatabasesModel.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/OfflineStorage/WebDatabasesModel.py Thu Oct 10 18:35:45 2013 +0200 @@ -115,7 +115,8 @@ # web database db = self.__data[parent.row()][1][index.row()] if index.column() == 0: - return self.trUtf8("{0} ({1})").format(db.displayName(), db.name()) + return self.trUtf8("{0} ({1})").format( + db.displayName(), db.name()) elif index.column() == 1: return self.__dataString(db.size())
--- a/Helpviewer/OpenSearch/OpenSearchDialog.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/OpenSearch/OpenSearchDialog.py Thu Oct 10 18:35:45 2013 +0200 @@ -63,8 +63,9 @@ if not osm.addEngine(fileName): E5MessageBox.critical(self, self.trUtf8("Add search engine"), - self.trUtf8("""{0} is not a valid OpenSearch 1.1 description or""" - """ is already on your list.""").format(fileName)) + self.trUtf8( + """{0} is not a valid OpenSearch 1.1 description or""" + """ is already on your list.""").format(fileName)) @pyqtSlot() def on_deleteButton_clicked(self):
--- a/Helpviewer/OpenSearch/OpenSearchEngine.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/OpenSearch/OpenSearchEngine.py Thu Oct 10 18:35:45 2013 +0200 @@ -10,8 +10,8 @@ import re import json -from PyQt4.QtCore import pyqtSignal, pyqtSlot, QLocale, QUrl, QByteArray, QBuffer, \ - QIODevice, QObject +from PyQt4.QtCore import pyqtSignal, pyqtSlot, QLocale, QUrl, QByteArray, \ + QBuffer, QIODevice, QObject from PyQt4.QtGui import QImage from PyQt4.QtNetwork import QNetworkRequest, QNetworkAccessManager @@ -81,8 +81,9 @@ result = result.replace("{country}", country) result = result.replace("{inputEncoding}", "UTF-8") result = result.replace("{outputEncoding}", "UTF-8") - result = result.replace("{searchTerms}", - bytes(QUrl.toPercentEncoding(searchTerm)).decode()) + result = result.replace( + "{searchTerms}", + bytes(QUrl.toPercentEncoding(searchTerm)).decode()) result = re.sub(r"""\{([^\}]*:|)source\??\}""", Program, result) return result @@ -146,7 +147,8 @@ if not self._searchUrlTemplate: return QUrl() - ret = QUrl.fromEncoded(self.parseTemplate(searchTerm, self._searchUrlTemplate)) + ret = QUrl.fromEncoded( + self.parseTemplate(searchTerm, self._searchUrlTemplate)) if self.__searchMethod != "post": for parameter in self._searchParameters: @@ -212,7 +214,8 @@ """ Public method to set the engine search parameters. - @param searchParameters search parameters of the engine (list of two tuples) + @param searchParameters search parameters of the engine + (list of two tuples) """ self._searchParameters = searchParameters[:] @@ -235,7 +238,8 @@ def searchMethod(self): """ - Public method to get the HTTP request method used to perform search requests. + Public method to get the HTTP request method used to perform search + requests. @return HTTP request method (string) """ @@ -243,7 +247,8 @@ def setSearchMethod(self, method): """ - Public method to set the HTTP request method used to perform search requests. + Public method to set the HTTP request method used to perform search + requests. @param method HTTP request method (string) """ @@ -255,7 +260,8 @@ def suggestionsMethod(self): """ - Public method to get the HTTP request method used to perform suggestions requests. + Public method to get the HTTP request method used to perform + suggestions requests. @return HTTP request method (string) """ @@ -263,7 +269,8 @@ def setSuggestionsMethod(self, method): """ - Public method to set the HTTP request method used to perform suggestions requests. + Public method to set the HTTP request method used to perform + suggestions requests. @param method HTTP request method (string) """ @@ -357,8 +364,8 @@ imageBuffer = QBuffer() imageBuffer.open(QIODevice.ReadWrite) if image.save(imageBuffer, "PNG"): - self._imageUrl = "data:image/png;base64,{0}"\ - .format(bytes(imageBuffer.buffer().toBase64()).decode()) + self._imageUrl = "data:image/png;base64,{0}".format( + bytes(imageBuffer.buffer().toBase64()).decode()) self.__image = QImage(image) self.imageChanged.emit() @@ -414,7 +421,6 @@ return if self.__suggestionsReply is not None: -## self.__suggestionsReply.finished[()].disconnect(self.__suggestionsObtained) self.__suggestionsReply.abort() self.__suggestionsReply.deleteLater() self.__suggestionsReply = None @@ -433,7 +439,8 @@ data = "&".join(parameters) self.__suggestionsReply = self.networkAccessManager().post( QNetworkRequest(self.suggestionsUrl(searchTerm)), data) - self.__suggestionsReply.finished[()].connect(self.__suggestionsObtained) + self.__suggestionsReply.finished[()].connect( + self.__suggestionsObtained) def __suggestionsObtained(self): """ @@ -465,7 +472,8 @@ """ Public method to get a reference to the network access manager object. - @return reference to the network access manager object (QNetworkAccessManager) + @return reference to the network access manager object + (QNetworkAccessManager) """ return self.__networkAccessManager
--- a/Helpviewer/OpenSearch/OpenSearchEngineAction.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/OpenSearch/OpenSearchEngineAction.py Thu Oct 10 18:35:45 2013 +0200 @@ -19,7 +19,8 @@ """ Constructor - @param engine reference to the open search engine object (OpenSearchEngine) + @param engine reference to the open search engine object + (OpenSearchEngine) @param parent reference to the parent object (QObject) """ super().__init__(parent) @@ -43,6 +44,7 @@ if image.isNull(): import Helpviewer.HelpWindow self.setIcon( - Helpviewer.HelpWindow.HelpWindow.icon(QUrl(self.__engine.imageUrl()))) + Helpviewer.HelpWindow.HelpWindow.icon( + QUrl(self.__engine.imageUrl()))) else: self.setIcon(QIcon(QPixmap.fromImage(image)))
--- a/Helpviewer/OpenSearch/OpenSearchEngineModel.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/OpenSearch/OpenSearchEngineModel.py Thu Oct 10 18:35:45 2013 +0200 @@ -21,7 +21,8 @@ """ Constructor - @param manager reference to the search engine manager (OpenSearchManager) + @param manager reference to the search engine manager + (OpenSearchManager) @param parent reference to the parent object (QObject) """ super().__init__(parent) @@ -109,7 +110,8 @@ if index.row() >= self.__manager.enginesCount() or index.row() < 0: return None - engine = self.__manager.engine(self.__manager.allEnginesNames()[index.row()]) + engine = self.__manager.engine( + self.__manager.allEnginesNames()[index.row()]) if engine is None: return None @@ -132,17 +134,18 @@ .format(engine.description()) if engine.providesSuggestions(): description += "<br/>" - description += \ - self.trUtf8("<strong>Provides contextual suggestions</strong>") + description += self.trUtf8( + "<strong>Provides contextual suggestions</strong>") return description elif index.column() == 1: if role in [Qt.EditRole, Qt.DisplayRole]: return ",".join(self.__manager.keywordsForEngine(engine)) elif role == Qt.ToolTipRole: - return self.trUtf8("Comma-separated list of keywords that may" - " be entered in the location bar followed by search terms to search" - " with this engine") + return self.trUtf8( + "Comma-separated list of keywords that may" + " be entered in the location bar followed by search terms" + " to search with this engine") return None @@ -166,7 +169,8 @@ engineName = self.__manager.allEnginesNames()[index.row()] keywords = re.split("[ ,]+", value) - self.__manager.setKeywordsForEngine(self.__manager.engine(engineName), keywords) + self.__manager.setKeywordsForEngine( + self.__manager.engine(engineName), keywords) return True
--- a/Helpviewer/OpenSearch/OpenSearchManager.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/OpenSearch/OpenSearchManager.py Thu Oct 10 18:35:45 2013 +0200 @@ -9,8 +9,8 @@ import os -from PyQt4.QtCore import pyqtSignal, QObject, QUrl, QFile, QDir, QIODevice, QByteArray, \ - QBuffer +from PyQt4.QtCore import pyqtSignal, QObject, QUrl, QFile, QDir, QIODevice, \ + QByteArray, QBuffer from PyQt4.QtNetwork import QNetworkRequest, QNetworkReply from E5Gui.E5Application import e5App @@ -182,7 +182,8 @@ """ Private method to add a new search engine given a filename. - @param filename name of a file containing the engine definition (string) + @param filename name of a file containing the engine definition + (string) @return flag indicating success (boolean) """ file_ = QFile(filename) @@ -200,7 +201,8 @@ def __addEngineByEngine(self, engine): """ - Private method to add a new search engine given a reference to an engine. + Private method to add a new search engine given a reference to an + engine. @param engine reference to an engine object (OpenSearchEngine) @return flag indicating success (boolean) @@ -234,11 +236,13 @@ return engine = self.__engines[name] - for keyword in [k for k in self.__keywords if self.__keywords[k] == engine]: + for keyword in [k for k in self.__keywords + if self.__keywords[k] == engine]: del self.__keywords[keyword] del self.__engines[name] - file_ = QDir(self.enginesDirectory()).filePath(self.generateEngineFileName(name)) + file_ = QDir(self.enginesDirectory()).filePath( + self.generateEngineFileName(name)) QFile.remove(file_) if name == self.__current: @@ -374,7 +378,8 @@ @return directory name (string) """ - return os.path.join(Utilities.getConfigDir(), "browser", "searchengines") + return os.path.join( + Utilities.getConfigDir(), "browser", "searchengines") def __confirmAddition(self, engine): """ @@ -390,10 +395,10 @@ res = E5MessageBox.yesNo(None, "", - self.trUtf8("""<p>Do you want to add the following engine to your list of""" - """ search engines?<br/><br/>Name: {0}<br/>""" - """Searches on: {1}</p>""")\ - .format(engine.name(), host)) + self.trUtf8( + """<p>Do you want to add the following engine to your""" + """ list of search engines?<br/><br/>Name: {0}<br/>""" + """Searches on: {1}</p>""").format(engine.name(), host)) return res def __engineFromUrlAvailable(self): @@ -516,6 +521,7 @@ def enginesChanged(self): """ - Public slot to tell the search engine manager, that something has changed. + Public slot to tell the search engine manager, that something has + changed. """ self.changed.emit()
--- a/Helpviewer/OpenSearch/OpenSearchWriter.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/OpenSearch/OpenSearchWriter.py Thu Oct 10 18:35:45 2013 +0200 @@ -65,7 +65,8 @@ if len(engine.searchParameters()) > 0: self.writeNamespace( - "http://a9.com/-/spec/opensearch/extensions/parameters/1.0/", "p") + "http://a9.com/-/spec/opensearch/extensions/" + "parameters/1.0/", "p") for parameter in engine.searchParameters(): self.writeStartElement("p:Parameter") self.writeAttribute("name", parameter[0]) @@ -81,7 +82,8 @@ if len(engine.suggestionsParameters()) > 0: self.writeNamespace( - "http://a9.com/-/spec/opensearch/extensions/parameters/1.0/", "p") + "http://a9.com/-/spec/opensearch/extensions/" + "parameters/1.0/", "p") for parameter in engine.suggestionsParameters(): self.writeStartElement("p:Parameter") self.writeAttribute("name", parameter[0])
--- a/Helpviewer/Passwords/PasswordManager.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Passwords/PasswordManager.py Thu Oct 10 18:35:45 2013 +0200 @@ -9,8 +9,8 @@ import os -from PyQt4.QtCore import pyqtSignal, QObject, QByteArray, QUrl, QCoreApplication, \ - QXmlStreamReader +from PyQt4.QtCore import pyqtSignal, QObject, QByteArray, QUrl, \ + QCoreApplication, QXmlStreamReader from PyQt4.QtGui import QProgressDialog, QApplication from PyQt4.QtNetwork import QNetworkRequest from PyQt4.QtWebKit import QWebSettings, QWebPage @@ -99,7 +99,10 @@ self.__load() key = self.__createKey(url, realm) - self.__logins[key] = (username, Utilities.crypto.pwConvert(password, encode=True)) + self.__logins[key] = ( + username, + Utilities.crypto.pwConvert(password, encode=True) + ) self.changed.emit() def __createKey(self, url, realm): @@ -111,7 +114,8 @@ @return key string (string) """ if realm: - key = "{0}://{1} ({2})".format(url.scheme(), url.authority(), realm) + key = "{0}://{1} ({2})".format( + url.scheme(), url.authority(), realm) else: key = "{0}://{1}".format(url.scheme(), url.authority()) return key @@ -134,11 +138,13 @@ from .PasswordWriter import PasswordWriter loginFile = self.getFileName() writer = PasswordWriter() - if not writer.write(loginFile, self.__logins, self.__loginForms, self.__never): + if not writer.write( + loginFile, self.__logins, self.__loginForms, self.__never): E5MessageBox.critical(None, self.trUtf8("Saving login data"), - self.trUtf8("""<p>Login data could not be saved to <b>{0}</b></p>""" - ).format(loginFile)) + self.trUtf8( + """<p>Login data could not be saved to <b>{0}</b></p>""" + ).format(loginFile)) else: self.passwordsSaved.emit() @@ -152,7 +158,8 @@ else: from .PasswordReader import PasswordReader reader = PasswordReader() - self.__logins, self.__loginForms, self.__never = reader.read(loginFile) + self.__logins, self.__loginForms, self.__never = \ + reader.read(loginFile) if reader.error() != QXmlStreamReader.NoError: E5MessageBox.warning(None, self.trUtf8("Loading login data"), @@ -188,7 +195,8 @@ return data = [] - section = 0 # 0 = login data, 1 = forms data, 2 = never store info + section = 0 # 0 = login data, 1 = forms data, + # 2 = never store info for line in lines.splitlines(): if line == self.FORMS: section = 1 @@ -204,9 +212,10 @@ if len(data) != 3: E5MessageBox.critical(None, self.trUtf8("Loading login data"), - self.trUtf8("""<p>Login data could not be loaded """ - """from <b>{0}</b></p>""" - """<p>Reason: Wrong input format</p>""")\ + self.trUtf8( + """<p>Login data could not be loaded """ + """from <b>{0}</b></p>""" + """<p>Reason: Wrong input format</p>""")\ .format(loginFile)) return self.__logins[data[0]] = (data[1], data[2]) @@ -373,11 +382,14 @@ self.trUtf8( """<b>Would you like to save this password?</b><br/>""" """To review passwords you have saved and remove them, """ - """use the password management dialog of the Settings menu."""), + """use the password management dialog of the Settings""" + """ menu."""), modal=True) neverButton = mb.addButton( - self.trUtf8("Never for this site"), E5MessageBox.DestructiveRole) - noButton = mb.addButton(self.trUtf8("Not now"), E5MessageBox.RejectRole) + self.trUtf8("Never for this site"), + E5MessageBox.DestructiveRole) + noButton = mb.addButton( + self.trUtf8("Not now"), E5MessageBox.RejectRole) mb.addButton(E5MessageBox.Yes) mb.exec_() if mb.clickedButton() == neverButton: @@ -400,7 +412,8 @@ password = element[1] form.elements[index] = (element[0], "--PASSWORD--") if user and password: - self.__logins[key] = (user, Utilities.crypto.pwConvert(password, encode=True)) + self.__logins[key] = \ + (user, Utilities.crypto.pwConvert(password, encode=True)) self.__loginForms[key] = form self.changed.emit() @@ -423,8 +436,8 @@ @param webPage reference to the web page (QWebPage) @param data data to be sent (QByteArray) - @keyparam boundary boundary string (QByteArray) for multipart encoded data, - None for urlencoded data + @keyparam boundary boundary string (QByteArray) for multipart + encoded data, None for urlencoded data @return parsed form (LoginForm) """ from .LoginForm import LoginForm @@ -546,27 +559,32 @@ value = element[1] disabled = page.mainFrame().evaluateJavaScript( - 'document.forms[{0}].elements["{1}"].disabled'.format(formName, name)) + 'document.forms[{0}].elements["{1}"].disabled'.format( + formName, name)) if disabled: continue readOnly = page.mainFrame().evaluateJavaScript( - 'document.forms[{0}].elements["{1}"].readOnly'.format(formName, name)) + 'document.forms[{0}].elements["{1}"].readOnly'.format( + formName, name)) if readOnly: continue type_ = page.mainFrame().evaluateJavaScript( - 'document.forms[{0}].elements["{1}"].type'.format(formName, name)) + 'document.forms[{0}].elements["{1}"].type'.format( + formName, name)) if type_ == "" or \ type_ in ["hidden", "reset", "submit"]: continue if type_ == "password": - value = Utilities.crypto.pwConvert(self.__logins[key][1], encode=False) + value = Utilities.crypto.pwConvert( + self.__logins[key][1], encode=False) setType = type_ == "checkbox" and "checked" or "value" value = value.replace("\\", "\\\\") value = value.replace('"', '\\"') - javascript = 'document.forms[{0}].elements["{1}"].{2}="{3}";'.format( - formName, name, setType, value) + javascript = \ + 'document.forms[{0}].elements["{1}"].{2}="{3}";'.format( + formName, name, setType, value) page.mainFrame().evaluateJavaScript(javascript) def masterPasswordChanged(self, oldPassword, newPassword): @@ -579,7 +597,8 @@ if not self.__loaded: self.__load() - progress = QProgressDialog(self.trUtf8("Re-encoding saved passwords..."), + progress = QProgressDialog( + self.trUtf8("Re-encoding saved passwords..."), None, 0, len(self.__logins), QApplication.activeModalWidget()) progress.setMinimumDuration(0) count = 0
--- a/Helpviewer/Passwords/PasswordReader.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Passwords/PasswordReader.py Thu Oct 10 18:35:45 2013 +0200 @@ -7,7 +7,8 @@ Module implementing a class to read login data files. """ -from PyQt4.QtCore import QXmlStreamReader, QIODevice, QFile, QCoreApplication, QUrl +from PyQt4.QtCore import QXmlStreamReader, QIODevice, QFile, \ + QCoreApplication, QUrl class PasswordReader(QXmlStreamReader):
--- a/Helpviewer/Passwords/PasswordWriter.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Passwords/PasswordWriter.py Thu Oct 10 18:35:45 2013 +0200 @@ -93,7 +93,8 @@ self.writeAttribute("key", key) self.writeAttribute("url", form.url.toString()) self.writeAttribute("name", str(form.name)) - self.writeAttribute("password", "yes" if form.hasAPassword else "no") + self.writeAttribute( + "password", "yes" if form.hasAPassword else "no") if form.elements: self.writeStartElement("Elements") for element in form.elements:
--- a/Helpviewer/Passwords/PasswordsDialog.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Passwords/PasswordsDialog.py Thu Oct 10 18:35:45 2013 +0200 @@ -32,18 +32,20 @@ self.__hidePasswordsText = self.trUtf8("Hide Passwords") self.passwordsButton.setText(self.__showPasswordsText) - self.removeButton.clicked[()].connect(self.passwordsTable.removeSelected) + self.removeButton.clicked[()].connect( + self.passwordsTable.removeSelected) self.removeAllButton.clicked[()].connect(self.passwordsTable.removeAll) import Helpviewer.HelpWindow from .PasswordModel import PasswordModel self.passwordsTable.verticalHeader().hide() - self.__passwordModel = \ - PasswordModel(Helpviewer.HelpWindow.HelpWindow.passwordManager(), self) + self.__passwordModel = PasswordModel( + Helpviewer.HelpWindow.HelpWindow.passwordManager(), self) self.__proxyModel = QSortFilterProxyModel(self) self.__proxyModel.setSourceModel(self.__passwordModel) - self.searchEdit.textChanged.connect(self.__proxyModel.setFilterFixedString) + self.searchEdit.textChanged.connect( + self.__proxyModel.setFilterFixedString) self.passwordsTable.setModel(self.__proxyModel) fm = QFontMetrics(QFont()) @@ -59,7 +61,8 @@ """ fm = QFontMetrics(QFont()) for section in range(self.__passwordModel.columnCount()): - header = self.passwordsTable.horizontalHeader().sectionSizeHint(section) + header = self.passwordsTable.horizontalHeader()\ + .sectionSizeHint(section) if section == 0: header = fm.width("averagebiglongsitename") elif section == 1: @@ -68,7 +71,8 @@ header = fm.width("averagelongpassword") buffer = fm.width("mm") header += buffer - self.passwordsTable.horizontalHeader().resizeSection(section, header) + self.passwordsTable.horizontalHeader()\ + .resizeSection(section, header) self.passwordsTable.horizontalHeader().setStretchLastSection(True) @pyqtSlot()
--- a/Helpviewer/PersonalInformationManager/PersonalInformationManager.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/PersonalInformationManager/PersonalInformationManager.py Thu Oct 10 18:35:45 2013 +0200 @@ -4,7 +4,8 @@ # """ -Module implementing a personal information manager used to complete form fields. +Module implementing a personal information manager used to complete form +fields. """ from PyQt4.QtCore import Qt, QObject @@ -16,7 +17,8 @@ class PersonalInformationManager(QObject): """ - Class implementing the personal information manager used to complete form fields. + Class implementing the personal information manager used to complete form + fields. """ FullName = 0 LastName = 1 @@ -122,7 +124,8 @@ @param menu reference to the main menu (QMenu) @param view reference to the view (HelpBrowser) - @param hitTestResult reference to the hit test result (QWebHitTestResult) + @param hitTestResult reference to the hit test result + (QWebHitTestResult) """ self.__view = view self.__element = hitTestResult.element() @@ -138,7 +141,8 @@ for key, info in sorted(self.__allInfo.items()): if info: - act = submenu.addAction(self.__translations[key], self.__insertData) + act = submenu.addAction( + self.__translations[key], self.__insertData) act.setData(info) submenu.addSeparator() @@ -159,8 +163,9 @@ info = act.data() info = info.replace('"', '\\"') self.__element.evaluateJavaScript( - 'var newVal = this.value.substring(0, this.selectionStart) + "{0}" +' - ' this.value.substring(this.selectionEnd); this.value = newVal;'.format(info)) + 'var newVal = this.value.substring(0, this.selectionStart) +' + ' "{0}" + this.value.substring(this.selectionEnd); this.value =' + ' newVal;'.format(info)) def viewKeyPressEvent(self, view, evt): """ @@ -212,7 +217,8 @@ def connectPage(self, page): """ - Public method to allow the personal information manager to connect to the page. + Public method to allow the personal information manager to connect to + the page. @param page reference to the web page (HelpWebPage) """
--- a/Helpviewer/PersonalInformationManager/__init__.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/PersonalInformationManager/__init__.py Thu Oct 10 18:35:45 2013 +0200 @@ -4,5 +4,6 @@ # """ -Package implementing the personal information manager for the completion of forms. +Package implementing the personal information manager for the completion of +forms. """
--- a/Helpviewer/SiteInfo/SiteInfoDialog.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/SiteInfo/SiteInfoDialog.py Thu Oct 10 18:35:45 2013 +0200 @@ -10,17 +10,17 @@ import os from PyQt4.QtCore import pyqtSlot, QUrl, Qt, QFile, qVersion -from PyQt4.QtGui import QDialog, QTreeWidgetItem, QPixmap, QGraphicsScene, QMenu, \ - QCursor, QApplication, QListWidgetItem +from PyQt4.QtGui import QDialog, QTreeWidgetItem, QPixmap, QGraphicsScene, \ + QMenu, QCursor, QApplication, QListWidgetItem from PyQt4.QtWebKit import QWebSettings from E5Gui import E5MessageBox, E5FileDialog try: - from .Ui_SiteInfoDialog import Ui_SiteInfoDialog # __IGNORE_WARNING__ + from .Ui_SiteInfoDialog import Ui_SiteInfoDialog # __IGNORE_WARNING__ SSL = True except ImportError: - from .Ui_SiteInfoNoSslDialog import Ui_SiteInfoDialog # __IGNORE_WARNING__ + from .Ui_SiteInfoNoSslDialog import Ui_SiteInfoDialog # __IGNORE_WARNING__ SSL = False from ..Download.DownloadUtilities import dataString @@ -46,11 +46,15 @@ self.setupUi(self) # put icons - self.tabWidget.setTabIcon(0, UI.PixmapCache.getIcon("siteinfo-general.png")) - self.tabWidget.setTabIcon(1, UI.PixmapCache.getIcon("siteinfo-media.png")) - self.tabWidget.setTabIcon(2, UI.PixmapCache.getIcon("siteinfo-databases.png")) + self.tabWidget.setTabIcon( + 0, UI.PixmapCache.getIcon("siteinfo-general.png")) + self.tabWidget.setTabIcon( + 1, UI.PixmapCache.getIcon("siteinfo-media.png")) + self.tabWidget.setTabIcon( + 2, UI.PixmapCache.getIcon("siteinfo-databases.png")) if SSL: - self.tabWidget.setTabIcon(3, UI.PixmapCache.getIcon("siteinfo-security.png")) + self.tabWidget.setTabIcon( + 3, UI.PixmapCache.getIcon("siteinfo-security.png")) self.__mainFrame = browser.page().mainFrame() title = browser.title() @@ -100,7 +104,8 @@ self.securityLabel.setStyleSheet(SiteInfoDialog.nokStyle) self.securityLabel.setText('<b>Connection is not encrypted.</b>') self.securityDetailsButton.setEnabled(False) - self.tabWidget.setTabEnabled(self.tabWidget.indexOf(self.securityTab), False) + self.tabWidget.setTabEnabled( + self.tabWidget.indexOf(self.securityTab), False) # populate Media tab images = self.__mainFrame.findAllElements("img") @@ -148,7 +153,8 @@ """ Private slot to show security details. """ - self.tabWidget.setCurrentIndex(self.tabWidget.indexOf(self.securityTab)) + self.tabWidget.setCurrentIndex( + self.tabWidget.indexOf(self.securityTab)) @pyqtSlot(QTreeWidgetItem, QTreeWidgetItem) def on_imagesTree_currentItemChanged(self, current, previous): @@ -261,7 +267,8 @@ E5MessageBox.critical(self, self.trUtf8("Save Image"), self.trUtf8( - """<p>Cannot write to file <b>{0}</b>.</p>""".format(filename))) + """<p>Cannot write to file <b>{0}</b>.</p>""") + .format(filename)) return f.write(cacheData.readAll()) f.close() @@ -284,6 +291,7 @@ return db = databases[id] - self.databaseName.setText("{0} ({1})".format(db.displayName(), db.name())) + self.databaseName.setText( + "{0} ({1})".format(db.displayName(), db.name())) self.databasePath.setText(db.fileName()) self.databaseSize.setText(dataString(db.size()))
--- a/Helpviewer/SpeedDial/PageThumbnailer.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/SpeedDial/PageThumbnailer.py Thu Oct 10 18:35:45 2013 +0200 @@ -18,7 +18,8 @@ """ Class implementing a thumbnail creator for web sites. - @signal thumbnailCreated(QPixmap) emitted after the thumbnail has been created + @signal thumbnailCreated(QPixmap) emitted after the thumbnail has been + created """ thumbnailCreated = pyqtSignal(QPixmap) @@ -42,8 +43,10 @@ Helpviewer.HelpWindow.HelpWindow.networkAccessManager()) self.__page.setNetworkAccessManager(self.__proxy) - self.__page.mainFrame().setScrollBarPolicy(Qt.Horizontal, Qt.ScrollBarAlwaysOff) - self.__page.mainFrame().setScrollBarPolicy(Qt.Vertical, Qt.ScrollBarAlwaysOff) + self.__page.mainFrame().setScrollBarPolicy( + Qt.Horizontal, Qt.ScrollBarAlwaysOff) + self.__page.mainFrame().setScrollBarPolicy( + Qt.Vertical, Qt.ScrollBarAlwaysOff) # Full HD # Every page should fit in this resolution @@ -111,7 +114,8 @@ """ Private slot creating the thumbnail of the web site. - @param status flag indicating a successful load of the web site (boolean) + @param status flag indicating a successful load of the web site + (boolean) """ if not status: self.thumbnailCreated.emit(QPixmap())
--- a/Helpviewer/SpeedDial/SpeedDial.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/SpeedDial/SpeedDial.py Thu Oct 10 18:35:45 2013 +0200 @@ -9,8 +9,8 @@ import os -from PyQt4.QtCore import pyqtSignal, pyqtSlot, QObject, QCryptographicHash, QByteArray, \ - QUrl, qWarning +from PyQt4.QtCore import pyqtSignal, pyqtSlot, QObject, QCryptographicHash, \ + QByteArray, QUrl, qWarning from PyQt4.QtWebKit import QWebPage from E5Gui import E5MessageBox @@ -140,7 +140,8 @@ @return name of the user agents file (string) """ - return os.path.join(Utilities.getConfigDir(), "browser", "speedDial.xml") + return os.path.join( + Utilities.getConfigDir(), "browser", "speedDial.xml") def __initialize(self): """ @@ -180,8 +181,10 @@ self.pagesChanged.emit() else: allPages = \ - 'url:"http://eric-ide.python-projects.org/"|title:"Eric Web Site";'\ - 'url:"http://www.riverbankcomputing.com/"|title:"PyQt4 Web Site";'\ + 'url:"http://eric-ide.python-projects.org/"|'\ + 'title:"Eric Web Site";'\ + 'url:"http://www.riverbankcomputing.com/"|'\ + 'title:"PyQt4 Web Site";'\ 'url:"http://qt.digia.com/"|title:"Qt Web Site";'\ 'url:"http://blog.qt.digia.com/"|title:"Qt Blog";'\ 'url:"http://www.python.org"|title:"Python Language Website";'\ @@ -199,8 +202,9 @@ self.__webPages, self.__pagesPerRow, self.__speedDialSize): E5MessageBox.critical(None, self.trUtf8("Saving Speed Dial data"), - self.trUtf8("""<p>Speed Dial data could not be saved to <b>{0}</b></p>""" - ).format(speedDialFile)) + self.trUtf8( + """<p>Speed Dial data could not be saved to""" + """ <b>{0}</b></p>""").format(speedDialFile)) else: self.speedDialSaved.emit() @@ -372,8 +376,9 @@ page.broken = True else: if not image.save(fileName): - qWarning("SpeedDial.__thumbnailCreated: Cannot save thumbnail to {0}" - .format(fileName)) + qWarning( + "SpeedDial.__thumbnailCreated: Cannot save thumbnail" + " to {0}".format(fileName)) fileName = QUrl.fromLocalFile(fileName).toString() @@ -386,7 +391,6 @@ frame.evaluateJavaScript("setTitleToUrl('{0}', '{1}');".format( url, title)) -## thumbnailer.thumbnailCreated.disconnect(self.__thumbnailCreated) thumbnailer.deleteLater() self.__thumbnailers.remove(thumbnailer)
--- a/Helpviewer/SpeedDial/SpeedDialReader.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/SpeedDial/SpeedDialReader.py Thu Oct 10 18:35:45 2013 +0200 @@ -27,8 +27,8 @@ @param fileNameOrDevice name of the file to read (string) or reference to the device to read (QIODevice) - @return list of speed dial pages (list of Page), number of pages per row (integer) - and size of the speed dial pages (integer) + @return list of speed dial pages (list of Page), number of pages per + row (integer) and size of the speed dial pages (integer) """ self.__pages = [] self.__pagesPerRow = 0
--- a/Helpviewer/Sync/DirectorySyncHandler.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Sync/DirectorySyncHandler.py Thu Oct 10 18:35:45 2013 +0200 @@ -23,13 +23,15 @@ Class implementing a synchronization handler using a shared directory. @signal syncStatus(type_, message) emitted to indicate the synchronization - status (string one of "bookmarks", "history", "passwords", "useragents" or - "speeddial", string) - @signal syncError(message) emitted for a general error with the error message (string) - @signal syncMessage(message) emitted to send a message about synchronization (string) - @signal syncFinished(type_, done, download) emitted after a synchronization has - finished (string one of "bookmarks", "history", "passwords", "useragents" or - "speeddial", boolean, boolean) + status (string one of "bookmarks", "history", "passwords", + "useragents" or "speeddial", string) + @signal syncError(message) emitted for a general error with the error + message (string) + @signal syncMessage(message) emitted to send a message about + synchronization (string) + @signal syncFinished(type_, done, download) emitted after a + synchronization has finished (string one of "bookmarks", "history", + "passwords", "useragents" or "speeddial", boolean, boolean) """ syncStatus = pyqtSignal(str, str) syncError = pyqtSignal(str) @@ -51,7 +53,8 @@ """ Public method to do the initial check. - @keyparam forceUpload flag indicating a forced upload of the files (boolean) + @keyparam forceUpload flag indicating a forced upload of the files + (boolean) """ if not Preferences.getHelp("SyncEnabled"): return @@ -60,7 +63,8 @@ self.__remoteFilesFound = [] - # check the existence of the shared directory; create it, if it is not there + # check the existence of the shared directory; create it, if it is + # not there if not os.path.exists(Preferences.getHelp("SyncDirectoryPath")): try: os.makedirs(Preferences.getHelp("SyncDirectoryPath")) @@ -77,9 +81,11 @@ Private method to downlaod the given file. @param type_ type of the synchronization event (string one - of "bookmarks", "history", "passwords", "useragents" or "speeddial") + of "bookmarks", "history", "passwords", "useragents" or + "speeddial") @param fileName name of the file to be downloaded (string) - @param timestamp time stamp in seconds of the file to be downloaded (int) + @param timestamp time stamp in seconds of the file to be downloaded + (integer) """ self.syncStatus.emit(type_, self._messages[type_]["RemoteExists"]) try: @@ -94,7 +100,8 @@ return QCoreApplication.processEvents() - ok, error = self.writeFile(QByteArray(data), fileName, type_, timestamp) + ok, error = self.writeFile(QByteArray(data), fileName, type_, + timestamp) if not ok: self.syncStatus.emit(type_, error) self.syncFinished.emit(type_, ok, True) @@ -104,7 +111,8 @@ Private method to upload the given file. @param type_ type of the synchronization event (string one - of "bookmarks", "history", "passwords", "useragents" or "speeddial") + of "bookmarks", "history", "passwords", "useragents" or + "speeddial") @param fileName name of the file to be uploaded (string) """ QCoreApplication.processEvents() @@ -120,8 +128,10 @@ f.write(bytes(data)) f.close() except IOError as err: - self.syncStatus.emit(type_, - self.trUtf8("Cannot write remote file.\n{0}").format(str(err))) + self.syncStatus.emit( + type_, + self.trUtf8("Cannot write remote file.\n{0}").format( + str(err))) self.syncFinished.emit(type_, False, False) return @@ -132,24 +142,30 @@ Private method to do the initial synchronization of the given file. @param type_ type of the synchronization event (string one - of "bookmarks", "history", "passwords", "useragents" or "speeddial") + of "bookmarks", "history", "passwords", "useragents" or + "speeddial") @param fileName name of the file to be synchronized (string) """ if not self.__forceUpload and \ - os.path.exists(os.path.join(Preferences.getHelp("SyncDirectoryPath"), - self._remoteFiles[type_])) and \ - QFileInfo(fileName).lastModified() <= \ - QFileInfo(os.path.join(Preferences.getHelp("SyncDirectoryPath"), - self._remoteFiles[type_])).lastModified(): + os.path.exists( + os.path.join(Preferences.getHelp("SyncDirectoryPath"), + self._remoteFiles[type_])) and \ + QFileInfo(fileName).lastModified() <= QFileInfo( + os.path.join(Preferences.getHelp("SyncDirectoryPath"), + self._remoteFiles[type_])).lastModified(): self.__downloadFile(type_, fileName, - QFileInfo(os.path.join(Preferences.getHelp("SyncDirectoryPath"), + QFileInfo(os.path.join( + Preferences.getHelp("SyncDirectoryPath"), self._remoteFiles[type_])).lastModified().toTime_t()) else: - if os.path.exists(os.path.join(Preferences.getHelp("SyncDirectoryPath"), - self._remoteFiles[type_])): - self.syncStatus.emit(type_, self._messages[type_]["RemoteMissing"]) + if os.path.exists( + os.path.join(Preferences.getHelp("SyncDirectoryPath"), + self._remoteFiles[type_])): + self.syncStatus.emit( + type_, self._messages[type_]["RemoteMissing"]) else: - self.syncStatus.emit(type_, self._messages[type_]["LocalNewer"]) + self.syncStatus.emit( + type_, self._messages[type_]["LocalNewer"]) self.__uploadFile(type_, fileName) def __initialSync(self): @@ -159,26 +175,34 @@ QCoreApplication.processEvents() # Bookmarks if Preferences.getHelp("SyncBookmarks"): - self.__initialSyncFile("bookmarks", - Helpviewer.HelpWindow.HelpWindow.bookmarksManager().getFileName()) + self.__initialSyncFile( + "bookmarks", + Helpviewer.HelpWindow.HelpWindow.bookmarksManager()\ + .getFileName()) QCoreApplication.processEvents() # History if Preferences.getHelp("SyncHistory"): - self.__initialSyncFile("history", - Helpviewer.HelpWindow.HelpWindow.historyManager().getFileName()) + self.__initialSyncFile( + "history", + Helpviewer.HelpWindow.HelpWindow.historyManager()\ + .getFileName()) QCoreApplication.processEvents() # Passwords if Preferences.getHelp("SyncPasswords"): - self.__initialSyncFile("passwords", - Helpviewer.HelpWindow.HelpWindow.passwordManager().getFileName()) + self.__initialSyncFile( + "passwords", + Helpviewer.HelpWindow.HelpWindow.passwordManager() + .getFileName()) QCoreApplication.processEvents() # User Agent Settings if Preferences.getHelp("SyncUserAgents"): - self.__initialSyncFile("useragents", - Helpviewer.HelpWindow.HelpWindow.userAgentsManager().getFileName()) + self.__initialSyncFile( + "useragents", + Helpviewer.HelpWindow.HelpWindow.userAgentsManager() + .getFileName()) QCoreApplication.processEvents() # Speed Dial Settings @@ -194,7 +218,8 @@ Private method to synchronize the given file. @param type_ type of the synchronization event (string one - of "bookmarks", "history", "passwords", "useragents" or "speeddial") + of "bookmarks", "history", "passwords", "useragents" or + "speeddial") @param fileName name of the file to be synchronized (string) """ self.syncStatus.emit(type_, self._messages[type_]["Uploading"])
--- a/Helpviewer/Sync/FtpSyncHandler.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Sync/FtpSyncHandler.py Thu Oct 10 18:35:45 2013 +0200 @@ -10,7 +10,8 @@ import ftplib import io -from PyQt4.QtCore import pyqtSignal, QTimer, QFileInfo, QCoreApplication, QByteArray +from PyQt4.QtCore import pyqtSignal, QTimer, QFileInfo, QCoreApplication, \ + QByteArray from E5Network.E5Ftp import E5Ftp, E5FtpProxyType, E5FtpProxyError @@ -28,13 +29,15 @@ Class implementing a synchronization handler using FTP. @signal syncStatus(type_, message) emitted to indicate the synchronization - status (string one of "bookmarks", "history", "passwords", "useragents" or - "speeddial", string) - @signal syncError(message) emitted for a general error with the error message (string) - @signal syncMessage(message) emitted to send a message about synchronization (string) - @signal syncFinished(type_, done, download) emitted after a synchronization has - finished (string one of "bookmarks", "history", "passwords", "useragents" or - "speeddial", boolean, boolean) + status (string one of "bookmarks", "history", "passwords", + "useragents" or "speeddial", string) + @signal syncError(message) emitted for a general error with the error + message (string) + @signal syncMessage(message) emitted to send a message about + synchronization (string) + @signal syncFinished(type_, done, download) emitted after a + synchronization has finished (string one of "bookmarks", "history", + "passwords", "useragents" or "speeddial", boolean, boolean) """ syncStatus = pyqtSignal(str, str) syncError = pyqtSignal(str) @@ -59,7 +62,8 @@ """ Public method to do the initial check. - @keyparam forceUpload flag indicating a forced upload of the files (boolean) + @keyparam forceUpload flag indicating a forced upload of the files + (boolean) """ if not Preferences.getHelp("SyncEnabled"): return @@ -71,7 +75,8 @@ self.__remoteFilesFound = {} self.__idleTimer = QTimer(self) - self.__idleTimer.setInterval(Preferences.getHelp("SyncFtpIdleTimeout") * 1000) + self.__idleTimer.setInterval( + Preferences.getHelp("SyncFtpIdleTimeout") * 1000) self.__idleTimer.timeout.connect(self.__idleTimeout) self.__ftp = E5Ftp() @@ -164,7 +169,8 @@ if urlInfo and urlInfo.isValid() and urlInfo.isFile(): if urlInfo.name() in self._remoteFiles.values(): - self.__remoteFilesFound[urlInfo.name()] = urlInfo.lastModified() + self.__remoteFilesFound[urlInfo.name()] = \ + urlInfo.lastModified() QCoreApplication.processEvents() @@ -173,9 +179,11 @@ Private method to downlaod the given file. @param type_ type of the synchronization event (string one - of "bookmarks", "history", "passwords", "useragents" or "speeddial") + of "bookmarks", "history", "passwords", "useragents" or + "speeddial") @param fileName name of the file to be downloaded (string) - @param timestamp time stamp in seconds of the file to be downloaded (int) + @param timestamp time stamp in seconds of the file to be downloaded + (integer) """ self.syncStatus.emit(type_, self._messages[type_]["RemoteExists"]) buffer = io.BytesIO() @@ -209,7 +217,8 @@ Private method to upload the given file. @param type_ type of the synchronization event (string one - of "bookmarks", "history", "passwords", "useragents" or "speeddial") + of "bookmarks", "history", "passwords", "useragents" or + "speeddial") @param fileName name of the file to be uploaded (string) @return flag indicating success (boolean) """ @@ -237,23 +246,29 @@ Private method to do the initial synchronization of the given file. @param type_ type of the synchronization event (string one - of "bookmarks", "history", "passwords", "useragents" or "speeddial") + of "bookmarks", "history", "passwords", "useragents" or + "speeddial") @param fileName name of the file to be synchronized (string) """ if not self.__forceUpload and \ self._remoteFiles[type_] in self.__remoteFilesFound: if QFileInfo(fileName).lastModified() < \ self.__remoteFilesFound[self._remoteFiles[type_]]: - self.__downloadFile(type_, fileName, - self.__remoteFilesFound[self._remoteFiles[type_]].toTime_t()) + self.__downloadFile( + type_, fileName, + self.__remoteFilesFound[self._remoteFiles[type_]] + .toTime_t()) else: - self.syncStatus.emit(type_, self.trUtf8("No synchronization required.")) + self.syncStatus.emit( + type_, self.trUtf8("No synchronization required.")) self.syncFinished.emit(type_, True, True) else: if self._remoteFiles[type_] not in self.__remoteFilesFound: - self.syncStatus.emit(type_, self._messages[type_]["RemoteMissing"]) + self.syncStatus.emit( + type_, self._messages[type_]["RemoteMissing"]) else: - self.syncStatus.emit(type_, self._messages[type_]["LocalNewer"]) + self.syncStatus.emit( + type_, self._messages[type_]["LocalNewer"]) self.__uploadFile(type_, fileName) def __initialSync(self): @@ -262,27 +277,36 @@ """ # Bookmarks if Preferences.getHelp("SyncBookmarks"): - self.__initialSyncFile("bookmarks", - Helpviewer.HelpWindow.HelpWindow.bookmarksManager().getFileName()) + self.__initialSyncFile( + "bookmarks", + Helpviewer.HelpWindow.HelpWindow.bookmarksManager() + .getFileName()) # History if Preferences.getHelp("SyncHistory"): - self.__initialSyncFile("history", - Helpviewer.HelpWindow.HelpWindow.historyManager().getFileName()) + self.__initialSyncFile( + "history", + Helpviewer.HelpWindow.HelpWindow.historyManager() + .getFileName()) # Passwords if Preferences.getHelp("SyncPasswords"): - self.__initialSyncFile("passwords", - Helpviewer.HelpWindow.HelpWindow.passwordManager().getFileName()) + self.__initialSyncFile( + "passwords", + Helpviewer.HelpWindow.HelpWindow.passwordManager() + .getFileName()) # User Agent Settings if Preferences.getHelp("SyncUserAgents"): - self.__initialSyncFile("useragents", - Helpviewer.HelpWindow.HelpWindow.userAgentsManager().getFileName()) + self.__initialSyncFile( + "useragents", + Helpviewer.HelpWindow.HelpWindow.userAgentsManager() + .getFileName()) # Speed Dial Settings if Preferences.getHelp("SyncSpeedDial"): - self.__initialSyncFile("speeddial", + self.__initialSyncFile( + "speeddial", Helpviewer.HelpWindow.HelpWindow.speedDial().getFileName()) self.__forceUpload = False @@ -292,7 +316,8 @@ Private method to synchronize the given file. @param type_ type of the synchronization event (string one - of "bookmarks", "history", "passwords", "useragents" or "speeddial") + of "bookmarks", "history", "passwords", "useragents" or + "speeddial") @param fileName name of the file to be synchronized (string) """ if self.__state == "initializing": @@ -304,14 +329,16 @@ if not self.__connected or self.__ftp.sock is None: ok = self.__connectAndLogin() if not ok: - self.syncStatus.emit(type_, self.trUtf8("Cannot log in to FTP host.")) + self.syncStatus.emit( + type_, self.trUtf8("Cannot log in to FTP host.")) return # upload the changed file self.__state = "uploading" self.syncStatus.emit(type_, self._messages[type_]["Uploading"]) if self.__uploadFile(type_, fileName): - self.syncStatus.emit(type_, self.trUtf8("Synchronization finished.")) + self.syncStatus.emit( + type_, self.trUtf8("Synchronization finished.")) self.__state = "idle" def syncBookmarks(self):
--- a/Helpviewer/Sync/SyncAssistantDialog.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Sync/SyncAssistantDialog.py Thu Oct 10 18:35:45 2013 +0200 @@ -38,12 +38,16 @@ self.setPage(SyncGlobals.PageEncryption, SyncEncryptionPage(self)) self.setPage(SyncGlobals.PageType, SyncHostTypePage(self)) self.setPage(SyncGlobals.PageFTPSettings, SyncFtpSettingsPage(self)) - self.setPage(SyncGlobals.PageDirectorySettings, SyncDirectorySettingsPage(self)) + self.setPage(SyncGlobals.PageDirectorySettings, + SyncDirectorySettingsPage(self)) self.setPage(SyncGlobals.PageCheck, SyncCheckPage(self)) - self.setPixmap(QWizard.LogoPixmap, UI.PixmapCache.getPixmap("ericWeb48.png")) - self.setPixmap(QWizard.WatermarkPixmap, UI.PixmapCache.getPixmap("eric256.png")) - self.setPixmap(QWizard.BackgroundPixmap, UI.PixmapCache.getPixmap("eric256.png")) + self.setPixmap(QWizard.LogoPixmap, + UI.PixmapCache.getPixmap("ericWeb48.png")) + self.setPixmap(QWizard.WatermarkPixmap, + UI.PixmapCache.getPixmap("eric256.png")) + self.setPixmap(QWizard.BackgroundPixmap, + UI.PixmapCache.getPixmap("eric256.png")) self.setMinimumSize(650, 450) if Globals.isWindowsPlatform():
--- a/Helpviewer/Sync/SyncCheckPage.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Sync/SyncCheckPage.py Thu Oct 10 18:35:45 2013 +0200 @@ -56,7 +56,8 @@ elif Preferences.getHelp("SyncType") == SyncGlobals.SyncTypeDirectory: self.handlerLabel.setText(self.trUtf8("Shared Directory")) self.infoLabel.setText(self.trUtf8("Directory:")) - self.infoDataLabel.setText(Preferences.getHelp("SyncDirectoryPath")) + self.infoDataLabel.setText( + Preferences.getHelp("SyncDirectoryPath")) else: self.handlerLabel.setText(self.trUtf8("No Synchronization")) self.hostLabel.setText("") @@ -68,11 +69,15 @@ self.speedDialMsgLabel.setText("") if not syncMgr.syncEnabled(): - self.bookmarkLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo.png")) + self.bookmarkLabel.setPixmap( + UI.PixmapCache.getPixmap("syncNo.png")) self.historyLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo.png")) - self.passwordsLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo.png")) - self.userAgentsLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo.png")) - self.speedDialLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo.png")) + self.passwordsLabel.setPixmap( + UI.PixmapCache.getPixmap("syncNo.png")) + self.userAgentsLabel.setPixmap( + UI.PixmapCache.getPixmap("syncNo.png")) + self.speedDialLabel.setPixmap( + UI.PixmapCache.getPixmap("syncNo.png")) return animationFile = os.path.join(getConfig("ericPixDir"), "loading.gif") @@ -81,7 +86,8 @@ if Preferences.getHelp("SyncBookmarks"): self.__makeAnimatedLabel(animationFile, self.bookmarkLabel) else: - self.bookmarkLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo.png")) + self.bookmarkLabel.setPixmap( + UI.PixmapCache.getPixmap("syncNo.png")) # history if Preferences.getHelp("SyncHistory"): @@ -93,21 +99,25 @@ if Preferences.getHelp("SyncPasswords"): self.__makeAnimatedLabel(animationFile, self.passwordsLabel) else: - self.passwordsLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo.png")) + self.passwordsLabel.setPixmap( + UI.PixmapCache.getPixmap("syncNo.png")) # user agent settings if Preferences.getHelp("SyncUserAgents"): self.__makeAnimatedLabel(animationFile, self.userAgentsLabel) else: - self.userAgentsLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo.png")) + self.userAgentsLabel.setPixmap( + UI.PixmapCache.getPixmap("syncNo.png")) # speed dial settings if Preferences.getHelp("SyncSpeedDial"): self.__makeAnimatedLabel(animationFile, self.speedDialLabel) else: - self.speedDialLabel.setPixmap(UI.PixmapCache.getPixmap("syncNo.png")) + self.speedDialLabel.setPixmap( + UI.PixmapCache.getPixmap("syncNo.png")) - QTimer.singleShot(0, lambda: syncMgr.loadSettings(forceUpload=forceUpload)) + QTimer.singleShot( + 0, lambda: syncMgr.loadSettings(forceUpload=forceUpload)) def __makeAnimatedLabel(self, fileName, label): """ @@ -144,7 +154,8 @@ Private slot to handle a finished synchronization event. @param type_ type of the synchronization event (string one - of "bookmarks", "history", "passwords", "useragents" or "speeddial") + of "bookmarks", "history", "passwords", "useragents" or + "speeddial") @param status flag indicating success (boolean) @param download flag indicating a download of a file (boolean) """ @@ -153,30 +164,36 @@ self.bookmarkLabel.setPixmap( UI.PixmapCache.getPixmap("syncCompleted.png")) else: - self.bookmarkLabel.setPixmap(UI.PixmapCache.getPixmap("syncFailed.png")) + self.bookmarkLabel.setPixmap( + UI.PixmapCache.getPixmap("syncFailed.png")) elif type_ == "history": if status: - self.historyLabel.setPixmap(UI.PixmapCache.getPixmap("syncCompleted.png")) + self.historyLabel.setPixmap( + UI.PixmapCache.getPixmap("syncCompleted.png")) else: - self.historyLabel.setPixmap(UI.PixmapCache.getPixmap("syncFailed.png")) + self.historyLabel.setPixmap( + UI.PixmapCache.getPixmap("syncFailed.png")) elif type_ == "passwords": if status: self.passwordsLabel.setPixmap( UI.PixmapCache.getPixmap("syncCompleted.png")) else: - self.passwordsLabel.setPixmap(UI.PixmapCache.getPixmap("syncFailed.png")) + self.passwordsLabel.setPixmap( + UI.PixmapCache.getPixmap("syncFailed.png")) elif type_ == "useragents": if status: self.userAgentsLabel.setPixmap( UI.PixmapCache.getPixmap("syncCompleted.png")) else: - self.userAgentsLabel.setPixmap(UI.PixmapCache.getPixmap("syncFailed.png")) + self.userAgentsLabel.setPixmap( + UI.PixmapCache.getPixmap("syncFailed.png")) elif type_ == "speeddial": if status: self.speedDialLabel.setPixmap( UI.PixmapCache.getPixmap("syncCompleted.png")) else: - self.speedDialLabel.setPixmap(UI.PixmapCache.getPixmap("syncFailed.png")) + self.speedDialLabel.setPixmap( + UI.PixmapCache.getPixmap("syncFailed.png")) def __syncError(self, message): """ @@ -185,5 +202,5 @@ @param message error message (string) """ self.syncErrorLabel.show() - self.syncErrorLabel.setText( - self.trUtf8('<font color="#FF0000"><b>Error:</b> {0}</font>').format(message)) + self.syncErrorLabel.setText(self.trUtf8( + '<font color="#FF0000"><b>Error:</b> {0}</font>').format(message))
--- a/Helpviewer/Sync/SyncDataPage.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Sync/SyncDataPage.py Thu Oct 10 18:35:45 2013 +0200 @@ -30,7 +30,8 @@ self.bookmarksCheckBox.setChecked(Preferences.getHelp("SyncBookmarks")) self.historyCheckBox.setChecked(Preferences.getHelp("SyncHistory")) self.passwordsCheckBox.setChecked(Preferences.getHelp("SyncPasswords")) - self.userAgentsCheckBox.setChecked(Preferences.getHelp("SyncUserAgents")) + self.userAgentsCheckBox.setChecked( + Preferences.getHelp("SyncUserAgents")) self.speedDialCheckBox.setChecked(Preferences.getHelp("SyncSpeedDial")) self.activeCheckBox.setChecked(Preferences.getHelp("SyncEnabled")) @@ -44,11 +45,16 @@ # save the settings Preferences.setHelp("SyncEnabled", self.activeCheckBox.isChecked()) - Preferences.setHelp("SyncBookmarks", self.bookmarksCheckBox.isChecked()) - Preferences.setHelp("SyncHistory", self.historyCheckBox.isChecked()) - Preferences.setHelp("SyncPasswords", self.passwordsCheckBox.isChecked()) - Preferences.setHelp("SyncUserAgents", self.userAgentsCheckBox.isChecked()) - Preferences.setHelp("SyncSpeedDial", self.speedDialCheckBox.isChecked()) + Preferences.setHelp( + "SyncBookmarks", self.bookmarksCheckBox.isChecked()) + Preferences.setHelp( + "SyncHistory", self.historyCheckBox.isChecked()) + Preferences.setHelp( + "SyncPasswords", self.passwordsCheckBox.isChecked()) + Preferences.setHelp( + "SyncUserAgents", self.userAgentsCheckBox.isChecked()) + Preferences.setHelp( + "SyncSpeedDial", self.speedDialCheckBox.isChecked()) from . import SyncGlobals if self.activeCheckBox.isChecked():
--- a/Helpviewer/Sync/SyncDirectorySettingsPage.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Sync/SyncDirectorySettingsPage.py Thu Oct 10 18:35:45 2013 +0200 @@ -59,7 +59,8 @@ @pyqtSlot() def on_directoryButton_clicked(self): """ - Private slot to select the shared directory via a directory selection dialog. + Private slot to select the shared directory via a directory selection + dialog. """ directory = E5FileDialog.getExistingDirectory( self,
--- a/Helpviewer/Sync/SyncEncryptionPage.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Sync/SyncEncryptionPage.py Thu Oct 10 18:35:45 2013 +0200 @@ -34,8 +34,10 @@ self.registerField("ReencryptData", self.reencryptCheckBox) - self.encryptionGroupBox.setChecked(Preferences.getHelp("SyncEncryptData")) - self.encryptionKeyEdit.setText(Preferences.getHelp("SyncEncryptionKey")) + self.encryptionGroupBox.setChecked( + Preferences.getHelp("SyncEncryptData")) + self.encryptionKeyEdit.setText( + Preferences.getHelp("SyncEncryptionKey")) self.encryptionKeyAgainEdit.setEnabled(False) self.keySizeComboBox.setCurrentIndex(self.keySizeComboBox.findData( Preferences.getHelp("SyncEncryptionKeyLength"))) @@ -48,12 +50,15 @@ @return next wizard page ID (integer) """ - Preferences.setHelp("SyncEncryptData", self.encryptionGroupBox.isChecked()) - Preferences.setHelp("SyncEncryptionKey", self.encryptionKeyEdit.text()) - Preferences.setHelp("SyncEncryptionKeyLength", self.keySizeComboBox.itemData( - self.keySizeComboBox.currentIndex())) - Preferences.setHelp("SyncEncryptPasswordsOnly", - self.loginsOnlyCheckBox.isChecked()) + Preferences.setHelp( + "SyncEncryptData", self.encryptionGroupBox.isChecked()) + Preferences.setHelp( + "SyncEncryptionKey", self.encryptionKeyEdit.text()) + Preferences.setHelp( + "SyncEncryptionKeyLength", self.keySizeComboBox.itemData( + self.keySizeComboBox.currentIndex())) + Preferences.setHelp( + "SyncEncryptPasswordsOnly", self.loginsOnlyCheckBox.isChecked()) from . import SyncGlobals return SyncGlobals.PageType @@ -89,12 +94,15 @@ self.reencryptCheckBox.isChecked()) if self.encryptionKeyEdit.text() == "": - error = error or self.trUtf8("Encryption key must not be empty.") + error = error or self.trUtf8( + "Encryption key must not be empty.") if self.encryptionKeyEdit.text() != "" and \ - self.reencryptCheckBox.isChecked() and \ - self.encryptionKeyEdit.text() != self.encryptionKeyAgainEdit.text(): - error = error or self.trUtf8("Repeated encryption key is wrong.") + self.reencryptCheckBox.isChecked() and \ + (self.encryptionKeyEdit.text() != + self.encryptionKeyAgainEdit.text()): + error = error or self.trUtf8( + "Repeated encryption key is wrong.") self.errorLabel.setText(error) self.completeChanged.emit()
--- a/Helpviewer/Sync/SyncHandler.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Sync/SyncHandler.py Thu Oct 10 18:35:45 2013 +0200 @@ -21,13 +21,15 @@ Base class for synchronization handlers. @signal syncStatus(type_, message) emitted to indicate the synchronization - status (string one of "bookmarks", "history", "passwords", "useragents" or - "speeddial", string) - @signal syncError(message) emitted for a general error with the error message (string) - @signal syncMessage(message) emitted to send a message about synchronization (string) - @signal syncFinished(type_, done, download) emitted after a synchronization has - finished (string one of "bookmarks", "history", "passwords", "useragents" or - "speeddial", boolean, boolean) + status (string one of "bookmarks", "history", "passwords", + "useragents" or "speeddial", string) + @signal syncError(message) emitted for a general error with the error + message (string) + @signal syncMessage(message) emitted to send a message about + synchronization (string) + @signal syncFinished(type_, done, download) emitted after a + synchronization has finished (string one of "bookmarks", "history", + "passwords", "useragents" or "speeddial", boolean, boolean) """ syncStatus = pyqtSignal(str, str) syncError = pyqtSignal(str) @@ -57,60 +59,72 @@ "RemoteExists": self.trUtf8( "Remote bookmarks file exists! Syncing local copy..."), "RemoteMissing": self.trUtf8( - "Remote bookmarks file does NOT exists. Exporting local copy..."), + "Remote bookmarks file does NOT exists. Exporting" + " local copy..."), "LocalNewer": self.trUtf8( "Local bookmarks file is NEWER. Exporting local copy..."), "LocalMissing": self.trUtf8( - "Local bookmarks file does NOT exist. Skipping synchronization!"), + "Local bookmarks file does NOT exist. Skipping" + " synchronization!"), "Uploading": self.trUtf8("Uploading local bookmarks file..."), }, "history": { "RemoteExists": self.trUtf8( "Remote history file exists! Syncing local copy..."), "RemoteMissing": self.trUtf8( - "Remote history file does NOT exists. Exporting local copy..."), + "Remote history file does NOT exists. Exporting" + " local copy..."), "LocalNewer": self.trUtf8( "Local history file is NEWER. Exporting local copy..."), "LocalMissing": self.trUtf8( - "Local history file does NOT exist. Skipping synchronization!"), + "Local history file does NOT exist. Skipping" + " synchronization!"), "Uploading": self.trUtf8("Uploading local history file..."), }, "passwords": { "RemoteExists": self.trUtf8( "Remote logins file exists! Syncing local copy..."), "RemoteMissing": self.trUtf8( - "Remote logins file does NOT exists. Exporting local copy..."), + "Remote logins file does NOT exists. Exporting" + " local copy..."), "LocalNewer": self.trUtf8( "Local logins file is NEWER. Exporting local copy..."), "LocalMissing": self.trUtf8( - "Local logins file does NOT exist. Skipping synchronization!"), + "Local logins file does NOT exist. Skipping" + " synchronization!"), "Uploading": self.trUtf8("Uploading local logins file..."), }, "useragents": { "RemoteExists": self.trUtf8( - "Remote user agent settings file exists! Syncing local copy..."), + "Remote user agent settings file exists! Syncing local" + " copy..."), "RemoteMissing": self.trUtf8( "Remote user agent settings file does NOT exists." " Exporting local copy..."), "LocalNewer": self.trUtf8( - "Local user agent settings file is NEWER. Exporting local copy..."), + "Local user agent settings file is NEWER. Exporting" + " local copy..."), "LocalMissing": self.trUtf8( "Local user agent settings file does NOT exist." " Skipping synchronization!"), - "Uploading": self.trUtf8("Uploading local user agent settings file..."), + "Uploading": self.trUtf8("Uploading local user agent" + " settings file..."), }, "speeddial": { "RemoteExists": self.trUtf8( - "Remote speed dial settings file exists! Syncing local copy..."), + "Remote speed dial settings file exists! Syncing local" + " copy..."), "RemoteMissing": self.trUtf8( "Remote speed dial settings file does NOT exists." " Exporting local copy..."), "LocalNewer": self.trUtf8( - "Local speed dial settings file is NEWER. Exporting local copy..."), + "Local speed dial settings file is NEWER. Exporting" + " local copy..."), "LocalMissing": self.trUtf8( "Local speed dial settings file does NOT exist." " Skipping synchronization!"), - "Uploading": self.trUtf8("Uploading local speed dial settings file..."), + "Uploading": self.trUtf8("Uploading local speed dial" + " settings file..."), }, } @@ -163,7 +177,8 @@ """ Public method to do the initial check. - @keyparam forceUpload flag indicating a forced upload of the files (boolean) + @keyparam forceUpload flag indicating a forced upload of the files + (boolean) @exception NotImplementedError raised to indicate that this method must be implemented by subclasses """ @@ -182,12 +197,13 @@ """ Public method to read a file. - If encrypted synchronization is enabled, the data will be encrypted using - the relevant encryption key. + If encrypted synchronization is enabled, the data will be encrypted + using the relevant encryption key. @param fileName name of the file to be read (string) @param type_ type of the synchronization event (string one - of "bookmarks", "history", "passwords", "useragents" or "speeddial") + of "bookmarks", "history", "passwords", "useragents" or + "speeddial") @return data of the file, optionally encrypted (QByteArray) """ if os.path.exists(fileName): @@ -220,21 +236,24 @@ """ Public method to write the data to a file. - If encrypted synchronization is enabled, the data will be decrypted using - the relevant encryption key. + If encrypted synchronization is enabled, the data will be decrypted + using the relevant encryption key. @param data data to be written and optionally decrypted (QByteArray) @param fileName name of the file the data is to be written to (string) @param type_ type of the synchronization event (string one - of "bookmarks", "history", "passwords", "useragents" or "speeddial") + of "bookmarks", "history", "passwords", "useragents" or + "speeddial") @param timestamp timestamp to be given to the file (int) - @return tuple giving a success flag and an error string (boolean, string) + @return tuple giving a success flag and an error string (boolean, + string) """ data = bytes(data) if Preferences.getHelp("SyncEncryptData") and \ - (not Preferences.getHelp("SyncEncryptPasswordsOnly") or \ - (Preferences.getHelp("SyncEncryptPasswordsOnly") and type_ == "passwords")): + (not Preferences.getHelp("SyncEncryptPasswordsOnly") or + (Preferences.getHelp("SyncEncryptPasswordsOnly") and + type_ == "passwords")): key = Preferences.getHelp("SyncEncryptionKey") if not key: return False, self.trUtf8("Invalid encryption key given.")
--- a/Helpviewer/Sync/SyncManager.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/Sync/SyncManager.py Thu Oct 10 18:35:45 2013 +0200 @@ -23,11 +23,11 @@ @signal syncMessage(message) emitted to give status info about the sync process (string) @signal syncStatus(type_, message) emitted to indicate the synchronization - status (string one of "bookmarks", "history", "passwords", "useragents" or - "speeddial", string) - @signal syncFinished(type_, done, download) emitted after a synchronization has - finished (string one of "bookmarks", "history", "passwords", "useragents" or - "speeddial", boolean, boolean) + status (string one of "bookmarks", "history", "passwords", + "useragents" or "speeddial", string) + @signal syncFinished(type_, done, download) emitted after a + synchronization has finished (string one of "bookmarks", "history", + "passwords", "useragents" or "speeddial", boolean, boolean) """ syncError = pyqtSignal(str) syncMessage = pyqtSignal(str) @@ -64,7 +64,8 @@ """ Public method to load the settings. - @keyparam forceUpload flag indicating a forced upload of the files (boolean) + @keyparam forceUpload flag indicating a forced upload of the files + (boolean) """ if self.__handler is not None: self.__handler.syncError.disconnect(self.__syncError) @@ -78,7 +79,8 @@ if Preferences.getHelp("SyncType") == SyncGlobals.SyncTypeFtp: from .FtpSyncHandler import FtpSyncHandler self.__handler = FtpSyncHandler(self) - elif Preferences.getHelp("SyncType") == SyncGlobals.SyncTypeDirectory: + elif Preferences.getHelp("SyncType") == \ + SyncGlobals.SyncTypeDirectory: from .DirectorySyncHandler import DirectorySyncHandler self.__handler = DirectorySyncHandler(self) self.__handler.syncError.connect(self.__syncError) @@ -90,12 +92,12 @@ # connect sync manager to bookmarks manager if Preferences.getHelp("SyncBookmarks"): - Helpviewer.HelpWindow.HelpWindow.bookmarksManager().bookmarksSaved\ - .connect(self.__syncBookmarks) + Helpviewer.HelpWindow.HelpWindow.bookmarksManager()\ + .bookmarksSaved.connect(self.__syncBookmarks) else: try: - Helpviewer.HelpWindow.HelpWindow.bookmarksManager().bookmarksSaved\ - .disconnect(self.__syncBookmarks) + Helpviewer.HelpWindow.HelpWindow.bookmarksManager()\ + .bookmarksSaved.disconnect(self.__syncBookmarks) except TypeError: pass @@ -105,19 +107,19 @@ .connect(self.__syncHistory) else: try: - Helpviewer.HelpWindow.HelpWindow.historyManager().historySaved\ - .disconnect(self.__syncHistory) + Helpviewer.HelpWindow.HelpWindow.historyManager()\ + .historySaved.disconnect(self.__syncHistory) except TypeError: pass # connect sync manager to passwords manager if Preferences.getHelp("SyncPasswords"): - Helpviewer.HelpWindow.HelpWindow.passwordManager().passwordsSaved\ - .connect(self.__syncPasswords) + Helpviewer.HelpWindow.HelpWindow.passwordManager()\ + .passwordsSaved.connect(self.__syncPasswords) else: try: - Helpviewer.HelpWindow.HelpWindow.passwordManager().passwordsSaved\ - .disconnect(self.__syncPasswords) + Helpviewer.HelpWindow.HelpWindow.passwordManager()\ + .passwordsSaved.disconnect(self.__syncPasswords) except TypeError: pass @@ -128,7 +130,8 @@ else: try: Helpviewer.HelpWindow.HelpWindow.userAgentsManager()\ - .userAgentSettingsSaved.disconnect(self.__syncUserAgents) + .userAgentSettingsSaved.disconnect( + self.__syncUserAgents) except TypeError: pass @@ -146,8 +149,8 @@ self.__handler = None try: - Helpviewer.HelpWindow.HelpWindow.bookmarksManager().bookmarksSaved\ - .disconnect(self.__syncBookmarks) + Helpviewer.HelpWindow.HelpWindow.bookmarksManager()\ + .bookmarksSaved.disconnect(self.__syncBookmarks) except TypeError: pass try: @@ -156,8 +159,8 @@ except TypeError: pass try: - Helpviewer.HelpWindow.HelpWindow.passwordManager().passwordsSaved\ - .disconnect(self.__syncPasswords) + Helpviewer.HelpWindow.HelpWindow.passwordManager()\ + .passwordsSaved.disconnect(self.__syncPasswords) except TypeError: pass try: @@ -229,7 +232,8 @@ Private slot to handle a finished synchronization event. @param type_ type of the synchronization event (string one - of "bookmarks", "history", "passwords", "useragents" or "speeddial") + of "bookmarks", "history", "passwords", "useragents" or + "speeddial") @param status flag indicating success (boolean) @param download flag indicating a download of a file (boolean) """ @@ -251,7 +255,8 @@ Private slot to handle a status update of a synchronization event. @param type_ type of the synchronization event (string one - of "bookmarks", "history", "passwords", "useragents" or "speeddial") + of "bookmarks", "history", "passwords", "useragents" or + "speeddial") @param message status message for the event (string) """ self.syncMessage.emit(message)
--- a/Helpviewer/UrlBar/FavIconLabel.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/UrlBar/FavIconLabel.py Thu Oct 10 18:35:45 2013 +0200 @@ -42,7 +42,8 @@ url = QUrl() if self.__browser: url = self.__browser.url() - self.setPixmap(Helpviewer.HelpWindow.HelpWindow.icon(url).pixmap(16, 16)) + self.setPixmap( + Helpviewer.HelpWindow.HelpWindow.icon(url).pixmap(16, 16)) except RuntimeError: pass
--- a/Helpviewer/UrlBar/UrlBar.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/UrlBar/UrlBar.py Thu Oct 10 18:35:45 2013 +0200 @@ -8,7 +8,8 @@ """ from PyQt4.QtCore import pyqtSlot, Qt, QPointF, QUrl, QDateTime, qVersion -from PyQt4.QtGui import QColor, QPalette, QLinearGradient, QIcon, QDialog, QApplication +from PyQt4.QtGui import QColor, QPalette, QLinearGradient, QIcon, QDialog, \ + QApplication try: from PyQt4.QtNetwork import QSslCertificate # __IGNORE_EXCEPTION__ except ImportError: @@ -49,7 +50,8 @@ QWebSettings.PrivateBrowsingEnabled) self.__bmActiveIcon = UI.PixmapCache.getIcon("bookmark16.png") - self.__bmInactiveIcon = QIcon(self.__bmActiveIcon.pixmap(16, 16, QIcon.Disabled)) + self.__bmInactiveIcon = QIcon( + self.__bmActiveIcon.pixmap(16, 16, QIcon.Disabled)) self.__favicon = FavIconLabel(self) self.addWidget(self.__favicon, E5LineEdit.LeftSide) @@ -59,7 +61,8 @@ self.__sslLabel.setVisible(False) self.__privacyButton = E5LineEditButton(self) - self.__privacyButton.setIcon(UI.PixmapCache.getIcon("privateBrowsing.png")) + self.__privacyButton.setIcon( + UI.PixmapCache.getIcon("privateBrowsing.png")) self.addWidget(self.__privacyButton, E5LineEdit.RightSide) self.__privacyButton.setVisible(self.__privateMode) @@ -84,12 +87,12 @@ self.__mw.privacyChanged.connect(self.__privacyButton.setVisible) self.textChanged.connect(self.__textChanged) - Helpviewer.HelpWindow.HelpWindow.bookmarksManager().entryChanged.connect( - self.__bookmarkChanged) - Helpviewer.HelpWindow.HelpWindow.bookmarksManager().entryAdded.connect( - self.__bookmarkChanged) - Helpviewer.HelpWindow.HelpWindow.bookmarksManager().entryRemoved.connect( - self.__bookmarkChanged) + Helpviewer.HelpWindow.HelpWindow.bookmarksManager()\ + .entryChanged.connect(self.__bookmarkChanged) + Helpviewer.HelpWindow.HelpWindow.bookmarksManager()\ + .entryAdded.connect(self.__bookmarkChanged) + Helpviewer.HelpWindow.HelpWindow.bookmarksManager()\ + .entryRemoved.connect(self.__bookmarkChanged) Helpviewer.HelpWindow.HelpWindow.speedDial().pagesChanged.connect( self.__bookmarkChanged) @@ -178,18 +181,20 @@ sslInfo = self.__browser.page().getSslCertificate() if sslInfo is not None: if qVersion() >= "5.0.0": - org = Utilities.decodeString( - ", ".join(sslInfo.subjectInfo(QSslCertificate.Organization))) + org = Utilities.decodeString(", ".join( + sslInfo.subjectInfo(QSslCertificate.Organization))) else: org = Utilities.decodeString( sslInfo.subjectInfo(QSslCertificate.Organization)) if org == "": if qVersion() >= "5.0.0": cn = Utilities.decodeString(", ".join( - sslInfo.subjectInfo(QSslCertificate.CommonName))) + sslInfo.subjectInfo( + QSslCertificate.CommonName))) else: cn = Utilities.decodeString( - sslInfo.subjectInfo(QSslCertificate.CommonName)) + sslInfo.subjectInfo( + QSslCertificate.CommonName)) if cn != "": org = cn.split(".", 1)[1] if org == "": @@ -244,7 +249,8 @@ """ Private slot to show a dialog with some bookmark info. """ - from .BookmarkActionSelectionDialog import BookmarkActionSelectionDialog + from .BookmarkActionSelectionDialog import \ + BookmarkActionSelectionDialog url = self.__browser.url() dlg = BookmarkActionSelectionDialog(url) if dlg.exec_() == QDialog.Accepted: @@ -290,7 +296,8 @@ if self.__browser.url().scheme() == "https": if QSslCertificate is not None: if self.__browser.page().hasValidSslInfo(): - backgroundColor = Preferences.getHelp("SaveUrlColor") + backgroundColor = Preferences.getHelp( + "SaveUrlColor") else: backgroundColor = Preferences.getHelp("SaveUrlColor") p.setBrush(QPalette.Base, backgroundColor) @@ -299,7 +306,8 @@ if self.__browser.url().scheme() == "https": if QSslCertificate is not None: if self.__browser.page().hasValidSslInfo(): - backgroundColor = Preferences.getHelp("SaveUrlColor") + backgroundColor = Preferences.getHelp( + "SaveUrlColor") else: backgroundColor = Preferences.getHelp("SaveUrlColor") highlight = QApplication.palette().color(QPalette.Highlight) @@ -308,14 +316,16 @@ b = (highlight.blue() + 2 * backgroundColor.blue()) // 3 loadingColor = QColor(r, g, b) - if abs(loadingColor.lightness() - backgroundColor.lightness()) < 20: + if abs(loadingColor.lightness() - + backgroundColor.lightness()) < 20: # special handling for special color schemes (e.g Gaia) r = (2 * highlight.red() + backgroundColor.red()) // 3 g = (2 * highlight.green() + backgroundColor.green()) // 3 b = (2 * highlight.blue() + backgroundColor.blue()) // 3 loadingColor = QColor(r, g, b) - gradient = QLinearGradient(QPointF(0, 0), QPointF(self.width(), 0)) + gradient = QLinearGradient( + QPointF(0, 0), QPointF(self.width(), 0)) gradient.setColorAt(0, loadingColor) gradient.setColorAt(progress / 100 - 0.000001, loadingColor) gradient.setColorAt(progress / 100, backgroundColor) @@ -366,7 +376,8 @@ @param evt reference to the key press event (QKeyEvent) """ if evt.key() == Qt.Key_Escape and self.__browser is not None: - self.setText(str(self.__browser.url().toEncoded(), encoding="utf-8")) + self.setText( + str(self.__browser.url().toEncoded(), encoding="utf-8")) self.selectAll() return @@ -376,8 +387,8 @@ append = "" if evt.modifiers() == Qt.KeyboardModifiers(Qt.ControlModifier): append = ".com" - elif evt.modifiers() == \ - Qt.KeyboardModifiers(Qt.ControlModifier | Qt.ShiftModifier): + elif evt.modifiers() == Qt.KeyboardModifiers( + Qt.ControlModifier | Qt.ShiftModifier): append = ".org" elif evt.modifiers() == Qt.KeyboardModifiers(Qt.ShiftModifier): append = ".net"
--- a/Helpviewer/UserAgent/UserAgentManager.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/UserAgent/UserAgentManager.py Thu Oct 10 18:35:45 2013 +0200 @@ -22,7 +22,8 @@ Class implementing a user agent manager. @signal changed() emitted to indicate a change - @signal userAgentSettingsSaved() emitted after the user agent settings were saved + @signal userAgentSettingsSaved() emitted after the user agent settings + were saved """ changed = pyqtSignal() userAgentSettingsSaved = pyqtSignal() @@ -35,7 +36,8 @@ """ super().__init__(parent) - self.__agents = {} # dictionary with agent strings indexed by host name + self.__agents = {} # dictionary with agent strings indexed + # by host name self.__loaded = False self.__saveTimer = AutoSaver(self, self.save) @@ -47,7 +49,8 @@ @return name of the user agents file (string) """ - return os.path.join(Utilities.getConfigDir(), "browser", "userAgentSettings.xml") + return os.path.join( + Utilities.getConfigDir(), "browser", "userAgentSettings.xml") def save(self): """ @@ -62,8 +65,9 @@ if not writer.write(agentFile, self.__agents): E5MessageBox.critical(None, self.trUtf8("Saving user agent data"), - self.trUtf8("""<p>User agent data could not be saved to <b>{0}</b></p>""" - ).format(agentFile)) + self.trUtf8( + """<p>User agent data could not be saved to""" + """ <b>{0}</b></p>""").format(agentFile)) else: self.userAgentSettingsSaved.emit() @@ -156,7 +160,8 @@ def allHostNames(self): """ - Public method to get a list of all host names we a user agent setting for. + Public method to get a list of all host names we a user agent setting + for. @return sorted list of all host names (list of strings) """
--- a/Helpviewer/UserAgent/UserAgentMenu.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/UserAgent/UserAgentMenu.py Thu Oct 10 18:35:45 2013 +0200 @@ -32,7 +32,8 @@ if self.__url: if self.__url.isValid(): import Helpviewer.HelpWindow - self.__manager = Helpviewer.HelpWindow.HelpWindow.userAgentsManager() + self.__manager = \ + Helpviewer.HelpWindow.HelpWindow.userAgentsManager() else: self.__url = None @@ -50,7 +51,8 @@ self.__defaultUserAgent = QAction(self) self.__defaultUserAgent.setText(self.trUtf8("Default")) self.__defaultUserAgent.setCheckable(True) - self.__defaultUserAgent.triggered[()].connect(self.__switchToDefaultUserAgent) + self.__defaultUserAgent.triggered[()].connect( + self.__switchToDefaultUserAgent) if self.__url: self.__defaultUserAgent.setChecked( self.__manager.userAgentForUrl(self.__url) == "") @@ -69,7 +71,8 @@ self.__otherUserAgent = QAction(self) self.__otherUserAgent.setText(self.trUtf8("Other...")) self.__otherUserAgent.setCheckable(True) - self.__otherUserAgent.triggered[()].connect(self.__switchToOtherUserAgent) + self.__otherUserAgent.triggered[()].connect( + self.__switchToOtherUserAgent) self.addAction(self.__otherUserAgent) self.__actionGroup.addAction(self.__otherUserAgent) self.__otherUserAgent.setChecked(not isChecked) @@ -174,7 +177,8 @@ if xml.hasError(): E5MessageBox.critical(self, self.trUtf8("Parsing default user agents"), - self.trUtf8("""<p>Error parsing default user agents.</p><p>{0}</p>""")\ + self.trUtf8( + """<p>Error parsing default user agents.</p><p>{0}</p>""") .format(xml.errorString())) return isChecked
--- a/Helpviewer/UserAgent/UserAgentReader.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/UserAgent/UserAgentReader.py Thu Oct 10 18:35:45 2013 +0200 @@ -27,7 +27,8 @@ @param fileNameOrDevice name of the file to read (string) or reference to the device to read (QIODevice) - @return dictionary with user agent data (host as key, agent string as value) + @return dictionary with user agent data (host as key, agent string as + value) """ self.__agents = {}
--- a/Helpviewer/UserAgent/UserAgentsDialog.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/UserAgent/UserAgentsDialog.py Thu Oct 10 18:35:45 2013 +0200 @@ -29,15 +29,18 @@ super().__init__(parent) self.setupUi(self) - self.removeButton.clicked[()].connect(self.userAgentsTable.removeSelected) - self.removeAllButton.clicked[()].connect(self.userAgentsTable.removeAll) + self.removeButton.clicked[()].connect( + self.userAgentsTable.removeSelected) + self.removeAllButton.clicked[()].connect( + self.userAgentsTable.removeAll) self.userAgentsTable.verticalHeader().hide() - self.__userAgentModel = \ - UserAgentModel(Helpviewer.HelpWindow.HelpWindow.userAgentsManager(), self) + self.__userAgentModel = UserAgentModel( + Helpviewer.HelpWindow.HelpWindow.userAgentsManager(), self) self.__proxyModel = QSortFilterProxyModel(self) self.__proxyModel.setSourceModel(self.__userAgentModel) - self.searchEdit.textChanged.connect(self.__proxyModel.setFilterFixedString) + self.searchEdit.textChanged.connect( + self.__proxyModel.setFilterFixedString) self.userAgentsTable.setModel(self.__proxyModel) fm = QFontMetrics(QFont())
--- a/Helpviewer/WebPlugins/ClickToFlash/ClickToFlash.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/WebPlugins/ClickToFlash/ClickToFlash.py Thu Oct 10 18:35:45 2013 +0200 @@ -11,7 +11,8 @@ from PyQt4.QtCore import pyqtSlot, QUrl, Qt, QByteArray, QTimer from PyQt4.QtGui import QWidget, QMenu, QCursor, QDialog, QLabel, QFormLayout from PyQt4.QtNetwork import QNetworkRequest -from PyQt4.QtWebKit import QWebHitTestResult, QWebElement, QWebView, QWebElementCollection +from PyQt4.QtWebKit import QWebHitTestResult, QWebElement, QWebView, \ + QWebElementCollection from .Ui_ClickToFlash import Ui_ClickToFlash @@ -26,7 +27,8 @@ _acceptedArgNames = [] _acceptedArgValues = [] - def __init__(self, plugin, mimeType, url, argumentNames, argumentValues, parent=None): + def __init__(self, plugin, mimeType, url, argumentNames, argumentValues, + parent=None): """ Constructor @@ -89,16 +91,19 @@ font = act.font() font.setBold(True) act.setFont(font) - menu.addAction(self.trUtf8("Show information about object"), self.__showInfo) + menu.addAction( + self.trUtf8("Show information about object"), self.__showInfo) menu.addSeparator() menu.addAction(self.trUtf8("Load"), self.__load) menu.addAction(self.trUtf8("Delete object"), self.__hideAdBlocked) menu.addSeparator() host = self.__url.host() - add = menu.addAction(self.trUtf8("Add '{0}' to Whitelist".format(host)), - self.__addToWhitelist) - remove = menu.addAction(self.trUtf8("Remove '{0}' from Whitelist".format(host)), - self.__removeFromWhitelist) + add = menu.addAction( + self.trUtf8("Add '{0}' to Whitelist").format(host), + self.__addToWhitelist) + remove = menu.addAction( + self.trUtf8("Remove '{0}' from Whitelist").format(host), + self.__removeFromWhitelist) onWhitelist = self.__plugin.onWhitelist(host) add.setEnabled(not onWhitelist) remove.setEnabled(onWhitelist) @@ -152,7 +157,8 @@ def __findElement(self): """ - Private method to find the element belonging to this ClickToFlash instance. + Private method to find the element belonging to this ClickToFlash + instance. """ parent = self.parentWidget() view = None @@ -216,7 +222,8 @@ checkString = view.url().resolved(QUrl(checkString)).toString( QUrl.RemoveQuery) - return self.__url.toEncoded().contains(QByteArray(checkString.encode("utf-8"))) + return self.__url.toEncoded().contains( + QByteArray(checkString.encode("utf-8"))) def __checkElement(self, element): """ @@ -297,11 +304,13 @@ @classmethod def isAlreadyAccepted(cls, url, argumentNames, argumentValues): """ - Class method to check, if the given parameter combination is being accepted. + Class method to check, if the given parameter combination is being + accepted. @param url URL to be checked for (QUrl) @param argumentNames argument names to be checked for (list of strings) - @param argumentValues argument values to be checked for (list of strings) + @param argumentValues argument values to be checked for (list of + strings) @return flag indicating that this was already accepted (boolean) """ return url == cls._acceptedUrl and \
--- a/Helpviewer/WebPlugins/ClickToFlash/ClickToFlashWhitelistDialog.py Wed Oct 09 19:47:41 2013 +0200 +++ b/Helpviewer/WebPlugins/ClickToFlash/ClickToFlashWhitelistDialog.py Thu Oct 10 18:35:45 2013 +0200 @@ -39,7 +39,8 @@ self.__proxyModel.setSourceModel(self.__model) self.whitelist.setModel(self.__proxyModel) - self.searchEdit.textChanged.connect(self.__proxyModel.setFilterFixedString) + self.searchEdit.textChanged.connect( + self.__proxyModel.setFilterFixedString) self.removeButton.clicked[()].connect(self.whitelist.removeSelected) self.removeAllButton.clicked[()].connect(self.whitelist.removeAll)