Package schrodinger :: Package application :: Package jaguar :: Package gui :: Module input_tab_widgets :: Class BlankableSpinBox
[hide private]
[frames] | no frames]

Class BlankableSpinBox

PyQt4.QtGui.QSpinBox --+
                       |
                      BlankableSpinBox

A spin box that allows the empty string as an acceptable value

Instance Methods [hide private]
 
__init__(self, parent, default=0)
Initialize the spin box with a range from -99 to 99.
PyQt4.QtCore.QInt
valueFromText(self, text)
Convert the specified text to an integer.
str
textFromValue(self, value)
Convert the specified integer to text.
 
stepBy(self, steps)
Increment the value of the spin box by the specified amount.
 
validate(self, input_text, pos)
Is the provided input acceptable? The blank string is considered acceptable.
int or NoneType
value(self)
Return the current value in the spin box.
int
stepEnabled(self)
Report on whether stepping up and down is allowed.
Method Details [hide private]

__init__(self, parent, default=0)
(Constructor)

 

Initialize the spin box with a range from -99 to 99. -100 is used as the sentinel value for empty string.

Parameters:
  • parent (PyQt4.QtGui.QWidget) - The Qt parent
  • default (int) - The default value, i.e. what value should we starting counting from if the user clears the spin box and then increments.

valueFromText(self, text)

 

Convert the specified text to an integer. "" is converted to -100.

Parameters:
  • text (str) - The text to convert
Returns: PyQt4.QtCore.QInt
The converted text

textFromValue(self, value)

 

Convert the specified integer to text. -100 is converted to "".

Parameters:
  • value (int) - The integer to convert
Returns: str
The converted integer

stepBy(self, steps)

 

Increment the value of the spin box by the specified amount. If the spin box contains "" before incrementing, load the default value.

Parameters:
  • steps (int) - The value to increment the spin box by

validate(self, input_text, pos)

 

Is the provided input acceptable? The blank string is considered acceptable.

See PyQt documentation for argument and return value documentation.

value(self)

 

Return the current value in the spin box. If the spin box is blank, None is returned.

Returns: int or NoneType
The current value in the spin box

stepEnabled(self)

 

Report on whether stepping up and down is allowed. When the spin box is blank, the user can step both up and down. The user cannot step down to the minimum, since that is a sentinel value.

Returns: int
A flag indicating whether stepping is allowed