# eric7.Plugins.ViewManagerPlugins.Tabview.Tabview

Module implementing a tabbed viewmanager class.

### Global Attributes

None

### Classes

TabBar | Class implementing a customized tab bar supporting drag & drop.
TabWidget | Class implementing a custimized tab widget.
Tabview | Class implementing a tabbed viewmanager class embedded in a splitter.

### Functions

None

## TabBar

Class implementing a customized tab bar supporting drag & drop.

### Signals

tabCopyRequested(int, int)
  emitted to signal a clone request giving the old and new index position
tabCopyRequested(str, int, int)
  emitted to signal a clone request giving the string encoded id of the source tab widget, the index in the source tab widget and the new index position
tabMoveRequested(int, int)
  emitted to signal a tab move request giving the old and new index position
tabRelocateRequested(str, int, int)
  emitted to signal a tab relocation request giving the string encoded id of the old tab widget, the index in the old tab widget and the new index position

### Derived from

EricWheelTabBar

### Class Attributes

None

### Class Methods

None

### Methods

TabBar | Constructor
dragEnterEvent | Protected method to handle drag enter events.
dropEvent | Protected method to handle drop events.
mouseMoveEvent | Protected method to handle mouse move events.
mousePressEvent | Protected method to handle mouse press events.

### Static Methods

None

#### TabBar (Constructor)

TabBar(parent=None)

Constructor

parent (QWidget)
  reference to the parent widget

#### TabBar.dragEnterEvent

dragEnterEvent(event)

Protected method to handle drag enter events.

event (QDragEnterEvent)
  reference to the drag enter event

#### TabBar.dropEvent

dropEvent(event)

Protected method to handle drop events.

event (QDropEvent)
  reference to the drop event

#### TabBar.mouseMoveEvent

mouseMoveEvent(event)

Protected method to handle mouse move events.

event (QMouseEvent)
  reference to the mouse move event

#### TabBar.mousePressEvent

mousePressEvent(event)

Protected method to handle mouse press events.

event (QMouseEvent)
  reference to the mouse press event

Up

## TabWidget

Class implementing a custimized tab widget.

### Derived from

EricTabWidget

### Class Attributes

None

### Class Methods

None

### Methods

TabWidget | Constructor
__captionChange | Private slot to handle Caption change signals from the editor.
__closeButtonClicked | Private method to handle the press of the close button.
__closeRequested | Private method to handle the press of the individual tab close button.
__contextMenuClose | Private method to close the selected tab.
__contextMenuCloseAll | Private method to close all tabs.
__contextMenuCloseOthers | Private method to close the other tabs.
__contextMenuCopyPathToClipboard | Private method to copy the file name of the selected tab to the clipboard.
__contextMenuCoverageScript | Private method to run a coverage test of the editor script.
__contextMenuDebugScript | Private method to debug the editor script.
__contextMenuMoveFirst | Private method to move a tab to the first position.
__contextMenuMoveLast | Private method to move a tab to the last position.
__contextMenuMoveLeft | Private method to move a tab one position to the left.
__contextMenuMoveRight | Private method to move a tab one position to the right.
__contextMenuOpenRejections | Private slot to open a rejections file associated with the selected tab.
__contextMenuPrintFile | Private method to print the selected tab.
__contextMenuPrintPreviewFile | Private method to show a print preview of the selected tab.
__contextMenuProfileScript | Private method to profile the editor script.
__contextMenuRunScript | Private method to run the editor script.
__contextMenuSave | Private method to save the selected tab.
__contextMenuSaveAll | Private method to save all tabs.
__contextMenuSaveAs | Private method to save the selected tab to a new file.
__copyTab | Private method to copy an editor.
__copyTabOther | Private method to copy an editor from another TabWidget.
__cursorLineChanged | Private slot to handle a change of the current editor's cursor line.
__initMenu | Private method to initialize the tab context menu.
__navigationMenuTriggered | Private slot called to handle the navigation button menu selection.
__relocateTab | Private method to relocate an editor from another TabWidget.
__showContextMenu | Private slot to show the tab context menu.
__showNavigationMenu | Private slot to show the navigation button menu.
addTab | Public method to add a new tab.
currentWidget | Public method to return a reference to the current page.
hasEditor | Public method to check for an editor.
hasEditors | Public method to test, if any editor is managed.
indexOf | Public method to get the tab index of the given editor.
insertWidget | Public method to insert a new tab.
mouseDoubleClickEvent | Protected method handling double click events.
removeWidget | Public method to remove a widget.
setCurrentWidget | Public method to set the current tab by the given editor assembly.
showIndicator | Public slot to set the indicator on or off.

