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 Preferences.ConfigurationPages.ConfigurationPageBase import \ |
|
13 ConfigurationPageBase |
|
14 from .Ui_PipPage import Ui_PipPage |
|
15 |
|
16 from .. import DefaultPyPiUrl |
|
17 |
|
18 |
|
19 class PipPage(ConfigurationPageBase, Ui_PipPage): |
|
20 """ |
|
21 Class implementing the pip configuration page. |
|
22 """ |
|
23 def __init__(self, plugin): |
|
24 """ |
|
25 Constructor |
|
26 |
|
27 @param plugin reference to the plugin object |
|
28 @type PipInterfacePlugin |
|
29 """ |
|
30 super(PipPage, self).__init__() |
|
31 self.setupUi(self) |
|
32 self.setObjectName("PipPage") |
|
33 |
|
34 self.__plugin = plugin |
|
35 |
|
36 self.indexLabel.setText(self.tr( |
|
37 '<b>Note:</b> Leave empty to use the default index URL (' |
|
38 '<a href="{0}">{0}</a>).') |
|
39 .format(DefaultPyPiUrl)) |
|
40 |
|
41 # set initial values |
|
42 self.indexEdit.setText(self.__plugin.getPreferences("PipSearchIndex")) |
|
43 |
|
44 def save(self): |
|
45 """ |
|
46 Public slot to save the pip configuration. |
|
47 """ |
|
48 self.__plugin.setPreferences( |
|
49 "PipSearchIndex", self.indexEdit.text().strip()) |
|