def _int_handler(self):
"""
Handler for int values. Parses QLineEdit.
"""
current = self._select_widget.text()
try:
# Make sure this scans as a string
if type(ast.literal_eval(current)) != int:
raise ValueError
new_value = int(current)
color = "#FFFFFF"
self._current_value = new_value
self._valid = True
except ValueError:
color = "#FFB6C1"
self._valid = False
self._select_widget.setStyleSheet("QLineEdit {{ background-color: {} }}".format(color))
评论列表
文章目录