def showErrors(self, intro = None): if not self.errors: return dialog = QDialog(self.main_window) dialog.setObjectName('errorDialog') dialog.setWindowTitle(tr('Error(s)')) layout = QVBoxLayout(dialog) dialog.setLayout(layout) if intro != '': if intro is None: intro = translate('MainWindow', 'Some errors were found in this form:') label = QLabel(intro) layout.addWidget(label) for subject, messages in self.errors.items(): for msg in messages: if msg: label = QLabel('- %s%s%s' % (subject, unicode(tr(': ')), unicode(msg))) else: label = QLabel('- %s' % unicode(subject)) layout.addWidget(label) button = createButton(translate('MainWindow', 'Edit again'), dialog, dialog, SLOT('close()')) layout.addWidget(button) dialog.exec_()
def createBottomButtons(self): bottom = QWidget(self) bottom_layout = QHBoxLayout() bottom_layout.setObjectName('bottomLayout') bottom.setLayout(bottom_layout) buttons = ( createButton(tr('&Save'), bottom, self.main_window, self.checkAndSaveConf), createButton(tr('App&ly'), bottom, self.main_window, self.applyConf), createButton(tr('Reset'), bottom, self.main_window, self.resetConf), ) for button in buttons: bottom_layout.addWidget(button) return bottom