|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2019 - 2022 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the conda configuration page. |
|
8 """ |
|
9 |
|
10 from EricWidgets.EricPathPicker import EricPathPickerModes |
|
11 |
|
12 from .ConfigurationPageBase import ConfigurationPageBase |
|
13 from .Ui_CondaPage import Ui_CondaPage |
|
14 |
|
15 import Preferences |
|
16 |
|
17 |
|
18 class CondaPage(ConfigurationPageBase, Ui_CondaPage): |
|
19 """ |
|
20 Class implementing the conda configuration page. |
|
21 """ |
|
22 def __init__(self): |
|
23 """ |
|
24 Constructor |
|
25 """ |
|
26 super().__init__() |
|
27 self.setupUi(self) |
|
28 self.setObjectName("CondaPage") |
|
29 |
|
30 self.condaExePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
|
31 self.condaExePicker.setToolTip(self.tr( |
|
32 "Press to select the conda executable via a file selection" |
|
33 " dialog.")) |
|
34 |
|
35 # set initial values |
|
36 self.__condaExecutable = Preferences.getConda("CondaExecutable") |
|
37 self.condaExePicker.setText(self.__condaExecutable) |
|
38 |
|
39 def save(self): |
|
40 """ |
|
41 Public slot to save the conda configuration. |
|
42 """ |
|
43 condaExecutable = self.condaExePicker.text() |
|
44 if condaExecutable != self.__condaExecutable: |
|
45 Preferences.setConda("CondaExecutable", condaExecutable) |
|
46 |
|
47 import CondaInterface |
|
48 CondaInterface.resetInterface() |
|
49 |
|
50 |
|
51 def create(dlg): |
|
52 """ |
|
53 Module function to create the configuration page. |
|
54 |
|
55 @param dlg reference to the configuration dialog |
|
56 @return reference to the instantiated page (ConfigurationPageBase) |
|
57 """ |
|
58 page = CondaPage() |
|
59 return page |