# eric6.WebBrowser.WebBrowserTabWidget

Module implementing the central widget showing the web pages.

### Global Attributes

None

### Classes

WebBrowserTabWidget | Class implementing the central widget showing the web pages.

### Functions

None

## WebBrowserTabWidget

Class implementing the central widget showing the web pages.

### Signals

browserClosed(QWidget)
  emitted after a browser was closed
browserOpened(QWidget)
  emitted after a new browser was created
browserZoomValueChanged(int)
  emitted to signal a change of the current browser's zoom level
currentUrlChanged(QUrl)
  emitted after the URL of the current browser has changed
showMessage(str)
  emitted to show a message in the main window status bar
sourceChanged(WebBrowserView, QUrl)
  emitted after the URL of a browser has changed
titleChanged(WebBrowserView, str)
  emitted after the title of a browser has changed

### Derived from

E5TabWidget

### Class Attributes

None

### Class Methods

None

### Methods

WebBrowserTabWidget | Constructor
__aboutToShowClosedTabsMenu | Private slot to populate the closed tabs menu.
__closedTabAvailable | Private slot to handle changes of the availability of closed tabs.
__currentChanged | Private slot to handle an index change.
__elide | Private method to elide some text.
__guessUrlFromPath | Private method to guess an URL given a path string.
__iconChanged | Private slot to handle a change of the web site icon.
__initTabContextMenu | Private method to create the tab context menu.
__lineEditReturnPressed | Private slot to handle the entering of an URL.
__loadFinished | Private method to handle the loadFinished signal.
__loadStarted | Private method to handle the loadStarted signal.
__navigationMenuTriggered | Private slot called to handle the navigation button menu selection.
__newBrowser | Private slot to open a new browser tab.
__pathSelected | Private slot called when a URL is selected from the completer.
__pdfGeneratedForPrinting | Private slot to print the generated PDF data.
__pdfGeneratedForSave | Private slot to save the generated PDF data to a file.
__printPreviewRequested | Private slot to generate the print preview.
__recentlyAudibleChanged | Private slot to react on the audible state of a page.
__showContextMenu | Private slot to show the tab context menu.
__showNavigationMenu | Private slot to show the navigation button menu.
__sourceChanged | Private slot to handle a change of a browsers source.
__tabContextMenuAudioMute | Private method to mute or unmute the selected tab.
__tabContextMenuClone | Private method to clone the selected tab.
__tabContextMenuClose | Private method to close the selected tab.
__tabContextMenuCloseOthers | Private slot to close all other tabs.
__tabContextMenuMoveLeft | Private method to move a tab one position to the left.
__tabContextMenuMoveRight | Private method to move a tab one position to the right.
__tabContextMenuPrint | Private method to print the selected tab.
__tabContextMenuPrintPdf | Private method to print the selected tab as PDF.
__tabContextMenuPrintPreview | Private method to show a print preview of the selected tab.
__titleChanged | Private slot to handle a change of a browsers title.
__windowCloseRequested | Private slot to handle the windowCloseRequested signal of a browser.
browserAt | Public method to get a reference to the browser with the given index.
browsers | Public method to get a list of references to all browsers.
canRestoreClosedTab | Public method to check, if closed tabs can be restored.
clearClosedTabsList | Public slot to clear the list of closed tabs.
closeAllBrowsers | Public slot called to handle the close all action.
closeBrowser | Public slot called to handle the close action.
closeBrowserAt | Public slot to close a browser based on its index.
closeBrowserView | Public method to close the given browser.
closedTabsManager | Public slot to get a reference to the closed tabs manager.
currentBrowser | Public method to get a reference to the current browser.
currentUrlBar | Public method to get a reference to the current url bar.
getSessionData | Public method to populate the session data.
getSourceFileList | Public method to get a list of all opened Qt help files.
loadFromSessionData | Public method to load the session data.
newBrowser | Public method to create a new web browser tab.
newBrowserAfter | Public method to create a new web browser tab after a given one.
preferencesChanged | Public slot to handle a change of preferences.
printBrowser | Public slot called to print the displayed page.
printBrowserPdf | Public slot called to print the displayed page to PDF.
printPreviewBrowser | Public slot called to show a print preview of the displayed file.
reloadAllBrowsers | Public slot to reload all browsers.
restoreAllClosedTabs | Public slot to restore all closed tabs.
restoreClosedTab | Public slot to restore the most recently closed tab.
shallShutDown | Public method to check, if the application should be shut down.
stackedUrlBar | Public method to get a reference to the stacked url bar.
urlBarForView | Public method to get a reference to the UrlBar associated with the given view.

