From 42b6334183f57cd72c1d7485e3d4998b953e81a4 Mon Sep 17 00:00:00 2001 From: Aleksandr Sorotskii Date: Thu, 6 Feb 2025 12:20:15 +0100 Subject: [PATCH] pycharm uv support survey; #PY-78501 Fixed GitOrigin-RevId: 314259d784d9cbf471a661ee51aa337d312fd613 --- .../pluginCore/resources/META-INF/plugin.xml | 4 + .../messages/PyBundle.properties | 14 +++ .../statistics/feedback/UvSupportSurvey.kt | 106 ++++++++++++++++++ 3 files changed, 124 insertions(+) create mode 100644 python/src/com/jetbrains/python/statistics/feedback/UvSupportSurvey.kt diff --git a/python/pluginCore/resources/META-INF/plugin.xml b/python/pluginCore/resources/META-INF/plugin.xml index 38a1ffc6b2a6..8cc80f009188 100644 --- a/python/pluginCore/resources/META-INF/plugin.xml +++ b/python/pluginCore/resources/META-INF/plugin.xml @@ -651,6 +651,7 @@ The Python plug-in provides smart editing for Python scripts. The feature set of description="Try to detect and automatically set-up module dependencies in a multi-module project"/> + @@ -1019,6 +1020,9 @@ The Python plug-in provides smart editing for Python scripts. The feature set of text="Set PropertiesComponent Value" description="Set value in application-level PropertiesComponent"/> + + diff --git a/python/pluginResources/messages/PyBundle.properties b/python/pluginResources/messages/PyBundle.properties index 8fcb1e8a6017..aed8bb51322b 100644 --- a/python/pluginResources/messages/PyBundle.properties +++ b/python/pluginResources/messages/PyBundle.properties @@ -1587,3 +1587,17 @@ python.survey.user.job.dialog.blocks.checkbox.other=Other validation.invalid.name=Invalid name dialog.message.command.could.not.complete=Command could not be completed successfully. \ Please see the command's output for information about resolving this problem. + + +python.survey.uv.support.group=PyCharm uv Support Survey +python.survey.uv.support.title=uv Support Feedback +python.survey.uv.support.content=What do you think about uv support in PyCharm? + +python.survey.uv.support.dialog.title=uv Support Feedback +python.survey.uv.support.dialog.blocks.top=uv Support Feedback +python.survey.uv.support.blocks.radiobutton.group=What do you think about uv support in PyCharm? +python.survey.uv.support.blocks.radiobutton.group.good=It's good! +python.survey.uv.support.blocks.radiobutton.group.soso=So-so +python.survey.uv.support.blocks.radiobutton.group.bad=Really bad +python.survey.uv.support.blocks.radiobutton.group.notyet=Didn't try +python.survey.uv.support.blocks.textarea.group=Could you please explain? \ No newline at end of file diff --git a/python/src/com/jetbrains/python/statistics/feedback/UvSupportSurvey.kt b/python/src/com/jetbrains/python/statistics/feedback/UvSupportSurvey.kt new file mode 100644 index 000000000000..a6381e8b8f7b --- /dev/null +++ b/python/src/com/jetbrains/python/statistics/feedback/UvSupportSurvey.kt @@ -0,0 +1,106 @@ +// 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.statistics.feedback + +import com.intellij.openapi.actionSystem.AnAction +import com.intellij.openapi.actionSystem.AnActionEvent +import com.intellij.openapi.application.ApplicationInfo +import com.intellij.openapi.project.Project +import com.intellij.platform.feedback.FeedbackSurvey +import com.intellij.platform.feedback.InIdeFeedbackSurveyConfig +import com.intellij.platform.feedback.InIdeFeedbackSurveyType +import com.intellij.platform.feedback.dialog.BlockBasedFeedbackDialog +import com.intellij.platform.feedback.dialog.CommonFeedbackSystemData +import com.intellij.platform.feedback.dialog.SystemDataJsonSerializable +import com.intellij.platform.feedback.dialog.showFeedbackSystemInfoDialog +import com.intellij.platform.feedback.dialog.uiBlocks.FeedbackBlock +import com.intellij.platform.feedback.dialog.uiBlocks.RadioButtonGroupBlock +import com.intellij.platform.feedback.dialog.uiBlocks.RadioButtonItemData +import com.intellij.platform.feedback.dialog.uiBlocks.TextAreaBlock +import com.intellij.platform.feedback.dialog.uiBlocks.TopLabelBlock +import com.intellij.platform.feedback.impl.notification.RequestFeedbackNotification +import com.jetbrains.python.PyBundle.message +import kotlinx.datetime.LocalDate + +class UvSupportSurvey : InIdeFeedbackSurveyConfig { + private val suitableIdeVersion = "2025.1" + + override val surveyId: String = "python_uv_support_survey" + override val lastDayOfFeedbackCollection: LocalDate + get() = LocalDate(2025, 2, 15) + + override val requireIdeEAP: Boolean = true + + override fun checkIdeIsSuitable(): Boolean = true + + override fun updateStateAfterDialogClosedOk(project: Project) {} + override fun updateStateAfterNotificationShowed(project: Project) {} + + override fun checkExtraConditionSatisfied(project: Project): Boolean { + return suitableIdeVersion == ApplicationInfo.getInstance().shortVersion + } + + override fun createFeedbackDialog(project: Project, forTest: Boolean): BlockBasedFeedbackDialog { + return UvSupportSurveyDialog(project, forTest) + } + + override fun createNotification(project: Project, forTest: Boolean): RequestFeedbackNotification { + return RequestFeedbackNotification( + message("python.survey.uv.support.group"), + message("python.survey.uv.support.title"), + message("python.survey.uv.support.content"), + ) + } +} + +class UvSupportSurveyDialog( + project: Project?, + forTest: Boolean, +) : BlockBasedFeedbackDialog(project, forTest) { + + override val myFeedbackReportId: String + get() = "python_uv_support_survey" + + override val myTitle: String + get() = message("python.survey.uv.support.dialog.title") + + private val items = listOf( + RadioButtonItemData(message("python.survey.uv.support.blocks.radiobutton.group.good"), "good"), + RadioButtonItemData(message("python.survey.uv.support.blocks.radiobutton.group.soso"), "soso"), + RadioButtonItemData(message("python.survey.uv.support.blocks.radiobutton.group.bad"), "bad"), + RadioButtonItemData(message("python.survey.uv.support.blocks.radiobutton.group.notyet"), "notyet") + ) + + override val myBlocks: List + get() = listOf( + TopLabelBlock(message("python.survey.uv.support.dialog.blocks.top")), + RadioButtonGroupBlock( + message("python.survey.uv.support.blocks.radiobutton.group"), + items, + "python_uv_radiobutton"), + TextAreaBlock( + message("python.survey.uv.support.blocks.textarea.group"), + "python_uv_textarea") + ) + + override val mySystemInfoData: CommonFeedbackSystemData + get() = CommonFeedbackSystemData.getCurrentData() + + override val myShowFeedbackSystemInfoDialog: () -> Unit = { + showFeedbackSystemInfoDialog(myProject, mySystemInfoData) + } + + init { + init() + } +} + +class PythonShowUvSupportAction : AnAction() { + override fun actionPerformed(e: AnActionEvent) { + PythonUvSupportSurvey().showNotification(e.project!!, true) + } +} + +class PythonUvSupportSurvey : FeedbackSurvey() { + override val feedbackSurveyType: InIdeFeedbackSurveyType = + InIdeFeedbackSurveyType(UvSupportSurvey()) +} \ No newline at end of file