Conda: started to implement the Conda Packages Manager widget. conda

Mon, 04 Feb 2019 20:03:11 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 04 Feb 2019 20:03:11 +0100
branch
conda
changeset 6698
bc5aa4cda1ee
parent 6697
2f5c951bdf14
child 6700
2a607332ccf8

Conda: started to implement the Conda Packages Manager widget.

CondaInterface/CondaPackagesWidget.py file | annotate | diff | comparison | revisions
CondaInterface/CondaPackagesWidget.ui file | annotate | diff | comparison | revisions
Documentation/Help/source.qch file | annotate | diff | comparison | revisions
UI/UserInterface.py file | annotate | diff | comparison | revisions
eric6.e4p file | annotate | diff | comparison | revisions
--- /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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CondaInterface/CondaPackagesWidget.ui	Mon Feb 04 20:03:11 2019 +0100
@@ -0,0 +1,142 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>CondaPackagesWidget</class>
+ <widget class="QWidget" name="CondaPackagesWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>639</width>
+    <height>443</height>
+   </rect>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <item>
+      <widget class="QComboBox" name="environmentsComboBox"/>
+     </item>
+     <item>
+      <widget class="E5ToolButton" name="condaMenuButton"/>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="QTreeWidget" name="packagesList">
+     <property name="alternatingRowColors">
+      <bool>true</bool>
+     </property>
+     <property name="selectionMode">
+      <enum>QAbstractItemView::ExtendedSelection</enum>
+     </property>
+     <property name="rootIsDecorated">
+      <bool>false</bool>
+     </property>
+     <property name="itemsExpandable">
+      <bool>false</bool>
+     </property>
+     <property name="sortingEnabled">
+      <bool>true</bool>
+     </property>
+     <attribute name="headerDefaultSectionSize">
+      <number>150</number>
+     </attribute>
+     <column>
+      <property name="text">
+       <string>Package</string>
+      </property>
+     </column>
+     <column>
+      <property name="text">
+       <string>Installed Version</string>
+      </property>
+     </column>
+     <column>
+      <property name="text">
+       <string>Available Version</string>
+      </property>
+     </column>
+    </widget>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
+     <item>
+      <spacer name="horizontalSpacer">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="refreshButton">
+       <property name="toolTip">
+        <string>Press to refresh the lists</string>
+       </property>
+       <property name="text">
+        <string>&amp;Refresh</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="upgradeButton">
+       <property name="toolTip">
+        <string>Press to upgrade the selected packages</string>
+       </property>
+       <property name="text">
+        <string>Up&amp;grade</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="upgradeAllButton">
+       <property name="toolTip">
+        <string>Press to upgrade all listed packages</string>
+       </property>
+       <property name="text">
+        <string>Upgrade &amp;All</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="uninstallButton">
+       <property name="toolTip">
+        <string>Press to uninstall the selected package</string>
+       </property>
+       <property name="text">
+        <string>&amp;Uninstall</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer_2">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>E5ToolButton</class>
+   <extends>QToolButton</extends>
+   <header>E5Gui/E5ToolButton.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
Binary file Documentation/Help/source.qch has changed
--- a/UI/UserInterface.py	Sun Feb 03 16:59:36 2019 +0100
+++ b/UI/UserInterface.py	Mon Feb 04 20:03:11 2019 +0100
@@ -981,6 +981,14 @@
             self.debugViewer, UI.PixmapCache.getIcon("debugViewer.png"),
             self.tr("Debug-Viewer"))
 
+        # Create the conda package manager
+        logging.debug("Creating Conda Package Manager...")
+        from CondaInterface.CondaPackagesWidget import CondaPackagesWidget
+        self.condaWidget = CondaPackagesWidget()
+        self.rightSidebar.addTab(
+            self.condaWidget, UI.PixmapCache.getIcon("miniconda.png"),
+            self.tr("Conda"))
+
         if Preferences.getUI("ShowCooperation"):
             # Create the chat part of the user interface
             logging.debug("Creating Chat Widget...")
--- a/eric6.e4p	Sun Feb 03 16:59:36 2019 +0100
+++ b/eric6.e4p	Mon Feb 04 20:03:11 2019 +0100
@@ -18,6 +18,7 @@
   <Sources>
     <Source>CondaInterface/Conda.py</Source>
     <Source>CondaInterface/CondaExecDialog.py</Source>
+    <Source>CondaInterface/CondaPackagesWidget.py</Source>
     <Source>CondaInterface/__init__.py</Source>
     <Source>Cooperation/ChatWidget.py</Source>
     <Source>Cooperation/Connection.py</Source>
@@ -1715,6 +1716,7 @@
   </Sources>
   <Forms>
     <Form>CondaInterface/CondaExecDialog.ui</Form>
+    <Form>CondaInterface/CondaPackagesWidget.ui</Form>
     <Form>Cooperation/ChatWidget.ui</Form>
     <Form>DataViews/CodeMetricsDialog.ui</Form>
     <Form>DataViews/PyCoverageDialog.ui</Form>
@@ -2247,14 +2249,14 @@
   </Resources>
   <Others>
     <Other>.hgignore</Other>
+    <Other>APIs/Python/zope-2.10.7.api</Other>
+    <Other>APIs/Python/zope-2.11.2.api</Other>
+    <Other>APIs/Python/zope-3.3.1.api</Other>
     <Other>APIs/Python3/PyQt4.bas</Other>
     <Other>APIs/Python3/PyQt5.bas</Other>
     <Other>APIs/Python3/QScintilla2.bas</Other>
     <Other>APIs/Python3/eric6.api</Other>
     <Other>APIs/Python3/eric6.bas</Other>
-    <Other>APIs/Python/zope-2.10.7.api</Other>
-    <Other>APIs/Python/zope-2.11.2.api</Other>
-    <Other>APIs/Python/zope-3.3.1.api</Other>
     <Other>APIs/QSS/qss.api</Other>
     <Other>APIs/Ruby/Ruby-1.8.7.api</Other>
     <Other>APIs/Ruby/Ruby-1.8.7.bas</Other>

eric ide

mercurial