schrodinger.application.bioluminate.actions.factory module

Contains Qt actions specific to the BioLuminate application.

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.application.bioluminate.actions.factory.get_action_obj_name(name)

Helper function to get the action’s object name according to the syntax useed to create the name. The syntax is “action_<text>” where text is the text used when setting the action.

schrodinger.application.bioluminate.actions.factory.replace_slot(owner, name, slot)

Removes all slots from the action and replaces it with another slot.

Parameters:
  • owner – The owner of the action
  • name – The name used when creating the SAction
  • slot (callable) – The new slot to connect to
Raises:

AttributeError – When no action is found with that name in the owner

class schrodinger.application.bioluminate.actions.factory.SAction(parent, name, text='', tooltip='', status_tip='', icon=None, slot=None, parent_slot=None, checkable=False, checked=False, visible=True, data=None, shortcut=None)

Bases: PyQt5.QtWidgets.QAction

A QAction that enforces standards that are expected by some BioLuminate methods. The setObjectName method is used and the name conforms to the global ACTION_NAME variable in the factory module.

__init__(parent, name, text='', tooltip='', status_tip='', icon=None, slot=None, parent_slot=None, checkable=False, checked=False, visible=True, data=None, shortcut=None)

Create a SAction object

Parameters:
  • parent – The parent object of this action. This is used for all parent_slot calls.
  • name (str) – This will be used to name the object. The name will have “action_” prepended to it.
  • text (str) – The text to use for the action menus and toolbars
  • tooltip (str) – The action’s tooltip
  • status_tip – The string to show in the status bar when the action is hovered over.
  • status_tip – The string to show in the status bar when the action is hovered over.
  • icon (string) – The icon path used to create a QtGui.QIcon
  • slot (callable) – The function called when action is executed
  • parent_slot (string) – The name of the parent function called when action is executed
  • checkable (bool) – Whether action has on/off state.
  • checkable – Whether action is on or off. Only good when checkable is True.
  • visible (bool) – Whether the action is shown or hidden
  • data (mixed) – Data associated with action
  • shortcut (string) – Shortcut to action
parent(self) → QObject
connectSlot(slot_callable=None, slot_name=None)

Connects action to a slot by either supplying a callable or a method name that belongs to the action’s parent widget. The slot_callable will override slot_name if both are passed in.

Parameters:
  • slot_callable (callable) – A function passed in to connect to the action
  • slot_name (string) – A method name found in the actions parent
disconnectSlots()

Disconnects slots connected to this action.

AboutQtRole = 3
AboutRole = 4
class ActionEvent

Bases: int

__init__ = <method-wrapper '__init__' of sip.enumtype object at 0x3449c28>
ApplicationSpecificRole = 2
HighPriority = 256
Hover = 1
LowPriority = 0
class MenuRole

Bases: int

__init__ = <method-wrapper '__init__' of sip.enumtype object at 0x3449fd8>
NoRole = 0
NormalPriority = 128
PreferencesRole = 5
class Priority

Bases: int

__init__ = <method-wrapper '__init__' of sip.enumtype object at 0x344a388>
QuitRole = 6
TextHeuristicRole = 1
Trigger = 0
actionGroup(self) → QActionGroup
activate(self, QAction.ActionEvent)
associatedGraphicsWidgets(self) → List[QGraphicsWidget]
associatedWidgets(self) → List[QWidget]
autoRepeat(self) → bool
blockSignals(self, bool) → bool
changed

changed(self) [signal]

childEvent(self, QChildEvent)
children(self) → List[QObject]
connectNotify(self, QMetaMethod)
customEvent(self, QEvent)
data(self) → Any
deleteLater(self)
destroyed

destroyed(self, object: QObject = None) [signal]

