Added code to handle an issue shutting down the web browser while it is still loading a page. 5_1_x

Wed, 13 Apr 2011 19:53:11 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 13 Apr 2011 19:53:11 +0200
branch
5_1_x
changeset 980
7626b3605b2d
parent 976
b639b17375b7
child 983
7261d8565a50

Added code to handle an issue shutting down the web browser while it is still loading a page.

Documentation/Help/source.qch file | annotate | diff | comparison | revisions
Helpviewer/UrlBar/FavIconLabel.py file | annotate | diff | comparison | revisions
Helpviewer/UrlBar/UrlBar.py file | annotate | diff | comparison | revisions
Binary file Documentation/Help/source.qch has changed
--- a/Helpviewer/UrlBar/FavIconLabel.py	Sat Apr 09 15:08:10 2011 +0200
+++ b/Helpviewer/UrlBar/FavIconLabel.py	Wed Apr 13 19:53:11 2011 +0200
@@ -38,10 +38,13 @@
         """
         Private slot to set the icon.
         """
-        url = QUrl()
-        if self.__browser:
-            url = self.__browser.url()
-        self.setPixmap(Helpviewer.HelpWindow.HelpWindow.icon(url).pixmap(16, 16))
+        try:
+            url = QUrl()
+            if self.__browser:
+                url = self.__browser.url()
+            self.setPixmap(Helpviewer.HelpWindow.HelpWindow.icon(url).pixmap(16, 16))
+        except RuntimeError:
+            pass
     
     def setBrowser(self, browser):
         """
--- a/Helpviewer/UrlBar/UrlBar.py	Sat Apr 09 15:08:10 2011 +0200
+++ b/Helpviewer/UrlBar/UrlBar.py	Wed Apr 13 19:53:11 2011 +0200
@@ -130,35 +130,38 @@
         
         @param ok flag indicating a successful load (boolean)
         """
-        if self.__browser.url().scheme() in ["pyrc", "about"]:
-            self.__bookmarkButton.setVisible(False)
-        else:
-            if Helpviewer.HelpWindow.HelpWindow.bookmarksManager()\
-               .bookmarkForUrl(self.__browser.url()) is None:
-                self.__bookmarkButton.setIcon(self.__bmInactiveIcon)
+        try:
+            if self.__browser.url().scheme() in ["pyrc", "about"]:
+                self.__bookmarkButton.setVisible(False)
             else:
-                self.__bookmarkButton.setIcon(self.__bmActiveIcon)
-            self.__bookmarkButton.setVisible(True)
-        
-        if ok and \
-           self.__browser.url().scheme() == "https" and \
-           QSslCertificate is not None:
-            sslInfo = self.__browser.page().getSslInfo()
-            if sslInfo is not None:
-                org = Utilities.decodeString(
-                    sslInfo.subjectInfo(QSslCertificate.Organization))
-                if org == "":
-                    cn = Utilities.decodeString(
-                        sslInfo.subjectInfo(QSslCertificate.CommonName))
-                    if cn != "":
-                        org = cn.split(".", 1)[1]
+                if Helpviewer.HelpWindow.HelpWindow.bookmarksManager()\
+                   .bookmarkForUrl(self.__browser.url()) is None:
+                    self.__bookmarkButton.setIcon(self.__bmInactiveIcon)
+                else:
+                    self.__bookmarkButton.setIcon(self.__bmActiveIcon)
+                self.__bookmarkButton.setVisible(True)
+            
+            if ok and \
+               self.__browser.url().scheme() == "https" and \
+               QSslCertificate is not None:
+                sslInfo = self.__browser.page().getSslInfo()
+                if sslInfo is not None:
+                    org = Utilities.decodeString(
+                        sslInfo.subjectInfo(QSslCertificate.Organization))
                     if org == "":
-                        org = self.trUtf8("Unknown")
-                self.__sslLabel.setText(" {0} ".format(org))
-                self.__sslLabel.setVisible(True)
-                return
-        
-        self.__sslLabel.setVisible(False)
+                        cn = Utilities.decodeString(
+                            sslInfo.subjectInfo(QSslCertificate.CommonName))
+                        if cn != "":
+                            org = cn.split(".", 1)[1]
+                        if org == "":
+                            org = self.trUtf8("Unknown")
+                    self.__sslLabel.setText(" {0} ".format(org))
+                    self.__sslLabel.setVisible(True)
+                    return
+            
+            self.__sslLabel.setVisible(False)
+        except RuntimeError:
+            pass
     
     def setPrivateMode(self, on):
         """

eric ide

mercurial