### Static Methods

None

#### TabWidget (Constructor)

TabWidget(vm)

Constructor

vm (Tabview)
  view manager widget

#### TabWidget.__captionChange

__captionChange(cap, editor)

Private slot to handle Caption change signals from the editor.

Updates the tab text and tooltip text to reflect the new caption information.

cap (str)
  Caption for the editor
editor (Editor)
  Editor to update the caption for

#### TabWidget.__closeButtonClicked

__closeButtonClicked()

Private method to handle the press of the close button.

#### TabWidget.__closeRequested

__closeRequested(index)

Private method to handle the press of the individual tab close button.

index
  index of the tab (integer)

#### TabWidget.__contextMenuClose

__contextMenuClose()

Private method to close the selected tab.

#### TabWidget.__contextMenuCloseAll

__contextMenuCloseAll()

Private method to close all tabs.

#### TabWidget.__contextMenuCloseOthers

__contextMenuCloseOthers()

Private method to close the other tabs.

#### TabWidget.__contextMenuCopyPathToClipboard

__contextMenuCopyPathToClipboard()

Private method to copy the file name of the selected tab to the clipboard.

#### TabWidget.__contextMenuCoverageScript

__contextMenuCoverageScript()

Private method to run a coverage test of the editor script.

#### TabWidget.__contextMenuDebugScript

__contextMenuDebugScript()

Private method to debug the editor script.

#### TabWidget.__contextMenuMoveFirst

__contextMenuMoveFirst()

Private method to move a tab to the first position.

#### TabWidget.__contextMenuMoveLast

__contextMenuMoveLast()

Private method to move a tab to the last position.

#### TabWidget.__contextMenuMoveLeft

__contextMenuMoveLeft()

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

#### TabWidget.__contextMenuMoveRight

__contextMenuMoveRight()

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

#### TabWidget.__contextMenuOpenRejections

__contextMenuOpenRejections()

Private slot to open a rejections file associated with the selected tab.

#### TabWidget.__contextMenuPrintFile

__contextMenuPrintFile()

Private method to print the selected tab.

#### TabWidget.__contextMenuPrintPreviewFile

__contextMenuPrintPreviewFile()

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

#### TabWidget.__contextMenuProfileScript

__contextMenuProfileScript()

Private method to profile the editor script.

#### TabWidget.__contextMenuRunScript

__contextMenuRunScript()

Private method to run the editor script.

#### TabWidget.__contextMenuSave

__contextMenuSave()

Private method to save the selected tab.

#### TabWidget.__contextMenuSaveAll

__contextMenuSaveAll()

Private method to save all tabs.

#### TabWidget.__contextMenuSaveAs

__contextMenuSaveAs()

Private method to save the selected tab to a new file.

#### TabWidget.__copyTab

__copyTab(sourceIndex, targetIndex)

Private method to copy an editor.

sourceIndex (int)
  index of the tab
targetIndex (int)
  index position to place it to

#### TabWidget.__copyTabOther

__copyTabOther(sourceId, sourceIndex, targetIndex)

Private method to copy an editor from another TabWidget.

sourceId (str)
  id of the TabWidget to get the editor from
sourceIndex (int)
  index of the tab in the old tab widget
targetIndex (int)
  index position to place it to

#### TabWidget.__cursorLineChanged

