Example #1
0
 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_()