diff --git a/python/python-features-trainer/resources/messages/PythonLessonsBundle.properties b/python/python-features-trainer/resources/messages/PythonLessonsBundle.properties
index 40a639daba46..0a8babaf8369 100644
--- a/python/python-features-trainer/resources/messages/PythonLessonsBundle.properties
+++ b/python/python-features-trainer/resources/messages/PythonLessonsBundle.properties
@@ -7,6 +7,8 @@ python.onboarding.module.name=Onboarding tour
python.onboarding.module.description=A brief overview of the main features in {0}.
python.onboarding.lesson.name=Get Acquainted with PyCharm
+python.onboarding.change.ui.settings=For this lesson, PyCharm changes some UI settings to the default state. \
+ Your preferences will be restored when you complete or exit the lesson.
python.onboarding.project.view.description=The Project view is one of the main tool windows. It contains the project directory, SDK-specific external libraries, and scratch files. Use the striped button to open it, and you will see a simple demo project. You can also open it by pressing {0}.
python.onboarding.balloon.project.view=Click to open the Project view
python.onboarding.balloon.project.directory=Expand the project directory to view the project files
diff --git a/python/python-features-trainer/src/com/jetbrains/python/ift/lesson/essensial/PythonOnboardingTour.kt b/python/python-features-trainer/src/com/jetbrains/python/ift/lesson/essensial/PythonOnboardingTour.kt
index 5d147f25a064..db22a94a9585 100644
--- a/python/python-features-trainer/src/com/jetbrains/python/ift/lesson/essensial/PythonOnboardingTour.kt
+++ b/python/python-features-trainer/src/com/jetbrains/python/ift/lesson/essensial/PythonOnboardingTour.kt
@@ -9,6 +9,7 @@ import com.intellij.icons.AllIcons
import com.intellij.ide.DataManager
import com.intellij.ide.actions.searcheverywhere.SearchEverywhereManagerImpl
import com.intellij.ide.actions.searcheverywhere.SearchEverywhereUI
+import com.intellij.ide.ui.UISettings
import com.intellij.ide.util.gotoByName.GotoActionModel
import com.intellij.idea.ActionsBundle
import com.intellij.openapi.actionSystem.ActionManager
@@ -87,6 +88,8 @@ class PythonOnboardingTour :
private val demoConfigurationName: String = "welcome"
private val demoFileName: String = "$demoConfigurationName.py"
+ private val uiSettings get() = UISettings.instance
+
override val properties = LessonProperties(
canStartInDumbMode = true,
openFileAtStart = false
@@ -95,6 +98,8 @@ class PythonOnboardingTour :
override val testScriptProperties = TaskTestContext.TestScriptProperties(skipTesting = true)
private var backupPopupLocation: Point? = null
+ private var hideToolStripesPreference = false
+ private var showNavigationBarPreference = true
val sample: LessonSample = parseLessonSample("""
def find_average(values):
@@ -121,6 +126,8 @@ class PythonOnboardingTour :
}
clearBreakpoints()
+ checkUiSettings()
+
projectTasks()
prepareSample(sample)
@@ -154,6 +161,11 @@ class PythonOnboardingTour :
override fun onLessonEnd(project: Project, lessonPassed: Boolean) {
restorePopupPosition(project, SearchEverywhereManagerImpl.LOCATION_SETTINGS_KEY, backupPopupLocation)
backupPopupLocation = null
+
+ uiSettings.hideToolStripes = hideToolStripesPreference
+ uiSettings.showNavigationBar = showNavigationBarPreference
+ uiSettings.fireUISettingsChanged()
+
if (!lessonPassed) return
val dataContextPromise = DataManager.getInstance().dataContextFromFocusAsync
invokeLater {
@@ -299,7 +311,6 @@ class PythonOnboardingTour :
}
task {
-
triggerByPartOfComponent(highlightInside = true, usePulsation = true) { ui: ActionToolbarImpl ->
ui.takeIf { (ui.place == ActionPlaces.NAVIGATION_BAR_TOOLBAR || ui.place == ActionPlaces.MAIN_TOOLBAR) }?.let {
val configurations = ui.components.find { it is JPanel && it.components.any { b -> b is ComboBoxAction.ComboBoxButton } }
@@ -350,6 +361,30 @@ class PythonOnboardingTour :
}
}
+
+ private fun LessonContext.checkUiSettings() {
+ hideToolStripesPreference = uiSettings.hideToolStripes
+ showNavigationBarPreference = uiSettings.showNavigationBar
+
+ if (!hideToolStripesPreference && (showNavigationBarPreference || uiSettings.showMainToolbar)) {
+ // a small hack to have same tasks count. It is needed to track statistics result.
+ task { }
+ task { }
+ return
+ }
+
+ task {
+ text(PythonLessonsBundle.message("python.onboarding.change.ui.settings"))
+ proceedLink()
+ }
+
+ prepareRuntimeTask {
+ uiSettings.hideToolStripes = false
+ uiSettings.showNavigationBar = true
+ uiSettings.fireUISettingsChanged()
+ }
+ }
+
private fun LessonContext.projectTasks() {
prepareRuntimeTask {
LessonUtil.hideStandardToolwindows(project)