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.
KeywordEdit
(label_text='', keyword_dict=None, keyword_string='', **kwargs)¶ Bases:
schrodinger.ui.qt.swidgets.SLabeledEdit
A swidgets.SLabeledEdit for displaying, editing and retrieving Jaguar keywords.
-
getKeywordDict
(keystring=None)¶ Return a dictionary whose keys are keywords and values are keyword values
Parameters: keystring (str) – If provided, the keywords are taken from this string rather than the QLineEdit. The default is to take the keywords from the QLineEdit Return type: dict Returns: Dictionary of keyword/value pairs Raises: ValueError – if any tokens do not match the keyword=value format
-
getKeywordString
()¶ Return the keyword string in the QLineEdit
Return type: str Returns: The string in the QLineEdit. No validity checking is done.
-
setKeywords
(keyword_dict=None, keyword_string='')¶ Set the text of the KeywordEdit
Parameters: - keyword_dict (dict) – A dictionary of keyword/value pairs for the KeywordEdit to display. If both keyword_dict and keyword_string are supplied, the keyword_dict keywords appear first.
- keyword_string (str) – The string to display in the KeywordEdit If both keyword_dict and keyword_string are supplied, the keyword_dict keywords appear first.
-
validateKeywords
(emptyok=False)¶ Validate the contents to ensure they are valid Jaguar keywords. The return value of this is compatible with appframework2 validation methods - i.e. an af2 validation method can just call: return self.keyword_le.validateKeywords()
Parameters: emptyok (bool) – Whether it is OK for the keyword input to be empty Return type: True or (False, str) Returns: True if no errors are found, otherwise a tuple containing False and an error message.
-
-
class
schrodinger.application.matsci.qualityslider.
QualitySlider
(parent=None, label='Calculation quality:', useredit=True, layout=None, coarse='', medium='', accurate='', radiobuttons=False)¶ Bases:
PyQt5.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
-
ACCURATE
= 2¶
-
COARSE
= 0¶
-
LABELS
= {0: 'Coarse', 1: 'Medium', 2: 'Accurate'}¶
-
MEDIUM
= 1¶
Callback for radiobutton toggled signals - change the keywords displayed in the KeywordEdit
-
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
-
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
-
getKeywordString
()¶ Return the current string in the KeywordEdit
Return type: str Returns: The current string in the KeywordEdit
-
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.
-
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
-
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
-