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