--- a/src/eric7/CodeFormatting/BlackConfigurationDialog.py Tue Sep 20 11:40:04 2022 +0200 +++ b/src/eric7/CodeFormatting/BlackConfigurationDialog.py Tue Sep 20 17:23:57 2022 +0200 @@ -50,6 +50,7 @@ self.__project = ( ericApp().getObject("Project") if (withProject or onlyProject) else None ) + self.__onlyProject = onlyProject indentTabWidth = ( QFontMetricsF(self.excludeEdit.font()).horizontalAdvance(" ") * 2 @@ -89,6 +90,8 @@ self.__project.getData("OTHERTOOLSPARMS", "Black") ) self.sourceComboBox.addItem(self.tr("Project File"), "project") + elif onlyProject: + self.sourceComboBox.addItem(self.tr("Project File"), "project") if not onlyProject: self.sourceComboBox.addItem(self.tr("Defaults"), "default") self.sourceComboBox.addItem(self.tr("Configuration Below"), "dialog") @@ -98,6 +101,8 @@ if self.__projectData: source = self.__projectData.get("source", "") self.sourceComboBox.setCurrentIndex(self.sourceComboBox.findData(source)) + elif onlyProject: + self.sourceComboBox.setCurrentIndex(self.sourceComboBox.findData("project")) def __populateTargetVersionsList(self): """ @@ -150,7 +155,7 @@ @type str """ self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( - bool(selection) + bool(selection) or self.__onlyProject ) source = self.sourceComboBox.currentData()