604 with open(ofn, "w", encoding="utf-8", newline=newline) as f: |
604 with open(ofn, "w", encoding="utf-8", newline=newline) as f: |
605 for line in self.buf.splitlines(): |
605 for line in self.buf.splitlines(): |
606 f.write(line + "\n") |
606 f.write(line + "\n") |
607 if self.compiledFile not in self.project.pdata["SOURCES"]: |
607 if self.compiledFile not in self.project.pdata["SOURCES"]: |
608 self.project.appendFile(ofn) |
608 self.project.appendFile(ofn) |
609 if not self.noDialog and not ui.notificationsEnabled(): |
609 ui.showNotification( |
610 E5MessageBox.information( |
610 UI.PixmapCache.getPixmap("resourcesCompiler48"), |
611 self, |
611 self.tr("Resource Compilation"), |
612 self.tr("Resource Compilation"), |
612 self.tr("The compilation of the resource file" |
613 self.tr("The compilation of the resource file" |
613 " was successful.")) |
614 " was successful.")) |
|
615 else: |
|
616 ui.showNotification( |
|
617 UI.PixmapCache.getPixmap("resourcesCompiler48"), |
|
618 self.tr("Resource Compilation"), |
|
619 self.tr("The compilation of the resource file" |
|
620 " was successful.")) |
|
621 except OSError as msg: |
614 except OSError as msg: |
622 if not self.noDialog: |
615 if not self.noDialog: |
623 E5MessageBox.information( |
616 E5MessageBox.information( |
624 self, |
617 self, |
625 self.tr("Resource Compilation"), |
618 self.tr("Resource Compilation"), |
626 self.tr( |
619 self.tr( |
627 "<p>The compilation of the resource file" |
620 "<p>The compilation of the resource file" |
628 " failed.</p><p>Reason: {0}</p>").format(str(msg))) |
621 " failed.</p><p>Reason: {0}</p>").format(str(msg))) |
629 else: |
622 else: |
630 if not self.noDialog: |
623 ui.showNotification( |
631 E5MessageBox.information( |
624 UI.PixmapCache.getPixmap("resourcesCompiler48"), |
632 self, |
625 self.tr("Resource Compilation"), |
633 self.tr("Resource Compilation"), |
626 self.tr( |
634 self.tr( |
627 "The compilation of the resource file failed."), |
635 "The compilation of the resource file failed.")) |
628 timeout=0) |
636 else: |
|
637 ui.showNotification( |
|
638 UI.PixmapCache.getPixmap("resourcesCompiler48"), |
|
639 self.tr("Resource Compilation"), |
|
640 self.tr( |
|
641 "The compilation of the resource file failed.")) |
|
642 self.compileProc = None |
629 self.compileProc = None |
643 |
630 |
644 def __compileQRC(self, fn, noDialog=False, progress=None): |
631 def __compileQRC(self, fn, noDialog=False, progress=None): |
645 """ |
632 """ |
646 Private method to compile a .qrc file to a .py file. |
633 Private method to compile a .qrc file to a .py file. |