### Static Methods

None

#### WebBrowserTabWidget (Constructor)

WebBrowserTabWidget(parent)

Constructor

parent
  reference to the parent widget (QWidget)

#### WebBrowserTabWidget.__aboutToShowClosedTabsMenu

__aboutToShowClosedTabsMenu()

Private slot to populate the closed tabs menu.

#### WebBrowserTabWidget.__closedTabAvailable

__closedTabAvailable(avail)

Private slot to handle changes of the availability of closed tabs.

avail
  flag indicating the availability of closed tabs (boolean)

#### WebBrowserTabWidget.__currentChanged

__currentChanged(index)

Private slot to handle an index change.

index
  new index (integer)

#### WebBrowserTabWidget.__elide

__elide(txt, mode=Qt.ElideRight, length=40)

Private method to elide some text.

txt
  text to be elided (string)
mode=
  elide mode (Qt.TextElideMode)
length=
  amount of characters to be used (integer)

Returns:
  the elided text (string)

#### WebBrowserTabWidget.__guessUrlFromPath

__guessUrlFromPath(path)

Private method to guess an URL given a path string.

path
  path string to guess an URL for (string)

Returns:
  guessed URL (QUrl)

#### WebBrowserTabWidget.__iconChanged

__iconChanged(browser)

Private slot to handle a change of the web site icon.

browser (WebBrowserView)
  reference to the web browser

#### WebBrowserTabWidget.__initTabContextMenu

__initTabContextMenu()

Private method to create the tab context menu.

#### WebBrowserTabWidget.__lineEditReturnPressed

__lineEditReturnPressed(edit)

Private slot to handle the entering of an URL.

edit (UrlBar)
  reference to the line edit

#### WebBrowserTabWidget.__loadFinished

__loadFinished(ok, browser)

Private method to handle the loadFinished signal.

ok (bool)
  flag indicating the result
browser (WebBrowserView)
  reference to the web browser

#### WebBrowserTabWidget.__loadStarted

__loadStarted(browser)

Private method to handle the loadStarted signal.

browser (WebBrowserView)
  reference to the web browser

#### WebBrowserTabWidget.__navigationMenuTriggered

__navigationMenuTriggered(act)

Private slot called to handle the navigation button menu selection.

act
  reference to the selected action (QAction)

#### WebBrowserTabWidget.__newBrowser

__newBrowser()

Private slot to open a new browser tab.

#### WebBrowserTabWidget.__pathSelected

__pathSelected(path)

Private slot called when a URL is selected from the completer.

path
  path to be shown (string)

#### WebBrowserTabWidget.__pdfGeneratedForPrinting

__pdfGeneratedForPrinting(pdfData)

Private slot to print the generated PDF data.

pdfData (QByteArray)
  generated PDF document

#### WebBrowserTabWidget.__pdfGeneratedForSave

__pdfGeneratedForSave(filePath, pdfData)

Private slot to save the generated PDF data to a file.

filePath (str)
  path to save the PDF to
pdfData (QByteArray)
  generated PDF document

#### WebBrowserTabWidget.__printPreviewRequested

__printPreviewRequested(printer, browser)

Private slot to generate the print preview.

