schrodinger.application.matsci.qualityslider module

A QSlider that allows the user to select Jaguar keywords based on Coarse/Medium/Accurate settings. The keywords are displayed to the user in a QLineEdit that by default is editable by the user. The main widget is a QFrame object that has a .slider property that is the QSlider and a .line_edit property that is the QLineEdit.

Alternatively, the Frame can contain radiobuttons instead of a QSlider

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.application.matsci.qualityslider.QualitySlider(parent=None, label='Calculation quality:', layout=None, coarse='', medium='', accurate='', radiobuttons=False)

Bases: PyQt6.QtWidgets.QFrame

A widget that allows the user to see and edit the Jaguar keywords for three different accuracy levels.

The QFrame contains either a QSlider or set of QRadioButtons and an SLabeldLineEdit. The QSlider/QRadioButtons can be used to switch between accuracy levels, and the keywords for that accuracy level are displayed in the SLabeledLineEdit

COARSE = 0
MEDIUM = 1
ACCURATE = 2
LABELS = {0: 'Coarse', 1: 'Medium', 2: 'Accurate'}
__init__(parent=None, label='Calculation quality:', layout=None, coarse='', medium='', accurate='', radiobuttons=False)

Create a QualitySlider instance

Parameters
  • parent (QWidget) – The parent of this QFrame

  • label (str) – The label shown in the frame

  • layout (QBoxLayout) – The layout to add this QFrame to

  • coarse (str) – The keyword string for coarse calculations

  • medium (str) – The keyword string for medium calculations

  • accurate (str) – The keyword string for accurate calculations

buttonChanged()

Callback for radiobutton toggled signals - change the keywords displayed in the KeywordEdit

valueChanged(newvalue)

Callback for when the QSlider changes value - change the keywords displayed in the KeywordEdit

Parameters

newvalue (int) – The current value of the QSlider

updateKeywordEdit(setting)

Change the keywords in the KeywordEdit to be those for the accuracy level of setting

Parameters

setting (int) – One of the class constants COARSE, MEDIUM or ACCURATE

setKeywords(setting, keywords, append=False)

Set the keywords for a particular accuracy level

Parameters
  • setting (int) – One of the class constants COARSE, MEDIUM or ACCURATE

  • keywords (str) – The string to use for the new keywords

  • append (bool) – True if the keywords string should be added to the current string, False (default) if it should replace the current string.

getKeywordString()

Return the current string in the KeywordEdit

Return type

str

Returns

The current string in the KeywordEdit

getKeywordDict()

Return a dictionary whose keys are keywords and values are keyword values for the current KeywordEdit contents.

Return type

dict

Returns

Dictionary of keyword/value pairs

Raises

ValueError – if any tokens do not match the keyword=value format

getCurrentSetting()

Return the current setting of the QSlider/QRadioButtons

Return type

int

Returns

The current setting of the QSlider/QRadioButtons - one of the class constants COARSE, MEDIUM or ACCURATE

reset()

Reset the widget