diff -r e9e7eca7efee -r bf71ee032bb4 src/eric7/VirtualEnv/VirtualenvInterpreterSelectionDialog.py --- a/src/eric7/VirtualEnv/VirtualenvInterpreterSelectionDialog.py Wed Jul 13 11:16:20 2022 +0200 +++ b/src/eric7/VirtualEnv/VirtualenvInterpreterSelectionDialog.py Wed Jul 13 14:55:47 2022 +0200 @@ -17,22 +17,24 @@ from EricWidgets.EricPathPicker import EricPathPickerModes from .Ui_VirtualenvInterpreterSelectionDialog import ( - Ui_VirtualenvInterpreterSelectionDialog + Ui_VirtualenvInterpreterSelectionDialog, ) import Globals class VirtualenvInterpreterSelectionDialog( - QDialog, Ui_VirtualenvInterpreterSelectionDialog): + QDialog, Ui_VirtualenvInterpreterSelectionDialog +): """ Class implementing a dialog to enter the interpreter for a virtual environment. """ + def __init__(self, venvName, venvDirectory, parent=None): """ Constructor - + @param venvName name for the virtual environment @type str @param venvDirectory directory of the virtual environment @@ -42,13 +44,12 @@ """ super().__init__(parent) self.setupUi(self) - + self.pythonExecPicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) - self.pythonExecPicker.setWindowTitle( - self.tr("Python Interpreter")) - + self.pythonExecPicker.setWindowTitle(self.tr("Python Interpreter")) + self.nameEdit.setText(venvName) - + if venvDirectory: # try to determine a Python interpreter name if Globals.isWindowsPlatform(): @@ -56,39 +57,37 @@ os.path.join(venvDirectory, "Scripts", "python*.exe") ) + glob.glob(os.path.join(venvDirectory, "python*.exe")) else: - candidates = glob.glob( - os.path.join(venvDirectory, "bin", "python*") - ) + candidates = glob.glob(os.path.join(venvDirectory, "bin", "python*")) self.pythonExecPicker.addItems(sorted(candidates)) self.pythonExecPicker.setText("") else: self.pythonExecPicker.setText(venvDirectory) - + def __updateOK(self): """ Private method to update the enabled status of the OK button. """ interpreterPath = self.pythonExecPicker.text() self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( - bool(interpreterPath) and - os.path.isfile(interpreterPath) and - os.access(interpreterPath, os.X_OK) + bool(interpreterPath) + and os.path.isfile(interpreterPath) + and os.access(interpreterPath, os.X_OK) ) - + @pyqtSlot(str) def on_pythonExecPicker_textChanged(self, txt): """ Private slot to handle changes of the entered Python interpreter path. - + @param txt entered Python interpreter path @type str """ self.__updateOK() - + def getData(self): """ Public method to get the entered data. - + @return path of the selected Python interpreter @rtype str """