diff -r 2f5c951bdf14 -r bc5aa4cda1ee CondaInterface/CondaPackagesWidget.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CondaInterface/CondaPackagesWidget.py Mon Feb 04 20:03:11 2019 +0100 @@ -0,0 +1,123 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2019 Detlev Offenbach <detlev@die-offenbachs.de> +# + +""" +Module implementing the conda packages management widget. +""" + +from __future__ import unicode_literals + +import os + +from PyQt5.QtCore import pyqtSlot, Qt +from PyQt5.QtWidgets import QWidget, QToolButton, QMenu + +from .Ui_CondaPackagesWidget import Ui_CondaPackagesWidget + +import UI.PixmapCache + + +class CondaPackagesWidget(QWidget, Ui_CondaPackagesWidget): + """ + Class implementing the conda packages management widget. + """ + def __init__(self, parent=None): + """ + Constructor + + @param parent reference to the parent widget + @type QWidget + """ + super(CondaPackagesWidget, self).__init__(parent) + self.setupUi(self) + + self.condaMenuButton.setObjectName( + "navigation_supermenu_button") + self.condaMenuButton.setIcon(UI.PixmapCache.getIcon("superMenu.png")) + self.condaMenuButton.setToolTip(self.tr("Conda Menu")) + self.condaMenuButton.setPopupMode(QToolButton.InstantPopup) + self.condaMenuButton.setToolButtonStyle(Qt.ToolButtonIconOnly) + self.condaMenuButton.setFocusPolicy(Qt.NoFocus) + self.condaMenuButton.setAutoRaise(True) + self.condaMenuButton.setShowMenuInside(True) + + self.__initCondaMenu() + self.__populateEnvironments() + + def __populateEnvironments(self): + """ + Private method to get a list of environments and populate the selector. + """ + # TODO: replace this by the real stuff + envs = [ + "path/to/envs/sqlite", + "path/to/envs/pyqt4", + "path/to/envs/pyqt5", + ] + + environmentNames = [os.path.basename(e) for e in envs] + self.environmentsComboBox.addItems(sorted(environmentNames)) + + def __initCondaMenu(self): + """ + Private method to create the super menu and attach it to the super + menu button. + """ + self.__condaMenu = QMenu(self) + # TODO: implement Conda menu + self.__condaMenu.addAction(self.tr("Test Entry"), self.on_refreshButton_clicked) + + self.condaMenuButton.setMenu(self.__condaMenu) + + @pyqtSlot(str) + def on_environmentsComboBox_activated(self, p0): + """ + Slot documentation goes here. + + @param p0 DESCRIPTION + @type str + """ + # TODO: not implemented yet + raise NotImplementedError + + @pyqtSlot() + def on_packagesList_itemSelectionChanged(self): + """ + Slot documentation goes here. + """ + # TODO: not implemented yet + raise NotImplementedError + + @pyqtSlot() + def on_refreshButton_clicked(self): + """ + Slot documentation goes here. + """ + # TODO: not implemented yet + raise NotImplementedError + + @pyqtSlot() + def on_upgradeButton_clicked(self): + """ + Slot documentation goes here. + """ + # TODO: not implemented yet + raise NotImplementedError + + @pyqtSlot() + def on_upgradeAllButton_clicked(self): + """ + Slot documentation goes here. + """ + # TODO: not implemented yet + raise NotImplementedError + + @pyqtSlot() + def on_uninstallButton_clicked(self): + """ + Slot documentation goes here. + """ + # TODO: not implemented yet + raise NotImplementedError