schrodinger.application.matsci.mswidgets module¶
Contains widgets that are useful in MatSci panels.
Copyright Schrodinger, LLC. All rights reserved.
- class schrodinger.application.matsci.mswidgets.SavedASLItem(text, asl)¶
Bases:
PyQt6.QtWidgets.QWidget
Widget that includes atomselector.ASLItem and a button for deleting the asl
- itemClicked¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- deleteClicked¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- __init__(text, asl)¶
- Parameters
text (str) – Display text of the asl item
asl (str) – Asl of the item
- class schrodinger.application.matsci.mswidgets.MSAtomSelector(master, title, status_label=True, get_name_func=None, set_name_func=None, command=None, flat=False, layout=None, **kwargs)¶
Bases:
schrodinger.ui.qt.atomselector.AtomSelector
,schrodinger.ui.qt.widgetmixins.basicmixins.MessageBoxMixin
,schrodinger.ui.qt.swidgets.ItemsManagerMixin
Modify the parent class to support saving ASLs, make the reset button clear asl text only, and add a status label if needed.
- ASL_NOT_ALLOWED = {'entry.id', 'entry.name', 'set'}¶
- ASL_ITEMS = {'Displayed Atoms': 'displayed_atoms', 'Heavy Atoms': 'heavy_atoms', 'Hydrogens-All': 'all_hydrogens', 'Hydrogens-Nonpolar': 'non_polar_hydrogens', 'Hydrogens-Polar': 'polar_hydrogens', 'Ions': 'ions', 'Membrane': 'membrane', 'Metal Atoms': 'metals', 'Nucleic Acids': 'nucleic_acids', 'Protein': '(protein) and not ligand', 'Protein Backbone': '(backbone) and not ligand', 'Protein Side Chains': '(withinbonds 1 sidechain) and not ligand', 'Waters': 'water', 'Workspace Selection': 'workspace_selection'}¶
- PREF_KEY = 'asl_selector_saved_asls'¶
- PLUS_TIP_WITH_SAVE = '<nobr>Click to choose from saved ASLs, the Workspace </nobr>selection or predefined atom sets, or to open the Atom Selection dialog'¶
- ITEM_TYPE_TEXT = 'ASL'¶
- __init__(master, title, status_label=True, get_name_func=None, set_name_func=None, command=None, flat=False, layout=None, **kwargs)¶
See the parent class for documentation
- Parameters
master (QWidget) – The parent of this atomselector widget
title (str) – label over atom selection box
status_label (bool) – If True, add a status label to indicate the number of selected atoms.
get_name_func (callable) – Function to call to get the suggested name for the asl. Should take no args and return a string.
set_name_func (callable) – Function to call to set the name for the selected saved ASL. Should take a string arg.
command (function or None) – Command to execute when the asl is modified. Signal is triggered only when editing finishes.
flat (bool) – Apply flat style to the groupbox, by default it is false in qt.
layout (QBoxLayout) – The layout to put this frame into
- clearAslText()¶
Currently, the reset button is used to clear asl string
- pickMolecule()¶
Set the pick_menu with pick molecule option.
- checkASL(asl)¶
Check if asl contains sets, entry.id or entry.name
- Parameters
asl (str) – asl in the line edit
- validateAsl(struct=None)¶
Validate the ASL, optionally against a structure as well
- Parameters
struct (structure.Structure or None) – The structure to validate the ASL against
- Return type
bool
- Returns
True if the ASL is valid, False otherwise
- setupSaveWidgets()¶
Set up the widgets required for saving and loading ASLs
- updateSavedASLs()¶
Update the saved asl items in the menu
- aslItemClicked(asl, text=None)¶
Overwrite parent method to update the name in addition to the asl
- Parameters
asl (str) – The asl for the item that was clicked
text (str) – The name for the item that was clicked
- saveASL()¶
Save the current asl using the name the user provides
- class schrodinger.application.matsci.mswidgets.StageFrame(master, layout=None, copy_stage=None, stage_type=None, icons=None)¶
Bases:
schrodinger.ui.qt.swidgets.SFrame
The base frame for a stage in a MultiStageArea
Contains a Toolbutton for a title and some Window-manager-like control buttons in the upper right corner
- STAGE_DELETED¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- __init__(master, layout=None, copy_stage=None, stage_type=None, icons=None)¶
Create a DesmondStageFrame instance
- Parameters
master (
MultiStageArea
) – The panel widgetlayout (QLayout) – The layout the frame should be placed into
copy_stage (
StageFrame
) – The StageFrame this StageFrame should be a copy of. The default is None, which will create a new default stage.stage_type – The type of stage to create, should be something meaningful to the subclass. The value is stored but not used in this parent class.
icons (set) – A set of module constants indicating which icons should be made into control buttons in the upper right corner. UP, DOWN, OPEN, CLOSE, DELETE, COPY
- property icons¶
- Return type
dict(str=QtGui.QIcon)
- Returns
dictionary whose keys are the names of the stage icons and whose values are the icon widgets
- layOut(copy_stage=None)¶
Lay out any custom widgets
- Parameters
copy_stage (
StageFrame
) – The StageFrame this StageFrame should be a copy of. The default is None, which will create a new default stage.
- initialize(copy_stage=None)¶
Perform any custom initialization before the widget is finalized
- Parameters
copy_stage (
StageFrame
) – The StageFrame this StageFrame should be a copy of. The default is None, which will create a new default stage.
- createControlButtons()¶
Create upper-right corner control buttons as requested by the user
- toggleVisibility(checked=None, show=None)¶
Show or hide the stage
- Parameters
checked (bool) – Not used, but swallows the PyQt clicked signal argument so that show doesn’t get overwritten
show (bool) – If True
- updateLabel()¶
Set the label of the title button that toggles the stage open and closed
- moveUp()¶
Move the stage up towards the top of the panel 1 stage
- moveDown()¶
Move the stage down towards the bottom of the panel 1 stage
- delete()¶
Delete this stage
- copy()¶
Create a copy of this stage
- reset()¶
Resets the parameters to their default values.
- class schrodinger.application.matsci.mswidgets.MultiStageArea(layout=None, append_button=True, append_stretch=True, stage_class=<class 'schrodinger.application.matsci.mswidgets.StageFrame'>, control_all_buttons=False, start_staged=True)¶
Bases:
PyQt6.QtWidgets.QScrollArea
A scrollable frame meant to hold multiple stages. See the MatSci Desmond Multistage Simulation Workflow as one example.
- __init__(layout=None, append_button=True, append_stretch=True, stage_class=<class 'schrodinger.application.matsci.mswidgets.StageFrame'>, control_all_buttons=False, start_staged=True)¶
Create a MultiStageArea instance
- Parameters
layout (QBoxLayout) – The layout to place this Area into
append_button (bool) – Whether to add an “Append Stage” button to a Horizontal layout below the scrolling area
append_button – Whether to add a QSpacer to the layout containing the append button. Use False if additional widgets will be added after creating the area.
stage_class (
StageFrame
) – The class used to create new stagescontrol_all_buttons (bool) – True if buttons to control the open/closed state of all stages should be added above the stage area, False if not. Note that if layout is not supplied, the top_control_layout will have to be added to a layout manually.
start_staged (bool) – Whether or not resetting this widget should populate the area with a stage. Defaults to
True
.
- addStage(copy_stage=None, stage_type=None, **kwargs)¶
Add a new stage
- Parameters
copy_stage (
StageFrame
) – The stage to copy. The default is None, which will create a new default stage.stage_type – What type of stage to add. Must be dealt with in the StageFrame subclass
- Return type
- Returns
The newly created stage
- Note
All other keyword arguments are passed to the stage class
- getStageIndex(stage)¶
Return which stage number this is
- Parameters
stage (StageFrame) – Returns the index for this stage in the stage list
- Return type
int
- Returns
The stage number (starting at 0)
- moveStageUp(stage)¶
Shift the given stage up one stage
- Parameters
stage (StageFrame) – The stage to move up
- moveStageDown(stage)¶
Shift the given stage down one stage
- Parameters
stage (StageFrame) – The stage to move down
- moveStage(current, new)¶
Move the a stage
- Parameters
current (int) – The current position of the stage
new (int) – The desired new position of the stage
- copyStage(stage, **kwargs)¶
Create a copy of stage and add it directly below stage
- Parameters
stage (StageFrame) – The stage to copy
- Note
All keyword arguments are passed to addStage
- deleteStage(stage, update=True)¶
Delete a stage
- Parameters
stage (
StageFrame
) – The stage to be deletedupdate (bool) – True if stage labels should be updated, False if not (use False if all stages are being deleted)
- updateStageLabels(start_at=0)¶
Update stage labels - usually due to a change in stage numbering
- Parameters
start_at (int) – All stages from this stage to the end of the stage list will be updated
- reset()¶
Reset the stage area
- expandAll()¶
Expand all stages
- collapseAll()¶
Collapse all stages
- class schrodinger.application.matsci.mswidgets.StageControlButton(icon, layout, command)¶
Bases:
PyQt6.QtWidgets.QToolButton
The QToolButtons on the right of each
StageFrame
- __init__(icon, layout, command)¶
Create a StageControlButton instance
- Parameters
icon (QIcon) – The icon for the button
layout (QLayout) – The layout the button should be placed in
command (callable) – The slot for the clicked() signal
- class schrodinger.application.matsci.mswidgets.Divider(layout)¶
Bases:
PyQt6.QtWidgets.QFrame
A raised divider line
- __init__(layout)¶
Create a Divider instance
- Parameters
layout (QLayout) – The layout the Divider should be added to
- class schrodinger.application.matsci.mswidgets.SaveDesmondFilesWidget(combined_trj=False, layout=None, **kwargs)¶
Bases:
schrodinger.ui.qt.swidgets.SFrame
Widget that provides options for saving intermediate Desmond job files.
- __init__(combined_trj=False, layout=None, **kwargs)¶
Create an instance.
- Parameters
combined_trj (bool) – Whether the checkbox for combining trajectory should be added.
- Param
layout: Layout to add this widget to
- getCommandLineArgs()¶
Return the command line flags to be used based on the widget state. Note that this expects driver classes to the
parserutils.SAVE_FLAG
with the allowed options found inparserutils.SAVE_FLAG_OPTS
.- Returns
List of command line args to use
- Return type
list
- setFromCommandLineFlags(flags)¶
Set the state of these widgets from command line flag values
- Parameters
flags (dict) – Keys are command line flags, values are flag values. For flags that take no value, the value is ignored - the presence of the key indicates the flag is present.
- reset()¶
Reset the frame
- class schrodinger.application.matsci.mswidgets.RandomSeedWidget(layout=None, minimum=0, maximum=2147483647, default=1234, **kwargs)¶
Bases:
schrodinger.ui.qt.swidgets.SCheckBoxWithSubWidget
Standardized checkbox with spinbox to provide option to specify random seed. The spinbox is hidden when the checkbox is not checked.
- __init__(layout=None, minimum=0, maximum=2147483647, default=1234, **kwargs)¶
- Parameters
layout (QtWidgets.QLayout) – Layout to add this widget to
minimum (int) – The minimum acceptable random seed value
maximum (int) – The maximum acceptable random seed value
default (int) – The default custom random seed value
- getSeed()¶
Return the value specified in the spinbox.
- Returns
seed for random number generator
- Return type
int
- getCommandLineFlag()¶
Return a list containing the proper random seed flag and argument specified by the state of this widget. Meant to be added onto a command list, e.g.:
cmd = [EXEC, infile_path] cmd += rs_widget.getCommandLineFlag()
- Returns
A list containing the random seed flag followed by either “random”, or the string representation of the seed specified in this widget’s spinbox.
- Return type
list
of twostr
- setFromCommandLineFlags(flags)¶
Set the state of these widgets from command line flag values
- Parameters
flags (dict) – Keys are command line flags, values are flag values. For flags that take no value, the value is ignored - the presence of the key indicates the flag is present.
- setVisible(state)¶
Overwrite the parent method to allow the checkbox state to control the visibility of the subwidget
- class schrodinger.application.matsci.mswidgets.DefineASLDialog(master, help_topic='', show_markers=False, struct=None)¶
Bases:
schrodinger.ui.qt.swidgets.SDialog
Manage defining an ASL.
- __init__(master, help_topic='', show_markers=False, struct=None)¶
Create an instance.
- Parameters
master (QtWidgets.QWidget) – the window to which this dialog should be WindowModal
help_topic (str) – an optional help topic
show_markers (bool) – whether to show the Markers checkbox
struct (schrodinger.structure.Structure) – an optional structure against which the ASL will be validated
- layOut()¶
Lay out the widgets.
- getAsl()¶
Return the ASL.
- Return type
str
- Returns
the ASL
- getIndices()¶
If a structure was provided at instantiation then return the atom indices of the provided structure that match the specified ASL.
- Return type
list
- Returns
matching atom indices or None if no structure was provided
- isValid()¶
Return True if valid, (False, msg) otherwise.
- Return type
bool, pair tuple
- Returns
True if valid, (False, msg) otherwise
- accept()¶
Callback for the Accept (OK) button.
- reject()¶
Callback for the Reject (Cancel) button.
- reset()¶
Reset it.
- class schrodinger.application.matsci.mswidgets.StructureLoader(master, label, maestro, parent_layout, *, max_title_len=25, allow_cms=False)¶
Bases:
schrodinger.ui.qt.swidgets.SFrame
A set of widgets that allow the user to load a structure.
- structure_changed¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- WORKSPACE = 'Included entry'¶
- FILE = 'From file'¶
- BUTTON_TEXT = {'From file': 'Browse...', 'Included entry': 'Import'}¶
- NOT_LOADED = 'Not loaded'¶
- NOT_LOADED_TIP = 'Structure is not yet loaded'¶
- DIALOG_ID = 'STRUCTURE_LOADER_IR'¶
- __init__(master, label, maestro, parent_layout, *, max_title_len=25, allow_cms=False)¶
Create StructureLoader object.
- Parameters
master (QWidget) – Master widget
label (str) – Label for the SLabeledComboBox widget
maestro (schrodinger.maestro.maestro) – Maestro instance
parent_layout (QLayout) – Parent layout
max_title_len (int) – Maximum length of the loaded entry label
allow_cms (bool) – Whether to try to read CMS and msys instead of structure
- typeChanged()¶
React to a change in the type of scaffold
- reset()¶
Reset the widgets
- updateLabel()¶
Update the status label.
- static getStructure(struct)¶
Return structure.
- Parameters
struct (structure.Structure or desmondutils.DesmondModel) – Input structure
- Return type
- Returns
Structure
- loadStructure()¶
Load a structure from the selected source.
- validate(struct)¶
Validate structure.
- Parameters
struct (structure.Structure) – Structure to be validated
- Return type
bool or bool and str
- Returns
True if everything is fine, or False and error message
- importFromWorkspace()¶
Import a structure from the workspace.
- Return type
bool or None
- Returns
True if a structure was loaded successfully, None if not
- importFromFile()¶
Import a structure from a file, including opening the dialog to allow the user to select the file.
- Return type
bool or None
- Returns
True if the structure was loaded successfully, None if not
- getMolecularWeight()¶
Get the molecular weight of the structure.
- Returns
the molecular weight of the structure
- Return type
float
- class schrodinger.application.matsci.mswidgets.WaterTypesComboBox(ff_combo_box=None, **kwargs)¶
Bases:
schrodinger.ui.qt.swidgets.SLabeledComboBox
Combobox containing all water molecule types available in msconst. Replaces the user-facing ‘None’ with ‘current’.
- __init__(ff_combo_box=None, **kwargs)¶
Create the combobox.
- Parameters
ff_combo_box (QtWidgets.QComboBox) – Forcefield QComboBox widget
- updateValidWaterModels(name=None)¶
Update water combobox items based on water force field.
- Parameters
name (str) – name of force-field
- selectInitialModel(initial_model)¶
Update combobbox items to initially selected model
- Parameters
initial_model (str) – name of the water force field
- getWaterModelDict(is_opls_2005=False)¶
Get valid water models based on force field
- Parameters
is_opls_2005 (bool) – True if OPLS2005 force field used else False
- Return type
dict
- Returns
Dictionary of valid water force field dict
- class schrodinger.application.matsci.mswidgets.PlaneSelectorMixin¶
Bases:
object
Set of widgets to create plane and directional arrow using various methods like best fit to selected atoms, crystal vector, and plane using 3 atoms.
- NPX = array([1., 0., 0.])¶
- NPY = array([0., 1., 0.])¶
- NPZ = array([0., 0., 1.])¶
- NPO = array([0., 0., 0.])¶
- FIT_SELECTED_ATOMS = 'Best fit to selected atoms'¶
- CRYSTAL_VECTOR = 'Crystal vector:'¶
- CHOOSE_ATOMS = 'Choose at least 3 atoms to define the plane'¶
- PLANE_SCALE = 2.0¶
- addWidgetsToLayout(layout)¶
Add PlaneSelectorMixin widgets to the passed layout
- Parameters
layout (QBoxLayout) – The layout to place this panel into
- methodToggled()¶
React to the plane determination method being changed
- flipDirection()¶
Flip the direction of the interface normal
- getBuffer()¶
Get the buffer between the cell contents and the PBC boundary
- Return type
float
- Returns
The buffer space
- pickToggled()¶
React to a change in state of the pick atom checkbox
- atomPicked(asl)¶
React to the user picking another atom while defining the plane
- Parameters
asl (str) – The asl defining the picked atom
- clearPicked()¶
Clear all the picked atom information, including the WS markers
- computePlaneFromAtoms(struct=None, atoms=None)¶
Compute the interface plane as the best fit plane to a set of atoms
- Parameters
struct (
schrodinger.structure.Structure
) – The structure containing the atoms. If not given, the previously loaded structure will be used.atoms (list) – List of atom indexes of the atoms to fit. If not given, all atoms will be fit.
- updateArrowAndPlane()¶
Update the workspace arrow and plane to the new coordinates.
- setStructure(struct)¶
Set the scaffold structure that will define the interface plane
- Parameters
struct (
schrodinger.structure.Structure
) – The scaffold structure that will define the interface
- loadStructureIntoWorkspace()¶
Put the loaded structure into the workspace so the user can view it
- crystalVectorPicked()¶
React to the user choosing one of the crystal lattice vectors to define the plane
- computePlaneFromEntry(use_selected_xtal_vector=False)¶
Compute the interface plane based on an entire entry. In order of preference, this would be the crystal lattice vector most parallel with the moment of inertia. If the lattice vectors are not known, then we fit a plane to the entire structure. In either case, we then move the plane so that the entry lies entirely on one side of the plane and slide the vector to be right over the centroid of the entry.
- Parameters
use_selected_xtal_vector (bool) – Instead of picking the best plane based on a heirarchy of options, use the one defined by the currently selected crystal lattice vector.
- pointVectorAwayFromStructure(struct, vector, origin)¶
Pick the 180 degree direction of the vector that points it away from the centroid of the given structure
- Parameters
struct (
schrodinger.structure.Structure
) – The structure to point the vector away fromvector (
numpy.array
) – The vector to potentially flip 180origin (
numpy.array
) – The point the vector will originate from
- Return type
numpy.array
- Returns
The given vector, possibly flipped 180 degrees so that it points away from the given structure
- createPlane()¶
Create or update the square in the workspace that represents the interface plane
- createArrow(head_coords, tail_coords)¶
Create the arrow that represents the interface plane normal in the workspace
- Parameters
head_coords (
numpy.array
) – The coordinates of the tip of the arrowtail_coords (
numpy.array
) – The coordinates of the base of the arrow
- defineNewNormal(vector=None, origin=None, allow_flip=True)¶
Store the new normal vector and origin for the interface plane, optionally updating the workspace graphics to show the new vector/plane
- Parameters
vector (
numpy.array
) – The new xyz values of the plane normal vector. If not given, the previous vector will be used.origin (
numpy.array
) – The new origin of the vector. If not given, the previous origin will be used.allow_flip (bool) – Whether to potentially flip the vector 180 degrees so that it points away from the structure
- setBestXtalVectorProperty()¶
Set the crystal lattice vector that is most parallel with the largest moment of inertia of the loaded structure in best_btext. This vector most likely aligns with the desired interface plane normal vector.
- cleanUp()¶
Clean up the everything in the workspace from this dialog, including restoring the molecules that were in the workspace prior to it opening. Also resets some properties to their default values
- cleanArrowAndPlanes()¶
Remove the arrow and markers from the workspace
- resetFrame()¶
Reset the dialog widgets and clean up the workspace
- class schrodinger.application.matsci.mswidgets.LipidImporter(layout=None, label=None, command=None)¶
Bases:
schrodinger.ui.qt.swidgets.SFrame
Manage importing a forcefield supported lipid into the Maestro workspace.
- lipidImported¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- __init__(layout=None, label=None, command=None)¶
Create an instance.
- Parameters
layout (QLayout or None) – the layout to which this widget will be added or None if there isn’t one
label (str or None) – the label of the button or None if the default is to be used
command (function or None) – a function to call on lipid import or None if none to call
- setStructureDict()¶
Set the structure dictionary.
- getStructure()¶
Return the structure for the chosen lipid.
- Return type
- Returns
the structure
- importLipid()¶
Import the lipid into the Maestro workspace.
- reset()¶
Reset.
- class schrodinger.application.matsci.mswidgets.Stepper(label, units, start, points, step, parent_layout, multiple=False)¶
Bases:
schrodinger.ui.qt.swidgets.SFrame
A set of widgets that allow inputting a start, stepsize and number of points
- class StepperData(start, num, stepsize)¶
Bases:
tuple
- num¶
Alias for field number 1
- start¶
Alias for field number 0
- stepsize¶
Alias for field number 2
- ADD_TIP = 'This increment will be added to the previous\nstep value to get the new step value.'¶
- MULT_TIP = 'This multiplier will be multiplied times the previous\nstep value to get the new step value.'¶
- __init__(label, units, start, points, step, parent_layout, multiple=False)¶
Create a Stepper instance
- Parameters
label (str) – The label for the line of widgets
units (str) – The label to put after the starting and stepsize value widgets
start (float) – The initial starting value
points (int) – The initial number of points
step (float) – The initial stepsize
parent_layout (swidgets.SBoxLayout) – The layout to place the Stepper into
multiple (bool) – Whether the step is a multiplier (True) or additive (False)
- numPointsChanged(value)¶
React to the number of points changing
- Parameters
value (int) – The current number of points
- getData()¶
Get the current settings
- Return type
- Returns
The current settings
- reset()¶
Reset the widgets
- values()¶
A generator for the values produced by the current settings
- Return type
generator of float
- Returns
Each item generated is a value defined by the current settings
- class schrodinger.application.matsci.mswidgets.AtomNameWidgetItem(value, type_value=<class 'str'>, default='')¶
Bases:
PyQt6.QtWidgets.QTableWidgetItem
QTableWidgetItem validated as type provided.
- __init__(value, type_value=<class 'str'>, default='')¶
Initialize item object.
- Parameters
value – Input value
type_value – type to which value must be converted. Default type of value is str
default – Value default, must be of type type_value
- getCurrentValue(value)¶
Get value of the correct type and save it.
- Parameters
value – Input value to be converted to the typed value
- Returns
typed value
- Return type
type
- setData(role, value)¶
Validates table cell data value by converting it to float.
- Parameters
role (int) – Item role.
value – Value of the item’s data.
- userData()¶
Get user data.
- Return type
any or None
- Returns
User data or None
- class schrodinger.application.matsci.mswidgets.MultiComboWithCount(text=None, item_name='item', layout=None, items=None, max_selected_items=None, command=None, stretch=True, width=80, **kwargs)¶
Bases:
schrodinger.ui.qt.multi_combo_box.MultiComboBox
A MultiComboBox that shows the number of selected items as the combobox text instead of item names.
- __init__(text=None, item_name='item', layout=None, items=None, max_selected_items=None, command=None, stretch=True, width=80, **kwargs)¶
Create a MultiComboWithCount instance
- Parameters
layout (QBoxLayout) – The layout for this widget
items (list) – The items to add to the combobox
max_selected_items (int) – The maximum number of items that the user may select before the rest disabled for selection.
command (callable) – The command to call when the selection changes
- property max_selected_items¶
- recordChange(*args)¶
Record that the selection has changed
- currentText()¶
Override the parent class to only show the number of selected items rather than all the item names
- Return type
str
- Returns
The text to display in the combobox
- changeToolTip()¶
Change the tooltip to show all selected items
- hideWidgets(hidden)¶
Hide (or show) the combobox and clear the selection
- Parameters
hidden (bool) – Whether to hide the combobox or show it
- updateSelectability()¶
If the number of selected items is greater than or equal to the maximum, then make sure that the remaining, unselected items are disabled. Otherwise, make sure that all items are enabled.
- enableAllItems()¶
Enables all items in the combo box
- disableUnselectedItems()¶
Disables all unselected items in the combo box
- setVisible(visible)¶
Show or hide the combobox
- Parameters
visible (bool) – Whether the combobox should be shown
- class schrodinger.application.matsci.mswidgets.OPLS5ForceFieldSelector(*args, allow_opls5=None, **kwargs)¶
Bases:
schrodinger.ui.qt.forcefield.ffselector.ForceFieldSelector
A force field selector that obeys the MS_USE_OPLS5 feature flag and also allows panels to overwrite the state of that flag.
Note that regardless of all other parameters, the selector will not show OPLS5 unless the company-wide OPLS5_SELECTABLE flag is on.
- __init__(*args, allow_opls5=None, **kwargs)¶
Create an instance
- Parameters
allow_opls5 (bool or None) – If True then ignore the MS_USE_OPLS5 feature flag and whether OPLS5 is available depends only on the OPLS5_SELECTABLE feature flag. If False then ignore MS_USE_OPLS5 and OPLS5 will not be available regardless of OPLS5_SELECTABLE. If None then OPLS5 will be available if and only if both OPLS5_SELECTABLE and MS_USE_OPLS5 are enabled.
- class schrodinger.application.matsci.mswidgets.MSForceFieldSelector(*args, **kwargs)¶
Bases:
schrodinger.application.matsci.mswidgets.OPLS5ForceFieldSelector
- __init__(*args, **kwargs)¶
Extend the
ForceFieldSelector
by applying a Materials-Science-specific default force field
- class schrodinger.application.matsci.mswidgets.ProcessBusyDialog(text, process, *args, **kwargs)¶
Bases:
schrodinger.ui.qt.swidgets.SDialog
A dialog that indicates a subprocess is running and gives the user a cancel button to kill it.
The class is designed to show/exec the dialog via the activate function. The dialog is modal and will block until the subprocess finishes.
- KILLED = -9¶
- SUCCESS = 0¶
- __init__(text, process, *args, **kwargs)¶
Create a ProcessBusyDialog instance
- Parameters
text (str) – The text to display in the dialog
process (subprocess.Popen) – The running subprocess
Additional arguments are passed to the parent class
- layOut()¶
Lay out the dialog widgets
- setNewData(text, process)¶
Set the new text and process for this dialog - used for dialogs that have activate called with persistent=True
- Parameters
text (str) – The new text of the dialog
process (subprocess.Popen) – The new running subprocess
- activate(persistent=False)¶
Show the dialog, wait for the process to finish (either naturally or by the user cancelling it) and return the process return code.
- Parameters
persistent (bool) – If False, close the dialog before returning. If True, do not close the dialog and caller is responsible for calling dialog.accept() to close.
- Return type
int
- Returns
0 if the process finished successfully, -9 if killed by the user, or a non-zero integer if the process died with an error
- reject()¶
Called when the user selects the Cancel button or the window manager X button. Kill the process but do not close the dialog. Allow the dialog to close naturally via the activate while loop when the process terminates.
- class schrodinger.application.matsci.mswidgets.OptionalInputSelector(parent, **kwargs)¶
Bases:
schrodinger.ui.qt.input_selector.InputSelector
An InputSelector object that does not act when disabled
- setEnabled(enable, *args, **kwargs)¶
Override the parent method to block signals when disabled
- validate(*args, **kwargs)¶
Override the parent method to not validate when disabled
- writePTEntries(*args, **kwargs)¶
Override the parent method to not write when disabled
- setup(jobname, *args, **kwargs)¶
Override the parent method to store the structure file name but do nothing else when disabled
- class schrodinger.application.matsci.mswidgets.ConvenientSelectorWithPopUp(label, default_selection, list_items, filter_cbs=(), command=None, layout=None, stretch=True)¶
Bases:
schrodinger.ui.qt.swidgets.SFrame
Convenient selector with popup that doesn’t need subclassing the selector, the button and the popup classes to use.
NOTE: This class hasn’t been tested with filter checkboxes yet, and might need more functionalities NOTE: Can use autowidth option of TemplateSelectorFilterListPopUp
- selectionChanged¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- __init__(label, default_selection, list_items, filter_cbs=(), command=None, layout=None, stretch=True)¶
Create an instance
- Parameters
label (str) – The selector label
default_selection (str) – Default selection in the list
list_items (iterable(QListWidgetItem) or iterable(str)) – Items or strings to add to the popup filtered list
filter_cbs (tuple(FilterCheckBox)) – tuple of filter checkboxes for the popup
command (callable) – The command to call when the selection changes
layout (QLayout) – The layout to place the frame in
stretch (bool) – Whether to add a stretch after the button
- getSelection()¶
Get the current selection
- Return type
str
- Returns
The current selection
- setSelection(selection)¶
Set the current selection for the selector
- Parameters
selection (str) – The text for the item
- Raises
ValueError – If no items are found with the text
- updateLineEdit()¶
Update the line edit text with the list’s current selection
- reset()¶
Reset the selector
- class schrodinger.application.matsci.mswidgets.MultiSlider(*, parent=None, num_thumbs=2, minimum=0, maximum=100, ticks=True, num_ticks=10, command=None, thumb_name=None, float_step=1, layout=None)¶
Bases:
PyQt6.QtWidgets.QSlider
A horizontal slider widget with variable number of thumbs that can be moved independently. The slider can be used to select a range of values or to select multiple values. Fine control is available by using the spinbox to set the value of the thumbs. The number of thumbs can be changed by using the spinbox or by clicking on the slider.
- SC_HANDLE = 2¶
- SC_GROOVE = 1¶
- CC_SLIDER = 3¶
- GROOVE_THICKNESS = 1¶
- THICKNESS = 4¶
- HIGHLIGHT_COLOR = <PyQt6.QtGui.QColor object>¶
- MAX_THUMBS = 20¶
- valueChanged¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- __init__(*, parent=None, num_thumbs=2, minimum=0, maximum=100, ticks=True, num_ticks=10, command=None, thumb_name=None, float_step=1, layout=None)¶
- Parameters
parent (QtWidgets.QWidget) – Parent widget
num_thumbs (int) – The initial number of thumbs
minimum (float or int) – Minimum value of the slider
maximum (float or int) – Maximum value of the slider
ticks (bool) – Whether to show tick marks
num_ticks (int) – Number of tick marks to show, excluding the minimum and maximum values of the slider
command (callable) – Function to call when the slider values are changed
thumb_name (str) – The user facing name of the thumbs.
float_step (float) – Step size of the slider
layout (QtWidgets.QLayout) – Layout to add the slider to
- addSpinBoxLayout(thumb_name)¶
Add the spin box layout
- Parameters
thumb_name (str) – The user facing name of the thumb
- event(event)¶
Override the event method to show a tooltip when the mouse cursor is over a thumb only.
- Parameters
event (QtCore.QEvent) – Event
- emitValueChanged()¶
Emit the valueChanged signal only if the values have changed
- property values¶
List of values of the thumbs in the slider. Note that the values are the actual values and not the slider positions.
- Returns
List of values of the thumbs
- Return type
list(float)
- valueAt(index)¶
Get the value of the thumb at the specified index
- Parameters
index (int) – Index of the thumb
- Returns
Value of the thumb
- Return type
float
- Raises
IndexError – If the index is out of range
- setValues(values)¶
Set the values of the thumbs in the slider
- Parameters
values (list(float)) – List of values
- Raises
ValueError – If the number of values does not match the number
- setRange(minimum, maximum)¶
Set the range of the slider.
- Parameters
minimum (float) – Minimum value
maximum (float) – Maximum value
- initPositions()¶
Initialize the positions of the thumbs in the slider such that they are evenly spaced.
- setNumThumbs(num_thumbs)¶
Set the number of thumbs in the slider
- Parameters
num_thumbs (int) – Number of thumbs
- setSelectedThumb(index)¶
Update the selected thumb
- Parameters
index (int) – Index of the selected thumb
- setDraggableThumb(index)¶
Update the draggable thumb
- Parameters
index (int) – Index of the draggable thumb
- updateSpinBox()¶
Update the spin box value, react to the slider value being changed
- updateSliderPosition(float_value)¶
Update the slider position based on the spin box value
- Parameters
float_value (float) – New value for the selected thumb set by the spin box
- addThumb(value)¶
Add a thumb to the slider
- Parameters
value (int) – Value of the thumb
- removeThumb(index)¶
Remove a thumb from the slider
- Parameters
index (int) – Index of the thumb to remove
- paintEvent(event)¶
Paint the slider
- Parameters
event (QtGui.QPaintEvent) – Paint event
- mousePressEvent(event)¶
Handle mouse press events to select, add thumbs, and remove thumbs
- Parameters
event (QtGui.QMouseEvent) – Mouse press event
- mouseMoveEvent(event)¶
Move the selected thumb to the new position if the mouse is moved while the left mouse button is pressed down (dragging)
- Parameters
event (QtGui.QMouseEvent) – Mouse move event
- mouseReleaseEvent(event)¶
Handle mouse release event
- Parameters
event (QtGui.QMouseEvent) – Mouse release event
- reset()¶
Reset the slider to its default state
- class schrodinger.application.matsci.mswidgets.MSMoleculeSelector(*args, **kwargs)¶
Bases:
schrodinger.application.matsci.mswidgets.MSAtomSelector
Atom selector which only allows selecting whole molecules
- __init__(*args, **kwargs)¶
Create an instance. See parent for argument docs.
- class schrodinger.application.matsci.mswidgets.SystemInformationFrame(parent, parent_layout, use_defaults=True, custom_headers=None)¶
Bases:
schrodinger.ui.qt.swidgets.SFrame
A frame which displays some information about the system.
- ATOM_NUM = 'Atom #'¶
- MOLECULE_NUM = 'Molecule #'¶
- TOTAL_WEIGHT = 'Total Weight'¶
- TOTAL_CHARGE = 'Total Charge'¶
- DEFAULT_HEADERS = ['Atom #', 'Molecule #', 'Total Weight', 'Total Charge']¶
- __init__(parent, parent_layout, use_defaults=True, custom_headers=None)¶
Create an instance of the frame.
- Parameters
parent (QtWidget) – The parent of this frame
parent_layout (QBoxLayout) – The layout to place this frame into
use_defaults (bool) – Whether to use the default headers
custom_headers (list) – A list of custom headers to use
- layOut()¶
Lay out the widgets in the frame.
- setSystemInfo(updated_items=None)¶
Set the system information labels. Note, this should be called after the parent structure has been loaded.
- Parameters
updated_items (dict) – A dictionary of headers that are already passed in
self.custom_headers
and their values.- Raises
ValueError – If using custom headers, updated_items must be provided. Also, updated_items must contain all headers in custom_headers.
- setDefaultItems()¶
Set the default system information labels.
- getTotalCharge()¶
Get the sum of formal charges of atoms in the structure.
- Return type
float
- Returns
total charge
- reset()¶
Reset all the labels in the frame.