--- a/eric6/DataViews/CodeMetricsDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/DataViews/CodeMetricsDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -34,10 +34,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(), "") @@ -52,7 +54,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) @@ -64,7 +67,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): @@ -83,14 +87,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): @@ -101,7 +107,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): """ @@ -113,9 +119,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) @@ -132,9 +141,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() @@ -231,12 +243,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): """ @@ -244,9 +261,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()