5 |
5 |
6 """ |
6 """ |
7 Module implementing a class used to display the parts of the project, that |
7 Module implementing a class used to display the parts of the project, that |
8 don't fit the other categories. |
8 don't fit the other categories. |
9 """ |
9 """ |
|
10 |
|
11 import contextlib |
10 |
12 |
11 from PyQt5.QtCore import QModelIndex, pyqtSignal, QUrl |
13 from PyQt5.QtCore import QModelIndex, pyqtSignal, QUrl |
12 from PyQt5.QtGui import QDesktopServices |
14 from PyQt5.QtGui import QDesktopServices |
13 from PyQt5.QtWidgets import QDialog, QMenu |
15 from PyQt5.QtWidgets import QDialog, QMenu |
14 |
16 |
142 @param coord the position of the mouse pointer (QPoint) |
144 @param coord the position of the mouse pointer (QPoint) |
143 """ |
145 """ |
144 if not self.project.isOpen(): |
146 if not self.project.isOpen(): |
145 return |
147 return |
146 |
148 |
147 try: |
149 with contextlib.suppress(Exception): |
148 cnt = self.getSelectedItemsCount() |
150 cnt = self.getSelectedItemsCount() |
149 if cnt <= 1: |
151 if cnt <= 1: |
150 index = self.indexAt(coord) |
152 index = self.indexAt(coord) |
151 if index.isValid(): |
153 if index.isValid(): |
152 self._selectSingleItem(index) |
154 self._selectSingleItem(index) |
168 self.menu.popup(self.mapToGlobal(coord)) |
170 self.menu.popup(self.mapToGlobal(coord)) |
169 else: |
171 else: |
170 self.backMenu.popup(self.mapToGlobal(coord)) |
172 self.backMenu.popup(self.mapToGlobal(coord)) |
171 else: |
173 else: |
172 self.backMenu.popup(self.mapToGlobal(coord)) |
174 self.backMenu.popup(self.mapToGlobal(coord)) |
173 except Exception: # secok |
|
174 pass |
|
175 |
175 |
176 def __showContextMenu(self): |
176 def __showContextMenu(self): |
177 """ |
177 """ |
178 Private slot called by the menu aboutToShow signal. |
178 Private slot called by the menu aboutToShow signal. |
179 """ |
179 """ |