def acceptableInput(self): for widget in self.input_widgets: if not widget.isEnabled(): continue if not acceptableInput(widget): return False return True
def updateWidget(self, widget): if widget.isEnabled(): valid = acceptableInput(widget) else: valid = True if valid: # Don't use empty string to avoid a strange bug: # setStyleSheet(u'') does not always update the style style = u';' else: style = u'.%s { background: %s; }' % (widget.metaObject().className(), COLOR_INVALID) widget.setStyleSheet(style) if self.ok_button: all_valid = valid if all_valid: all_valid = self.acceptableInput() self.ok_button.setEnabled(all_valid)