--- a/WebBrowser/WebBrowserPage.py Mon Jul 03 19:23:54 2017 +0200 +++ b/WebBrowser/WebBrowserPage.py Tue Jul 04 19:44:30 2017 +0200 @@ -378,70 +378,70 @@ #################################################### ## 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"])) +## +## 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