eric6/WebBrowser/Passwords/PasswordModel.py

changeset 8243
cc717c2ae956
parent 8218
7c09585bd960
equal deleted inserted replaced
8242:aa713ac50c0d 8243:cc717c2ae956
4 # 4 #
5 5
6 """ 6 """
7 Module implementing a model for password management. 7 Module implementing a model for password management.
8 """ 8 """
9
10 import contextlib
9 11
10 from PyQt5.QtCore import Qt, QModelIndex, QAbstractTableModel 12 from PyQt5.QtCore import Qt, QModelIndex, QAbstractTableModel
11 13
12 14
13 class PasswordModel(QAbstractTableModel): 15 class PasswordModel(QAbstractTableModel):
151 """ 153 """
152 if ( 154 if (
153 orientation == Qt.Orientation.Horizontal and 155 orientation == Qt.Orientation.Horizontal and
154 role == Qt.ItemDataRole.DisplayRole 156 role == Qt.ItemDataRole.DisplayRole
155 ): 157 ):
156 try: 158 with contextlib.suppress(IndexError):
157 return self.__headers[section] 159 return self.__headers[section]
158 except IndexError:
159 pass
160 160
161 return None 161 return None

eric ide

mercurial