574 QMessageBox.critical(None, |
574 QMessageBox.critical(None, |
575 self.trUtf8("Add new Python package"), |
575 self.trUtf8("Add new Python package"), |
576 self.trUtf8("""<p>The package directory <b>{0}</b> could""" |
576 self.trUtf8("""<p>The package directory <b>{0}</b> could""" |
577 """ not be created. Aborting...</p>""" |
577 """ not be created. Aborting...</p>""" |
578 """<p>Reason: {1}</p>""")\ |
578 """<p>Reason: {1}</p>""")\ |
579 .format(packagePath, str(err)), |
579 .format(packagePath, str(err))) |
580 QMessageBox.StandardButtons(\ |
|
581 QMessageBox.Ok)) |
|
582 return |
580 return |
583 packageFile = os.path.join(packagePath, "__init__.py") |
581 packageFile = os.path.join(packagePath, "__init__.py") |
584 if not os.path.exists(packageFile): |
582 if not os.path.exists(packageFile): |
585 try: |
583 try: |
586 f = open(packageFile, "w", encoding = "utf-8") |
584 f = open(packageFile, "w", encoding = "utf-8") |
589 QMessageBox.critical(None, |
587 QMessageBox.critical(None, |
590 self.trUtf8("Add new Python package"), |
588 self.trUtf8("Add new Python package"), |
591 self.trUtf8("""<p>The package file <b>{0}</b> could""" |
589 self.trUtf8("""<p>The package file <b>{0}</b> could""" |
592 """ not be created. Aborting...</p>""" |
590 """ not be created. Aborting...</p>""" |
593 """<p>Reason: {1}</p>""")\ |
591 """<p>Reason: {1}</p>""")\ |
594 .format(packageFile, str(err)), |
592 .format(packageFile, str(err))) |
595 QMessageBox.StandardButtons(\ |
|
596 QMessageBox.Ok)) |
|
597 return |
593 return |
598 self.project.appendFile(packageFile) |
594 self.project.appendFile(packageFile) |
599 if packageFile: |
595 if packageFile: |
600 self.sourceFile[str].emit(packageFile) |
596 self.sourceFile[str].emit(packageFile) |
601 |
597 |