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

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

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 13 Apr 2011 19:53:47 +0200
changeset 981
8217c9d312c3
parent 979
0ae0c8852d31
child 982
a1abe3018d04

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

Helpviewer/UrlBar/UrlBar.py file | annotate | diff | comparison | revisions
--- a/Helpviewer/UrlBar/UrlBar.py	Mon Apr 11 20:06:15 2011 +0200
+++ b/Helpviewer/UrlBar/UrlBar.py	Wed Apr 13 19:53:47 2011 +0200
@@ -131,35 +131,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