schrodinger.application.matsci.mswidgets module

Contains widgets that are useful in MatSci panels.

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.application.matsci.mswidgets.CompactSolventSelector(parent=None, layout=None, keywords=None, **extra_args)

Bases: PyQt5.QtWidgets.QFrame

A single line of widgets that displays the currently chosen solvent and a button that will open a dialog allowing a new solvent model/solvent choice. Tracks the necessary Jaguar keywords to implement the user’s choice.

chooseSolvent()

Open a dialog that lets the user choose solvent parameters (model, solvent, solvent properties) and store the choices

getKeystring()

Get a string containing all the keywords specified by the user’s choices

Return type:str
Returns:A string containg keywords that define the user’s choices. An empty string is returned if no model has been selected
getSolventName()

Get the name of the chosen solvent

Return type:str
Returns:The user-facing name of the chosen solvent, or NO_SOLVENT if no model has been chosen
isSolventModelUsed()

Has a solvent model been chosen?

Return type:bool
Returns:True if yes, False if no
reset()

Reset all the widgets to their original values

solventKeywordsChanged(keywords, options={})

Called when the user clicks accept on the SolventDialog

Parameters:keywords (dict) – A dictionary of Jaguar solvent model keywords
class schrodinger.application.matsci.mswidgets.Divider(layout)

Bases: PyQt5.QtWidgets.QFrame

A raised divider line

class schrodinger.application.matsci.mswidgets.EmbeddedSolventWidget(parent=None, solvents=None, layout=None, dielectric=True, reference=False, keywords=None, models=None, other_solvent_options={})

Bases: schrodinger.application.jaguar.gui.tabs.solvation_tab.SolvationTab

A master widget that contains the widgets from the Jaguar Solvation tab and is convenient to use outside the Jaguar gui environment.

loadSettingsFromKeywords(keywords)

Set the widget states based on the given keyword dictionary

Parameters:keywords (dict) – Keys are jaguar keywords, values are keyword values
reset()

Reset the widgets to their initial values

class schrodinger.application.matsci.mswidgets.MultiStageArea(layout=None, append_button=True, append_stretch=True, stage_class=<class 'schrodinger.application.matsci.mswidgets.StageFrame'>)

Bases: PyQt5.QtWidgets.QScrollArea

A scrollable frame meant to hold multiple stages. See the MatSci Desmond Multistage Simulation Workflow as one example.

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:

StageFrame

Returns:

The newly created stage

Note:

All other keyword arguments are passed to the stage class

collapseAll()

Collapse all stages

copyStage(stage)

Create a copy of stage and add it directly below stage

Parameters:stage (StageFrame) – The stage to copy
deleteStage(stage, update=True)

Delete a stage

Parameters:
  • stage (StageFrame) – The stage to be deleted
  • update (bool) – True if stage labels should be updated, False if not (use False if all stages are being deleted)
expandAll()

Expand all stages

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)
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
moveStageDown(stage)

Shift the given stage down one stage

Parameters:stage (StageFrame) – The stage to move down
moveStageUp(stage)

Shift the given stage up one stage

Parameters:stage (StageFrame) – The stage to move up
reset()

Reset the stage area

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
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.

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:if disabled, an empty list. Otherwise, a list containing the random seed flag followed by the string representation of the seed specified in this widget’s spinbox.
Return type:empty list, or list of two str
getSeed()

Return the value specified in the spinbox.

Returns:seed for random number generator
Return type:int
class schrodinger.application.matsci.mswidgets.SaveDesmondFilesWidget(layout=None, **kwargs)

Bases: schrodinger.ui.qt.swidgets.SCheckBoxWithSubWidget

Standardized checkbox with combo to provide options for saving intermediate Desmond job files.

getCommandLineArgs()

Return the command line flags to be used based on the widget state. Note that this expects driver classes to the jobutils.SAVE_FLAG with the allowed options found in l{jobutils.SAVE_FLAG_OPTS}.

Returns:List of command line args to use
Return type:list
class schrodinger.application.matsci.mswidgets.SolventDialog(parent, keywords=None, **extra_args)

Bases: PyQt5.QtWidgets.QDialog

A Dialog that allows the user to pick a solvent model, solvent and parameters.

Emits a keywordsChanged signal when the user clicks Accept and passes a dictionary of the Jaguar keywords that reflect the selected settings.

accept()

Gather the options and emit a keyword dictionary with the keywords/values they define, then close the dialog.

help()

Show the Jaguar solvent help

keywordsChanged
class schrodinger.application.matsci.mswidgets.StageControlButton(icon, layout, command)

Bases: PyQt5.QtWidgets.QToolButton

The QToolButtons on the right of each StageFrame

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

copy()

Create a copy of this stage

createControlButtons()

Create upper-right corner control buttons as requested by the user

createIconsIfNecessary()

Factory to create button icons if they have not been created

delete()

Delete this stage

icons = {}
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.
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.
moveDown()

Move the stage down towards the bottom of the panel 1 stage

moveUp()

Move the stage up towards the top of the panel 1 stage

reset()

Resets the parameters to their default values.

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

class schrodinger.application.matsci.mswidgets.WheelEventFilterer

Bases: PyQt5.QtCore.QObject

An event filter that turns off wheel events for the affected widget

eventFilter(unused, event)

Filter out mouse wheel events

Parameters:
  • unused (unused) – unused
  • event (QEvent) – The event object for the current event
Return type:

bool

Returns:

True if the event should be ignored (a Mouse Wheel event) or False if it should be passed to the widget

Add a Desmond D. E. Shaw logo on the left and a MatSci logo on the right

Parameters:layout (QBoxLayout) – The layout to add the logos to
schrodinger.application.matsci.mswidgets.center_widget_in_table_cell(table, row, column, widget)

Centers the widget in the cell and adds a non-selectable widget item so the cell background can’t be selected

Parameters:
  • table (QTableWidget) – The table that contains the cell & widget
  • row (int) – The row of the cell
  • column (int) – The column of the cell
  • widget (QWidget) – The widget that will be placed into the cell and centered
schrodinger.application.matsci.mswidgets.sub_formula(formula)

Add <sub></sub> tags around numbers. Can be used to prettify unit cell formula.

Parameters:formula (str) – Formula to add tags around numbers
Return type:str
Returns:Formula with tags added
schrodinger.application.matsci.mswidgets.turn_off_unwanted_wheel_events(widget, combobox=True, spinbox=True, others=None)

Turns off the mouse wheel event for any of the specified widget types that are a child of widget

Note: The mouse wheel will still scroll an open pop-up options list for a combobox if the list opens too large for the screen. Only mouse wheel events when the combobox is closed are ignored.

Parameters:
  • widget (QtWidgets.QWidget) – The widget to search for child widgets
  • combobox (bool) – True if comboboxes should be affected
  • spinbox (bool) – True if spinboxes (int and double) should be affected
  • others (list) – A list of other widget classes that should be affected