Fri, 07 Jul 2017 19:05:53 +0200
Some fixes and adjustments for the session support of the Web Browser NG.
--- a/APIs/Python3/eric6.api Thu Jul 06 19:13:51 2017 +0200 +++ b/APIs/Python3/eric6.api Fri Jul 07 19:05:53 2017 +0200 @@ -11165,6 +11165,7 @@ eric6.WebBrowser.WebBrowserWindow.WebBrowserWindow.historyManager?4() eric6.WebBrowser.WebBrowserWindow.WebBrowserWindow.icon?4(url) eric6.WebBrowser.WebBrowserWindow.WebBrowserWindow.imageSearchEngine?4() +eric6.WebBrowser.WebBrowserWindow.WebBrowserWindow.isClosing?4() eric6.WebBrowser.WebBrowserWindow.WebBrowserWindow.isFullScreenNavigationVisible?4() eric6.WebBrowser.WebBrowserWindow.WebBrowserWindow.isPrivate?4() eric6.WebBrowser.WebBrowserWindow.WebBrowserWindow.javascriptConsole?4()
--- a/Documentation/Help/source.qhp Thu Jul 06 19:13:51 2017 +0200 +++ b/Documentation/Help/source.qhp Fri Jul 07 19:05:53 2017 +0200 @@ -16213,6 +16213,7 @@ <keyword name="WebBrowserWindow.historyManager" id="WebBrowserWindow.historyManager" ref="eric6.WebBrowser.WebBrowserWindow.html#WebBrowserWindow.historyManager" /> <keyword name="WebBrowserWindow.icon" id="WebBrowserWindow.icon" ref="eric6.WebBrowser.WebBrowserWindow.html#WebBrowserWindow.icon" /> <keyword name="WebBrowserWindow.imageSearchEngine" id="WebBrowserWindow.imageSearchEngine" ref="eric6.WebBrowser.WebBrowserWindow.html#WebBrowserWindow.imageSearchEngine" /> + <keyword name="WebBrowserWindow.isClosing" id="WebBrowserWindow.isClosing" ref="eric6.WebBrowser.WebBrowserWindow.html#WebBrowserWindow.isClosing" /> <keyword name="WebBrowserWindow.isFullScreenNavigationVisible" id="WebBrowserWindow.isFullScreenNavigationVisible" ref="eric6.WebBrowser.WebBrowserWindow.html#WebBrowserWindow.isFullScreenNavigationVisible" /> <keyword name="WebBrowserWindow.isPrivate" id="WebBrowserWindow.isPrivate" ref="eric6.WebBrowser.WebBrowserWindow.html#WebBrowserWindow.isPrivate" /> <keyword name="WebBrowserWindow.javascriptConsole" id="WebBrowserWindow.javascriptConsole" ref="eric6.WebBrowser.WebBrowserWindow.html#WebBrowserWindow.javascriptConsole" />
--- a/Documentation/Source/eric6.WebBrowser.WebBrowserWindow.html Thu Jul 06 19:13:51 2017 +0200 +++ b/Documentation/Source/eric6.WebBrowser.WebBrowserWindow.html Fri Jul 07 19:05:53 2017 +0200 @@ -553,6 +553,9 @@ <td><a href="#WebBrowserWindow.hideFullScreenNavigation">hideFullScreenNavigation</a></td> <td>Public slot to hide full screen navigation.</td> </tr><tr> +<td><a href="#WebBrowserWindow.isClosing">isClosing</a></td> +<td>Public method to test, if the window is closing.</td> +</tr><tr> <td><a href="#WebBrowserWindow.isFullScreenNavigationVisible">isFullScreenNavigationVisible</a></td> <td>Public method to check, if full screen navigation is active.</td> </tr><tr> @@ -1978,7 +1981,22 @@ <b>hideFullScreenNavigation</b>(<i></i>) <p> Public slot to hide full screen navigation. -</p><a NAME="WebBrowserWindow.isFullScreenNavigationVisible" ID="WebBrowserWindow.isFullScreenNavigationVisible"></a> +</p><a NAME="WebBrowserWindow.isClosing" ID="WebBrowserWindow.isClosing"></a> +<h4>WebBrowserWindow.isClosing</h4> +<b>isClosing</b>(<i></i>) +<p> + Public method to test, if the window is closing. +</p><dl> +<dt>Returns:</dt> +<dd> +flag indicating that the window is closing +</dd> +</dl><dl> +<dt>Return Type:</dt> +<dd> +bool +</dd> +</dl><a NAME="WebBrowserWindow.isFullScreenNavigationVisible" ID="WebBrowserWindow.isFullScreenNavigationVisible"></a> <h4>WebBrowserWindow.isFullScreenNavigationVisible</h4> <b>isFullScreenNavigationVisible</b>(<i></i>) <p>
--- a/WebBrowser/Session/SessionManager.py Thu Jul 06 19:13:51 2017 +0200 +++ b/WebBrowser/Session/SessionManager.py Fri Jul 07 19:05:53 2017 +0200 @@ -441,9 +441,6 @@ geometry = QByteArray.fromBase64( data["WindowGeometry"].encode("ascii")) window.restoreGeometry(geometry) - if Utilities.isWindowsPlatform(): - window.hide() - window.show() QApplication.processEvents() # restore additional windows @@ -455,9 +452,6 @@ geometry = QByteArray.fromBase64( data["WindowGeometry"].encode("ascii")) window.restoreGeometry(geometry) - if Utilities.isWindowsPlatform(): - window.hide() - window.show() QApplication.processEvents() QApplication.restoreOverrideCursor() @@ -466,7 +460,7 @@ try: currentWindow = \ WebBrowserWindow.mainWindows()[currentWindowIndex] - currentWindow.raise_() + QTimer.singleShot(0, lambda: currentWindow.raise_()) except IndexError: # ignore it pass
--- a/WebBrowser/WebBrowserTabWidget.py Thu Jul 06 19:13:51 2017 +0200 +++ b/WebBrowser/WebBrowserTabWidget.py Fri Jul 07 19:05:53 2017 +0200 @@ -1237,7 +1237,6 @@ Preferences.getWebBrowser("LoadTabOnActivation") for data in sessionData["Tabs"]: browser = self.newBrowser(restoreSession=True) - QApplication.processEvents() if loadTabOnActivate: browser.storeSessionData(data) title, urlStr, icon = browser.extractSessionMetaData(data) @@ -1248,7 +1247,8 @@ browser.loadFromSessionData(data) # 2. set tab index - if "CurrentTabIndex" in sessionData: + if "CurrentTabIndex" in sessionData and \ + sessionData["CurrentTabIndex"] >= 0: index = tabCount + sessionData["CurrentTabIndex"] self.setCurrentIndex(index) self.browserAt(index).activateSession()
--- a/WebBrowser/WebBrowserView.py Thu Jul 06 19:13:51 2017 +0200 +++ b/WebBrowser/WebBrowserView.py Fri Jul 07 19:05:53 2017 +0200 @@ -1917,8 +1917,8 @@ loop is running. """ if self.__restoreData: - self.loadFromSessionData(self.__restoreData) - self.__restoreData = None + sessionData, self.__restoreData = self.__restoreData, None + self.loadFromSessionData(sessionData) def showEvent(self, evt): """ @@ -1934,7 +1934,7 @@ """ Private slot to activate a restored session. """ - if self.__restoreData: + if self.__restoreData and not self.__mw.isClosing(): QTimer.singleShot(0, self.__showEventSlot) def getSessionData(self):
--- a/WebBrowser/WebBrowserWindow.py Thu Jul 06 19:13:51 2017 +0200 +++ b/WebBrowser/WebBrowserWindow.py Fri Jul 07 19:05:53 2017 +0200 @@ -186,6 +186,7 @@ self.__htmlFullScreen = False self.__windowStates = Qt.WindowNoState + self.__isClosing = False from .SearchWidget import SearchWidget from .QtHelp.HelpTocWidget import HelpTocWidget @@ -2790,6 +2791,15 @@ else: e.ignore() + def isClosing(self): + """ + Public method to test, if the window is closing. + + @return flag indicating that the window is closing + @rtype bool + """ + return self.__isClosing + def __shutdownWindow(self): """ Private method to shut down a web browser window. @@ -2800,6 +2810,8 @@ if not self.__tabWidget.shallShutDown(): return False + self.__isClosing = True + if not self.__fromEric: if not WebBrowserWindow._performingShutdown and \ len(WebBrowserWindow.BrowserWindows) == 1: