A few fixes for the web browser. 5_2_x

Sun, 19 Feb 2012 17:28:22 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 19 Feb 2012 17:28:22 +0100
branch
5_2_x
changeset 1646
26e064833700
parent 1643
56c886e0baef
child 1648
85e8b2742027

A few fixes for the web browser.

Documentation/Help/source.qch file | annotate | diff | comparison | revisions
Documentation/Source/eric5.Helpviewer.HelpTabWidget.html file | annotate | diff | comparison | revisions
Documentation/Source/eric5.Helpviewer.HelpWindow.html file | annotate | diff | comparison | revisions
Helpviewer/HelpTabWidget.py file | annotate | diff | comparison | revisions
Helpviewer/HelpWindow.py file | annotate | diff | comparison | revisions
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Source/eric5.Helpviewer.HelpTabWidget.html	Sun Feb 19 15:29:32 2012 +0100
+++ b/Documentation/Source/eric5.Helpviewer.HelpTabWidget.html	Sun Feb 19 17:28:22 2012 +0100
@@ -44,7 +44,24 @@
 <h2>HelpTabWidget</h2>
 <p>
     Class implementing the central widget showing the web pages.
-</p>
+</p><h3>Signals</h3>
+<dl>
+<dt>browserClosed(QWidget)</dt>
+<dd>
+emitted after a browser was closed
+</dd><dt>showMessage(str)</dt>
+<dd>
+emitted to show a message in the main window status bar
+</dd><dt>sourceChanged(HelpBrowser, QUrl)</dt>
+<dd>
+emitted after the URL of a browser
+            has changed
+</dd><dt>titleChanged(HelpBrowser, str)</dt>
+<dd>
+emitted after the title of a browser
+            has changed
+</dd>
+</dl>
 <h3>Derived from</h3>
 E5TabWidget
 <h3>Class Attributes</h3>
--- a/Documentation/Source/eric5.Helpviewer.HelpWindow.html	Sun Feb 19 15:29:32 2012 +0100
+++ b/Documentation/Source/eric5.Helpviewer.HelpWindow.html	Sun Feb 19 17:28:22 2012 +0100
@@ -321,7 +321,7 @@
 <td>Private slot to synchronize the TOC with the currently shown page.</td>
 </tr><tr>
 <td><a href="#HelpWindow.__titleChanged">__titleChanged</a></td>
-<td>Private slot called to handle a change of the current browsers title.</td>
+<td>Private slot called to handle a change of s browser's title.</td>
 </tr><tr>
 <td><a href="#HelpWindow.__viewFullScreen">__viewFullScreen</a></td>
 <td>Private slot called to toggle fullscreen mode.</td>
@@ -1026,11 +1026,14 @@
         Private slot to synchronize the TOC with the currently shown page.
 </p><a NAME="HelpWindow.__titleChanged" ID="HelpWindow.__titleChanged"></a>
 <h4>HelpWindow.__titleChanged</h4>
-<b>__titleChanged</b>(<i>title</i>)
+<b>__titleChanged</b>(<i>browser, title</i>)
 <p>
-        Private slot called to handle a change of the current browsers title.
+        Private slot called to handle a change of s browser's title.
 </p><dl>
-<dt><i>title</i></dt>
+<dt><i>browser</i></dt>
+<dd>
+reference to the browser (HelpBrowser)
+</dd><dt><i>title</i></dt>
 <dd>
 new title (string)
 </dd>
--- a/Helpviewer/HelpTabWidget.py	Sun Feb 19 15:29:32 2012 +0100
+++ b/Helpviewer/HelpTabWidget.py	Sun Feb 19 17:28:22 2012 +0100
@@ -37,9 +37,16 @@
 class HelpTabWidget(E5TabWidget):
     """
     Class implementing the central widget showing the web pages.
+    
+    @signal sourceChanged(HelpBrowser, QUrl) emitted after the URL of a browser
+            has changed
+    @signal titleChanged(HelpBrowser, str) emitted after the title of a browser
+            has changed
+    @signal showMessage(str) emitted to show a message in the main window status bar
+    @signal browserClosed(QWidget) emitted after a browser was closed
     """
-    sourceChanged = pyqtSignal(QUrl)
-    titleChanged = pyqtSignal(str)
+    sourceChanged = pyqtSignal(HelpBrowser, QUrl)
+    titleChanged = pyqtSignal(HelpBrowser, str)
     showMessage = pyqtSignal(str)
     browserClosed = pyqtSignal(QWidget)
     
@@ -528,7 +535,10 @@
         
         @param url URL of the new site (QUrl)
         """
-        self.sourceChanged.emit(url)
+        browser = self.sender()
+        
+        if browser is not None:
+            self.sourceChanged.emit(browser, url)
     
     def __titleChanged(self, title):
         """
@@ -536,13 +546,17 @@
         
         @param title new title (string)
         """
-        if title == "":
-            title = self.currentBrowser().url().toString()
+        browser = self.sender()
         
-        self.setTabText(self.currentIndex(), self.__elide(title.replace("&", "&&")))
-        self.setTabToolTip(self.currentIndex(), title)
-        
-        self.titleChanged.emit(title)
+        if browser is not None:
+            index = self.indexOf(browser)
+            if title == "":
+                title = browser.url().toString()
+            
+            self.setTabText(index, self.__elide(title.replace("&", "&&")))
+            self.setTabToolTip(index, title)
+            
+            self.titleChanged.emit(browser, title)
     
     def __elide(self, txt, mode=Qt.ElideRight, length=40):
         """
--- a/Helpviewer/HelpWindow.py	Sun Feb 19 15:29:32 2012 +0100
+++ b/Helpviewer/HelpWindow.py	Sun Feb 19 17:28:22 2012 +0100
@@ -1572,14 +1572,15 @@
             idx += 1
             act.setIcon(HelpWindow.__getWebIcon(QUrl(hist)))
         
-    def __titleChanged(self, title):
+    def __titleChanged(self, browser, title):
         """
-        Private slot called to handle a change of the current browsers title.
+        Private slot called to handle a change of s browser's title.
         
+        @param browser reference to the browser (HelpBrowser)
         @param title new title (string)
         """
         self.historyManager().updateHistoryEntry(
-            self.currentBrowser().url().toString(), title)
+            browser.url().toString(), title)
     
     def newTab(self, link=None, requestData=None):
         """

eric ide

mercurial