eric6/DataViews/PyCoverageDialog.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8207
d359172d11be
equal deleted inserted replaced
8141:27f636beebad 8143:2c730d5fd177
36 36
37 @param parent parent widget (QWidget) 37 @param parent parent widget (QWidget)
38 """ 38 """
39 super(PyCoverageDialog, self).__init__(parent) 39 super(PyCoverageDialog, self).__init__(parent)
40 self.setupUi(self) 40 self.setupUi(self)
41 self.setWindowFlags(Qt.Window) 41 self.setWindowFlags(Qt.WindowType.Window)
42 42
43 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) 43 self.buttonBox.button(
44 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) 44 QDialogButtonBox.StandardButton.Close).setEnabled(False)
45 self.buttonBox.button(
46 QDialogButtonBox.StandardButton.Cancel).setDefault(True)
45 47
46 self.summaryList.headerItem().setText( 48 self.summaryList.headerItem().setText(
47 self.summaryList.columnCount(), "") 49 self.summaryList.columnCount(), "")
48 self.resultList.headerItem().setText(self.resultList.columnCount(), "") 50 self.resultList.headerItem().setText(self.resultList.columnCount(), "")
49 51
63 self.__menu.addAction(self.tr('Annotate all'), self.__annotateAll) 65 self.__menu.addAction(self.tr('Annotate all'), self.__annotateAll)
64 self.__menu.addAction( 66 self.__menu.addAction(
65 self.tr('Delete annotated files'), self.__deleteAnnotated) 67 self.tr('Delete annotated files'), self.__deleteAnnotated)
66 self.__menu.addSeparator() 68 self.__menu.addSeparator()
67 self.__menu.addAction(self.tr('Erase Coverage Info'), self.__erase) 69 self.__menu.addAction(self.tr('Erase Coverage Info'), self.__erase)
68 self.resultList.setContextMenuPolicy(Qt.CustomContextMenu) 70 self.resultList.setContextMenuPolicy(
71 Qt.ContextMenuPolicy.CustomContextMenu)
69 self.resultList.customContextMenuRequested.connect( 72 self.resultList.customContextMenuRequested.connect(
70 self.__showContextMenu) 73 self.__showContextMenu)
71 74
72 def __format_lines(self, lines): 75 def __format_lines(self, lines):
73 """ 76 """
133 "{0:.0f}%".format(coverage), 136 "{0:.0f}%".format(coverage),
134 excluded, 137 excluded,
135 missing 138 missing
136 ]) 139 ])
137 for col in range(1, 4): 140 for col in range(1, 4):
138 itm.setTextAlignment(col, Qt.AlignRight) 141 itm.setTextAlignment(col, Qt.AlignmentFlag.AlignRight)
139 if statements != executed: 142 if statements != executed:
140 font = itm.font(0) 143 font = itm.font(0)
141 font.setBold(True) 144 font.setBold(True)
142 for col in range(itm.columnCount()): 145 for col in range(itm.columnCount()):
143 itm.setFont(col, font) 146 itm.setFont(col, font)
233 str(total_statements), 236 str(total_statements),
234 str(total_executed), 237 str(total_executed),
235 "{0:.0f}%".format(pc) 238 "{0:.0f}%".format(pc)
236 ]) 239 ])
237 for col in range(0, 3): 240 for col in range(0, 3):
238 itm.setTextAlignment(col, Qt.AlignRight) 241 itm.setTextAlignment(col, Qt.AlignmentFlag.AlignRight)
239 else: 242 else:
240 self.summaryGroup.hide() 243 self.summaryGroup.hide()
241 244
242 if total_exceptions: 245 if total_exceptions:
243 E5MessageBox.warning( 246 E5MessageBox.warning(
253 """ 256 """
254 Private slot called when the action finished or the user pressed the 257 Private slot called when the action finished or the user pressed the
255 button. 258 button.
256 """ 259 """
257 self.cancelled = True 260 self.cancelled = True
258 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) 261 self.buttonBox.button(
259 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) 262 QDialogButtonBox.StandardButton.Close).setEnabled(True)
260 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) 263 self.buttonBox.button(
264 QDialogButtonBox.StandardButton.Cancel).setEnabled(False)
265 self.buttonBox.button(
266 QDialogButtonBox.StandardButton.Close).setDefault(True)
261 QApplication.processEvents() 267 QApplication.processEvents()
262 self.resultList.header().resizeSections(QHeaderView.ResizeToContents) 268 self.resultList.header().resizeSections(
269 QHeaderView.ResizeMode.ResizeToContents)
263 self.resultList.header().setStretchLastSection(True) 270 self.resultList.header().setStretchLastSection(True)
264 self.summaryList.header().resizeSections(QHeaderView.ResizeToContents) 271 self.summaryList.header().resizeSections(
272 QHeaderView.ResizeMode.ResizeToContents)
265 self.summaryList.header().setStretchLastSection(True) 273 self.summaryList.header().setStretchLastSection(True)
266 274
267 def on_buttonBox_clicked(self, button): 275 def on_buttonBox_clicked(self, button):
268 """ 276 """
269 Private slot called by a button of the button box clicked. 277 Private slot called by a button of the button box clicked.
270 278
271 @param button button that was clicked (QAbstractButton) 279 @param button button that was clicked (QAbstractButton)
272 """ 280 """
273 if button == self.buttonBox.button(QDialogButtonBox.Close): 281 if button == self.buttonBox.button(
282 QDialogButtonBox.StandardButton.Close
283 ):
274 self.close() 284 self.close()
275 elif button == self.buttonBox.button(QDialogButtonBox.Cancel): 285 elif button == self.buttonBox.button(
286 QDialogButtonBox.StandardButton.Cancel
287 ):
276 self.__finish() 288 self.__finish()
277 289
278 def __showContextMenu(self, coord): 290 def __showContextMenu(self, coord):
279 """ 291 """
280 Private slot to show the context menu of the listview. 292 Private slot to show the context menu of the listview.
398 excludePattern = self.excludeCombo.currentText() 410 excludePattern = self.excludeCombo.currentText()
399 if excludePattern in self.excludeList: 411 if excludePattern in self.excludeList:
400 self.excludeList.remove(excludePattern) 412 self.excludeList.remove(excludePattern)
401 self.excludeList.insert(0, excludePattern) 413 self.excludeList.insert(0, excludePattern)
402 self.cancelled = False 414 self.cancelled = False
403 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) 415 self.buttonBox.button(
404 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) 416 QDialogButtonBox.StandardButton.Close).setEnabled(False)
405 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) 417 self.buttonBox.button(
418 QDialogButtonBox.StandardButton.Cancel).setEnabled(True)
419 self.buttonBox.button(
420 QDialogButtonBox.StandardButton.Cancel).setDefault(True)
406 self.start(self.__cfn, self.__fn) 421 self.start(self.__cfn, self.__fn)
407 422
408 @pyqtSlot(QTreeWidgetItem, int) 423 @pyqtSlot(QTreeWidgetItem, int)
409 def on_resultList_itemActivated(self, item, column): 424 def on_resultList_itemActivated(self, item, column):
410 """ 425 """

eric ide

mercurial