fixup! fixup! [python] PY-84973 Create venv implicitly for welcome project

(cherry picked from commit 2dd868999e535b66fad598e2e27bdbac07acba2c)

IJ-MR-179754

GitOrigin-RevId: 2a4bb84055726c52c49b806df7b49f2a9c54e52b
This commit is contained in:
Alexey Katsman
2025-10-24 15:24:13 +00:00
committed by intellij-monorepo-bot
parent b8131c9d1e
commit 725f5752ab
@@ -1,15 +1,19 @@
// 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.pycharm.community.ide.impl.welcomeScreen
import com.intellij.openapi.diagnostic.thisLogger
import com.intellij.openapi.application.EDT
import com.intellij.openapi.project.Project
import com.intellij.openapi.project.ex.ProjectEx
import com.intellij.openapi.ui.MessageDialogBuilder
import com.intellij.openapi.wm.ex.WelcomeScreenProjectProvider
import com.intellij.platform.PlatformProjectOpenProcessor
import com.intellij.pycharm.community.ide.impl.PyCharmCommunityCustomizationBundle
import com.intellij.pycharm.community.ide.impl.miscProject.impl.MISC_PROJECT_NAME
import com.intellij.pycharm.community.ide.impl.miscProject.impl.MISC_PROJECT_WITH_WELCOME_NAME
import com.intellij.pycharm.community.ide.impl.miscProject.impl.miscProjectDefaultPath
import com.jetbrains.python.projectCreation.createVenvAndSdk
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import java.nio.file.Path
private class PyCharmWelcomeScreenProjectProvider : WelcomeScreenProjectProvider() {
@@ -35,7 +39,14 @@ private class PyCharmWelcomeScreenProjectProvider : WelcomeScreenProjectProvider
}
if (PlatformProjectOpenProcessor.isNewProject(project)) {
createVenvAndSdk(project)
createVenvAndSdk(project, confirmInstallation = {
withContext(Dispatchers.EDT) {
MessageDialogBuilder.yesNo(
PyCharmCommunityCustomizationBundle.message("misc.no.python.found"),
PyCharmCommunityCustomizationBundle.message("misc.install.python.question")
).ask(project)
}
})
}
return project
}