Wed, 13 Feb 2019 19:48:48 +0100
CondaPackagesWidget: show an error string if conda is not available. No other interface element are shown in that case.
--- a/CondaInterface/CondaPackagesWidget.py Wed Feb 13 19:03:29 2019 +0100 +++ b/CondaInterface/CondaPackagesWidget.py Wed Feb 13 19:48:48 2019 +0100 @@ -51,6 +51,21 @@ self.__conda = conda + if not CondaInterface.isCondaAvailable(): + self.baseWidget.hide() + self.searchWidget.hide() + + else: + self.notAvailableWidget.hide() + + self.__initCondaInterface() + + def __initCondaInterface(self): + """ + Private method to initialize the conda interface elements. + """ + self.statusLabel.hide() + self.condaMenuButton.setObjectName( "navigation_supermenu_button") self.condaMenuButton.setIcon(UI.PixmapCache.getIcon("superMenu.png")) @@ -196,6 +211,8 @@ prefix = self.environmentsComboBox.itemData(index) if prefix: QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) + self.statusLabel.show() + self.statusLabel.setText(self.tr("Getting installed packages...")) QApplication.processEvents() # 1. populate with installed packages @@ -207,6 +224,7 @@ itm.setData(1, self.PackageVersionRole, version) itm.setData(1, self.PackageBuildRole, build) self.packagesList.setUpdatesEnabled(True) + self.statusLabel.setText(self.tr("Getting outdated packages...")) QApplication.processEvents() # 2. update with update information @@ -237,6 +255,7 @@ self.packagesList.resizeColumnToContents(col) self.packagesList.setUpdatesEnabled(True) QApplication.restoreOverrideCursor() + self.statusLabel.hide() self.__updateActionButtons() self.__updateSearchActionButtons() @@ -681,3 +700,15 @@ Private slot to open the configuration page. """ e5App().getObject("UserInterface").showPreferences("condaPage") + + @pyqtSlot() + def on_recheckButton_clicked(self): + """ + Private slot to re-check the availability of conda and adjust the + interface if it became available. + """ + if CondaInterface.isCondaAvailable(): + self.__initCondaInterface() + + self.notAvailableWidget.hide() + self.baseWidget.show()
--- a/CondaInterface/CondaPackagesWidget.ui Wed Feb 13 19:03:29 2019 +0100 +++ b/CondaInterface/CondaPackagesWidget.ui Wed Feb 13 19:48:48 2019 +0100 @@ -6,134 +6,249 @@ <rect> <x>0</x> <y>0</y> - <width>639</width> - <height>573</height> + <width>600</width> + <height>600</height> </rect> </property> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QComboBox" name="environmentsComboBox"/> - </item> - <item> - <widget class="E5ToolButton" name="condaMenuButton"/> - </item> - </layout> - </item> + <layout class="QVBoxLayout" name="verticalLayout_5"> <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> - <attribute name="headerDefaultSectionSize"> - <number>150</number> - </attribute> - <column> - <property name="text"> - <string>Package</string> + <widget class="QWidget" name="notAvailableWidget" native="true"> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> </property> - </column> - <column> - <property name="text"> - <string>Installed Version</string> - </property> - </column> - <column> - <property name="text"> - <string>Available Version</string> - </property> - </column> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>5</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="notAvailableLabel"> + <property name="text"> + <string><h2>conda is not available</h2></string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_6"> + <item> + <spacer name="horizontalSpacer_5"> + <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="recheckButton"> + <property name="toolTip"> + <string>Press to re-check the availability of conda</string> + </property> + <property name="text"> + <string>Re-Check</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_6"> + <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> + <item> + <spacer name="verticalSpacer_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>2</height> + </size> + </property> + </spacer> + </item> + </layout> </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>&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&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 &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>&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> - <item> - <widget class="QToolButton" name="searchToggleButton"> - <property name="toolTip"> - <string>Toggle to show or hide the search window</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> + <widget class="QWidget" name="baseWidget" native="true"> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <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="QLabel" name="statusLabel"/> + </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> + <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>&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&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 &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>&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> + <item> + <widget class="QToolButton" name="searchToggleButton"> + <property name="toolTip"> + <string>Toggle to show or hide the search window</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> </item> <item> <widget class="QWidget" name="searchWidget" native="true">
--- a/CondaInterface/__init__.py Wed Feb 13 19:03:29 2019 +0100 +++ b/CondaInterface/__init__.py Wed Feb 13 19:48:48 2019 +0100 @@ -63,7 +63,10 @@ int(i) for i in __CondaVersionStr.split(".") ) __CondaRootPrefix = jsonDict["root_prefix"] - __CondaUserConfig = jsonDict["rc_path"] + if "user_rc_path" in jsonDict: + __CondaUserConfig = jsonDict["user_rc_path"] + elif "rc_path" in jsonDict: + __CondaUserConfig = jsonDict["rc_path"] __initialized = True @@ -112,6 +115,16 @@ return __CondaUserConfig +def isCondaAvailable(): + """ + Module function to check the availability of conda. + + @return flag indicating conda availability + @rtype bool + """ + __initializeCondaInterface() + return bool(__CondaVersion) + def resetInterface(): """ Module function to reset the conda interface.