class CustomWidget QtGui QWdiget def resetLineEditsStyleS heet self if

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
class CustomWidget(QtGui.QWdiget)
def resetLineEditsStyleSheet(self):
if getattr(self, '_old_css_fields', None):
for field, css in self._old_css_fields.items():
field.setStyleSheet(css)
self._old_css_fields = None
def showErr(self, errs):
self._old_css_fields = {}
wrong_fields = set()
msgs = []
for err in errs:
if err.fields is not None:
wrong_fields.update(err.fields)
msgs.append(err.msg)
for field in wrong_fields:
self._old_css_fields[field] = field.styleSheet()
field.setStyleSheet("background-color: AntiqueWhite;")
qcore.QTimer.singleShot(900, self.resetLineEditsStyleSheet)
msg = u'. '.join(msgs)
self.ui.statusLabel.setText(u"<strong>Ошибка:</strong> %s" % msg)