A few fixes for the web browser.

Sun, 19 Feb 2012 17:27:34 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 19 Feb 2012 17:27:34 +0100
changeset 1645
73904ca06d2d
parent 1644
c580a7686c52
child 1647
30be422ac04b

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
Preferences/ConfigurationPages/HelpAppearancePage.ui file | annotate | diff | comparison | revisions
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Source/eric5.Helpviewer.HelpTabWidget.html	Sun Feb 19 15:30:22 2012 +0100
+++ b/Documentation/Source/eric5.Helpviewer.HelpTabWidget.html	Sun Feb 19 17:27:34 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:30:22 2012 +0100
+++ b/Documentation/Source/eric5.Helpviewer.HelpWindow.html	Sun Feb 19 17:27:34 2012 +0100
@@ -336,7 +336,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>
@@ -1076,11 +1076,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:30:22 2012 +0100
+++ b/Helpviewer/HelpTabWidget.py	Sun Feb 19 17:27:34 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)
     
@@ -84,18 +91,19 @@
         self.__navigationButton.setEnabled(False)
         self.__rightCornerWidgetLayout.addWidget(self.__navigationButton)
         
+        self.__closeButton = QToolButton(self)
+        self.__closeButton.setIcon(UI.PixmapCache.getIcon("close.png"))
+        self.__closeButton.setToolTip(self.trUtf8("Close the current help window"))
+        self.__closeButton.setEnabled(False)
+        self.__closeButton.clicked[bool].connect(self.closeBrowser)
+        self.__rightCornerWidgetLayout.addWidget(self.__closeButton)
         if Preferences.getUI("SingleCloseButton") or \
            not hasattr(self, 'setTabsClosable'):
-            self.__closeButton = QToolButton(self)
-            self.__closeButton.setIcon(UI.PixmapCache.getIcon("close.png"))
-            self.__closeButton.setToolTip(self.trUtf8("Close the current help window"))
-            self.__closeButton.setEnabled(False)
-            self.__closeButton.clicked[bool].connect(self.closeBrowser)
-            self.__rightCornerWidgetLayout.addWidget(self.__closeButton)
+            self.__closeButton.show()
         else:
             self.setTabsClosable(True)
             self.tabCloseRequested.connect(self.closeBrowserAt)
-            self.__closeButton = None
+            self.__closeButton.hide()
         
         self.setCornerWidget(self.__rightCornerWidget, Qt.TopRightCorner)
         
@@ -271,7 +279,7 @@
         
         self.__mainWindow.closeAct.setEnabled(True)
         self.__mainWindow.closeAllAct.setEnabled(True)
-        self.__closeButton and self.__closeButton.setEnabled(True)
+        self.__closeButton.setEnabled(True)
         self.__navigationButton.setEnabled(True)
         
         if not linkName and not requestData and \
@@ -528,7 +536,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 +547,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)
+        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(title)
+            self.titleChanged.emit(browser, title)
     
     def __elide(self, txt, mode=Qt.ElideRight, length=40):
         """
@@ -574,6 +589,20 @@
         
         for urlbar in self.__stackedUrlBar.urlBars():
             urlbar.preferencesChanged()
+        
+        if Preferences.getUI("SingleCloseButton") or \
+           not hasattr(self, 'setTabsClosable'):
+            if hasattr(self, 'setTabsClosable'):
+                self.setTabsClosable(False)
+                try:
+                    self.tabCloseRequested.disconnect(self.closeBrowserAt)
+                except TypeError:
+                    pass
+            self.__closeButton.show()
+        else:
+            self.setTabsClosable(True)
+            self.tabCloseRequested.connect(self.closeBrowserAt)
+            self.__closeButton.hide()
     
     def __loadStarted(self):
         """
--- a/Helpviewer/HelpWindow.py	Sun Feb 19 15:30:22 2012 +0100
+++ b/Helpviewer/HelpWindow.py	Sun Feb 19 17:27:34 2012 +0100
@@ -1630,14 +1630,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):
         """
--- a/Preferences/ConfigurationPages/HelpAppearancePage.ui	Sun Feb 19 15:30:22 2012 +0100
+++ b/Preferences/ConfigurationPages/HelpAppearancePage.ui	Sun Feb 19 17:27:34 2012 +0100
@@ -190,26 +190,6 @@
     </widget>
    </item>
    <item>
-    <widget class="Line" name="separatorLine">
-     <property name="frameShape">
-      <enum>QFrame::HLine</enum>
-     </property>
-     <property name="frameShadow">
-      <enum>QFrame::Sunken</enum>
-     </property>
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <widget class="QLabel" name="nextStartupNoteLabel">
-     <property name="text">
-      <string>&lt;font color=&quot;#FF0000&quot;&gt;&lt;b&gt;Note:&lt;/b&gt; All settings below are activated at the next startup of the application.&lt;/font&gt;</string>
-     </property>
-    </widget>
-   </item>
-   <item>
     <widget class="QGroupBox" name="tabsGroupBox">
      <property name="title">
       <string>Tabs</string>

eric ide

mercurial