6 """ |
6 """ |
7 Module implementing a class used to display the resources part of the project. |
7 Module implementing a class used to display the resources part of the project. |
8 """ |
8 """ |
9 |
9 |
10 import os |
10 import os |
|
11 import contextlib |
11 |
12 |
12 from PyQt5.QtCore import QThread, QFileInfo, pyqtSignal, QProcess |
13 from PyQt5.QtCore import QThread, QFileInfo, pyqtSignal, QProcess |
13 from PyQt5.QtWidgets import QDialog, QApplication, QMenu |
14 from PyQt5.QtWidgets import QDialog, QApplication, QMenu |
14 |
15 |
15 from E5Gui.E5Application import e5App |
16 from E5Gui.E5Application import e5App |
325 @param coord the position of the mouse pointer (QPoint) |
326 @param coord the position of the mouse pointer (QPoint) |
326 """ |
327 """ |
327 if not self.project.isOpen(): |
328 if not self.project.isOpen(): |
328 return |
329 return |
329 |
330 |
330 try: |
331 with contextlib.suppress(Exception): |
331 categories = self.getSelectedItemsCountCategorized( |
332 categories = self.getSelectedItemsCountCategorized( |
332 [ProjectBrowserFileItem, ProjectBrowserSimpleDirectoryItem]) |
333 [ProjectBrowserFileItem, ProjectBrowserSimpleDirectoryItem]) |
333 cnt = categories["sum"] |
334 cnt = categories["sum"] |
334 if cnt <= 1: |
335 if cnt <= 1: |
335 index = self.indexAt(coord) |
336 index = self.indexAt(coord) |
355 self.dirMenu.popup(self.mapToGlobal(coord)) |
356 self.dirMenu.popup(self.mapToGlobal(coord)) |
356 else: |
357 else: |
357 self.backMenu.popup(self.mapToGlobal(coord)) |
358 self.backMenu.popup(self.mapToGlobal(coord)) |
358 else: |
359 else: |
359 self.backMenu.popup(self.mapToGlobal(coord)) |
360 self.backMenu.popup(self.mapToGlobal(coord)) |
360 except Exception: # secok |
|
361 pass |
|
362 |
361 |
363 def __showContextMenu(self): |
362 def __showContextMenu(self): |
364 """ |
363 """ |
365 Private slot called by the menu aboutToShow signal. |
364 Private slot called by the menu aboutToShow signal. |
366 """ |
365 """ |