diff --git a/python/interpreters/src/impl/InterpreterImpl.kt b/python/interpreters/src/impl/InterpreterImpl.kt index 885a11e28884..050a0e16207f 100644 --- a/python/interpreters/src/impl/InterpreterImpl.kt +++ b/python/interpreters/src/impl/InterpreterImpl.kt @@ -7,7 +7,7 @@ import com.intellij.python.community.interpreters.Interpreter import com.intellij.python.community.interpreters.InvalidInterpreter import com.intellij.python.community.interpreters.ValidInterpreter import com.intellij.python.community.services.shared.PythonWithName -import com.intellij.python.community.services.shared.UICustomization +import com.jetbrains.python.PyToolUIInfo import com.jetbrains.python.psi.LanguageLevel import com.jetbrains.python.sdk.PythonSdkAdditionalData import org.jetbrains.annotations.ApiStatus @@ -18,7 +18,7 @@ internal class ValidInterpreterImpl( override val languageLevel: LanguageLevel, override val asExecutablePython: ExecutablePython, private val mixin: SdkMixin, - override val ui: UICustomization?, + override val ui: PyToolUIInfo?, ) : ValidInterpreter, InterpreterFields by mixin { override fun toString(): String { return "ValidInterpreterImpl(languageLevel=$languageLevel, asExecutablePython=$asExecutablePython)" diff --git a/python/interpreters/src/impl/InterpreterServiceImpl.kt b/python/interpreters/src/impl/InterpreterServiceImpl.kt index cfbcfe966601..3a34398eb6f6 100644 --- a/python/interpreters/src/impl/InterpreterServiceImpl.kt +++ b/python/interpreters/src/impl/InterpreterServiceImpl.kt @@ -12,7 +12,7 @@ import com.intellij.python.community.interpreters.Interpreter import com.intellij.python.community.interpreters.InterpreterService import com.intellij.python.community.interpreters.impl.PyInterpreterBundle.message import com.intellij.python.community.interpreters.spi.InterpreterProvider -import com.intellij.python.community.services.shared.UICustomization +import com.jetbrains.python.PyToolUIInfo import com.jetbrains.python.Result import com.jetbrains.python.errorProcessing.MessageError import com.jetbrains.python.psi.LanguageLevel @@ -101,7 +101,7 @@ private suspend fun createInterpreter(provider: InterpreterPr } private class VanillaInterpreterProvider : InterpreterProvider { - override val ui: UICustomization? = null + override val ui: PyToolUIInfo? = null override val flavorDataClass: Class = PyFlavorData.Empty::class.java override suspend fun createExecutablePython(sdkHomePath: Path, flavorData: PyFlavorData.Empty): Result { diff --git a/python/interpreters/src/spi/InterpreterProvider.kt b/python/interpreters/src/spi/InterpreterProvider.kt index fe8d47a2a0a0..0dea99b241a5 100644 --- a/python/interpreters/src/spi/InterpreterProvider.kt +++ b/python/interpreters/src/spi/InterpreterProvider.kt @@ -5,7 +5,7 @@ import com.intellij.openapi.extensions.ExtensionPointName import com.intellij.openapi.projectRoots.Sdk import com.intellij.python.community.execService.python.advancedApi.ExecutablePython import com.intellij.python.community.interpreters.Interpreter -import com.intellij.python.community.services.shared.UICustomization +import com.jetbrains.python.PyToolUIInfo import com.jetbrains.python.Result import com.jetbrains.python.errorProcessing.MessageError import com.jetbrains.python.sdk.flavors.PyFlavorData @@ -26,7 +26,7 @@ interface InterpreterProvider { EP.extensionList.firstOrNull { it.flavorDataClass.isInstance(data) } as InterpreterProvider? } - val ui: UICustomization? + val ui: PyToolUIInfo? val flavorDataClass: Class suspend fun createExecutablePython(sdkHomePath: Path, flavorData: T): Result } \ No newline at end of file diff --git a/python/openapi/src/com/jetbrains/python/PyToolUIInfo.kt b/python/openapi/src/com/jetbrains/python/PyToolUIInfo.kt new file mode 100644 index 000000000000..16192b7d0578 --- /dev/null +++ b/python/openapi/src/com/jetbrains/python/PyToolUIInfo.kt @@ -0,0 +1,20 @@ +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +package com.jetbrains.python + +import com.intellij.openapi.util.NlsSafe +import org.jetbrains.annotations.ApiStatus +import javax.swing.Icon + +/** + * Various tools might have name and icon + */ +@ApiStatus.Internal +data class PyToolUIInfo( + /** + * i.e: "UV" for pythons found by UV + */ + val toolName: @NlsSafe String, // Tools are usually untranslatable + val icon: Icon? = null, +) : Comparable { + override fun compareTo(other: PyToolUIInfo): Int = toolName.compareTo(other.toolName) +} \ No newline at end of file diff --git a/python/services/shared/src/com/intellij/python/community/services/shared/UiCustomization.kt b/python/services/shared/src/com/intellij/python/community/services/shared/UiCustomization.kt deleted file mode 100644 index 96858ef3d8d8..000000000000 --- a/python/services/shared/src/com/intellij/python/community/services/shared/UiCustomization.kt +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -package com.intellij.python.community.services.shared - -import org.jetbrains.annotations.Nls -import javax.swing.Icon - -data class UICustomization( - /** - * i.e: "UV" for pythons found by UV - */ - val title: @Nls String, - val icon: Icon? = null, -) : Comparable { - override fun compareTo(other: UICustomization): Int = title.compareTo(other.title) -} diff --git a/python/services/shared/src/com/intellij/python/community/services/shared/UiHolder.kt b/python/services/shared/src/com/intellij/python/community/services/shared/UiHolder.kt index 63d74e28d80d..43b2330a8d4e 100644 --- a/python/services/shared/src/com/intellij/python/community/services/shared/UiHolder.kt +++ b/python/services/shared/src/com/intellij/python/community/services/shared/UiHolder.kt @@ -1,9 +1,11 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.python.community.services.shared +import com.jetbrains.python.PyToolUIInfo + interface UiHolder { /** * UI hints on how to display this python to the end user: icon, title, etc */ - val ui: UICustomization? + val ui: PyToolUIInfo? } \ No newline at end of file diff --git a/python/services/shared/src/com/intellij/python/community/services/shared/comparators.kt b/python/services/shared/src/com/intellij/python/community/services/shared/comparators.kt index 5bb68e8f78cb..77689d77306a 100644 --- a/python/services/shared/src/com/intellij/python/community/services/shared/comparators.kt +++ b/python/services/shared/src/com/intellij/python/community/services/shared/comparators.kt @@ -2,6 +2,7 @@ package com.intellij.python.community.services.shared import com.intellij.openapi.diagnostic.fileLogger +import com.jetbrains.python.PyToolUIInfo import com.jetbrains.python.psi.LanguageLevel import java.util.* @@ -21,9 +22,9 @@ object LanguageLevelComparator : Comparator { object UiComparator : Comparator { override fun compare(o1: UiHolder, o2: UiHolder): Int { if (logger.isDebugEnabled) { - logger.debug("ui ${o1.ui?.title} vs ${o2.ui?.title}") + logger.debug("ui ${o1.ui?.toolName} vs ${o2.ui?.toolName}") } - return Objects.compare(o1.ui, o2.ui, Comparator.nullsFirst(UICustomization::compareTo)) + return Objects.compare(o1.ui, o2.ui, Comparator.nullsFirst(PyToolUIInfo::compareTo)) } } @@ -36,4 +37,4 @@ class LanguageLevelWithUiComparator : Comparator where T : LanguageLevelHo } } -private fun T.string(): String where T : LanguageLevelHolder, T : UiHolder = "($languageLevel,${ui?.title})" +private fun T.string(): String where T : LanguageLevelHolder, T : UiHolder = "($languageLevel,${ui?.toolName})" diff --git a/python/services/shared/tests/com/intellij/python/junit5Tests/unit/comparators/ComparatorsTest.kt b/python/services/shared/tests/com/intellij/python/junit5Tests/unit/comparators/ComparatorsTest.kt index ed171e32e2a7..4d9a8a38236c 100644 --- a/python/services/shared/tests/com/intellij/python/junit5Tests/unit/comparators/ComparatorsTest.kt +++ b/python/services/shared/tests/com/intellij/python/junit5Tests/unit/comparators/ComparatorsTest.kt @@ -3,7 +3,7 @@ package com.intellij.python.junit5Tests.unit.comparators import com.intellij.python.community.services.shared.LanguageLevelHolder import com.intellij.python.community.services.shared.LanguageLevelWithUiComparator -import com.intellij.python.community.services.shared.UICustomization +import com.jetbrains.python.PyToolUIInfo import com.intellij.python.community.services.shared.UiHolder import com.jetbrains.python.psi.LanguageLevel import org.hamcrest.MatcherAssert @@ -18,9 +18,9 @@ class ComparatorsTest { val mocks = arrayOf( MockLevel(LanguageLevel.PYTHON314), MockLevel(LanguageLevel.PYTHON310), - MockLevel(LanguageLevel.PYTHON310, ui = UICustomization("A")), - MockLevel(LanguageLevel.PYTHON310, ui = UICustomization("Z")), - MockLevel(LanguageLevel.PYTHON310, ui = UICustomization("B")), + MockLevel(LanguageLevel.PYTHON310, ui = PyToolUIInfo("A")), + MockLevel(LanguageLevel.PYTHON310, ui = PyToolUIInfo("Z")), + MockLevel(LanguageLevel.PYTHON310, ui = PyToolUIInfo("B")), MockLevel(LanguageLevel.PYTHON27), MockLevel(LanguageLevel.PYTHON313), ) @@ -30,9 +30,9 @@ class ComparatorsTest { MockLevel(LanguageLevel.PYTHON314), MockLevel(LanguageLevel.PYTHON313), MockLevel(LanguageLevel.PYTHON310), - MockLevel(LanguageLevel.PYTHON310, ui = UICustomization("A")), - MockLevel(LanguageLevel.PYTHON310, ui = UICustomization("B")), - MockLevel(LanguageLevel.PYTHON310, ui = UICustomization("Z")), + MockLevel(LanguageLevel.PYTHON310, ui = PyToolUIInfo("A")), + MockLevel(LanguageLevel.PYTHON310, ui = PyToolUIInfo("B")), + MockLevel(LanguageLevel.PYTHON310, ui = PyToolUIInfo("Z")), MockLevel(LanguageLevel.PYTHON27) )) } @@ -40,5 +40,5 @@ class ComparatorsTest { private data class MockLevel( override val languageLevel: LanguageLevel, - override val ui: UICustomization? = null, + override val ui: PyToolUIInfo? = null, ) : LanguageLevelHolder, UiHolder \ No newline at end of file diff --git a/python/services/system-python/src/com/intellij/python/community/services/systemPython/api.kt b/python/services/system-python/src/com/intellij/python/community/services/systemPython/api.kt index 2ca110acdc0d..9ae61f1ceb4b 100644 --- a/python/services/system-python/src/com/intellij/python/community/services/systemPython/api.kt +++ b/python/services/system-python/src/com/intellij/python/community/services/systemPython/api.kt @@ -8,7 +8,7 @@ import com.intellij.platform.eel.provider.localEel import com.intellij.python.community.impl.venv.createVenv import com.intellij.python.community.services.shared.LanguageLevelWithUiComparator import com.intellij.python.community.services.shared.PythonWithUi -import com.intellij.python.community.services.shared.UICustomization +import com.jetbrains.python.PyToolUIInfo import com.intellij.python.community.services.shared.VanillaPythonWithLanguageLevel import com.jetbrains.python.PythonBinary import com.jetbrains.python.Result @@ -56,7 +56,7 @@ fun SystemPythonService(): SystemPythonService = ApplicationManager.getApplicati * * Instances could be obtained with [SystemPythonService] */ -class SystemPython internal constructor(private val delegate: VanillaPythonWithLanguageLevel, override val ui: UICustomization?) : VanillaPythonWithLanguageLevel by delegate, PythonWithUi, Comparable { +class SystemPython internal constructor(private val delegate: VanillaPythonWithLanguageLevel, override val ui: PyToolUIInfo?) : VanillaPythonWithLanguageLevel by delegate, PythonWithUi, Comparable { private companion object { val comparator = LanguageLevelWithUiComparator() diff --git a/python/services/system-python/src/com/intellij/python/community/services/systemPython/impl/providers/AsdfSystemProvider.kt b/python/services/system-python/src/com/intellij/python/community/services/systemPython/impl/providers/AsdfSystemProvider.kt index 823d79d9be2a..456b68d2ef46 100644 --- a/python/services/system-python/src/com/intellij/python/community/services/systemPython/impl/providers/AsdfSystemProvider.kt +++ b/python/services/system-python/src/com/intellij/python/community/services/systemPython/impl/providers/AsdfSystemProvider.kt @@ -6,7 +6,7 @@ import com.intellij.platform.eel.EelApi import com.intellij.platform.eel.getOrNull import com.intellij.platform.eel.path.EelPath import com.intellij.platform.eel.provider.asNioPath -import com.intellij.python.community.services.shared.UICustomization +import com.jetbrains.python.PyToolUIInfo import com.intellij.python.community.services.systemPython.icons.PythonCommunityServicesSystemPythonIcons import com.intellij.python.community.services.systemPython.SystemPythonProvider import com.jetbrains.python.PythonBinary @@ -56,9 +56,9 @@ private class AsdfSystemPythonProvider : SystemPythonProvider { return PyResult.success(pythons) } - override val uiCustomization: UICustomization? + override val uiCustomization: PyToolUIInfo? get() { // TODO: proper icon - return UICustomization(title = "asdf", icon = PythonCommunityServicesSystemPythonIcons.Asdf) + return PyToolUIInfo(toolName = "asdf", icon = PythonCommunityServicesSystemPythonIcons.Asdf) } } \ No newline at end of file diff --git a/python/services/system-python/src/com/intellij/python/community/services/systemPython/impl/providers/BrewSystemPythonProvider.kt b/python/services/system-python/src/com/intellij/python/community/services/systemPython/impl/providers/BrewSystemPythonProvider.kt index 2a86f82090a8..c37f4320a821 100644 --- a/python/services/system-python/src/com/intellij/python/community/services/systemPython/impl/providers/BrewSystemPythonProvider.kt +++ b/python/services/system-python/src/com/intellij/python/community/services/systemPython/impl/providers/BrewSystemPythonProvider.kt @@ -4,7 +4,7 @@ package com.intellij.python.community.services.systemPython.impl.providers import com.intellij.openapi.diagnostic.Logger import com.intellij.platform.eel.EelApi import com.intellij.platform.eel.isMac -import com.intellij.python.community.services.shared.UICustomization +import com.jetbrains.python.PyToolUIInfo import com.intellij.python.community.services.systemPython.icons.PythonCommunityServicesSystemPythonIcons import com.intellij.python.community.services.systemPython.SystemPythonProvider import com.jetbrains.python.PythonBinary @@ -37,9 +37,9 @@ private class BrewSystemPythonProvider : SystemPythonProvider { return PyResult.success(pythons) } - override val uiCustomization: UICustomization? + override val uiCustomization: PyToolUIInfo get() { // TODO: proper icon - return UICustomization(title = "homebrew", icon = PythonCommunityServicesSystemPythonIcons.Homebrew) + return PyToolUIInfo(toolName = "homebrew", icon = PythonCommunityServicesSystemPythonIcons.Homebrew) } } diff --git a/python/services/system-python/src/com/intellij/python/community/services/systemPython/impl/providers/MacSystemPythonProvider.kt b/python/services/system-python/src/com/intellij/python/community/services/systemPython/impl/providers/MacSystemPythonProvider.kt index 3e5ba4f4c4d0..47a3911d20f3 100644 --- a/python/services/system-python/src/com/intellij/python/community/services/systemPython/impl/providers/MacSystemPythonProvider.kt +++ b/python/services/system-python/src/com/intellij/python/community/services/systemPython/impl/providers/MacSystemPythonProvider.kt @@ -4,7 +4,7 @@ package com.intellij.python.community.services.systemPython.impl.providers import com.intellij.openapi.diagnostic.Logger import com.intellij.platform.eel.EelApi import com.intellij.platform.eel.isMac -import com.intellij.python.community.services.shared.UICustomization +import com.jetbrains.python.PyToolUIInfo import com.intellij.python.community.services.systemPython.SystemPythonProvider import com.jetbrains.python.PythonBinary import com.jetbrains.python.errorProcessing.PyResult @@ -51,7 +51,7 @@ private class MacSystemPythonProvider : SystemPythonProvider { return PyResult.success(pythons) } - override val uiCustomization: UICustomization? + override val uiCustomization: PyToolUIInfo? get() { // TODO: return null diff --git a/python/services/system-python/src/com/intellij/python/community/services/systemPython/impl/providers/PyenvSystemPythonProvider.kt b/python/services/system-python/src/com/intellij/python/community/services/systemPython/impl/providers/PyenvSystemPythonProvider.kt index 1f0223f687a4..cdfdb66328a1 100644 --- a/python/services/system-python/src/com/intellij/python/community/services/systemPython/impl/providers/PyenvSystemPythonProvider.kt +++ b/python/services/system-python/src/com/intellij/python/community/services/systemPython/impl/providers/PyenvSystemPythonProvider.kt @@ -6,7 +6,7 @@ import com.intellij.platform.eel.EelApi import com.intellij.platform.eel.getOrNull import com.intellij.platform.eel.path.EelPath import com.intellij.platform.eel.provider.asNioPath -import com.intellij.python.community.services.shared.UICustomization +import com.jetbrains.python.PyToolUIInfo import com.intellij.python.community.services.systemPython.icons.PythonCommunityServicesSystemPythonIcons import com.intellij.python.community.services.systemPython.SystemPythonProvider import com.jetbrains.python.PythonBinary @@ -56,9 +56,9 @@ private class PyenvSystemPythonProvider : SystemPythonProvider { return PyResult.success(pythons) } - override val uiCustomization: UICustomization? + override val uiCustomization: PyToolUIInfo? get() { // TODO: proper icon - return UICustomization(title = "pyenv", icon = PythonCommunityServicesSystemPythonIcons.Pyenv) + return PyToolUIInfo(toolName = "pyenv", icon = PythonCommunityServicesSystemPythonIcons.Pyenv) } } diff --git a/python/services/system-python/src/com/intellij/python/community/services/systemPython/impl/providers/UnixSystemPythonProvider.kt b/python/services/system-python/src/com/intellij/python/community/services/systemPython/impl/providers/UnixSystemPythonProvider.kt index 79de99b2d68a..5b22ddfd81d7 100644 --- a/python/services/system-python/src/com/intellij/python/community/services/systemPython/impl/providers/UnixSystemPythonProvider.kt +++ b/python/services/system-python/src/com/intellij/python/community/services/systemPython/impl/providers/UnixSystemPythonProvider.kt @@ -6,7 +6,7 @@ import com.intellij.platform.eel.EelApi import com.intellij.platform.eel.EelPlatform import com.intellij.platform.eel.isMac import com.intellij.python.community.services.systemPython.SystemPythonProvider -import com.intellij.python.community.services.shared.UICustomization +import com.jetbrains.python.PyToolUIInfo import com.jetbrains.python.PythonBinary import com.jetbrains.python.errorProcessing.PyResult import kotlinx.coroutines.Dispatchers @@ -48,7 +48,7 @@ private class UnixSystemPythonProvider : SystemPythonProvider { return PyResult.success(pythons) } - override val uiCustomization: UICustomization? + override val uiCustomization: PyToolUIInfo? get() { // TODO: return null diff --git a/python/services/system-python/src/com/intellij/python/community/services/systemPython/spi.kt b/python/services/system-python/src/com/intellij/python/community/services/systemPython/spi.kt index 15ea126b0b45..4f15337eb580 100644 --- a/python/services/system-python/src/com/intellij/python/community/services/systemPython/spi.kt +++ b/python/services/system-python/src/com/intellij/python/community/services/systemPython/spi.kt @@ -3,7 +3,7 @@ package com.intellij.python.community.services.systemPython import com.intellij.openapi.extensions.ExtensionPointName import com.intellij.platform.eel.EelApi -import com.intellij.python.community.services.shared.UICustomization +import com.jetbrains.python.PyToolUIInfo import com.intellij.python.community.services.systemPython.SystemPythonProvider.Companion.EP import com.jetbrains.python.PythonBinary import com.jetbrains.python.errorProcessing.PyResult @@ -19,7 +19,7 @@ interface SystemPythonProvider { /** * You can optionally customize how your pythons are displayed */ - val uiCustomization: UICustomization? get() = null + val uiCustomization: PyToolUIInfo? get() = null suspend fun findSystemPythons(eelApi: EelApi): PyResult> } \ No newline at end of file diff --git a/python/services/system-python/src/com/intellij/python/community/services/systemPython/systemPythonServiceImpl.kt b/python/services/system-python/src/com/intellij/python/community/services/systemPython/systemPythonServiceImpl.kt index 58618146b787..2135cf12f723 100644 --- a/python/services/system-python/src/com/intellij/python/community/services/systemPython/systemPythonServiceImpl.kt +++ b/python/services/system-python/src/com/intellij/python/community/services/systemPython/systemPythonServiceImpl.kt @@ -8,12 +8,11 @@ import com.intellij.openapi.diagnostic.fileLogger import com.intellij.openapi.util.registry.RegistryManager import com.intellij.platform.eel.EelApi import com.intellij.platform.eel.EelDescriptor -import com.intellij.platform.eel.EelMachine import com.intellij.platform.eel.provider.getEelDescriptor import com.intellij.platform.eel.provider.localEel import com.intellij.python.community.impl.installer.PySdkToInstallManager import com.intellij.python.community.services.internal.impl.VanillaPythonWithLanguageLevelImpl -import com.intellij.python.community.services.shared.UICustomization +import com.jetbrains.python.PyToolUIInfo import com.intellij.python.community.services.systemPython.SystemPythonServiceImpl.MyServiceState import com.intellij.python.community.services.systemPython.impl.Cache import com.intellij.python.community.services.systemPython.impl.PySystemPythonBundle @@ -107,7 +106,7 @@ internal class SystemPythonServiceImpl(scope: CoroutineScope) : SystemPythonServ private suspend fun searchPythonsPhysicallyNoCache(eelApi: EelApi): List = withContext(Dispatchers.IO) { findPythonsMutex.withLock { - val pythonsUi = mutableMapOf() + val pythonsUi = mutableMapOf() val pythonsFromExtensions = SystemPythonProvider.EP.extensionList .flatMap { provider -> diff --git a/python/services/system-python/tests/com/intellij/python/junit5Tests/env/systemPython/SystemPythonServiceShowCaseTest.kt b/python/services/system-python/tests/com/intellij/python/junit5Tests/env/systemPython/SystemPythonServiceShowCaseTest.kt index a7a9f080bd59..967c18dc5904 100644 --- a/python/services/system-python/tests/com/intellij/python/junit5Tests/env/systemPython/SystemPythonServiceShowCaseTest.kt +++ b/python/services/system-python/tests/com/intellij/python/junit5Tests/env/systemPython/SystemPythonServiceShowCaseTest.kt @@ -36,7 +36,7 @@ import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test import org.junit.jupiter.api.io.TempDir import com.intellij.platform.eel.EelApi -import com.intellij.python.community.services.shared.UICustomization +import com.jetbrains.python.PyToolUIInfo import com.jetbrains.python.PythonBinary import com.jetbrains.python.errorProcessing.PyResult import java.nio.file.Path @@ -120,7 +120,7 @@ class SystemPythonServiceShowCaseTest { private class CountingTestProvider( private val result: PyResult>, - override val uiCustomization: UICustomization? = null, + override val uiCustomization: PyToolUIInfo? = null, ) : SystemPythonProvider { var calls: Int = 0 override suspend fun findSystemPythons(eelApi: EelApi): PyResult> { diff --git a/python/services/system-python/tests/com/intellij/python/junit5Tests/env/systemPython/impl/EnvProviderTest.kt b/python/services/system-python/tests/com/intellij/python/junit5Tests/env/systemPython/impl/EnvProviderTest.kt index 7eee6f4b7331..cdb90fa415b4 100644 --- a/python/services/system-python/tests/com/intellij/python/junit5Tests/env/systemPython/impl/EnvProviderTest.kt +++ b/python/services/system-python/tests/com/intellij/python/junit5Tests/env/systemPython/impl/EnvProviderTest.kt @@ -4,7 +4,7 @@ package com.intellij.python.junit5Tests.env.systemPython.impl import com.intellij.openapi.Disposable import com.intellij.openapi.application.ApplicationManager import com.intellij.python.community.impl.venv.createVenv -import com.intellij.python.community.services.shared.UICustomization +import com.jetbrains.python.PyToolUIInfo import com.intellij.python.community.services.systemPython.SystemPythonProvider import com.intellij.python.community.services.systemPython.SystemPythonService import com.intellij.python.junit5Tests.framework.env.PyEnvTestCase @@ -17,7 +17,6 @@ import com.jetbrains.python.Result import com.jetbrains.python.getOrThrow import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers -import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test import org.junit.jupiter.api.io.TempDir @@ -48,7 +47,7 @@ class EnvProviderTest { @TempDir venvDir: Path, ): Unit = timeoutRunBlocking { val venvPython = createVenv(python, venvDir).getOrThrow() - val ui = UICustomization("myui") + val ui = PyToolUIInfo("myui") val provider = InlineTestProvider(setOf(venvPython), ui) ApplicationManager.getApplication().registerExtension(SystemPythonProvider.EP, provider, disposable) val python = SystemPythonService().findSystemPythons(forceRefresh = true).first { it.pythonBinary == venvPython } @@ -57,7 +56,7 @@ class EnvProviderTest { private class InlineTestProvider( private val pythons: Set, - override val uiCustomization: UICustomization? + override val uiCustomization: PyToolUIInfo? ) : SystemPythonProvider { override suspend fun findSystemPythons(eelApi: EelApi) = Result.success(pythons) } diff --git a/python/src/com/jetbrains/python/sdk/add/v2/models.kt b/python/src/com/jetbrains/python/sdk/add/v2/models.kt index f37a16603411..834653eb62d7 100644 --- a/python/src/com/jetbrains/python/sdk/add/v2/models.kt +++ b/python/src/com/jetbrains/python/sdk/add/v2/models.kt @@ -25,6 +25,7 @@ import com.intellij.python.pyproject.PyProjectToml import com.intellij.util.asDisposable import com.intellij.util.concurrency.annotations.RequiresEdt import com.jetbrains.python.PyBundle.message +import com.jetbrains.python.PyToolUIInfo import com.jetbrains.python.Result import com.jetbrains.python.Result.Companion.success import com.jetbrains.python.TraceContext @@ -348,7 +349,7 @@ sealed class PythonSelectableInterpreter : Comparable { icon = IconLoader.getTransparentIcon(interpreter.ui?.icon ?: PythonParserIcons.PythonFile) - val title = interpreter.ui?.title ?: message("sdk.rendering.detected.grey.text") + val title = interpreter.ui?.toolName ?: message("sdk.rendering.detected.grey.text") append(String.format("Python %-4s", interpreter.languageLevel)) append(" (" + replaceHomePathToTilde(interpreter.homePath) + ") $title", SimpleTextAttributes.GRAYED_SMALL_ATTRIBUTES) } diff --git a/python/src/com/jetbrains/python/sdk/uv/UvSystemPythonProvider.kt b/python/src/com/jetbrains/python/sdk/uv/UvSystemPythonProvider.kt index 63aa9791efe1..4536676ff866 100644 --- a/python/src/com/jetbrains/python/sdk/uv/UvSystemPythonProvider.kt +++ b/python/src/com/jetbrains/python/sdk/uv/UvSystemPythonProvider.kt @@ -3,7 +3,7 @@ package com.jetbrains.python.sdk.uv import com.intellij.platform.eel.EelApi import com.intellij.platform.eel.provider.localEel -import com.intellij.python.community.services.shared.UICustomization +import com.jetbrains.python.PyToolUIInfo import com.intellij.python.community.services.systemPython.SystemPythonProvider import com.jetbrains.python.PythonBinary import com.jetbrains.python.Result @@ -24,6 +24,5 @@ internal class UvSystemPythonProvider : SystemPythonProvider { return uv.listUvPythons() } - @Suppress("HardCodedStringLiteral") // tool name is untranslatable - override val uiCustomization: UICustomization = UICustomization("uv", PythonIcons.UV) + override val uiCustomization: PyToolUIInfo = PyToolUIInfo("uv", PythonIcons.UV) } \ No newline at end of file