__cursorLineChanged(lineno, editor)

Private slot to handle a change of the current editor's cursor line.

lineno (int)
  line number of the editor's cursor (zero based)
editor (Editor)
  reference to the editor

#### TabWidget.__initMenu

__initMenu()

Private method to initialize the tab context menu.

#### TabWidget.__navigationMenuTriggered

__navigationMenuTriggered(act)

Private slot called to handle the navigation button menu selection.

act (QAction)
  reference to the selected action

#### TabWidget.__relocateTab

__relocateTab(sourceId, sourceIndex, targetIndex)

Private method to relocate an editor from another TabWidget.

sourceId (str)
  id of the TabWidget to get the editor from
sourceIndex (int)
  index of the tab in the old tab widget
targetIndex (int)
  index position to place it to

#### TabWidget.__showContextMenu

__showContextMenu(coord, index)

Private slot to show the tab context menu.

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

#### TabWidget.__showNavigationMenu

__showNavigationMenu()

Private slot to show the navigation button menu.

#### TabWidget.addTab

addTab(assembly, title)

Public method to add a new tab.

assembly (QScintilla.EditorAssembly.EditorAssembly)
  editor assembly object to be added
title (str)
  title for the new tab

#### TabWidget.currentWidget

currentWidget()

Public method to return a reference to the current page.

Return:
  reference to the current page

Return Type:
  Editor

#### TabWidget.hasEditor

hasEditor(editor)

Public method to check for an editor.

editor (Editor)
  editor object to check for

Return:
  flag indicating, whether the editor to be checked belongs to the list of editors managed by this tab widget.

Return Type:
  bool

#### TabWidget.hasEditors

hasEditors()

Public method to test, if any editor is managed.

Return:
  flag indicating editors are managed

Return Type:
  bool

#### TabWidget.indexOf

indexOf(widget)

Public method to get the tab index of the given editor.

widget (QLabel or Editor)
  widget to get the index for

Return:
  tab index of the editor

Return Type:
  int

#### TabWidget.insertWidget

insertWidget(index, assembly, title)

Public method to insert a new tab.

index (int)
  index position for the new tab
assembly (QScintilla.EditorAssembly.EditorAssembly)
  editor assembly object to be added
title (str)
  title for the new tab

Return:
  index of the inserted tab

Return Type:
  int

#### TabWidget.mouseDoubleClickEvent

mouseDoubleClickEvent(event)

Protected method handling double click events.

event
  reference to the event object (QMouseEvent)

#### TabWidget.removeWidget

removeWidget(widget)

Public method to remove a widget.

widget (QWidget)
  widget to be removed

#### TabWidget.setCurrentWidget

setCurrentWidget(assembly)

Public method to set the current tab by the given editor assembly.

assembly (EditorAssembly.EditorAssembly)
  editor assembly to determine current tab from

#### TabWidget.showIndicator

showIndicator(on)

Public slot to set the indicator on or off.

on (bool)
  flag indicating the state of the indicator

Up

## Tabview

Class implementing a tabbed viewmanager class embedded in a splitter.

### Signals

astViewerStateChanged(bool)
  emitted to signal a change in the AST viewer state
bookmarkToggled(Editor)
  emitted when a bookmark is toggled.
breakpointToggled(Editor)
  emitted when a breakpoint is toggled.
changeCaption(str)
  emitted if a change of the caption is necessary
checkActions(Editor)
  emitted when some actions should be checked for their status
cursorChanged(Editor)
  emitted after the cursor position of the active window has changed
editorChanged(str)
  emitted when the current editor has changed
editorChangedEd(Editor)
  emitted when the current editor has changed
editorClosed(str)
  emitted just before an editor window gets closed
editorClosedEd(Editor)
  emitted just before an editor window gets closed
editorLanguageChanged(Editor)
  emitted to signal a change of an editors language
editorLineChanged(str,int)
  emitted to signal a change of an editor's current line (line is given one based)
