8242:aa713ac50c0d | 8243:cc717c2ae956 |
---|---|
6 """ | 6 """ |
7 Module implementing a model for search engines. | 7 Module implementing a model for search engines. |
8 """ | 8 """ |
9 | 9 |
10 import re | 10 import re |
11 import contextlib | |
11 | 12 |
12 from PyQt5.QtCore import Qt, QUrl, QAbstractTableModel, QModelIndex | 13 from PyQt5.QtCore import Qt, QUrl, QAbstractTableModel, QModelIndex |
13 from PyQt5.QtGui import QPixmap, QIcon | 14 from PyQt5.QtGui import QPixmap, QIcon |
14 | 15 |
15 | 16 |
197 """ | 198 """ |
198 if ( | 199 if ( |
199 orientation == Qt.Orientation.Horizontal and | 200 orientation == Qt.Orientation.Horizontal and |
200 role == Qt.ItemDataRole.DisplayRole | 201 role == Qt.ItemDataRole.DisplayRole |
201 ): | 202 ): |
202 try: | 203 with contextlib.suppress(IndexError): |
203 return self.__headers[section] | 204 return self.__headers[section] |
204 except IndexError: | |
205 pass | |
206 | 205 |
207 return None | 206 return None |
208 | 207 |
209 def __enginesChanged(self): | 208 def __enginesChanged(self): |
210 """ | 209 """ |