--- a/WebBrowser/WebBrowserPage.py Tue Jul 04 19:44:30 2017 +0200 +++ b/WebBrowser/WebBrowserPage.py Wed Jul 05 19:38:06 2017 +0200 @@ -14,8 +14,7 @@ except NameError: pass -from PyQt5.QtCore import pyqtSlot, QUrl, QTimer, QEventLoop, QPoint, QPointF, \ - QByteArray, QDataStream, QIODevice +from PyQt5.QtCore import pyqtSlot, QUrl, QTimer, QEventLoop, QPoint, QPointF from PyQt5.QtGui import QDesktopServices from PyQt5.QtWebEngineWidgets import QWebEnginePage, QWebEngineSettings, \ QWebEngineScript @@ -375,74 +374,6 @@ self.view().mainWindow().javascriptConsole().javaScriptConsoleMessage( level, message, lineNumber, sourceId) - #################################################### - ## Methods below implement session related functions - #################################################### -## -## def getSessionData(self): -## """ -## Public method to populate the session data. -## -## @return dictionary containing the session data -## @rtype dict -## """ -## sessionData = {} -## -## # 1. zoom factor -## sessionData["ZoomFactor"] = self.zoomFactor() -## -## # 2. scroll position -## scrollPos = self.scrollPosition() -## sessionData["ScrollPosition"] = { -## "x": scrollPos.x(), -## "y": scrollPos.y(), -## } -## -## # 3. page history -## historyArray = QByteArray() -## stream = QDataStream(historyArray, QIODevice.WriteOnly) -## stream << self.history() -## sessionData["History"] = str( -## historyArray.toBase64(QByteArray.Base64UrlEncoding), -## encoding="ascii") -## sessionData["HistoryIndex"] = self.history().currentItemIndex() -## -## # 4. current URL -## sessionData["Url"] = self.url().toString( -## QUrl.PrettyDecoded | QUrl.RemovePassword) -## -## return sessionData -## -## def loadFromSessionData(self, sessionData): -## """ -## Public method to load the session data. -## -## @param sessionData dictionary containing the session data as -## generated by getSessionData() -## @type dict -## """ -## # 1. page history -## if "History" in sessionData: -## historyArray = QByteArray.fromBase64( -## sessionData["History"].encode("ascii"), -## QByteArray.Base64UrlEncoding) -## stream = QDataStream(historyArray, QIODevice.ReadOnly) -## stream >> self.history() -## -## if "HistoryIndex" in sessionData: -## item = self.history().itemAt(sessionData["HistoryIndex"]) -## if item is not None: -## self.history().goToItem(item) -## -## # 2. zoom factor -## if "ZoomFactor" in sessionData: -## self.setZoomFactor(sessionData["ZoomFactor"]) -## -## # 3. scroll position -## if "ScrollPosition" in sessionData: -## scrollPos = sessionData["ScrollPosition"] -## self.scrollTo(QPointF(scrollPos["x"], scrollPos["y"])) - ################################################## ## Methods below implement compatibility functions ##################################################