schrodinger.ui.qt.widgetmixins.panelmixins module¶
-
schrodinger.ui.qt.widgetmixins.panelmixins.
infer_input_mappings
(TaskClass, panel_model)¶
-
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
.
-
run
(*args, **kwargs)¶ Mark the current state as clean. This is useful for panels that implement a “Cancel” button. To implement a cancel button, connect the button to a slot that calls
self.discardChanges()
-
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
-
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__
(*args, **kwargs)¶ Initialize self. See help(type(self)) for accurate signature.
-
auto_update_model
= True¶
-
auto_update_target
= True¶
-
defineMappings
()¶ Override this in the subclass to define mappings. Should return a list of tuples [(<target>, <param>)]. Most commonly, targets will be a basic widget, like QLineEdit or QComboBox, or a custom widget that inherits from MapperMixin or TargetMixin.
For more fine-grain custom control, instantiate a Target object, which allows custom setters, getters, and signals to be specified.
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)]
-
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
-
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.
TaskPanelMixin
(*args, **kwargs)¶ Bases:
schrodinger.ui.qt.widgetmixins.panelmixins.PanelMixin
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
= ()¶
-
initSetUp
()¶
-
initSetDefaults
()¶ @overrides: widgetmixins.InitMixin
-
initLayOut
()¶ @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
-
setActiveTaskIndex
(index)¶ Select the active task based on index. This is usually used as a slot for a QComboBox.currentIndexChanged or QButtonGroup.buttonClicked signal that controls the active task of the panel.
Parameters: index (int) – 0-based index for tasks in the order they were added.
-
getTask
(index=None)¶ The active task instance. This is the task instance that will be run if the start button is clicked.
-
getTaskBar
(index=None)¶ Gets the active task’s taskbar.
-
getTaskManager
(index=None)¶
-
prestart
()¶
-
SHOW_AS_WINDOW
= True¶
-
__init__
(*args, **kwargs)¶ Initialize self. See help(type(self)) for accurate signature.
-
auto_update_model
= True¶
-
auto_update_target
= True¶
-
defineMappings
()¶ Override this in the subclass to define mappings. Should return a list of tuples [(<target>, <param>)]. Most commonly, targets will be a basic widget, like QLineEdit or QComboBox, or a custom widget that inherits from MapperMixin or TargetMixin.
For more fine-grain custom control, instantiate a Target object, which allows custom setters, getters, and signals to be specified.
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)]
-
discardChanges
()¶ Revert the model to the value it was the last time
saveCleanState
was called.
-
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
-
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
()¶
-
run
(*args, **kwargs)¶ Mark the current state as clean. This is useful for panels that implement a “Cancel” button. To implement a cancel button, connect the button to a slot that calls
self.discardChanges()
-
runAllSlots
()¶
-
saveCleanState
()¶ Copy the model as a clean state. Next time
discardChanges
is called, the model will be updated to reflect this current state.
-
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
()¶
-