CondaInterface/CondaPackagesWidget.py

branch
conda
changeset 6715
f1bf1985434e
parent 6712
91fa67e8ebbc
child 6724
ca89c7d94c94
equal deleted inserted replaced
6714:7718e9b548fa 6715:f1bf1985434e
92 Private method to create the super menu and attach it to the super 92 Private method to create the super menu and attach it to the super
93 menu button. 93 menu button.
94 """ 94 """
95 self.__condaMenu = QMenu(self) 95 self.__condaMenu = QMenu(self)
96 # TODO: implement Conda menu 96 # TODO: implement Conda menu
97 self.__condaMenu.addAction(self.tr("Test Entry"), 97 self.__condaMenu.addAction(
98 self.on_refreshButton_clicked) 98 self.tr("Update Conda"), self.__conda.updateConda)
99 self.__condaMenu.addSeparator()
99 100
100 self.condaMenuButton.setMenu(self.__condaMenu) 101 self.condaMenuButton.setMenu(self.__condaMenu)
102
103 self.__condaMenu.aboutToShow.connect(self.__aboutToShowCondaMenu)
101 104
102 def __selectedUpdateableItems(self): 105 def __selectedUpdateableItems(self):
103 """ 106 """
104 Private method to get a list of selected items that can be updated. 107 Private method to get a list of selected items that can be updated.
105 108
278 pattern = self.searchEdit.text() 281 pattern = self.searchEdit.text()
279 if pattern: 282 if pattern:
280 QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) 283 QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
281 QApplication.processEvents() 284 QApplication.processEvents()
282 285
283 prefix = self.environmentsComboBox.itemData( 286 if CondaInterface.condaVersion() >= (4, 4, 0):
284 self.environmentsComboBox.currentIndex()) 287 prefix = ""
288 else:
289 prefix = self.environmentsComboBox.itemData(
290 self.environmentsComboBox.currentIndex())
285 ok, result = self.__conda.searchPackages( 291 ok, result = self.__conda.searchPackages(
286 pattern, 292 pattern,
287 fullNameOnly=self.fullNameButton.isChecked(), 293 fullNameOnly=self.fullNameButton.isChecked(),
288 packageSpec=self.packageSpecButton.isChecked(), 294 packageSpec=self.packageSpecButton.isChecked(),
289 platform=self.platformComboBox.currentText(), 295 platform=self.platformComboBox.currentText(),
334 """ 340 """
335 details = item.data(0, self.PackageDetailedDataRole) 341 details = item.data(0, self.PackageDetailedDataRole)
336 if details: 342 if details:
337 from .CondaPackageDetailsWidget import CondaPackageDetailsDialog 343 from .CondaPackageDetailsWidget import CondaPackageDetailsDialog
338 dlg = CondaPackageDetailsDialog(details, self) 344 dlg = CondaPackageDetailsDialog(details, self)
339 dlg.show() 345 dlg.exec_()
340 346
341 @pyqtSlot(str) 347 @pyqtSlot(str)
342 def on_searchEdit_textChanged(self, txt): 348 def on_searchEdit_textChanged(self, txt):
343 """ 349 """
344 Private slot handling changes of the entered search specification. 350 Private slot handling changes of the entered search specification.
364 self.__doSearch() 370 self.__doSearch()
365 371
366 @pyqtSlot() 372 @pyqtSlot()
367 def on_installButton_clicked(self): 373 def on_installButton_clicked(self):
368 """ 374 """
369 Slot documentation goes here. 375 Private slot to install a selected package.
370 """ 376 """
371 # TODO: not implemented yet 377 if len(self.searchResultList.selectedItems()) == 1:
372 raise NotImplementedError 378 item = self.searchResultList.selectedItems()[0]
379 if item.parent() is None:
380 # it is just the package item
381 package = item.text(0)
382 else:
383 # item with version and build
384 package = "{0}={1}={2}".format(
385 item.parent().text(0),
386 item.text(1),
387 item.text(2),
388 )
389
390 prefix = self.environmentsComboBox.itemData(
391 self.environmentsComboBox.currentIndex())
392 ok = self.__conda.installPackages([package], prefix=prefix)
393 if ok:
394 self.on_refreshButton_clicked()
373 395
374 @pyqtSlot() 396 @pyqtSlot()
375 def on_showDetailsButton_clicked(self): 397 def on_showDetailsButton_clicked(self):
376 """ 398 """
377 Private slot handling the 'Show Details' button. 399 Private slot handling the 'Show Details' button.
423 if checked: 445 if checked:
424 self.searchEdit.setFocus(Qt.OtherFocusReason) 446 self.searchEdit.setFocus(Qt.OtherFocusReason)
425 self.searchEdit.selectAll() 447 self.searchEdit.selectAll()
426 448
427 self.__updateSearchActionButtons() 449 self.__updateSearchActionButtons()
450
451 @pyqtSlot()
452 def __aboutToShowCondaMenu(self):
453 """
454 Private slot to handle the conda menu about to be shown.
455 """
456 selectedEnvironment = self.environmentsComboBox.currentText()

eric ide

mercurial