printer (QPrinter)
  reference to the printer object
browser (WebBrowserView)
  reference to the browser to be printed

#### WebBrowserTabWidget.__recentlyAudibleChanged

__recentlyAudibleChanged(recentlyAudible, page)

Private slot to react on the audible state of a page.

recentlyAudible (bool)
  flag indicating the new audible state
page (WebBrowserPage)
  reference to the web page

#### WebBrowserTabWidget.__showContextMenu

__showContextMenu(coord, index)

Private slot to show the tab context menu.

coord
  the position of the mouse pointer (QPoint)
index
  index of the tab the menu is requested for (integer)

#### WebBrowserTabWidget.__showNavigationMenu

__showNavigationMenu()

Private slot to show the navigation button menu.

#### WebBrowserTabWidget.__sourceChanged

__sourceChanged(url, browser)

Private slot to handle a change of a browsers source.

url (QUrl)
  URL of the new site
browser (WebBrowserView)
  reference to the web browser

#### WebBrowserTabWidget.__tabContextMenuAudioMute

__tabContextMenuAudioMute()

Private method to mute or unmute the selected tab.

#### WebBrowserTabWidget.__tabContextMenuClone

__tabContextMenuClone()

Private method to clone the selected tab.

#### WebBrowserTabWidget.__tabContextMenuClose

__tabContextMenuClose()

Private method to close the selected tab.

#### WebBrowserTabWidget.__tabContextMenuCloseOthers

__tabContextMenuCloseOthers()

Private slot to close all other tabs.

#### WebBrowserTabWidget.__tabContextMenuMoveLeft

__tabContextMenuMoveLeft()

Private method to move a tab one position to the left.

#### WebBrowserTabWidget.__tabContextMenuMoveRight

__tabContextMenuMoveRight()

Private method to move a tab one position to the right.

#### WebBrowserTabWidget.__tabContextMenuPrint

__tabContextMenuPrint()

Private method to print the selected tab.

#### WebBrowserTabWidget.__tabContextMenuPrintPdf

__tabContextMenuPrintPdf()

Private method to print the selected tab as PDF.

#### WebBrowserTabWidget.__tabContextMenuPrintPreview

__tabContextMenuPrintPreview()

Private method to show a print preview of the selected tab.

#### WebBrowserTabWidget.__titleChanged

__titleChanged(title, browser)

Private slot to handle a change of a browsers title.

title (str)
  new title
browser (WebBrowserView)
  reference to the web browser

#### WebBrowserTabWidget.__windowCloseRequested

__windowCloseRequested(page)

Private slot to handle the windowCloseRequested signal of a browser.

page (WebBrowserPage)
  reference to the web page

#### WebBrowserTabWidget.browserAt

browserAt(index)

Public method to get a reference to the browser with the given index.

index
  index of the browser to get (integer)

Returns:
  reference to the indexed browser (WebBrowserView)

#### WebBrowserTabWidget.browsers

browsers()

Public method to get a list of references to all browsers.

Returns:
  list of references to browsers (list of WebBrowserView)

#### WebBrowserTabWidget.canRestoreClosedTab

canRestoreClosedTab()

Public method to check, if closed tabs can be restored.

Returns:
  flag indicating that closed tabs can be restored (boolean)

#### WebBrowserTabWidget.clearClosedTabsList

clearClosedTabsList()

Public slot to clear the list of closed tabs.

#### WebBrowserTabWidget.closeAllBrowsers

closeAllBrowsers(shutdown=False)

Public slot called to handle the close all action.

shutdown (bool)
  flag indicating a shutdown action

#### WebBrowserTabWidget.closeBrowser

closeBrowser()

Public slot called to handle the close action.

#### WebBrowserTabWidget.closeBrowserAt

closeBrowserAt(index, shutdown=False)

Public slot to close a browser based on its index.

index (int)
  index of browser to close
shutdown (bool)
  flag indicating a shutdown action

