schrodinger.ui.qt.atom_weights_table_widget module

class schrodinger.ui.qt.atom_weights_table_widget.AtomWeight(*args, _param_type=<object object>, **kwargs)

Bases: schrodinger.models.parameters.CompoundParam

Represent weight parameters for a single atom.

atom_number: int

A parameter of the class.

element: str

A parameter of the class.

pdb_name: str

A parameter of the class.

weight: float

A parameter of the class.

atom_numberChanged

A pyqtSignal emitted by instances of the class.

atom_numberReplaced

A pyqtSignal emitted by instances of the class.

elementChanged

A pyqtSignal emitted by instances of the class.

elementReplaced

A pyqtSignal emitted by instances of the class.

pdb_nameChanged

A pyqtSignal emitted by instances of the class.

pdb_nameReplaced

A pyqtSignal emitted by instances of the class.

weightChanged

A pyqtSignal emitted by instances of the class.

weightReplaced

A pyqtSignal emitted by instances of the class.

class schrodinger.ui.qt.atom_weights_table_widget.AtomWeightsSpec(*args, _param_type=<object object>, **kwargs)

Bases: schrodinger.ui.qt.mapperwidgets.plptable.TableSpec

Table spec for the custom weights.

atom_number = <schrodinger.ui.qt.mapperwidgets.plptable.FieldColumn object>
element = <schrodinger.ui.qt.mapperwidgets.plptable.FieldColumn object>
pdb_name = <schrodinger.ui.qt.mapperwidgets.plptable.FieldColumn object>
weight = <schrodinger.ui.qt.mapperwidgets.plptable.FieldColumn object>
sort_role(field)
weight_font(weight)
weight_color(weight)
columnsChanged

A pyqtSignal emitted by instances of the class.

columnsReplaced

A pyqtSignal emitted by instances of the class.

class schrodinger.ui.qt.atom_weights_table_widget.AtomWeightsTableWidget(*args, **kwargs)

Bases: schrodinger.ui.qt.mapperwidgets.plptable.PLPTableWidget

Table to display atom weights data.

__init__(*args, **kwargs)
Parameters
  • spec (TableSpec) – Table specification. Will be ignored if autospec is True.

  • autospec (bool) – Whether to automatically generate the table specification from the PLP item fields.

  • plp (parameters.ParamListParam) – ParamListParam containing data. It is more common to set the plp using mappers.

  • view (QtWidgets.QTableView) – Custom table view instance. If None, an instance of table_helper.SampleDataTableView will be created.

class schrodinger.ui.qt.atom_weights_table_widget.AtomWeightsSettings(*args, _param_type=<object object>, **kwargs)

Bases: schrodinger.models.parameters.CompoundParam

Class for storing Custom Weight Options. Contains all logic for updating the table data and spheres.

allow_custom_weights: bool

A parameter of the class.

use_custom_weights: bool

A parameter of the class.

default_weight: float

A parameter of the class.

custom_weight: float

A parameter of the class.

atom_weights: List[schrodinger.ui.qt.atom_weights_table_widget.AtomWeight]

A parameter of the class.

selected_weights: List[schrodinger.ui.qt.atom_weights_table_widget.AtomWeight]

A parameter of the class.

template_stsChanged

A pyqtSignal emitted by instances of the class.

initConcrete()

Override to customize initialization of concrete params.

property template_sts: List[schrodinger.structure._structure.Structure]
property template_st: Optional[schrodinger.structure._structure.Structure]

Return the first template structure or None.

updateAtomWeights()

Clear the table model and then add a row for each atom in the current template_st.

applyDefaultWeight()

Apply the default weights to all rows that haven’t been assigned a custom weight, and update all spheres.

applyCustomWeight()

Apply the custom weight to currently selected rows and update all spheres.

addWeightPropsToTemplateStructures(weight_property: str)

Add weight_property as a property to the atoms in all template structures.

Parameters

weight_property – the name of the associated weight property

allow_custom_weightsChanged

A pyqtSignal emitted by instances of the class.

allow_custom_weightsReplaced

A pyqtSignal emitted by instances of the class.

