|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2022 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing a dialog to enter the parameters for the creation of the embedded |
|
8 virtual environment. |
|
9 """ |
|
10 |
|
11 from PyQt6.QtWidgets import QDialog |
|
12 |
|
13 from EricWidgets.EricPathPicker import EricPathPickerModes |
|
14 |
|
15 from .Ui_ProjectVenvCreationParametersDialog import ( |
|
16 Ui_ProjectVenvCreationParametersDialog, |
|
17 ) |
|
18 |
|
19 import Globals |
|
20 |
|
21 |
|
22 class ProjectVenvCreationParametersDialog( |
|
23 QDialog, Ui_ProjectVenvCreationParametersDialog |
|
24 ): |
|
25 """ |
|
26 Class implementing a dialog to enter the parameters for the creation of the embedded |
|
27 virtual environment. |
|
28 """ |
|
29 |
|
30 def __init__(self, withSystemSitePackages=False, parent=None): |
|
31 """ |
|
32 Constructor |
|
33 |
|
34 @param withSystemSitePackages flag indicating to access the system site-packages |
|
35 (defaults to False) |
|
36 @type bool |
|
37 @param parent reference to the parent widget (defaults to None) |
|
38 @type QWidget (optional) |
|
39 """ |
|
40 super().__init__(parent) |
|
41 self.setupUi(self) |
|
42 |
|
43 self.pythonExecPicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
|
44 self.pythonExecPicker.setWindowTitle(self.tr("Python Interpreter")) |
|
45 self.pythonExecPicker.setDefaultDirectory(Globals.getPythonExecutable()) |
|
46 |
|
47 self.systemCheckBox.setChecked(withSystemSitePackages) |
|
48 |
|
49 msh = self.minimumSizeHint() |
|
50 self.resize(max(self.width(), msh.width()), msh.height()) |
|
51 |
|
52 def getData(self): |
|
53 """ |
|
54 Public method to retrieve the entered data. |
|
55 |
|
56 @return tuple containing the path of the Python executable and a flag indicating |
|
57 to enable access to the system wide site-packages |
|
58 @rtype tuple of (str, bool) |
|
59 """ |
|
60 return self.pythonExecPicker.text().strip(), self.systemCheckBox.isChecked() |