Changeset e4676c8 in sasview for src/sas/qtgui/DensityPanel.py
- Timestamp:
- Nov 3, 2016 6:07:10 AM (8 years ago)
- Branches:
- ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- ca8b853
- Parents:
- f140169
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/DensityPanel.py
rf140169 re4676c8 2 2 import logging 3 3 import functools 4 from PyQt4 import QtGui, QtCore 4 5 5 6 from periodictable import formula as Formula 6 7 7 from PyQt4 import QtGui, QtCore8 from GuiUtils import FormulaValidator 8 9 9 10 # Local UI … … 34 35 except: 35 36 return "" 36 37 38 class FormulaValidator(QtGui.QValidator):39 def __init__(self, parent=None):40 super(FormulaValidator, self).__init__(parent)41 42 def validate(self, input, pos):43 try:44 Formula(str(input))45 self._setStyleSheet("")46 return QtGui.QValidator.Acceptable, pos47 48 except Exception as e:49 self._setStyleSheet("background-color:pink;")50 return QtGui.QValidator.Intermediate, pos51 52 def _setStyleSheet(self, value):53 try:54 if self.parent():55 self.parent().setStyleSheet(value)56 except:57 pass58 37 59 38
Note: See TracChangeset
for help on using the changeset viewer.