271 |
271 |
272 self.__replies = [] |
272 self.__replies = [] |
273 |
273 |
274 self.viewsStackWidget.setCurrentWidget(self.packagesPage) |
274 self.viewsStackWidget.setCurrentWidget(self.packagesPage) |
275 self.on_packagesList_currentItemChanged(None, None) |
275 self.on_packagesList_currentItemChanged(None, None) |
|
276 |
|
277 self.preferencesChanged() # perform preferences dependent configuration |
276 |
278 |
277 @pyqtSlot() |
279 @pyqtSlot() |
278 def __projectOpened(self): |
280 def __projectOpened(self): |
279 """ |
281 """ |
280 Private slot to handle the projectOpened signal. |
282 Private slot to handle the projectOpened signal. |
1668 self.vulnerabilityCheckBox.setChecked(enable) |
1670 self.vulnerabilityCheckBox.setChecked(enable) |
1669 self.vulnerabilityCheckBox.setEnabled(enable) |
1671 self.vulnerabilityCheckBox.setEnabled(enable) |
1670 self.packagesList.setColumnHidden( |
1672 self.packagesList.setColumnHidden( |
1671 PipPackagesWidget.VulnerabilityColumn, not enable |
1673 PipPackagesWidget.VulnerabilityColumn, not enable |
1672 ) |
1674 ) |
|
1675 if not enable: |
|
1676 self.__clearVulnerabilityInfo() |
1673 |
1677 |
1674 @pyqtSlot(bool) |
1678 @pyqtSlot(bool) |
1675 def on_vulnerabilityCheckBox_clicked(self, checked): |
1679 def on_vulnerabilityCheckBox_clicked(self, checked): |
1676 """ |
1680 """ |
1677 Private slot handling a change of the automatic vulnerability checks. |
1681 Private slot handling a change of the automatic vulnerability checks. |
1679 @param checked flag indicating the state of the check box |
1683 @param checked flag indicating the state of the check box |
1680 @type bool |
1684 @type bool |
1681 """ |
1685 """ |
1682 if checked: |
1686 if checked: |
1683 self.__updateVulnerabilityData(clearFirst=True) |
1687 self.__updateVulnerabilityData(clearFirst=True) |
|
1688 else: |
|
1689 self.__clearVulnerabilityInfo() |
1684 |
1690 |
1685 self.packagesList.header().setSectionHidden( |
1691 self.packagesList.header().setSectionHidden( |
1686 PipPackagesWidget.VulnerabilityColumn, not checked |
1692 PipPackagesWidget.VulnerabilityColumn, not checked |
1687 ) |
1693 ) |
1688 |
1694 |
1730 name=itm.text(PipPackagesWidget.PackageColumn), |
1736 name=itm.text(PipPackagesWidget.PackageColumn), |
1731 version=itm.text(PipPackagesWidget.InstalledVersionColumn), |
1737 version=itm.text(PipPackagesWidget.InstalledVersionColumn), |
1732 ) |
1738 ) |
1733 ) |
1739 ) |
1734 |
1740 |
1735 error, vulnerabilities = self.__pip.getVulnerabilityChecker().check(packages) |
1741 if packages: |
1736 if error == VulnerabilityCheckError.OK: |
1742 error, vulnerabilities = self.__pip.getVulnerabilityChecker().check( |
1737 for package in vulnerabilities: |
1743 packages |
1738 items = self.packagesList.findItems( |
1744 ) |
1739 package, Qt.MatchFlag.MatchExactly | Qt.MatchFlag.MatchCaseSensitive |
1745 if error == VulnerabilityCheckError.OK: |
1740 ) |
1746 for package in vulnerabilities: |
1741 if items: |
1747 items = self.packagesList.findItems( |
1742 itm = items[0] |
1748 package, |
1743 itm.setData( |
1749 Qt.MatchFlag.MatchExactly | Qt.MatchFlag.MatchCaseSensitive, |
1744 PipPackagesWidget.VulnerabilityColumn, |
|
1745 PipPackagesWidget.VulnerabilityRole, |
|
1746 vulnerabilities[package], |
|
1747 ) |
1750 ) |
1748 affected = {v.spec for v in vulnerabilities[package]} |
1751 if items: |
1749 itm.setText( |
1752 itm = items[0] |
1750 PipPackagesWidget.VulnerabilityColumn, ", ".join(affected) |
1753 itm.setData( |
1751 ) |
1754 PipPackagesWidget.VulnerabilityColumn, |
1752 itm.setIcon( |
1755 PipPackagesWidget.VulnerabilityRole, |
1753 PipPackagesWidget.VulnerabilityColumn, |
1756 vulnerabilities[package], |
1754 EricPixmapCache.getIcon("securityLow"), |
1757 ) |
1755 ) |
1758 affected = {v.spec for v in vulnerabilities[package]} |
1756 |
1759 itm.setText( |
1757 elif error in ( |
1760 PipPackagesWidget.VulnerabilityColumn, ", ".join(affected) |
1758 VulnerabilityCheckError.FullDbUnavailable, |
1761 ) |
1759 VulnerabilityCheckError.SummaryDbUnavailable, |
1762 itm.setIcon( |
1760 ): |
1763 PipPackagesWidget.VulnerabilityColumn, |
1761 self.setVulnerabilityEnabled(False) |
1764 EricPixmapCache.getIcon("securityLow"), |
|
1765 ) |
|
1766 |
|
1767 elif error in ( |
|
1768 VulnerabilityCheckError.FullDbUnavailable, |
|
1769 VulnerabilityCheckError.SummaryDbUnavailable, |
|
1770 ): |
|
1771 self.setVulnerabilityEnabled(False) |
1762 |
1772 |
1763 @pyqtSlot() |
1773 @pyqtSlot() |
1764 def __updateVulnerabilityDbCache(self): |
1774 def __updateVulnerabilityDbCache(self): |
1765 """ |
1775 """ |
1766 Private slot to initiate an update of the local cache of the |
1776 Private slot to initiate an update of the local cache of the |