13 import contextlib |
13 import contextlib |
14 |
14 |
15 from PyQt6.QtCore import QThread, pyqtSignal, QProcess |
15 from PyQt6.QtCore import QThread, pyqtSignal, QProcess |
16 from PyQt6.QtWidgets import QDialog, QApplication, QMenu |
16 from PyQt6.QtWidgets import QDialog, QApplication, QMenu |
17 |
17 |
18 from EricWidgets.EricApplication import ericApp |
18 from eric7.EricWidgets.EricApplication import ericApp |
19 from EricWidgets import EricMessageBox |
19 from eric7.EricWidgets import EricMessageBox |
20 from EricWidgets.EricProgressDialog import EricProgressDialog |
20 from eric7.EricWidgets.EricProgressDialog import EricProgressDialog |
21 |
21 |
22 from .ProjectBrowserModel import ( |
22 from .ProjectBrowserModel import ( |
23 ProjectBrowserFileItem, |
23 ProjectBrowserFileItem, |
24 ProjectBrowserSimpleDirectoryItem, |
24 ProjectBrowserSimpleDirectoryItem, |
25 ProjectBrowserDirectoryItem, |
25 ProjectBrowserDirectoryItem, |
26 ProjectBrowserProtocolsType, |
26 ProjectBrowserProtocolsType, |
27 ) |
27 ) |
28 from .ProjectBaseBrowser import ProjectBaseBrowser |
28 from .ProjectBaseBrowser import ProjectBaseBrowser |
29 |
29 |
30 from UI.BrowserModel import ( |
30 from eric7.UI.BrowserModel import ( |
31 BrowserFileItem, |
31 BrowserFileItem, |
32 BrowserClassItem, |
32 BrowserClassItem, |
33 BrowserMethodItem, |
33 BrowserMethodItem, |
34 BrowserClassAttributeItem, |
34 BrowserClassAttributeItem, |
35 ) |
35 ) |
36 import UI.PixmapCache |
36 from eric7.EricGui import EricPixmapCache |
37 from UI.NotificationWidget import NotificationTypes |
37 from eric7.UI.NotificationWidget import NotificationTypes |
38 |
38 |
39 import Globals |
39 from eric7 import Globals, Preferences, Utilities |
40 import Preferences |
|
41 import Utilities |
|
42 |
40 |
43 |
41 |
44 class ProjectProtocolsBrowser(ProjectBaseBrowser): |
42 class ProjectProtocolsBrowser(ProjectBaseBrowser): |
45 """ |
43 """ |
46 A class used to display the protocols (protobuf) part of the project. |
44 A class used to display the protocols (protobuf) part of the project. |
464 fn2 = itm.fileName() |
462 fn2 = itm.fileName() |
465 fullNames.append(fn2) |
463 fullNames.append(fn2) |
466 fn = self.project.getRelativePath(fn2) |
464 fn = self.project.getRelativePath(fn2) |
467 files.append(fn) |
465 files.append(fn) |
468 |
466 |
469 from UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog |
467 from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog |
470 |
468 |
471 dlg = DeleteFilesConfirmationDialog( |
469 dlg = DeleteFilesConfirmationDialog( |
472 self.parent(), |
470 self.parent(), |
473 self.tr("Delete Protocols"), |
471 self.tr("Delete Protocols"), |
474 self.tr( |
472 self.tr( |
565 if grpc: |
563 if grpc: |
566 fileList += glob.glob(os.path.join(path, "*_pb2_grpc.py")) |
564 fileList += glob.glob(os.path.join(path, "*_pb2_grpc.py")) |
567 for file in fileList: |
565 for file in fileList: |
568 self.project.appendFile(file) |
566 self.project.appendFile(file) |
569 if grpc: |
567 if grpc: |
570 icon = UI.PixmapCache.getPixmap("gRPC48") |
568 icon = EricPixmapCache.getPixmap("gRPC48") |
571 else: |
569 else: |
572 icon = UI.PixmapCache.getPixmap("protobuf48") |
570 icon = EricPixmapCache.getPixmap("protobuf48") |
573 ui.showNotification( |
571 ui.showNotification( |
574 icon, |
572 icon, |
575 self.tr("Protocol Compilation"), |
573 self.tr("Protocol Compilation"), |
576 self.tr("The compilation of the protocol file was" " successful."), |
574 self.tr("The compilation of the protocol file was" " successful."), |
577 ) |
575 ) |
578 else: |
576 else: |
579 if grpc: |
577 if grpc: |
580 icon = UI.PixmapCache.getPixmap("gRPC48") |
578 icon = EricPixmapCache.getPixmap("gRPC48") |
581 else: |
579 else: |
582 icon = UI.PixmapCache.getPixmap("protobuf48") |
580 icon = EricPixmapCache.getPixmap("protobuf48") |
583 ui.showNotification( |
581 ui.showNotification( |
584 icon, |
582 icon, |
585 self.tr("Protocol Compilation"), |
583 self.tr("Protocol Compilation"), |
586 self.tr("The compilation of the protocol file failed."), |
584 self.tr("The compilation of the protocol file failed."), |
587 kind=NotificationTypes.CRITICAL, |
585 kind=NotificationTypes.CRITICAL, |