Package schrodinger :: Package application :: Package matsci :: Module qualityslider :: Class KeywordEdit
[hide private]
[frames] | no frames]

Class KeywordEdit

PyQt4.QtGui.QLineEdit --+        
                        |        
 ui.qt.swidgets.SLineEdit --+    
                            |    
  ui.qt.swidgets.SLabeledEdit --+
                                |
                               KeywordEdit

A swidgets.SLabeledEdit for displaying, editing and retrieving Jaguar keywords.

Instance Methods [hide private]
 
__init__(self, label_text="", keyword_dict=None, keyword_string="", **kwargs)
Create a KeywordEdit instance.
str
getKeywordString(self)
Return the keyword string in the QLineEdit
dict
getKeywordDict(self, keystring=None)
Return a dictionary whose keys are keywords and values are keyword values
 
setKeywords(self, keyword_dict=None, keyword_string="")
Set the text of the KeywordEdit
True or (False, str)
validateKeywords(self, emptyok=False)
Validate the contents to ensure they are valid Jaguar keywords.

Inherited from ui.qt.swidgets.SLabeledEdit: reset, setEnabled, setIndicator

Inherited from ui.qt.swidgets.SLineEdit: eventFilter, float, getString, int, resizeEvent, setClearButton, updateClearButton

Class Variables [hide private]

Inherited from ui.qt.swidgets.SLineEdit: AV_ERROR_MSG

Method Details [hide private]

__init__(self, label_text="", keyword_dict=None, keyword_string="", **kwargs)
(Constructor)

 

Create a KeywordEdit instance.

Any unrecognized keyword arguments are passed to the SLabeledEdit class

Parameters:
  • label_text (str) - The text of the label for the KeywordEdit. By default, there is no label.
  • 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.
Overrides: ui.qt.swidgets.SLineEdit.__init__

getKeywordString(self)

 

Return the keyword string in the QLineEdit

Returns: str
The string in the QLineEdit. No validity checking is done.

getKeywordDict(self, 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
Returns: dict
Dictionary of keyword/value pairs
Raises:
  • ValueError - if any tokens do not match the keyword=value format

setKeywords(self, 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(self, 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
Returns: True or (False, str)
True if no errors are found, otherwise a tuple containing False and an error message.