WebBrowser/WebBrowserTabWidget.py

changeset 5038
df7103c3f2a6
parent 5036
318e879a37fa
child 5039
200f12184a43
diff -r b2b37d7c0791 -r df7103c3f2a6 WebBrowser/WebBrowserTabWidget.py
--- a/WebBrowser/WebBrowserTabWidget.py	Thu Jul 14 18:56:39 2016 +0200
+++ b/WebBrowser/WebBrowserTabWidget.py	Sun Jul 17 15:36:11 2016 +0200
@@ -302,13 +302,17 @@
         """
         self.newBrowser()
     
-    def newBrowser(self, link=None, position=-1):
+    def newBrowser(self, link=None, position=-1, background=False):
         """
         Public method to create a new web browser tab.
         
         @param link link to be shown (string or QUrl)
         @keyparam position position to create the new tab at or -1 to add it
             to the end (integer)
+        @keyparam background flag indicating to open the tab in the
+            background (bool)
+        @return reference to the new browser
+        @rtype WebBrowserView
         """
         if link is None:
             linkName = ""
@@ -358,7 +362,8 @@
             index = self.addTab(browser, self.tr("..."))
         else:
             index = self.insertTab(position, browser, self.tr("..."))
-        self.setCurrentIndex(index)
+        if not background:
+            self.setCurrentIndex(index)
         
         self.__mainWindow.closeAct.setEnabled(True)
         self.__mainWindow.closeAllAct.setEnabled(True)
@@ -383,19 +388,25 @@
                 self.setTabToolTip(index, browser.documentTitle())
         
         self.browserOpened.emit(browser)
+        
+        return browser
     
-    def newBrowserAfter(self, browser, link=None):
+    def newBrowserAfter(self, browser, link=None, background=False):
         """
         Public method to create a new web browser tab after a given one.
         
         @param browser reference to the browser to add after (WebBrowserView)
         @param link link to be shown (string or QUrl)
+        @keyparam background flag indicating to open the tab in the
+            background (bool)
+        @return reference to the new browser
+        @rtype WebBrowserView
         """
         if browser:
             position = self.indexOf(browser) + 1
         else:
             position = -1
-        self.newBrowser(link, position)
+        return self.newBrowser(link, position, background)
     
     def __showNavigationMenu(self):
         """
@@ -597,7 +608,7 @@
     
     def __pdfGenerated(self, filePath, pdfData):
         """
-        Public slot handling the generated PDF data.
+        Private slot handling the generated PDF data.
         
         @param filePath path to save the PDF to
         @type str

eric ide

mercurial