|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2015 - 2021 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Package implementing the pip configuration page. |
|
8 """ |
|
9 |
|
10 from .ConfigurationPageBase import ConfigurationPageBase |
|
11 from .Ui_PipPage import Ui_PipPage |
|
12 |
|
13 from PipInterface.Pip import Pip |
|
14 |
|
15 import Preferences |
|
16 |
|
17 |
|
18 class PipPage(ConfigurationPageBase, Ui_PipPage): |
|
19 """ |
|
20 Class implementing the pip configuration page. |
|
21 """ |
|
22 def __init__(self): |
|
23 """ |
|
24 Constructor |
|
25 """ |
|
26 super().__init__() |
|
27 self.setupUi(self) |
|
28 self.setObjectName("PipPage") |
|
29 |
|
30 self.indexLabel.setText(self.tr( |
|
31 '<b>Note:</b> Leave empty to use the default index URL (' |
|
32 '<a href="{0}">{0}</a>).') |
|
33 .format(Pip.DefaultPyPiUrl)) |
|
34 |
|
35 # set initial values |
|
36 self.indexEdit.setText(Preferences.getPip("PipSearchIndex")) |
|
37 self.noCondaCheckBox.setChecked( |
|
38 Preferences.getPip("ExcludeCondaEnvironments")) |
|
39 |
|
40 def save(self): |
|
41 """ |
|
42 Public slot to save the pip configuration. |
|
43 """ |
|
44 Preferences.setPip( |
|
45 "PipSearchIndex", self.indexEdit.text().strip()) |
|
46 Preferences.setPip( |
|
47 "ExcludeCondaEnvironments", self.noCondaCheckBox.isChecked()) |
|
48 |
|
49 |
|
50 def create(dlg): |
|
51 """ |
|
52 Module function to create the configuration page. |
|
53 |
|
54 @param dlg reference to the configuration dialog |
|
55 @return reference to the instantiated page (ConfigurationPageBase) |
|
56 """ |
|
57 page = PipPage() |
|
58 return page |