115 self.__module is not None and \ |
115 self.__module is not None and \ |
116 self.classNameCombo.count() == 0: |
116 self.classNameCombo.count() == 0: |
117 self.__initError = True |
117 self.__initError = True |
118 E5MessageBox.critical( |
118 E5MessageBox.critical( |
119 self, |
119 self, |
120 self.trUtf8("Create Dialog Code"), |
120 self.tr("Create Dialog Code"), |
121 self.trUtf8( |
121 self.tr( |
122 """The file <b>{0}</b> exists but does not contain""" |
122 """The file <b>{0}</b> exists but does not contain""" |
123 """ any classes.""").format(self.srcFile)) |
123 """ any classes.""").format(self.srcFile)) |
124 |
124 |
125 self.okButton.setEnabled(self.classNameCombo.count() > 0) |
125 self.okButton.setEnabled(self.classNameCombo.count() > 0) |
126 |
126 |
144 dlg = uic.loadUi(self.formFile) |
144 dlg = uic.loadUi(self.formFile) |
145 return dlg.objectName() |
145 return dlg.objectName() |
146 except (AttributeError, ImportError) as err: |
146 except (AttributeError, ImportError) as err: |
147 E5MessageBox.critical( |
147 E5MessageBox.critical( |
148 self, |
148 self, |
149 self.trUtf8("uic error"), |
149 self.tr("uic error"), |
150 self.trUtf8( |
150 self.tr( |
151 """<p>There was an error loading the form <b>{0}</b>""" |
151 """<p>There was an error loading the form <b>{0}</b>""" |
152 """.</p><p>{1}</p>""").format(self.formFile, str(err))) |
152 """.</p><p>{1}</p>""").format(self.formFile, str(err))) |
153 return "" |
153 return "" |
154 |
154 |
155 def __className(self): |
155 def __className(self): |
162 dlg = uic.loadUi(self.formFile) |
162 dlg = uic.loadUi(self.formFile) |
163 return dlg.metaObject().className() |
163 return dlg.metaObject().className() |
164 except (AttributeError, ImportError) as err: |
164 except (AttributeError, ImportError) as err: |
165 E5MessageBox.critical( |
165 E5MessageBox.critical( |
166 self, |
166 self, |
167 self.trUtf8("uic error"), |
167 self.tr("uic error"), |
168 self.trUtf8( |
168 self.tr( |
169 """<p>There was an error loading the form <b>{0}</b>""" |
169 """<p>There was an error loading the form <b>{0}</b>""" |
170 """.</p><p>{1}</p>""").format(self.formFile, str(err))) |
170 """.</p><p>{1}</p>""").format(self.formFile, str(err))) |
171 return "" |
171 return "" |
172 |
172 |
173 def __signatures(self): |
173 def __signatures(self): |
326 |
326 |
327 self.slotsView.sortByColumn(0, Qt.AscendingOrder) |
327 self.slotsView.sortByColumn(0, Qt.AscendingOrder) |
328 except (AttributeError, ImportError) as err: |
328 except (AttributeError, ImportError) as err: |
329 E5MessageBox.critical( |
329 E5MessageBox.critical( |
330 self, |
330 self, |
331 self.trUtf8("uic error"), |
331 self.tr("uic error"), |
332 self.trUtf8( |
332 self.tr( |
333 """<p>There was an error loading the form <b>{0}</b>""" |
333 """<p>There was an error loading the form <b>{0}</b>""" |
334 """.</p><p>{1}</p>""").format(self.formFile, str(err))) |
334 """.</p><p>{1}</p>""").format(self.formFile, str(err))) |
335 |
335 |
336 def __generateCode(self): |
336 def __generateCode(self): |
337 """ |
337 """ |
395 template = tmplFile.read() |
395 template = tmplFile.read() |
396 tmplFile.close() |
396 tmplFile.close() |
397 except IOError as why: |
397 except IOError as why: |
398 E5MessageBox.critical( |
398 E5MessageBox.critical( |
399 self, |
399 self, |
400 self.trUtf8("Code Generation"), |
400 self.tr("Code Generation"), |
401 self.trUtf8( |
401 self.tr( |
402 """<p>Could not open the code template file""" |
402 """<p>Could not open the code template file""" |
403 """ "{0}".</p><p>Reason: {1}</p>""") |
403 """ "{0}".</p><p>Reason: {1}</p>""") |
404 .format(tmplName, str(why))) |
404 .format(tmplName, str(why))) |
405 return |
405 return |
406 |
406 |
431 if not sourceImpl[-1].endswith("\n"): |
431 if not sourceImpl[-1].endswith("\n"): |
432 sourceImpl[-1] = "{0}{1}".format(sourceImpl[-1], "\n") |
432 sourceImpl[-1] = "{0}{1}".format(sourceImpl[-1], "\n") |
433 except IOError as why: |
433 except IOError as why: |
434 E5MessageBox.critical( |
434 E5MessageBox.critical( |
435 self, |
435 self, |
436 self.trUtf8("Code Generation"), |
436 self.tr("Code Generation"), |
437 self.trUtf8( |
437 self.tr( |
438 """<p>Could not open the source file "{0}".</p>""" |
438 """<p>Could not open the source file "{0}".</p>""" |
439 """<p>Reason: {1}</p>""") |
439 """<p>Reason: {1}</p>""") |
440 .format(self.srcFile, str(why))) |
440 .format(self.srcFile, str(why))) |
441 return |
441 return |
442 |
442 |
510 srcFile.write("".join(sourceImpl)) |
510 srcFile.write("".join(sourceImpl)) |
511 srcFile.close() |
511 srcFile.close() |
512 except IOError as why: |
512 except IOError as why: |
513 E5MessageBox.critical( |
513 E5MessageBox.critical( |
514 self, |
514 self, |
515 self.trUtf8("Code Generation"), |
515 self.tr("Code Generation"), |
516 self.trUtf8("""<p>Could not write the source file "{0}".</p>""" |
516 self.tr("""<p>Could not write the source file "{0}".</p>""" |
517 """<p>Reason: {1}</p>""") |
517 """<p>Reason: {1}</p>""") |
518 .format(self.filenameEdit.text(), str(why))) |
518 .format(self.filenameEdit.text(), str(why))) |
519 return |
519 return |
520 |
520 |
521 self.project.appendFile(self.filenameEdit.text()) |
521 self.project.appendFile(self.filenameEdit.text()) |
522 |
522 |