eric6/DataViews/CodeMetricsDialog.py

branch
maintenance
changeset 8176
31965986ecd1
parent 8148
f50b338b63cc
parent 8147
99c7da0ab9d2
child 8273
698ae46f40a4
--- a/eric6/DataViews/CodeMetricsDialog.py	Sat Mar 06 10:00:52 2021 +0100
+++ b/eric6/DataViews/CodeMetricsDialog.py	Sun Mar 28 15:00:11 2021 +0200
@@ -35,10 +35,12 @@
         """
         super(CodeMetricsDialog, 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(), "")
@@ -53,7 +55,8 @@
         self.__menu.addAction(self.tr("Collapse All"),
                               self.__resultCollapse)
         self.__menu.addAction(self.tr("Expand All"), self.__resultExpand)
-        self.resultList.setContextMenuPolicy(Qt.CustomContextMenu)
+        self.resultList.setContextMenuPolicy(
+            Qt.ContextMenuPolicy.CustomContextMenu)
         self.resultList.customContextMenuRequested.connect(
             self.__showContextMenu)
         
@@ -65,7 +68,8 @@
         """
         Private method to resize the list columns.
         """
-        self.resultList.header().resizeSections(QHeaderView.ResizeToContents)
+        self.resultList.header().resizeSections(
+            QHeaderView.ResizeMode.ResizeToContents)
         self.resultList.header().setStretchLastSection(True)
         
     def __createResultItem(self, parent, values):
@@ -84,14 +88,16 @@
                 data.append(value)
         itm = QTreeWidgetItem(parent, data)
         for col in range(1, 7):
-            itm.setTextAlignment(col, Qt.Alignment(Qt.AlignRight))
+            itm.setTextAlignment(
+                col, Qt.Alignment(Qt.AlignmentFlag.AlignRight))
         return itm
         
     def __resizeSummaryColumns(self):
         """
         Private method to resize the list columns.
         """
-        self.summaryList.header().resizeSections(QHeaderView.ResizeToContents)
+        self.summaryList.header().resizeSections(
+            QHeaderView.ResizeMode.ResizeToContents)
         self.summaryList.header().setStretchLastSection(True)
         
     def __createSummaryItem(self, col0, col1):
@@ -102,7 +108,7 @@
         @param col1 string for column 1 (string)
         """
         itm = QTreeWidgetItem(self.summaryList, [col0, col1])
-        itm.setTextAlignment(1, Qt.Alignment(Qt.AlignRight))
+        itm.setTextAlignment(1, Qt.Alignment(Qt.AlignmentFlag.AlignRight))
         
     def prepare(self, fileList, project):
         """
@@ -114,9 +120,12 @@
         self.__fileList = fileList[:]
         self.__project = project
         
-        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)
         
         self.filterFrame.setVisible(True)
         
@@ -133,9 +142,12 @@
                 the code metrics for (string or list of strings)
         """
         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)
         QApplication.processEvents()
         
         loc = QLocale()
@@ -232,12 +244,17 @@
         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)
         
-        self.resultList.header().setSectionResizeMode(QHeaderView.Interactive)
-        self.summaryList.header().setSectionResizeMode(QHeaderView.Interactive)
+        self.resultList.header().setSectionResizeMode(
+            QHeaderView.ResizeMode.Interactive)
+        self.summaryList.header().setSectionResizeMode(
+            QHeaderView.ResizeMode.Interactive)
         
     def on_buttonBox_clicked(self, button):
         """
@@ -245,9 +262,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()
         
     @pyqtSlot()

eric ide

mercurial