12 import pathlib |
12 import pathlib |
13 |
13 |
14 from PyQt6.QtCore import QThread, pyqtSignal, QProcess |
14 from PyQt6.QtCore import QThread, pyqtSignal, QProcess |
15 from PyQt6.QtWidgets import QDialog, QApplication, QMenu |
15 from PyQt6.QtWidgets import QDialog, QApplication, QMenu |
16 |
16 |
17 from EricWidgets.EricApplication import ericApp |
17 from eric7.EricWidgets.EricApplication import ericApp |
18 from EricWidgets import EricMessageBox, EricFileDialog |
18 from eric7.EricWidgets import EricMessageBox, EricFileDialog |
19 from EricWidgets.EricProgressDialog import EricProgressDialog |
19 from eric7.EricWidgets.EricProgressDialog import EricProgressDialog |
20 |
20 |
21 from .ProjectBrowserModel import ( |
21 from .ProjectBrowserModel import ( |
22 ProjectBrowserFileItem, |
22 ProjectBrowserFileItem, |
23 ProjectBrowserSimpleDirectoryItem, |
23 ProjectBrowserSimpleDirectoryItem, |
24 ProjectBrowserDirectoryItem, |
24 ProjectBrowserDirectoryItem, |
25 ProjectBrowserResourceType, |
25 ProjectBrowserResourceType, |
26 ) |
26 ) |
27 from .ProjectBaseBrowser import ProjectBaseBrowser |
27 from .ProjectBaseBrowser import ProjectBaseBrowser |
28 |
28 |
29 import UI.PixmapCache |
29 from eric7.EricGui import EricPixmapCache |
30 from UI.NotificationWidget import NotificationTypes |
30 from eric7.UI.NotificationWidget import NotificationTypes |
31 |
31 |
32 import Preferences |
32 from eric7 import Preferences, Utilities |
33 import Utilities |
|
34 |
33 |
35 |
34 |
36 class ProjectResourcesBrowser(ProjectBaseBrowser): |
35 class ProjectResourcesBrowser(ProjectBaseBrowser): |
37 """ |
36 """ |
38 A class used to display the resources part of the project. |
37 A class used to display the resources part of the project. |
556 fn2 = itm.fileName() |
555 fn2 = itm.fileName() |
557 fullNames.append(fn2) |
556 fullNames.append(fn2) |
558 fn = self.project.getRelativePath(fn2) |
557 fn = self.project.getRelativePath(fn2) |
559 files.append(fn) |
558 files.append(fn) |
560 |
559 |
561 from UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog |
560 from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog |
562 |
561 |
563 dlg = DeleteFilesConfirmationDialog( |
562 dlg = DeleteFilesConfirmationDialog( |
564 self.parent(), |
563 self.parent(), |
565 self.tr("Delete resources"), |
564 self.tr("Delete resources"), |
566 self.tr( |
565 self.tr( |
631 for line in self.buf.splitlines(): |
630 for line in self.buf.splitlines(): |
632 f.write(line + "\n") |
631 f.write(line + "\n") |
633 if self.compiledFile not in self.project.pdata["SOURCES"]: |
632 if self.compiledFile not in self.project.pdata["SOURCES"]: |
634 self.project.appendFile(ofn) |
633 self.project.appendFile(ofn) |
635 ui.showNotification( |
634 ui.showNotification( |
636 UI.PixmapCache.getPixmap("resourcesCompiler48"), |
635 EricPixmapCache.getPixmap("resourcesCompiler48"), |
637 self.tr("Resource Compilation"), |
636 self.tr("Resource Compilation"), |
638 self.tr("The compilation of the resource file" " was successful."), |
637 self.tr("The compilation of the resource file" " was successful."), |
639 ) |
638 ) |
640 except OSError as msg: |
639 except OSError as msg: |
641 if not self.noDialog: |
640 if not self.noDialog: |
647 " failed.</p><p>Reason: {0}</p>" |
646 " failed.</p><p>Reason: {0}</p>" |
648 ).format(str(msg)), |
647 ).format(str(msg)), |
649 ) |
648 ) |
650 else: |
649 else: |
651 ui.showNotification( |
650 ui.showNotification( |
652 UI.PixmapCache.getPixmap("resourcesCompiler48"), |
651 EricPixmapCache.getPixmap("resourcesCompiler48"), |
653 self.tr("Resource Compilation"), |
652 self.tr("Resource Compilation"), |
654 self.tr("The compilation of the resource file failed."), |
653 self.tr("The compilation of the resource file failed."), |
655 kind=NotificationTypes.CRITICAL, |
654 kind=NotificationTypes.CRITICAL, |
656 timeout=0, |
655 timeout=0, |
657 ) |
656 ) |