disconnect(self)
disconnectNotify(self, QMetaMethod)
dumpObjectInfo(self)
dumpObjectTree(self)
dynamicPropertyNames(self) → List[QByteArray]
event(self, QEvent) → bool
eventFilter(self, QObject, QEvent) → bool
findChild(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → QObject

findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject

findChildren(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → List[QObject]

findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]

font(self) → QFont
hover(self)
hovered

hovered(self) [signal]

icon(self) → QIcon
iconText(self) → str
inherits(self, str) → bool
installEventFilter(self, QObject)
isCheckable(self) → bool
isChecked(self) → bool
isEnabled(self) → bool
isIconVisibleInMenu(self) → bool
isSeparator(self) → bool
isShortcutVisibleInContextMenu(self) → bool
isSignalConnected(self, QMetaMethod) → bool
isVisible(self) → bool
isWidgetType(self) → bool
isWindowType(self) → bool
killTimer(self, int)
menu(self) → QMenu
menuRole(self) → QAction.MenuRole
metaObject(self) → QMetaObject
moveToThread(self, QThread)
objectName(self) → str
objectNameChanged

objectNameChanged(self, str) [signal]

parentWidget(self) → QWidget
priority(self) → QAction.Priority
property(self, str) → Any
pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.

receivers(self, PYQT_SIGNAL) → int
removeEventFilter(self, QObject)
sender(self) → QObject
senderSignalIndex(self) → int
setActionGroup(self, QActionGroup)
setAutoRepeat(self, bool)
setCheckable(self, bool)
setChecked(self, bool)
setData(self, Any)
setDisabled(self, bool)
setEnabled(self, bool)
setFont(self, QFont)
setIcon(self, QIcon)
setIconText(self, str)
setIconVisibleInMenu(self, bool)
setMenu(self, QMenu)
setMenuRole(self, QAction.MenuRole)
setObjectName(self, str)
setParent(self, QObject)
setPriority(self, QAction.Priority)
setProperty(self, str, Any) → bool
setSeparator(self, bool)
setShortcut(self, Union[QKeySequence, QKeySequence.StandardKey, str, int])
setShortcutContext(self, Qt.ShortcutContext)
setShortcutVisibleInContextMenu(self, bool)
setShortcuts(self, Iterable[Union[QKeySequence, QKeySequence.StandardKey, str, int]])

setShortcuts(self, QKeySequence.StandardKey)

setStatusTip(self, str)
setText(self, str)
setToolTip(self, str)
setVisible(self, bool)
setWhatsThis(self, str)
shortcut(self) → QKeySequence
shortcutContext(self) → Qt.ShortcutContext
shortcuts(self) → List[QKeySequence]
showStatusText(self, widget: QWidget = None) → bool
signalsBlocked(self) → bool
startTimer(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) → int
staticMetaObject = <PyQt5.QtCore.QMetaObject object>
statusTip(self) → str
text(self) → str
thread(self) → QThread
timerEvent(self, QTimerEvent)
toggle(self)
toggled

toggled(self, bool) [signal]

toolTip(self) → str
tr(self, str, disambiguation: str = None, n: int = -1) → str
trigger(self)
triggered

triggered(self, checked: bool = False) [signal]

whatsThis(self) → str
class schrodinger.application.bioluminate.actions.factory.Factory(parent)

Bases: object

A class dedicated to the creation, deletion and modification of groups of actions.

__init__(parent)

Initialize self. See help(type(self)) for accurate signature.

connectAction(action, slot)

Connects an action to a slot

getAction(action_name)

Gets an action from the action name

clearActions()

Clears all actions in the factory

removeAction(action_name)

Removes an action from the stored actions based on action name

createActions(action_params, action_order=None, parent=None)

Creates actions.

Parameters:
  • action_params (dict) – Parameters used to create an action.
  • action_order (list of strings) – Order of actions (must be keys in action_params
  • parent (object) – Parent of actions. Default: self.parent
See:

SAction.__init__

addActions(action_params, action_order=None, parent=None)

Add actions to the current action list

setActions(action_params, action_order=None, parent=None)

Replace current acction with new actions

getMenu()

Return self.actions list as a QtWidgets.QMenu

getMenuBar()

Return self.actions list as a QtWidgets.QMenuBar

getToolBar(title=None, movable=False)

Return self.actions list as a QtWidgets.QToolBar

Parameters:title – Title to set to the toolbar
addContext(parent=None)

Add a context menu to parent.

Parameters:parent (object) – Parent of actions. Default: self.parent
addSubMenu(action_params, action_order=None, parent=None, add_separator=False, text=None, icon=None)

Adds a submenu to an action and appends the action to self.actions.