|
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 import DefaultPyPiUrl |
|
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 @param plugin reference to the plugin object |
|
29 @type PipInterfacePlugin |
|
30 """ |
|
31 super(PipPage, self).__init__() |
|
32 self.setupUi(self) |
|
33 self.setObjectName("PipPage") |
|
34 |
|
35 self.indexLabel.setText(self.tr( |
|
36 '<b>Note:</b> Leave empty to use the default index URL (' |
|
37 '<a href="{0}">{0}</a>).') |
|
38 .format(DefaultPyPiUrl)) |
|
39 |
|
40 # set initial values |
|
41 self.indexEdit.setText(Preferences.getPip("PipSearchIndex")) |
|
42 |
|
43 def save(self): |
|
44 """ |
|
45 Public slot to save the pip configuration. |
|
46 """ |
|
47 Preferences.setPip( |
|
48 "PipSearchIndex", self.indexEdit.text().strip()) |
|
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 = PipPage() |
|
59 return page |