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