src/eric7/Testing/TestResultsTree.py

branch
eric7
changeset 9500
5771348ded12
parent 9473
3f23dbf37dbe
child 9502
6091145e189e
equal deleted inserted replaced
9499:dd389c57c2f0 9500:5771348ded12
144 return ( 144 return (
145 "" 145 ""
146 if duration is None 146 if duration is None
147 else locale.format_string("%.2f", duration, grouping=True) 147 else locale.format_string("%.2f", duration, grouping=True)
148 ) 148 )
149 elif role == Qt.ItemDataRole.ToolTipRole: 149 elif (
150 if idx == TopLevelId and column == TestResultsModel.NameColumn: 150 role == Qt.ItemDataRole.ToolTipRole
151 return self.__testResults[row].name 151 and idx == TopLevelId
152 elif role == Qt.ItemDataRole.FontRole: 152 and column == TestResultsModel.NameColumn
153 if idx != TopLevelId: 153 ):
154 return Preferences.getEditorOtherFonts("MonospacedFont") 154 return self.__testResults[row].name
155 elif role == Qt.ItemDataRole.BackgroundRole: 155 elif role == Qt.ItemDataRole.FontRole and idx != TopLevelId:
156 if idx == TopLevelId: 156 return Preferences.getEditorOtherFonts("MonospacedFont")
157 testResult = self.__testResults[row] 157 elif role == Qt.ItemDataRole.BackgroundRole and idx == TopLevelId:
158 with contextlib.suppress(KeyError): 158 testResult = self.__testResults[row]
159 return self.__backgroundColors[testResult.category] 159 with contextlib.suppress(KeyError):
160 elif role == Qt.ItemDataRole.TextAlignmentRole: 160 return self.__backgroundColors[testResult.category]
161 if idx == TopLevelId and column == TestResultsModel.DurationColumn: 161 elif (
162 return Qt.AlignmentFlag.AlignRight.value 162 role == Qt.ItemDataRole.TextAlignmentRole
163 elif role == Qt.ItemDataRole.UserRole: # __IGNORE_WARNING_Y102__ 163 and idx == TopLevelId and column == TestResultsModel.DurationColumn
164 if idx == TopLevelId: 164 ):
165 testresult = self.__testResults[row] 165 return Qt.AlignmentFlag.AlignRight.value
166 return (testresult.filename, testresult.lineno) 166 elif role == Qt.ItemDataRole.UserRole and idx == TopLevelId:
167 testresult = self.__testResults[row]
168 return (testresult.filename, testresult.lineno)
167 169
168 return None 170 return None
169 171
170 def headerData(self, section, orientation, role=Qt.ItemDataRole.DisplayRole): 172 def headerData(self, section, orientation, role=Qt.ItemDataRole.DisplayRole):
171 """ 173 """

eric ide

mercurial