schrodinger.application.bioluminate.actions.factory module¶
Contains Qt actions specific to the BioLuminate application.
Copyright Schrodinger, LLC. All rights reserved.
-
class
schrodinger.application.bioluminate.actions.factory.
Factory
(parent)¶ A class dedicated to the creation, deletion and modification of groups of actions.
-
addActions
(action_params, action_order=None, parent=None)¶ Add actions to the current action list
-
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
.
-
clearActions
()¶ Clears all actions in the factory
-
connectAction
(action, slot)¶ Connects an action to a slot
-
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__
-
getAction
(action_name)¶ Gets an action from the action name
-
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
-
removeAction
(action_name)¶ Removes an action from the stored actions based on action name
-
setActions
(action_params, action_order=None, parent=None)¶ Replace current acction with new actions
-
-
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 globalACTION_NAME
variable in thefactory
module.-
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.
-
-
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