#### WebBrowserTabWidget.closeBrowserView

closeBrowserView(browser)

Public method to close the given browser.

browser (WebBrowserView)
  reference to the web browser view to be closed

#### WebBrowserTabWidget.closedTabsManager

closedTabsManager()

Public slot to get a reference to the closed tabs manager.

Returns:
  reference to the closed tabs manager (ClosedTabsManager)

#### WebBrowserTabWidget.currentBrowser

currentBrowser()

Public method to get a reference to the current browser.

Returns:
  reference to the current browser (WebBrowserView)

#### WebBrowserTabWidget.currentUrlBar

currentUrlBar()

Public method to get a reference to the current url bar.

Returns:
  reference to the current url bar (UrlBar)

#### WebBrowserTabWidget.getSessionData

getSessionData()

Public method to populate the session data.

Returns:
  dictionary containing the session data

Return Type:
  dict

#### WebBrowserTabWidget.getSourceFileList

getSourceFileList()

Public method to get a list of all opened Qt help files.

Returns:
  dictionary with tab id as key and host/namespace as value

#### WebBrowserTabWidget.loadFromSessionData

loadFromSessionData(sessionData)

Public method to load the session data.

sessionData (dict)
  dictionary containing the session data as generated by getSessionData()

#### WebBrowserTabWidget.newBrowser

newBrowser(link=None, position=-1, background=False, restoreSession=False)

Public method to create a new web browser tab.

link (str or QUrl)
  link to be shown
position= (int)
  position to create the new tab at or -1 to add it to the end
background= (bool)
  flag indicating to open the tab in the background
restoreSession= (bool)
  flag indicating a restore session action

Returns:
  reference to the new browser

Return Type:
  WebBrowserView

#### WebBrowserTabWidget.newBrowserAfter

newBrowserAfter(browser, link=None, background=False)

Public method to create a new web browser tab after a given one.

browser
  reference to the browser to add after (WebBrowserView)
link
  link to be shown (string or QUrl)
background=
  flag indicating to open the tab in the background (bool)

Returns:
  reference to the new browser

Return Type:
  WebBrowserView

#### WebBrowserTabWidget.preferencesChanged

preferencesChanged()

Public slot to handle a change of preferences.

#### WebBrowserTabWidget.printBrowser

printBrowser(browser=None)

Public slot called to print the displayed page.

browser
  reference to the browser to be printed (WebBrowserView)

#### WebBrowserTabWidget.printBrowserPdf

printBrowserPdf(browser=None)

Public slot called to print the displayed page to PDF.

browser
  reference to the browser to be printed (HelpBrowser)

#### WebBrowserTabWidget.printPreviewBrowser

printPreviewBrowser(browser=None)

Public slot called to show a print preview of the displayed file.

browser
  reference to the browser to be printed (WebBrowserView)

#### WebBrowserTabWidget.reloadAllBrowsers

reloadAllBrowsers()

Public slot to reload all browsers.

#### WebBrowserTabWidget.restoreAllClosedTabs

restoreAllClosedTabs()

Public slot to restore all closed tabs.

#### WebBrowserTabWidget.restoreClosedTab

restoreClosedTab(act)

Public slot to restore the most recently closed tab.

act (QAction)
  reference to the action that triggered

#### WebBrowserTabWidget.shallShutDown

shallShutDown()

Public method to check, if the application should be shut down.

Returns:
  flag indicating a shut down (boolean)

#### WebBrowserTabWidget.stackedUrlBar

stackedUrlBar()

Public method to get a reference to the stacked url bar.

Returns:
  reference to the stacked url bar (StackedUrlBar)

#### WebBrowserTabWidget.urlBarForView

urlBarForView(view)

Public method to get a reference to the UrlBar associated with the given view.

view (WebBrowserView)
  reference to the view to get the urlbar for

Returns:
  reference to the associated urlbar

Return Type:
  UrlBar

Up