src/eric7/Project/ProjectVenvCreationParametersDialog.py

branch
eric7
changeset 9389
7b2344009d7a
child 9413
80c06d472826
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/eric7/Project/ProjectVenvCreationParametersDialog.py	Thu Oct 06 16:22:35 2022 +0200
@@ -0,0 +1,60 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2022 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+"""
+Module implementing a dialog to enter the parameters for the creation of the embedded
+virtual environment.
+"""
+
+from PyQt6.QtWidgets import QDialog
+
+from EricWidgets.EricPathPicker import EricPathPickerModes
+
+from .Ui_ProjectVenvCreationParametersDialog import (
+    Ui_ProjectVenvCreationParametersDialog,
+)
+
+import Globals
+
+
+class ProjectVenvCreationParametersDialog(
+    QDialog, Ui_ProjectVenvCreationParametersDialog
+):
+    """
+    Class implementing a dialog to enter the parameters for the creation of the embedded
+    virtual environment.
+    """
+
+    def __init__(self, withSystemSitePackages=False, parent=None):
+        """
+        Constructor
+
+        @param withSystemSitePackages flag indicating to access the system site-packages
+            (defaults to False)
+        @type bool
+        @param parent reference to the parent widget (defaults to None)
+        @type QWidget (optional)
+        """
+        super().__init__(parent)
+        self.setupUi(self)
+
+        self.pythonExecPicker.setMode(EricPathPickerModes.OPEN_FILE_MODE)
+        self.pythonExecPicker.setWindowTitle(self.tr("Python Interpreter"))
+        self.pythonExecPicker.setDefaultDirectory(Globals.getPythonExecutable())
+
+        self.systemCheckBox.setChecked(withSystemSitePackages)
+
+        msh = self.minimumSizeHint()
+        self.resize(max(self.width(), msh.width()), msh.height())
+
+    def getData(self):
+        """
+        Public method to retrieve the entered data.
+
+        @return tuple containing the path of the Python executable and a flag indicating
+            to enable access to the system wide site-packages
+        @rtype tuple of (str, bool)
+        """
+        return self.pythonExecPicker.text().strip(), self.systemCheckBox.isChecked()

eric ide

mercurial