27 self.setupUi(self) |
27 self.setupUi(self) |
28 self.setObjectName("PipPage") |
28 self.setObjectName("PipPage") |
29 |
29 |
30 self.indexLabel.setText(self.tr( |
30 self.indexLabel.setText(self.tr( |
31 '<b>Note:</b> Leave empty to use the default index URL (' |
31 '<b>Note:</b> Leave empty to use the default index URL (' |
32 '<a href="{0}">{0}</a>).') |
32 '<a href="{0}">{0}</a>).' |
33 .format(Pip.DefaultPyPiUrl)) |
33 ).format(Pip.DefaultPyPiUrl)) |
|
34 self.safetyDbMirrorLabel.setText(self.tr( |
|
35 '<b>Note:</b> Leave empty to use the default Safety DB URL ({0}).' |
|
36 ).format(Preferences.Prefs.pipDefaults["VulnerabilityDbMirror"])) |
34 |
37 |
35 # set initial values |
38 # set initial values |
36 self.indexEdit.setText(Preferences.getPip("PipSearchIndex")) |
39 self.indexEdit.setText(Preferences.getPip("PipSearchIndex")) |
|
40 |
|
41 safetyDbUrl = Preferences.getPip("VulnerabilityDbMirror") |
|
42 if ( |
|
43 safetyDbUrl == |
|
44 Preferences.Prefs.pipDefaults["VulnerabilityDbMirror"] |
|
45 ): |
|
46 safetyDbUrl = "" |
|
47 self.safetyDbMirrorEdit.setText(safetyDbUrl) |
|
48 self.validitySpinBox.setValue( |
|
49 Preferences.getPip("VulnerabilityDbCacheValidity") // 3600) |
|
50 # seconds converted to hours |
|
51 |
37 self.noCondaCheckBox.setChecked( |
52 self.noCondaCheckBox.setChecked( |
38 Preferences.getPip("ExcludeCondaEnvironments")) |
53 Preferences.getPip("ExcludeCondaEnvironments")) |
39 |
54 |
40 def save(self): |
55 def save(self): |
41 """ |
56 """ |
42 Public slot to save the pip configuration. |
57 Public slot to save the pip configuration. |
43 """ |
58 """ |
44 Preferences.setPip( |
59 safetyDbUrl = self.safetyDbMirrorEdit.text().strip() |
45 "PipSearchIndex", self.indexEdit.text().strip()) |
60 if not safetyDbUrl: |
46 Preferences.setPip( |
61 safetyDbUrl = Preferences.Prefs.pipDefaults[ |
47 "ExcludeCondaEnvironments", self.noCondaCheckBox.isChecked()) |
62 "VulnerabilityDbMirror"] |
|
63 safetyDbUrl = safetyDbUrl.replace("\\", "/") |
|
64 if not safetyDbUrl.endswith("/"): |
|
65 safetyDbUrl += "/" |
|
66 |
|
67 Preferences.setPip("PipSearchIndex", |
|
68 self.indexEdit.text().strip()) |
|
69 |
|
70 Preferences.setPip("VulnerabilityDbMirror", safetyDbUrl) |
|
71 Preferences.setPip("VulnerabilityDbCacheValidity", |
|
72 self.validitySpinBox.value() * 3600) |
|
73 # hours converted to seconds |
|
74 |
|
75 Preferences.setPip("ExcludeCondaEnvironments", |
|
76 self.noCondaCheckBox.isChecked()) |
48 |
77 |
49 |
78 |
50 def create(dlg): |
79 def create(dlg): |
51 """ |
80 """ |
52 Module function to create the configuration page. |
81 Module function to create the configuration page. |