atom_weightsChanged

A pyqtSignal emitted by instances of the class.

atom_weightsReplaced

A pyqtSignal emitted by instances of the class.

custom_weightChanged

A pyqtSignal emitted by instances of the class.

custom_weightReplaced

A pyqtSignal emitted by instances of the class.

default_weightChanged

A pyqtSignal emitted by instances of the class.

default_weightReplaced

A pyqtSignal emitted by instances of the class.

selected_weightsChanged

A pyqtSignal emitted by instances of the class.

selected_weightsReplaced

A pyqtSignal emitted by instances of the class.

use_custom_weightsChanged

A pyqtSignal emitted by instances of the class.

use_custom_weightsReplaced

A pyqtSignal emitted by instances of the class.

class schrodinger.ui.qt.atom_weights_table_widget.WeightSphereManager

Bases: schrodinger.models.mappers.MapperMixin

Manages 3D spheres representing atom weights of each individual atoms in AtomWeightsSettings.

model_class

alias of schrodinger.ui.qt.atom_weights_table_widget.AtomWeightsSettings

OPACITY_DEFAULT = 0.4
OPACITY_SELECTED = 1.0
COLOR_DEFAULT = (0.5, 0.5, 1.0)
COLOR_SELECTED = (1.0, 1.0, 0.0)
RESOLUTION_DEFAULT = 50
__init__()
defineMappings()

Override this in the subclass to define mappings. Should return a list of tuples [(<target>, <param>)]. Targets can be:

  1. a basic widget, like QLineEdit or QComboBox

  2. a custom object that inherits MapperMixin or TargetMixin

  3. a TargetSpec instance

  4. 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)]
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

updateSpheres()

Clear all spheres and, if necessary, create a sphere for each row in the atom weights table with appropriate colors.

clearSpheres()

Delete all spheres from the sphere group. Clears all spheres in the WS.

class schrodinger.ui.qt.atom_weights_table_widget.AtomWeightsWidget(*args, **kwargs)

Bases: schrodinger.models.mappers.MapperMixin, schrodinger.ui.qt.basewidgets.BaseWidget

A widget for the custom weights table. User can specify default and custom weights for the atoms and then use the values to run their custom job with an additional WEIGHT_PROPERTY.

Initially, set the template structures using setTemplateStructures() method. To add weights to the template structures, call addWeightPropsToTemplateStructures() with the WEIGHT_PROPERTY.

Atom weights can be visualized with sphere markers in the workspace by instantiating this alongside WeightSphereManager and mapping both views to the same model.

All the params of AtomWeightsSettings need to be synced up with the parent widget for an ideal arrangement.

model_class

alias of schrodinger.ui.qt.atom_weights_table_widget.AtomWeightsSettings

ui_module = <module 'schrodinger.ui.qt.atom_weights_table_ui' from '/scr/buildbot/builds/core-suite-ci/core-suite-ci/build/internal/lib/python3.11/site-packages/schrodinger/ui/qt/atom_weights_table_ui.py'>
ATOM_WEIGHTS = [0, 0.25, 0.5, 0.75, 1]
initSetUp()

Creates widget from ui and stores it ui_widget.

Suggested subclass use: create and initialize subwidgets, and connect signals.

initLayOut()

@overrides: widgetmixins.InitMixin

defineMappings()

Override this in the subclass to define mappings. Should return a list of tuples [(<target>, <param>)]. Targets can be:

  1. a basic widget, like QLineEdit or QComboBox

  2. a custom object that inherits MapperMixin or TargetMixin

  3. a TargetSpec instance

  4. 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)]
property template_sts: List[schrodinger.structure._structure.Structure]

Return the list of template structures currently held in the model.

setTemplateStructures(template_sts: List[schrodinger.structure._structure.Structure])

Set the model’s template structures as template_sts or [] if query is an *.ivol file, and determine whether the get_ws_selection_btn should be enabled.

Parameters

template_sts – Structures to apply custom atom weights to.

addWeightPropsToTemplateStructures(weight_property)

Add weight_property as a property to the atoms in all template structures.

Parameters

weight_property (str) – the name of the associated weight property