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:
PyQt6.QtGui.QAction
A QAction that enforces standards that are expected by some BioLuminate methods. The
setObjectName
method is used and the name conforms to the globalACTION_NAME
variable in thefactory
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 overrideslot_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¶
- ApplicationSpecificRole = 2¶
- HighPriority = 256¶
- Hover = 1¶
- LowPriority = 0¶
- class MenuRole(value)¶
Bases:
enum.Enum
An enumeration.
- NoRole = 0¶
- TextHeuristicRole = 1¶
- ApplicationSpecificRole = 2¶
- AboutQtRole = 3¶
- AboutRole = 4¶
- PreferencesRole = 5¶
- QuitRole = 6¶
- NoRole = 0¶
- NormalPriority = 128¶
- PreferencesRole = 5¶
- class Priority(value)¶
Bases:
enum.Enum
An enumeration.
- LowPriority = 0¶
- NormalPriority = 128¶
- HighPriority = 256¶
- QuitRole = 6¶
- TextHeuristicRole = 1¶
- Trigger = 0¶
- actionGroup(self) QActionGroup ¶
- activate(self, event: QAction.ActionEvent)¶
- associatedObjects(self) List[QObject] ¶
- autoRepeat(self) bool ¶
- blockSignals(self, b: bool) bool ¶
- changed¶
changed(self) [signal]
- checkableChanged¶
checkableChanged(self, checkable: bool) [signal]
- childEvent(self, a0: QChildEvent)¶
- children(self) List[QObject] ¶
- connectNotify(self, signal: QMetaMethod)¶
- customEvent(self, a0: QEvent)¶
- data(self) Any ¶
- deleteLater(self)¶
- destroyed¶
destroyed(self, object: typing.Optional[QObject] = None) [signal]
- disconnect(a0: QMetaObject.Connection) bool ¶
- disconnect(self) None
- disconnectNotify(self, signal: QMetaMethod)¶
- dumpObjectInfo(self)¶
- dumpObjectTree(self)¶
- dynamicPropertyNames(self) List[QByteArray] ¶
- enabledChanged¶
enabledChanged(self, enabled: bool) [signal]
- event(self, a0: QEvent) bool ¶
- eventFilter(self, a0: QObject, a1: QEvent) bool ¶
- findChild(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject ¶
- findChild(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
- findChildren(self, type: type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject] ¶
- findChildren(self, types: Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
- findChildren(self, type: type, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
- findChildren(self, types: Tuple, re: QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
- font(self) QFont ¶
- hover(self)¶
- hovered¶
hovered(self) [signal]
- icon(self) QIcon ¶
- iconText(self) str ¶
- inherits(self, classname: str) bool ¶
- installEventFilter(self, a0: QObject)¶
- isCheckable(self) bool ¶
- isChecked(self) bool ¶
- isEnabled(self) bool ¶
- isIconVisibleInMenu(self) bool ¶
- isSeparator(self) bool ¶
- isShortcutVisibleInContextMenu(self) bool ¶
- isSignalConnected(self, signal: QMetaMethod) bool ¶
- isVisible(self) bool ¶
- isWidgetType(self) bool ¶
- isWindowType(self) bool ¶
- killTimer(self, id: int)¶
- metaObject(self) QMetaObject ¶
- moveToThread(self, thread: QThread)¶
- objectName(self) str ¶
- objectNameChanged¶
objectNameChanged(self, objectName: str) [signal]
- priority(self) QAction.Priority ¶
- property(self, name: 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, signal: PYQT_SIGNAL) int ¶
- removeEventFilter(self, a0: QObject)¶
- resetEnabled(self)¶
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setActionGroup(self, group: QActionGroup)¶
- setAutoRepeat(self, a0: bool)¶
- setCheckable(self, a0: bool)¶
- setChecked(self, a0: bool)¶
- setData(self, var: Any)¶
- setDisabled(self, b: bool)¶
- setEnabled(self, a0: bool)¶
- setFont(self, font: QFont)¶
- setIcon(self, icon: QIcon)¶
- setIconText(self, text: str)¶
- setIconVisibleInMenu(self, visible: bool)¶
- setMenu(self, menu: QMenu)¶
- setMenuRole(self, menuRole: QAction.MenuRole)¶
- setObjectName(self, name: str)¶
- setParent(self, a0: QObject)¶
- setPriority(self, priority: QAction.Priority)¶
- setProperty(self, name: str, value: Any) bool ¶
- setSeparator(self, b: bool)¶
- setShortcut(self, shortcut: Union[QKeySequence, QKeySequence.StandardKey, str, int])¶
- setShortcutContext(self, context: Qt.ShortcutContext)¶
- setShortcutVisibleInContextMenu(self, show: bool)¶
- setShortcuts(self, shortcuts: Iterable[Union[QKeySequence, QKeySequence.StandardKey, str, int]])¶
- setShortcuts(self, a0: QKeySequence.StandardKey) None
- setStatusTip(self, statusTip: str)¶
- setText(self, text: str)¶
- setToolTip(self, tip: str)¶
- setVisible(self, a0: bool)¶
- setWhatsThis(self, what: str)¶
- shortcut(self) QKeySequence ¶
- shortcutContext(self) Qt.ShortcutContext ¶
- shortcuts(self) List[QKeySequence] ¶
- showStatusText(self, object: typing.Optional[QObject] = None) bool ¶
- signalsBlocked(self) bool ¶
- startTimer(self, interval: int, timerType: Qt.TimerType = Qt.CoarseTimer) int ¶
- staticMetaObject = <PyQt6.QtCore.QMetaObject object>¶
- statusTip(self) str ¶
- text(self) str ¶
- thread(self) QThread ¶
- timerEvent(self, a0: QTimerEvent)¶
- toggle(self)¶
- toggled¶
toggled(self, a0: bool) [signal]
- toolTip(self) str ¶
- tr(sourceText: str, disambiguation: typing.Optional[str] = None, n: int = - 1) str ¶
- trigger(self)¶
- triggered¶
triggered(self, checked: bool = False) [signal]
- visibleChanged¶
visibleChanged(self) [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)¶
- 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
- 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 aQtWidgets.QMenu
- getMenuBar()¶
Return
self.actions
list as aQtWidgets.QMenuBar
- getToolBar(title=None, movable=False)¶
Return
self.actions
list as aQtWidgets.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
.