schrodinger.ui.qt.widgetmixins.panelmixins module¶
-
class
schrodinger.ui.qt.widgetmixins.panelmixins.
PanelMixin
(*args, **kwargs)¶ Bases:
schrodinger.models.mappers.MapperMixin
PanelMixin makes a widget act as a panel - it supports a panel singleton, and expects to be shown as a window rather than an embedded widget.
Requires ExecutionMixin
-
SHOW_AS_WINDOW
= True¶
-
classmethod
getPanelInstance
()¶ Return the singleton instance of this panel, creating one if necessary.
Returns: instance of this panel. Return type: PanelMixin
-
classmethod
panel
(blocking=False, modal=False, finished_callback=None)¶ Open an instance of this class.
For full argument documentation, see
ExecutionMixin.run
.
-
__init__
(*args, **kwargs)¶ Initialize self. See help(type(self)) for accurate signature.
-
defineMappings
()¶ Override this in the subclass to define mappings. Should return a list of tuples [(<target>, <param>)]. Targets can be
- a basic widget, like
QLineEdit
orQComboBox
- a custom object that inherits
MapperMixin
orTargetMixin
- a
TargetSpec
instance - a slot
For common widgets, standard signals and getter/setter methods will be used, as defined in
mappers._get_default_access_names()
.For more fine-grained custom control, instantiate a
TargetSpec
object, which allows custom setters, getters, and signals to be specified.Supplying a slot as the first element of the tuple is equivalent to providing
TargetSpec(slot=my_slot)
.Note that all target slots are triggered on
setModel()
as well as in response to the specified signal.The param is an abstract param reference, e.g. MyModel.my_param.
Example:
def defineMappings(self): combo = self.style_combo return [(self.name_le, MyModel.name), (TargetSpec(combo, getter=combo.currentText, setter=combo.setCurrentText), MyModel.style), (self.coord_widget, MyModel.coord), (self._onASLTextChanged, MyModel.asl_text)]
- a basic widget, like
-
getModel
()¶
-
getSignalsAndSlots
(model)¶ Override this method to specify signal and slot pairs that need to be connected/disconnected whenever the model instance is switched using setModel. The model instance is provided as an argument so that instance-specific signals can be used, but any pairs of signals and slots may be returned from this method.
Returns: a list of 2-tuples where each tuple is a signal, slot pair
-
initLayOut
()¶ @overrides: widgetmixins.InitMixin
-
initSetDefaults
()¶ @overrides: widgetmixins.InitMixin
-
makeInitialModel
()¶
-
mappedParams
()¶ Return a list of the abstract params that are mapped to.
-
model
¶
-
modelChanged
¶
-
model_class
= None¶
-
resetMappedParams
()¶
-
runAllSlots
()¶
-
setDefaults
()¶ @overrides: af2.App
-
setModel
(model)¶ Sets the model object for the mapper. Disconnects the old model, if one is set, and connects the new model. Pass in None to have no model set.
Parameters: model – the model instance or None
-
setModelWithoutSlots
(model)¶ This is called when this MapperMixin is a sub-widget of a parent MapperMixin. Since the slots will all be called at the end of the parent setModel, they shouldn’t be called during the sub-widget’s setModel.
-
setting_model
()¶
-
-
class
schrodinger.ui.qt.widgetmixins.panelmixins.
CleanStateMixin
¶ Bases:
object
Mixin for use with
PanelMixin
. Implements two methods for saving and reverting changes to the model. Automatically saves the state of the model when a panel is run. Subclasses are responsible for callingdiscardChanges
at the right time (e.g. when a user hits the cancel button)-
run
(*args, **kwargs)¶
-
setModel
(model)¶
-
saveCleanState
()¶ Copy the model as a clean state. Next time
discardChanges
is called, the model will be updated to reflect this current state.
-
discardChanges
()¶ Revert the model to the value it was the last time
saveCleanState
was called.
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
schrodinger.ui.qt.widgetmixins.panelmixins.
TaskPanelMixin
(*args, **kwargs)¶ Bases:
schrodinger.ui.qt.widgetmixins.panelmixins.PanelMixin
,schrodinger.ui.qt.widgetmixins.basicmixins.StatusBarMixin
A panel where the overall panel is associated with one or more panel tasks. One task is active at any time; this task will be sync’ed to the panel state and the bottom taskbar of the panel will be associated with the active task (i.e. job options will pertain to the active task, and clicking the run button will start that task).
DEPENDENCIES: widgetmixins.MessageBoxMixin
-
PANEL_TASKS
= ()¶
-
PRESETS_FEATURE_FLAG
= False¶
-
initSetUp
()¶
-
initSetDefaults
()¶ @overrides: widgetmixins.InitMixin
-
setModel
(model)¶ Sets the model object for the mapper. Disconnects the old model, if one is set, and connects the new model. Pass in None to have no model set.
Parameters: model – the model instance or None
-
getSettingsMenuActions
(abstract_task)¶ Return a tuple representation of the settings button menu for a given
abstract_task
. For custom menus, override this method and return a list of tuples mapping desired menu item texts mapped to the method or function that should be called when the item is selected. IfNone
is returned, then no actions are set on the settings button.The following menu items are used for the default implementation:
‘Job Settings’ -> Opens up a config dialog ‘Preferences…’ -> Opens the Maestro preferences dialog to the
job preferences page.‘Write’ -> Write the job to a bash file
- —-(The above items are only shown if the task is a jobtask)———
- *’Write STU ZIP File’ -> Write a zip file that can be used to
- create a stu test.
‘Reset Entire Panel’ -> Resets the entire panel ‘Reset This Task’ -> Reset just the current task (hidden if there’s
only one type of task for the panel.*’Start debugger…’ -> Start a command line debugger with IPython *’Start debugger GUI…’ -> Open up the debugger gui
- Menu items that are only shown if the user has SCHRODINGER_SRC defined in their environment.
Parameters: abstract_task (tasks.AbstractTask) – The task to retrieve menu actions for. It will always be a member of self.PANEL_TASKS
.Returns: A list of tuples mapping the desired menu item text with the function that should be called when the item is selected. If the slot is None
, then a separator will be added instead and the text will be ignored.:rtype : list[tuple(str, callable) or None] or None
-
setStandardBaseName
(base_name, panel_task=None)¶ Set the base name used for naming tasks.
Parameters: - base_name (str) – The new base name to use
- index (tasks.AbstractTask) – The panel task to set the standard basename for. Must
be a member of
PANEL_TASKS
. If not provided, default to the currently active task.
-
defineTaskPreprocessors
(model)¶ Return a list of tuples containing a task and an associated preprocesor.
To include preprocessors, override this method in a subclass. Example:
def defineTaskPreprocessors(self, model): return [ (model.search_task, self._validateSearchTerms), (model.email_task, self._compileAddresses) ]
Parameters: model (parameters.CompoundParam) – a model instance Returns: a list of (task, method) tuples Return type: list[tuple[tasks.AbstractTask, typing.Callable]]
-
defineTaskPostprocessors
(model)¶ Return a list of tuples containing a task and an associated postprocessor.
The signature of this method is identical to that of
defineTaskPreprocessors()
.Parameters: model (parameters.CompoundParam) – a model instance Returns: a list of (task, method) tuples Return type: list[tuple[tasks.AbstractTask, typing.Callable]]
-
setActiveTask
(new_active_task)¶ Set the currently active task. Expects a task from
PANEL_TASKS
.Parameters: new_active_task – Abstract task
-
activeTask
()¶ Return the currently active task.
Returns: The currently active task from PANEL_TASKS
-
getTask
(panel_task=None)¶ The active task instance. This is the task instance that will be run if the start button is clicked.
Parameters: panel_task – An abstract task from PANEL_TASKS
. If passed in, the task instance that will be started next for that panel task will be returned.
-
getTaskBar
(panel_task=None)¶ Gets the active task’s taskbar.
Parameters: panel_task – An abstract task from PANEL_TASKS
. If passed in, the taskbar for that panel task will be returned.
-
getTaskManager
(panel_task=None)¶ Gets the active task’s taskmanager
Parameters: panel_task – An abstract task from PANEL_TASKS
. If passed in, the taskmanager for that panel task will be returned.
-
SHOW_AS_WINDOW
= True¶
-
__init__
(*args, **kwargs)¶ Initialize self. See help(type(self)) for accurate signature.
-
defineMappings
()¶ Override this in the subclass to define mappings. Should return a list of tuples [(<target>, <param>)]. Targets can be
- a basic widget, like
QLineEdit
orQComboBox
- a custom object that inherits
MapperMixin
orTargetMixin
- a
TargetSpec
instance - a slot
For common widgets, standard signals and getter/setter methods will be used, as defined in
mappers._get_default_access_names()
.For more fine-grained custom control, instantiate a
TargetSpec
object, which allows custom setters, getters, and signals to be specified.Supplying a slot as the first element of the tuple is equivalent to providing
TargetSpec(slot=my_slot)
.Note that all target slots are triggered on
setModel()
as well as in response to the specified signal.The param is an abstract param reference, e.g. MyModel.my_param.
Example:
def defineMappings(self): combo = self.style_combo return [(self.name_le, MyModel.name), (TargetSpec(combo, getter=combo.currentText, setter=combo.setCurrentText), MyModel.style), (self.coord_widget, MyModel.coord), (self._onASLTextChanged, MyModel.asl_text)]
- a basic widget, like
-
getModel
()¶
-
classmethod
getPanelInstance
()¶ Return the singleton instance of this panel, creating one if necessary.
Returns: instance of this panel. Return type: PanelMixin
-
getSignalsAndSlots
(model)¶ Override this method to specify signal and slot pairs that need to be connected/disconnected whenever the model instance is switched using setModel. The model instance is provided as an argument so that instance-specific signals can be used, but any pairs of signals and slots may be returned from this method.
Returns: a list of 2-tuples where each tuple is a signal, slot pair
-
initLayOut
()¶ @overrides: widgetmixins.InitMixin
-
makeInitialModel
()¶
-
mappedParams
()¶ Return a list of the abstract params that are mapped to.
-
model
¶
-
modelChanged
¶
-
model_class
= None¶
-
classmethod
panel
(blocking=False, modal=False, finished_callback=None)¶ Open an instance of this class.
For full argument documentation, see
ExecutionMixin.run
.
-
resetMappedParams
()¶
-
runAllSlots
()¶
-
setDefaults
()¶ @overrides: af2.App
-
setModelWithoutSlots
(model)¶ This is called when this MapperMixin is a sub-widget of a parent MapperMixin. Since the slots will all be called at the end of the parent setModel, they shouldn’t be called during the sub-widget’s setModel.
-
setting_model
()¶
-