--- a/src/eric7/CodeFormatting/BlackConfigurationDialog.py Mon Sep 19 16:44:08 2022 +0200 +++ b/src/eric7/CodeFormatting/BlackConfigurationDialog.py Mon Sep 19 19:44:38 2022 +0200 @@ -31,20 +31,25 @@ Class implementing a dialog to enter the parameters for a Black formatting run. """ - def __init__(self, withProject=True, parent=None): + def __init__(self, withProject=True, onlyProject=False, parent=None): """ Constructor @param withProject flag indicating to look for project configurations (defaults to True) - @type bool + @type bool (optional) + @param onlyProject flag indicating to only look for project configurations + (defaults to False) + @type bool (optional) @param parent reference to the parent widget (defaults to None) @type QWidget (optional) """ super().__init__(parent) self.setupUi(self) - self.__project = ericApp().getObject("Project") if withProject else None + self.__project = ( + ericApp().getObject("Project") if (withProject or onlyProject) else None + ) indentTabWidth = ( QFontMetricsF(self.excludeEdit.font()).horizontalAdvance(" ") * 2 @@ -84,8 +89,9 @@ self.__project.getData("OTHERTOOLSPARMS", "Black") ) self.sourceComboBox.addItem(self.tr("Project File"), "project") - self.sourceComboBox.addItem(self.tr("Defaults"), "default") - self.sourceComboBox.addItem(self.tr("Configuration Below"), "dialog") + if not onlyProject: + self.sourceComboBox.addItem(self.tr("Defaults"), "default") + self.sourceComboBox.addItem(self.tr("Configuration Below"), "dialog") self.__populateTargetVersionsList()