6 """ |
6 """ |
7 Module implementing a class used to display the Sources part of the project. |
7 Module implementing a class used to display the Sources part of the project. |
8 """ |
8 """ |
9 |
9 |
10 import os |
10 import os |
|
11 import contextlib |
11 |
12 |
12 from PyQt5.QtCore import pyqtSignal |
13 from PyQt5.QtCore import pyqtSignal |
13 from PyQt5.QtWidgets import QDialog, QInputDialog, QMenu |
14 from PyQt5.QtWidgets import QDialog, QInputDialog, QMenu |
14 |
15 |
15 from E5Gui import E5MessageBox |
16 from E5Gui import E5MessageBox |
578 @param coord the position of the mouse pointer (QPoint) |
579 @param coord the position of the mouse pointer (QPoint) |
579 """ |
580 """ |
580 if not self.project.isOpen(): |
581 if not self.project.isOpen(): |
581 return |
582 return |
582 |
583 |
583 try: |
584 with contextlib.suppress(Exception): |
584 categories = self.getSelectedItemsCountCategorized( |
585 categories = self.getSelectedItemsCountCategorized( |
585 [ProjectBrowserFileItem, BrowserClassItem, |
586 [ProjectBrowserFileItem, BrowserClassItem, |
586 BrowserMethodItem, ProjectBrowserSimpleDirectoryItem, |
587 BrowserMethodItem, ProjectBrowserSimpleDirectoryItem, |
587 BrowserClassAttributeItem, BrowserImportItem]) |
588 BrowserClassAttributeItem, BrowserImportItem]) |
588 cnt = categories["sum"] |
589 cnt = categories["sum"] |
667 self.dirMenu.popup(self.mapToGlobal(coord)) |
668 self.dirMenu.popup(self.mapToGlobal(coord)) |
668 else: |
669 else: |
669 self.backMenu.popup(self.mapToGlobal(coord)) |
670 self.backMenu.popup(self.mapToGlobal(coord)) |
670 else: |
671 else: |
671 self.backMenu.popup(self.mapToGlobal(coord)) |
672 self.backMenu.popup(self.mapToGlobal(coord)) |
672 except Exception: # secok |
|
673 pass |
|
674 |
673 |
675 def __showContextMenu(self): |
674 def __showContextMenu(self): |
676 """ |
675 """ |
677 Private slot called by the sourceMenu aboutToShow signal. |
676 Private slot called by the sourceMenu aboutToShow signal. |
678 """ |
677 """ |