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
- 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.
- 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
.