schrodinger.application.msv.gui.tab_widget module

class schrodinger.application.msv.gui.tab_widget.MSVTabWidget(parent=None, undo_group=None)

Bases: PyQt5.QtWidgets.QTabWidget

QTabWidget customized for MSV

Variables:
  • newTabRequested (QtCore.pyqtSignal) – A signal emitted when a new tab is requested
  • duplicateTabRequested (QtCore.pyqtSignal) – A signal emitted with the index of the tab to duplicate
addLockedTab(widget, title, make_active=True)

Add a tab that can’t be closed or renamed and will always be the left-most tab. Note that this tab will not be closed when calling reset.

See addTab for argument documentation.

addTab(widget, title=None, make_active=True)

If no title is passed in when addTab is called, a default tab title of ‘Query + n’ will be generated, where n is the number of tabs added.

Parameters:
  • widget (PyQt5.QtWidgets.QWidget) – The widget to add to the tab widget
  • title (str) – The title of the tab
  • make_active (bool) – Whether to make the tab active
Return type:

int

Returns:

The index of the newly added tab

duplicateTabRequested
newTabRequested
removeTab(index, force=False)

Remove the tab at the specified index from the tab widget, if the tab is not the last tab

Parameters:
  • index (int) – The index of the tab to be removed
  • force (bool) – Whether we should allow removal of the last tab.
renameTab(index, new_name)

Rename the tab at the given index with the new name

Parameters:
  • index (int) – The index of the tab to rename
  • new_name (str) – The new name of the tab
renameTabRequested(index)

Shows a dialog allowing the user to rename the tab

Parameters:index (int) – The index of the tab to rename
reset()

Reset the tabs. This removes all tabs other than the locked tab (if one is present).

resizeEvent(event)

When expanding the window, the tab bar size does not change, but we still want to resize the tabs.

class schrodinger.application.msv.gui.tab_widget.NewTabNameDialog(index, original_name, parent=None)

Bases: PyQt5.QtWidgets.QDialog

Variables:nameAccepted (QtCore.pyqtSignal) –

A signal emitted with the new name chosen for the tab. Emitted with:

  • The index of the tab to be renamed
  • The new name of the tab
nameAccepted
onNameSelection()

Emits a signal with name selection information

class schrodinger.application.msv.gui.tab_widget.TabBarPlus(parent=None)

Bases: PyQt5.QtWidgets.QTabBar

Custom tab bar with a new tab button next to the last tab and the ability to lock the leftmost tab (i.e. the Workspace tab in Maestro). The locked tab cannot be closed, moved, or renamed.

MAX_TAB_NUM = 15
lockLeftmostTab()

Prevent the leftmost tab from being moved or closed.

mouseMoveEvent(event)

Undo any changes that were made in mousePressEvent in preparation for tab dragging.

See Qt documentation for additional method documentation.

mousePressEvent(event)

If a locked tab is present and clicked on, prevent it from being dragged. If another tab is clicked on, figure out where we need to stop dragging to prevent that tab from being dragged over or past the locked tab.

See Qt documentation for additional method documentation.

mouseReleaseEvent(event)

Undo any changes that were made in mousePressEvent in preparation for tab dragging.

See Qt documentation for additional method documentation.

movePlusButton()

Move new tab button to correct position.

newTabClicked
reset()

Reset the tab bar. Note that this only resets the counter used for default tab names. Removing all non-locked tabs is handled in MSVTabWidget.reset.

resizeEvent(event)

Resize widget and move new tab button

resizeTabs()

This is called when resizeEvent is triggered or when the width of the MSV changes.

sizeHint()

Return the size of the tab bar with extra space for new tab button.

tabLayoutChange()

Move new tab button to correct position after a layout change

class schrodinger.application.msv.gui.tab_widget.TabLabelContextMenu(parent=None)

Bases: PyQt5.QtWidgets.QMenu

Context menu for the tab label. Only shown when a label is clicked on.

Note that setIndex must be called before the menu is shown so that the information about the tab to be operated on is correctly emitted.

Variables:
  • duplicateTab (QtCore.pyqtSignal) – A signal emitted with the index of the tab to duplicate
  • renameTab – A signal emitted with the index of the tab to renamed
duplicateTab
onDuplicateTabRequested()

Emits the duplicateTab signals with the current index

onRenameTabRequested()

Emits the renameTab signal with the current index

renameTab
setIndex(index)

Set the index on the context menu so we can track which tab should be operated on

Parameters:index (int) – The index of the tab to operate on