CondaInterface/CondaPackagesWidget.py

branch
conda
changeset 6738
a7f835b41606
parent 6731
c70eaa492741
child 6771
bcffbb627791
equal deleted inserted replaced
6737:26a4738dd206 6738:a7f835b41606
48 """ 48 """
49 super(CondaPackagesWidget, self).__init__(parent) 49 super(CondaPackagesWidget, self).__init__(parent)
50 self.setupUi(self) 50 self.setupUi(self)
51 51
52 self.__conda = conda 52 self.__conda = conda
53
54 if not CondaInterface.isCondaAvailable():
55 self.baseWidget.hide()
56 self.searchWidget.hide()
57
58 else:
59 self.notAvailableWidget.hide()
60
61 self.__initCondaInterface()
62
63 def __initCondaInterface(self):
64 """
65 Private method to initialize the conda interface elements.
66 """
67 self.statusLabel.hide()
53 68
54 self.condaMenuButton.setObjectName( 69 self.condaMenuButton.setObjectName(
55 "navigation_supermenu_button") 70 "navigation_supermenu_button")
56 self.condaMenuButton.setIcon(UI.PixmapCache.getIcon("superMenu.png")) 71 self.condaMenuButton.setIcon(UI.PixmapCache.getIcon("superMenu.png"))
57 self.condaMenuButton.setToolTip(self.tr("Conda Menu")) 72 self.condaMenuButton.setToolTip(self.tr("Conda Menu"))
194 """ 209 """
195 self.packagesList.clear() 210 self.packagesList.clear()
196 prefix = self.environmentsComboBox.itemData(index) 211 prefix = self.environmentsComboBox.itemData(index)
197 if prefix: 212 if prefix:
198 QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) 213 QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
214 self.statusLabel.show()
215 self.statusLabel.setText(self.tr("Getting installed packages..."))
199 QApplication.processEvents() 216 QApplication.processEvents()
200 217
201 # 1. populate with installed packages 218 # 1. populate with installed packages
202 self.packagesList.setUpdatesEnabled(False) 219 self.packagesList.setUpdatesEnabled(False)
203 installedPackages = \ 220 installedPackages = \
205 for package, version, build in installedPackages: 222 for package, version, build in installedPackages:
206 itm = QTreeWidgetItem(self.packagesList, [package, version]) 223 itm = QTreeWidgetItem(self.packagesList, [package, version])
207 itm.setData(1, self.PackageVersionRole, version) 224 itm.setData(1, self.PackageVersionRole, version)
208 itm.setData(1, self.PackageBuildRole, build) 225 itm.setData(1, self.PackageBuildRole, build)
209 self.packagesList.setUpdatesEnabled(True) 226 self.packagesList.setUpdatesEnabled(True)
227 self.statusLabel.setText(self.tr("Getting outdated packages..."))
210 QApplication.processEvents() 228 QApplication.processEvents()
211 229
212 # 2. update with update information 230 # 2. update with update information
213 self.packagesList.setUpdatesEnabled(False) 231 self.packagesList.setUpdatesEnabled(False)
214 updateablePackages = \ 232 updateablePackages = \
235 self.packagesList.sortItems(0, Qt.AscendingOrder) 253 self.packagesList.sortItems(0, Qt.AscendingOrder)
236 for col in range(self.packagesList.columnCount()): 254 for col in range(self.packagesList.columnCount()):
237 self.packagesList.resizeColumnToContents(col) 255 self.packagesList.resizeColumnToContents(col)
238 self.packagesList.setUpdatesEnabled(True) 256 self.packagesList.setUpdatesEnabled(True)
239 QApplication.restoreOverrideCursor() 257 QApplication.restoreOverrideCursor()
258 self.statusLabel.hide()
240 259
241 self.__updateActionButtons() 260 self.__updateActionButtons()
242 self.__updateSearchActionButtons() 261 self.__updateSearchActionButtons()
243 262
244 @pyqtSlot() 263 @pyqtSlot()
679 def __condaConfigure(self): 698 def __condaConfigure(self):
680 """ 699 """
681 Private slot to open the configuration page. 700 Private slot to open the configuration page.
682 """ 701 """
683 e5App().getObject("UserInterface").showPreferences("condaPage") 702 e5App().getObject("UserInterface").showPreferences("condaPage")
703
704 @pyqtSlot()
705 def on_recheckButton_clicked(self):
706 """
707 Private slot to re-check the availability of conda and adjust the
708 interface if it became available.
709 """
710 if CondaInterface.isCondaAvailable():
711 self.__initCondaInterface()
712
713 self.notAvailableWidget.hide()
714 self.baseWidget.show()

eric ide

mercurial