Thu, 24 Apr 2025 12:58:23 +0200
Corrected some shortcomings in the conda interface.
--- a/src/eric7/CondaInterface/Conda.py Wed Apr 23 18:13:44 2025 +0200 +++ b/src/eric7/CondaInterface/Conda.py Thu Apr 24 12:58:23 2025 +0200 @@ -11,7 +11,7 @@ import json import os -from PyQt6.QtCore import QCoreApplication, QObject, QProcess, pyqtSignal +from PyQt6.QtCore import QCoreApplication, QObject, QProcess, pyqtSignal, pyqtSlot from PyQt6.QtWidgets import QDialog from eric7 import Preferences @@ -51,17 +51,31 @@ super().__init__(parent) self.__ui = parent + with contextlib.suppress(AttributeError): + self.__ui.preferencesChanged.connect(self.__preferencesChanged) + self.__preferencesChanged() + + @pyqtSlot() + def __preferencesChanged(self): + """ + Private slot handling a change of configuration. + """ envManager = ericApp().getObject("VirtualEnvManager") - envManager.registerType( - VirtualenvType( - name=Conda.EnvironmentType, - visual_name=self.tr("Anaconda"), - createFunc=self.createCondaVirtualEnvironment, - deleteFunc=self.deleteCondaVirtualEnvironment, - defaultExecPathFunc=self.condaDefaultExecPath, - ) - ) + if isCondaAvailable(): + with contextlib.suppress(KeyError): + # conda was possibly registered already + envManager.registerType( + VirtualenvType( + name=Conda.EnvironmentType, + visual_name=self.tr("Anaconda"), + createFunc=self.createCondaVirtualEnvironment, + deleteFunc=self.deleteCondaVirtualEnvironment, + defaultExecPathFunc=self.condaDefaultExecPath, + ) + ) + else: + envManager.unregisterType(name=Conda.EnvironmentType) ####################################################################### ## environment related methods below
--- a/src/eric7/CondaInterface/CondaPackagesWidget.py Wed Apr 23 18:13:44 2025 +0200 +++ b/src/eric7/CondaInterface/CondaPackagesWidget.py Thu Apr 24 12:58:23 2025 +0200 @@ -111,6 +111,7 @@ self.__updateActionButtons() self.searchWidget.hide() + self.baseWidget.show() self.__conda.condaEnvironmentCreated.connect(self.on_refreshButton_clicked) self.__conda.condaEnvironmentRemoved.connect(self.on_refreshButton_clicked) @@ -766,4 +767,4 @@ self.__initCondaInterface() self.notAvailableWidget.hide() - self.baseWidget.show() + self.availableWidget.show()
--- a/src/eric7/Documentation/Help/source.qhp Wed Apr 23 18:13:44 2025 +0200 +++ b/src/eric7/Documentation/Help/source.qhp Thu Apr 24 12:58:23 2025 +0200 @@ -3526,6 +3526,7 @@ <keyword name="Conda" id="Conda" ref="eric7.CondaInterface.Conda.html#Conda" /> <keyword name="Conda (Constructor)" id="Conda (Constructor)" ref="eric7.CondaInterface.Conda.html#Conda.__init__" /> <keyword name="Conda (Module)" id="Conda (Module)" ref="eric7.CondaInterface.Conda.html" /> + <keyword name="Conda.__preferencesChanged" id="Conda.__preferencesChanged" ref="eric7.CondaInterface.Conda.html#Conda.__preferencesChanged" /> <keyword name="Conda.cleanConda" id="Conda.cleanConda" ref="eric7.CondaInterface.Conda.html#Conda.cleanConda" /> <keyword name="Conda.condaDefaultExecPath" id="Conda.condaDefaultExecPath" ref="eric7.CondaInterface.Conda.html#Conda.condaDefaultExecPath" /> <keyword name="Conda.createCondaEnvironment" id="Conda.createCondaEnvironment" ref="eric7.CondaInterface.Conda.html#Conda.createCondaEnvironment" />
--- a/src/eric7/Documentation/Source/eric7.CondaInterface.Conda.html Wed Apr 23 18:13:44 2025 +0200 +++ b/src/eric7/Documentation/Source/eric7.CondaInterface.Conda.html Thu Apr 24 12:58:23 2025 +0200 @@ -71,6 +71,10 @@ <td>Constructor</td> </tr> <tr> +<td><a href="#Conda.__preferencesChanged">__preferencesChanged</a></td> +<td>Private slot handling a change of configuration.</td> +</tr> +<tr> <td><a href="#Conda.cleanConda">cleanConda</a></td> <td>Public method to update conda itself.</td> </tr> @@ -164,6 +168,13 @@ parent </dd> </dl> +<a NAME="Conda.__preferencesChanged" ID="Conda.__preferencesChanged"></a> +<h4>Conda.__preferencesChanged</h4> +<b>__preferencesChanged</b>(<i></i>) +<p> + Private slot handling a change of configuration. +</p> + <a NAME="Conda.cleanConda" ID="Conda.cleanConda"></a> <h4>Conda.cleanConda</h4> <b>cleanConda</b>(<i>cleanAction</i>)