editorLineChangedEd(Editor,int)
  emitted to signal a change of an editor's current line (line is given one based)
editorOpened(str)
  emitted after an editor window was opened
editorOpenedEd(Editor)
  emitted after an editor window was opened
editorRenamed(str)
  emitted after an editor was renamed
editorRenamedEd(Editor)
  emitted after an editor was renamed
editorSaved(str)
  emitted after an editor window was saved
editorSavedEd(Editor)
  emitted after an editor window was saved
editorTextChanged(Editor)
  emitted to signal a change of an editor's text
lastEditorClosed()
  emitted after the last editor window was closed
previewStateChanged(bool)
  emitted to signal a change in the preview state
syntaxerrorToggled(Editor)
  emitted when a syntax error is toggled.

### Derived from

ViewManager

### Class Attributes

None

### Class Methods

None

### Methods

Tabview | Constructor
__currentChanged | Private slot to handle the currentChanged signal.
_addView | Protected method to add a view (i.e.
_initWindowActions | Protected method to define the user interface actions for window handling.
_modificationStatusChanged | Protected slot to handle the modificationStatusChanged signal.
_removeAllViews | Protected method to remove all views (i.e.
_removeView | Protected method to remove a view (i.e.
_showView | Protected method to show a view (i.e.
_syntaxErrorToggled | Protected slot to handle the syntaxerrorToggled signal.
activeWindow | Public method to return the active (i.e.
addSplit | Public method used to split the current view.
canCascade | Public method to signal if cascading of managed windows is available.
canSplit | public method to signal if splitting of the view is available.
canTile | Public method to signal if tiling of managed windows is available.
cascade | Public method to cascade the managed windows.
eventFilter | Public method called to filter the event queue.
getOpenEditorsForSession | Public method to get a lists of all open editors.
getSplitOrientation | Public method to get the orientation of the split view.
getTabWidgetById | Public method to get a reference to a tab widget knowing its ID.
insertView | Public method to add a view (i.e.
mainWidget | Public method to return a reference to the main Widget of a specific view manager subclass.
nextSplit | Public slot used to move to the next split.
preferencesChanged | Public slot to handle the preferencesChanged signal.
prevSplit | Public slot used to move to the previous split.
removeSplit | Public method used to remove the current split view or a split view by index.
setEditorName | Public method to change the displayed name of the editor.
setSplitCount | Public method to set the number of split views.
setSplitOrientation | Public method used to set the orientation of the split view.
showWindowMenu | Public method to set up the viewmanager part of the Window menu.
splitCount | Public method to get the number of splitted views.
tile | Public method to tile the managed windows.

### Static Methods

None

#### Tabview (Constructor)

Tabview(parent)

Constructor

parent (QWidget)
  parent widget

#### Tabview.__currentChanged

__currentChanged(index)

Private slot to handle the currentChanged signal.

index (int)
  index of the current tab

#### Tabview._addView

_addView(win, fn=None, noName="", addNext=False, indexes=None)

Protected method to add a view (i.e. window).

win (EditorAssembly)
  editor assembly to be added
fn (str)
  filename of this editor
noName (str)
  name to be used for an unnamed editor
addNext (bool)
  flag indicating to add the view next to the current view
indexes (tuple of two int)
  of the editor, first the split view index, second the index within the view

#### Tabview._initWindowActions

_initWindowActions()

Protected method to define the user interface actions for window handling.

#### Tabview._modificationStatusChanged

_modificationStatusChanged(m, editor)

Protected slot to handle the modificationStatusChanged signal.

m (bool)
  flag indicating the modification status
editor (Editor)
  editor window changed

#### Tabview._removeAllViews

_removeAllViews()

Protected method to remove all views (i.e. windows).

#### Tabview._removeView

_removeView(win)

Protected method to remove a view (i.e. window).

win (Editor)
  editor window to be removed

#### Tabview._showView

_showView(win, fn=None)

Protected method to show a view (i.e. window).

win (EditorAssembly)
  editor assembly to be shown
fn (str)
  filename of this editor

#### Tabview._syntaxErrorToggled

_syntaxErrorToggled(editor)

Protected slot to handle the syntaxerrorToggled signal.

editor (Editor)
  editor that sent the signal

#### Tabview.activeWindow

activeWindow()

Public method to return the active (i.e. current) window.

Return:
  reference to the active editor

Return Type:
  Editor

#### Tabview.addSplit

addSplit()

Public method used to split the current view.

#### Tabview.canCascade

canCascade()

Public method to signal if cascading of managed windows is available.

Return:
  flag indicating cascading of windows is available

Return Type:
  bool

#### Tabview.canSplit

canSplit()

public method to signal if splitting of the view is available.

Return:
  flag indicating splitting of the view is available.

Return Type:
  bool

#### Tabview.canTile

canTile()

Public method to signal if tiling of managed windows is available.

Return:
  flag indicating tiling of windows is available

Return Type:
  bool

#### Tabview.cascade

cascade()

Public method to cascade the managed windows.

#### Tabview.eventFilter

eventFilter(watched, event)

Public method called to filter the event queue.

watched (QObject)
  the QObject being watched
event (QEvent)
  the event that occurred

Return:
  always False

Return Type:
  bool

#### Tabview.getOpenEditorsForSession

getOpenEditorsForSession()

Public method to get a lists of all open editors.

The returned list contains one list per split view. If the view manager cannot split the view, only one list of editors is returned.

Return:
  list of list of editor references

Return Type:
  list of list of Editor

#### Tabview.getSplitOrientation

getSplitOrientation()

Public method to get the orientation of the split view.

Return:
  orientation of the split

Return Type:
  Qt.Orientation.Horizontal or Qt.Orientation.Vertical

#### Tabview.getTabWidgetById

getTabWidgetById(id_)

Public method to get a reference to a tab widget knowing its ID.

id_ (int)
  id of the tab widget

Return:
  reference to the tab widget

Return Type:
  TabWidget

#### Tabview.insertView

insertView(win, tabWidget, index, fn=None, noName="")

Public method to add a view (i.e. window).

win (EditorAssembly)
  editor assembly to be inserted
tabWidget (TabWidget)
  reference to the tab widget to insert the editor into
index (int)
  index position to insert at
fn (str)
  filename of this editor
noName (str)
  name to be used for an unnamed editor

#### Tabview.mainWidget

mainWidget()

Public method to return a reference to the main Widget of a specific view manager subclass.

Return:
  reference to the main widget

Return Type:
  QWidget

#### Tabview.nextSplit

nextSplit()

Public slot used to move to the next split.

#### Tabview.preferencesChanged

preferencesChanged()

Public slot to handle the preferencesChanged signal.

#### Tabview.prevSplit

prevSplit()

Public slot used to move to the previous split.

#### Tabview.removeSplit

removeSplit(index=-1)

Public method used to remove the current split view or a split view by index.

index (int)
  index of the split to be removed (-1 means to delete the current split)

Return:
  flag indicating successful deletion

Return Type:
  bool

#### Tabview.setEditorName

setEditorName(editor, newName)

Public method to change the displayed name of the editor.

editor (Editor)
  editor window to be changed
newName (str)
  new name to be shown

#### Tabview.setSplitCount

setSplitCount(count)

Public method to set the number of split views.

count (int)
  number of split views

#### Tabview.setSplitOrientation

setSplitOrientation(orientation)

Public method used to set the orientation of the split view.

orientation (Qt.Orientation.Horizontal or Qt.Orientation.Vertical)
  orientation of the split

#### Tabview.showWindowMenu

showWindowMenu(windowMenu)

Public method to set up the viewmanager part of the Window menu.

windowMenu (QMenu)
  reference to the window menu

#### Tabview.splitCount

splitCount()

Public method to get the number of splitted views.

Return:
  number of splitted views

Return Type:
  int

#### Tabview.tile

tile()

Public method to tile the managed windows.

Up