76 self.dirMenuActions = [] |
77 self.dirMenuActions = [] |
77 self.dirMultiMenuActions = [] |
78 self.dirMultiMenuActions = [] |
78 |
79 |
79 self.menu = QMenu(self) |
80 self.menu = QMenu(self) |
80 if self.project.getProjectType() in [ |
81 if self.project.getProjectType() in [ |
81 "PyQt5", "PyQt5C", "E6Plugin", "PySide2", "PySide2C" |
82 "PyQt5", "PyQt5C", "E6Plugin", |
|
83 "PySide2", "PySide2C", "PySide6", "PySide6C" |
82 ]: |
84 ]: |
83 self.menu.addAction( |
85 self.menu.addAction( |
84 self.tr('Compile resource'), |
86 self.tr('Compile resource'), |
85 self.__compileResource) |
87 self.__compileResource) |
86 self.menu.addAction( |
88 self.menu.addAction( |
118 self.menuActions.append(act) |
120 self.menuActions.append(act) |
119 act = self.menu.addAction(self.tr('Delete'), self.__deleteFile) |
121 act = self.menu.addAction(self.tr('Delete'), self.__deleteFile) |
120 self.menuActions.append(act) |
122 self.menuActions.append(act) |
121 self.menu.addSeparator() |
123 self.menu.addSeparator() |
122 if self.project.getProjectType() in [ |
124 if self.project.getProjectType() in [ |
123 "PyQt5", "PyQt5C", "E6Plugin", "PySide2", "PySide2C" |
125 "PyQt5", "PyQt5C", "E6Plugin", |
|
126 "PySide2", "PySide2C", "PySide6", "PySide6C" |
124 ]: |
127 ]: |
125 self.menu.addAction( |
128 self.menu.addAction( |
126 self.tr('New resource...'), self.__newResource) |
129 self.tr('New resource...'), self.__newResource) |
127 else: |
130 else: |
128 if self.hooks["newResource"] is not None: |
131 if self.hooks["newResource"] is not None: |
146 self.menu.addSeparator() |
149 self.menu.addSeparator() |
147 self.menu.addAction(self.tr('Configure...'), self._configure) |
150 self.menu.addAction(self.tr('Configure...'), self._configure) |
148 |
151 |
149 self.backMenu = QMenu(self) |
152 self.backMenu = QMenu(self) |
150 if self.project.getProjectType() in [ |
153 if self.project.getProjectType() in [ |
151 "PyQt5", "PyQt5C", "E6Plugin", "PySide2", "PySide2C" |
154 "PyQt5", "PyQt5C", "E6Plugin", |
|
155 "PySide2", "PySide2C", "PySide6", "PySide6C" |
152 ]: |
156 ]: |
153 self.backMenu.addAction( |
157 self.backMenu.addAction( |
154 self.tr('Compile all resources'), |
158 self.tr('Compile all resources'), |
155 self.__compileAllResources) |
159 self.__compileAllResources) |
156 self.backMenu.addSeparator() |
160 self.backMenu.addSeparator() |
188 self.backMenu.setEnabled(False) |
192 self.backMenu.setEnabled(False) |
189 |
193 |
190 # create the menu for multiple selected files |
194 # create the menu for multiple selected files |
191 self.multiMenu = QMenu(self) |
195 self.multiMenu = QMenu(self) |
192 if self.project.getProjectType() in [ |
196 if self.project.getProjectType() in [ |
193 "PyQt5", "PyQt5C", "E6Plugin", "PySide2", "PySide2C" |
197 "PyQt5", "PyQt5C", "E6Plugin", |
|
198 "PySide2", "PySide2C", "PySide6", "PySide6C" |
194 ]: |
199 ]: |
195 act = self.multiMenu.addAction( |
200 act = self.multiMenu.addAction( |
196 self.tr('Compile resources'), |
201 self.tr('Compile resources'), |
197 self.__compileSelectedResources) |
202 self.__compileSelectedResources) |
198 self.multiMenu.addSeparator() |
203 self.multiMenu.addSeparator() |
224 self.multiMenu.addSeparator() |
229 self.multiMenu.addSeparator() |
225 self.multiMenu.addAction(self.tr('Configure...'), self._configure) |
230 self.multiMenu.addAction(self.tr('Configure...'), self._configure) |
226 |
231 |
227 self.dirMenu = QMenu(self) |
232 self.dirMenu = QMenu(self) |
228 if self.project.getProjectType() in [ |
233 if self.project.getProjectType() in [ |
229 "PyQt5", "PyQt5C", "E6Plugin", "PySide2", "PySide2C" |
234 "PyQt5", "PyQt5C", "E6Plugin", |
|
235 "PySide2", "PySide2C", "PySide6", "PySide6C" |
230 ]: |
236 ]: |
231 self.dirMenu.addAction( |
237 self.dirMenu.addAction( |
232 self.tr('Compile all resources'), |
238 self.tr('Compile all resources'), |
233 self.__compileAllResources) |
239 self.__compileAllResources) |
234 self.dirMenu.addSeparator() |
240 self.dirMenu.addSeparator() |
269 self.dirMenu.addSeparator() |
275 self.dirMenu.addSeparator() |
270 self.dirMenu.addAction(self.tr('Configure...'), self._configure) |
276 self.dirMenu.addAction(self.tr('Configure...'), self._configure) |
271 |
277 |
272 self.dirMultiMenu = QMenu(self) |
278 self.dirMultiMenu = QMenu(self) |
273 if self.project.getProjectType() in [ |
279 if self.project.getProjectType() in [ |
274 "PyQt5", "PyQt5C", "E6Plugin", "PySide2", "PySide2C" |
280 "PyQt5", "PyQt5C", "E6Plugin", |
|
281 "PySide2", "PySide2C", "PySide6", "PySide6C" |
275 ]: |
282 ]: |
276 self.dirMultiMenu.addAction( |
283 self.dirMultiMenu.addAction( |
277 self.tr('Compile all resources'), |
284 self.tr('Compile all resources'), |
278 self.__compileAllResources) |
285 self.__compileAllResources) |
279 self.dirMultiMenu.addSeparator() |
286 self.dirMultiMenu.addSeparator() |
547 ########################################################################### |
554 ########################################################################### |
548 |
555 |
549 def __readStdout(self): |
556 def __readStdout(self): |
550 """ |
557 """ |
551 Private slot to handle the readyReadStandardOutput signal of the |
558 Private slot to handle the readyReadStandardOutput signal of the |
552 pyrcc5/pyside2-rcc process. |
559 pyrcc5/pyside2-rcc/pyside6-rcc process. |
553 """ |
560 """ |
554 if self.compileProc is None: |
561 if self.compileProc is None: |
555 return |
562 return |
556 self.compileProc.setReadChannel(QProcess.StandardOutput) |
563 self.compileProc.setReadChannel(QProcess.StandardOutput) |
557 |
564 |
598 with open(ofn, "w", encoding="utf-8", newline=newline) as f: |
605 with open(ofn, "w", encoding="utf-8", newline=newline) as f: |
599 for line in self.buf.splitlines(): |
606 for line in self.buf.splitlines(): |
600 f.write(line + "\n") |
607 f.write(line + "\n") |
601 if self.compiledFile not in self.project.pdata["SOURCES"]: |
608 if self.compiledFile not in self.project.pdata["SOURCES"]: |
602 self.project.appendFile(ofn) |
609 self.project.appendFile(ofn) |
603 if not self.noDialog and not ui.notificationsEnabled(): |
610 ui.showNotification( |
604 E5MessageBox.information( |
611 UI.PixmapCache.getPixmap("resourcesCompiler48"), |
605 self, |
612 self.tr("Resource Compilation"), |
606 self.tr("Resource Compilation"), |
613 self.tr("The compilation of the resource file" |
607 self.tr("The compilation of the resource file" |
614 " was successful.")) |
608 " was successful.")) |
|
609 else: |
|
610 ui.showNotification( |
|
611 UI.PixmapCache.getPixmap("resourcesCompiler48"), |
|
612 self.tr("Resource Compilation"), |
|
613 self.tr("The compilation of the resource file" |
|
614 " was successful.")) |
|
615 except OSError as msg: |
615 except OSError as msg: |
616 if not self.noDialog: |
616 if not self.noDialog: |
617 E5MessageBox.information( |
617 E5MessageBox.information( |
618 self, |
618 self, |
619 self.tr("Resource Compilation"), |
619 self.tr("Resource Compilation"), |
620 self.tr( |
620 self.tr( |
621 "<p>The compilation of the resource file" |
621 "<p>The compilation of the resource file" |
622 " failed.</p><p>Reason: {0}</p>").format(str(msg))) |
622 " failed.</p><p>Reason: {0}</p>").format(str(msg))) |
623 else: |
623 else: |
624 if not self.noDialog: |
624 ui.showNotification( |
625 E5MessageBox.information( |
625 UI.PixmapCache.getPixmap("resourcesCompiler48"), |
626 self, |
626 self.tr("Resource Compilation"), |
627 self.tr("Resource Compilation"), |
627 self.tr( |
628 self.tr( |
628 "The compilation of the resource file failed."), |
629 "The compilation of the resource file failed.")) |
629 kind=NotificationTypes.Critical, |
630 else: |
630 timeout=0) |
631 ui.showNotification( |
|
632 UI.PixmapCache.getPixmap("resourcesCompiler48"), |
|
633 self.tr("Resource Compilation"), |
|
634 self.tr( |
|
635 "The compilation of the resource file failed.")) |
|
636 self.compileProc = None |
631 self.compileProc = None |
637 |
632 |
638 def __compileQRC(self, fn, noDialog=False, progress=None): |
633 def __compileQRC(self, fn, noDialog=False, progress=None): |
639 """ |
634 """ |
640 Private method to compile a .qrc file to a .py file. |
635 Private method to compile a .qrc file to a .py file. |
653 self.rccCompiler = Utilities.generatePyQtToolPath('pyrcc5') |
648 self.rccCompiler = Utilities.generatePyQtToolPath('pyrcc5') |
654 elif self.project.getProjectType() in ["E6Plugin"]: |
649 elif self.project.getProjectType() in ["E6Plugin"]: |
655 self.rccCompiler = Utilities.generatePyQtToolPath('pyrcc5') |
650 self.rccCompiler = Utilities.generatePyQtToolPath('pyrcc5') |
656 elif self.project.getProjectType() in ["PySide2", "PySide2C"]: |
651 elif self.project.getProjectType() in ["PySide2", "PySide2C"]: |
657 self.rccCompiler = Utilities.generatePySideToolPath( |
652 self.rccCompiler = Utilities.generatePySideToolPath( |
658 'pyside2-rcc') |
653 'pyside2-rcc', variant=2) |
|
654 elif self.project.getProjectType() in ["PySide6", "PySide6C"]: |
|
655 self.rccCompiler = Utilities.generatePySideToolPath( |
|
656 'pyside6-rcc', variant=6) |
659 else: |
657 else: |
660 return None |
658 return None |
661 defaultParameters = self.project.getDefaultRccCompilerParameters() |
659 defaultParameters = self.project.getDefaultRccCompilerParameters() |
662 rccParameters = self.project.pdata["RCCPARAMS"] |
660 rccParameters = self.project.pdata["RCCPARAMS"] |
663 if ( |
661 if ( |