eric6/DataViews/PyCoverageDialog.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8207
d359172d11be
diff -r 27f636beebad -r 2c730d5fd177 eric6/DataViews/PyCoverageDialog.py
--- a/eric6/DataViews/PyCoverageDialog.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/DataViews/PyCoverageDialog.py	Tue Mar 02 17:17:09 2021 +0100
@@ -38,10 +38,12 @@
         """
         super(PyCoverageDialog, self).__init__(parent)
         self.setupUi(self)
-        self.setWindowFlags(Qt.Window)
+        self.setWindowFlags(Qt.WindowType.Window)
         
-        self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
-        self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close).setEnabled(False)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Cancel).setDefault(True)
         
         self.summaryList.headerItem().setText(
             self.summaryList.columnCount(), "")
@@ -65,7 +67,8 @@
             self.tr('Delete annotated files'), self.__deleteAnnotated)
         self.__menu.addSeparator()
         self.__menu.addAction(self.tr('Erase Coverage Info'), self.__erase)
-        self.resultList.setContextMenuPolicy(Qt.CustomContextMenu)
+        self.resultList.setContextMenuPolicy(
+            Qt.ContextMenuPolicy.CustomContextMenu)
         self.resultList.customContextMenuRequested.connect(
             self.__showContextMenu)
     
@@ -135,7 +138,7 @@
             missing
         ])
         for col in range(1, 4):
-            itm.setTextAlignment(col, Qt.AlignRight)
+            itm.setTextAlignment(col, Qt.AlignmentFlag.AlignRight)
         if statements != executed:
             font = itm.font(0)
             font.setBold(True)
@@ -235,7 +238,7 @@
                 "{0:.0f}%".format(pc)
             ])
             for col in range(0, 3):
-                itm.setTextAlignment(col, Qt.AlignRight)
+                itm.setTextAlignment(col, Qt.AlignmentFlag.AlignRight)
         else:
             self.summaryGroup.hide()
         
@@ -255,13 +258,18 @@
         button.
         """
         self.cancelled = True
-        self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True)
-        self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False)
-        self.buttonBox.button(QDialogButtonBox.Close).setDefault(True)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close).setEnabled(True)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Cancel).setEnabled(False)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close).setDefault(True)
         QApplication.processEvents()
-        self.resultList.header().resizeSections(QHeaderView.ResizeToContents)
+        self.resultList.header().resizeSections(
+            QHeaderView.ResizeMode.ResizeToContents)
         self.resultList.header().setStretchLastSection(True)
-        self.summaryList.header().resizeSections(QHeaderView.ResizeToContents)
+        self.summaryList.header().resizeSections(
+            QHeaderView.ResizeMode.ResizeToContents)
         self.summaryList.header().setStretchLastSection(True)
         
     def on_buttonBox_clicked(self, button):
@@ -270,9 +278,13 @@
         
         @param button button that was clicked (QAbstractButton)
         """
-        if button == self.buttonBox.button(QDialogButtonBox.Close):
+        if button == self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close
+        ):
             self.close()
-        elif button == self.buttonBox.button(QDialogButtonBox.Cancel):
+        elif button == self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Cancel
+        ):
             self.__finish()
         
     def __showContextMenu(self, coord):
@@ -400,9 +412,12 @@
             self.excludeList.remove(excludePattern)
         self.excludeList.insert(0, excludePattern)
         self.cancelled = False
-        self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
-        self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True)
-        self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close).setEnabled(False)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Cancel).setEnabled(True)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Cancel).setDefault(True)
         self.start(self.__cfn, self.__fn)
     
     @pyqtSlot(QTreeWidgetItem, int)

eric ide

mercurial