diff --git a/python/educational-core/course-creator/resources/META-INF/plugin.xml b/python/educational-core/course-creator/resources/META-INF/plugin.xml
index 94c1704c0429..313a484685ad 100644
--- a/python/educational-core/course-creator/resources/META-INF/plugin.xml
+++ b/python/educational-core/course-creator/resources/META-INF/plugin.xml
@@ -54,7 +54,7 @@
-
+
diff --git a/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCChangeCourseInfo.java b/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCChangeCourseInfo.java
index 9b0839dacaa6..4552161cdb91 100644
--- a/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCChangeCourseInfo.java
+++ b/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCChangeCourseInfo.java
@@ -19,7 +19,6 @@ import javax.swing.*;
import java.awt.*;
public class CCChangeCourseInfo extends DumbAwareAction {
-
private static final String ACTION_TEXT = "Change Course Information";
public CCChangeCourseInfo() {
@@ -61,15 +60,21 @@ public class CCChangeCourseInfo extends DumbAwareAction {
CCNewProjectPanel panel =
new CCNewProjectPanel(course.getName(), Course.getAuthorsString(course.getAuthors()), course.getDescription());
+ setupLanguageLevels(course, panel);
DialogBuilder builder = createChangeInfoDialog(project, panel);
if (builder.showAndGet()) {
course.setAuthors(panel.getAuthors());
course.setName(panel.getName());
course.setDescription(panel.getDescription());
+ setVersion(course, panel);
ProjectView.getInstance(project).refresh();
}
}
+ protected void setVersion(Course course, CCNewProjectPanel panel) {}
+
+ protected void setupLanguageLevels(Course course, CCNewProjectPanel panel) {}
+
private static DialogBuilder createChangeInfoDialog(Project project, @NotNull CCNewProjectPanel panel) {
DialogBuilder builder = new DialogBuilder(project);
diff --git a/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/ui/CCNewProjectPanel.form b/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/ui/CCNewProjectPanel.form
index 7d27d1116c6d..a38d52649a60 100644
--- a/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/ui/CCNewProjectPanel.form
+++ b/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/ui/CCNewProjectPanel.form
@@ -15,7 +15,7 @@
-
+
@@ -53,7 +53,7 @@
-
+
diff --git a/python/educational-python/course-creator-python/src/com/jetbrains/edu/coursecreator/PyCCChangeCourseInfo.java b/python/educational-python/course-creator-python/src/com/jetbrains/edu/coursecreator/PyCCChangeCourseInfo.java
new file mode 100644
index 000000000000..5845edc0ffc2
--- /dev/null
+++ b/python/educational-python/course-creator-python/src/com/jetbrains/edu/coursecreator/PyCCChangeCourseInfo.java
@@ -0,0 +1,47 @@
+package com.jetbrains.edu.coursecreator;
+
+import com.intellij.openapi.ui.ComboBox;
+import com.jetbrains.edu.coursecreator.actions.CCChangeCourseInfo;
+import com.jetbrains.edu.coursecreator.ui.CCNewProjectPanel;
+import com.jetbrains.edu.learning.courseFormat.Course;
+import com.jetbrains.python.PythonLanguage;
+
+import javax.swing.*;
+
+import static com.jetbrains.edu.learning.PyStudyLanguageManager.PYTHON_2;
+import static com.jetbrains.edu.learning.PyStudyLanguageManager.PYTHON_3;
+
+public class PyCCChangeCourseInfo extends CCChangeCourseInfo {
+ public static final String ALL_VERSIONS = "All versions";
+
+ public PyCCChangeCourseInfo() {
+ super();
+ }
+
+ protected void setVersion(Course course, CCNewProjectPanel panel) {
+ String version = panel.getLanguageVersion();
+ String language = PythonLanguage.getInstance().getID();
+ if (version != null && !ALL_VERSIONS.equals(version)) {
+ language += " " + version;
+ }
+ course.setLanguage(language);
+ }
+
+ protected void setupLanguageLevels(Course course, CCNewProjectPanel panel) {
+ JLabel languageLevelLabel = panel.getLanguageLevelLabel();
+ languageLevelLabel.setText("Python:");
+ languageLevelLabel.setVisible(true);
+ ComboBox languageLevelCombobox = panel.getLanguageLevelCombobox();
+ languageLevelCombobox.addItem(ALL_VERSIONS);
+ languageLevelCombobox.addItem(PYTHON_3);
+ languageLevelCombobox.addItem(PYTHON_2);
+ languageLevelCombobox.setVisible(true);
+ final String version = course.getLanguageVersion();
+ if (version != null) {
+ languageLevelCombobox.setSelectedItem(version);
+ }
+ else {
+ languageLevelCombobox.setSelectedItem(ALL_VERSIONS);
+ }
+ }
+}
diff --git a/python/educational-python/course-creator-python/src/com/jetbrains/edu/coursecreator/PyCCProjectGenerator.java b/python/educational-python/course-creator-python/src/com/jetbrains/edu/coursecreator/PyCCProjectGenerator.java
index dfe93ef62c2e..29b7c31b6493 100644
--- a/python/educational-python/course-creator-python/src/com/jetbrains/edu/coursecreator/PyCCProjectGenerator.java
+++ b/python/educational-python/course-creator-python/src/com/jetbrains/edu/coursecreator/PyCCProjectGenerator.java
@@ -12,7 +12,6 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.project.Project;
-import com.intellij.openapi.ui.ComboBox;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.platform.DirectoryProjectGenerator;
@@ -28,7 +27,6 @@ import com.jetbrains.edu.learning.courseFormat.Course;
import com.jetbrains.edu.learning.statistics.EduUsagesCollector;
import com.jetbrains.python.PythonLanguage;
import com.jetbrains.python.newProject.PythonProjectGenerator;
-import com.jetbrains.python.psi.LanguageLevel;
import icons.CourseCreatorPythonIcons;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
@@ -40,9 +38,6 @@ import java.io.File;
public class PyCCProjectGenerator extends PythonProjectGenerator implements DirectoryProjectGenerator {
private static final Logger LOG = Logger.getInstance(PyCCProjectGenerator.class);
- public static final String ALL_VERSIONS = "All versions";
- public static final String PYTHON_3 = "3x";
- public static final String PYTHON_2 = "2x";
private CCNewProjectPanel mySettingsPanel;
@Nls
@@ -104,10 +99,6 @@ public class PyCCProjectGenerator extends PythonProjectGenerator implements Dire
course.setDescription(settingsPanel.getDescription());
String language = PythonLanguage.getInstance().getID();
- String version = settingsPanel.getLanguageVersion();
- if (version != null && !ALL_VERSIONS.equals(version)) {
- language += " " + version;
- }
course.setLanguage(language);
course.setCourseMode(CCUtils.COURSE_MODE);
@@ -134,7 +125,6 @@ public class PyCCProjectGenerator extends PythonProjectGenerator implements Dire
@Override
public JPanel extendBasePanel() throws ProcessCanceledException {
mySettingsPanel = new CCNewProjectPanel();
- setupLanguageLevels(mySettingsPanel);
mySettingsPanel.registerValidators(new FacetValidatorsManager() {
public void registerValidator(FacetEditorValidator validator, JComponent... componentsToWatch) {
throw new UnsupportedOperationException();
@@ -147,17 +137,4 @@ public class PyCCProjectGenerator extends PythonProjectGenerator implements Dire
return mySettingsPanel.getMainPanel();
}
- private static void setupLanguageLevels(CCNewProjectPanel panel) {
- JLabel languageLevelLabel = panel.getLanguageLevelLabel();
- languageLevelLabel.setText("Python:");
- languageLevelLabel.setVisible(true);
- ComboBox languageLevelCombobox = panel.getLanguageLevelCombobox();
- languageLevelCombobox.addItem(ALL_VERSIONS);
- languageLevelCombobox.addItem(PYTHON_3);
- languageLevelCombobox.addItem(PYTHON_2);
- for (LanguageLevel level : LanguageLevel.values()) {
- languageLevelCombobox.addItem(level.toString());
- }
- languageLevelCombobox.setVisible(true);
- }
}
diff --git a/python/educational-python/student-python/src/com/jetbrains/edu/learning/PyStudyDirectoryProjectGenerator.java b/python/educational-python/student-python/src/com/jetbrains/edu/learning/PyStudyDirectoryProjectGenerator.java
index 2e7288b30701..2da13df60a45 100644
--- a/python/educational-python/student-python/src/com/jetbrains/edu/learning/PyStudyDirectoryProjectGenerator.java
+++ b/python/educational-python/student-python/src/com/jetbrains/edu/learning/PyStudyDirectoryProjectGenerator.java
@@ -221,8 +221,8 @@ public class PyStudyDirectoryProjectGenerator extends PythonProjectGenerator imp
LanguageLevel baseLevel = LanguageLevel.PYTHON30;
if (course != null) {
final String version = course.getLanguageVersion();
- if (version != null) {
- baseLevel = LanguageLevel.fromPythonVersion(version);
+ if (PyStudyLanguageManager.PYTHON_2.equals(version)) {
+ baseLevel = LanguageLevel.PYTHON27;
}
}
final PythonSdkFlavor flavor = PythonSdkFlavor.getApplicableFlavors(false).get(0);
diff --git a/python/educational-python/student-python/src/com/jetbrains/edu/learning/PyStudyLanguageManager.java b/python/educational-python/student-python/src/com/jetbrains/edu/learning/PyStudyLanguageManager.java
index 5cb6c220d3fc..5eb4b81436e2 100644
--- a/python/educational-python/student-python/src/com/jetbrains/edu/learning/PyStudyLanguageManager.java
+++ b/python/educational-python/student-python/src/com/jetbrains/edu/learning/PyStudyLanguageManager.java
@@ -4,6 +4,8 @@ import com.jetbrains.edu.learning.core.EduNames;
import org.jetbrains.annotations.NotNull;
public class PyStudyLanguageManager implements StudyLanguageManager {
+ public static final String PYTHON_3 = "3.x";
+ public static final String PYTHON_2 = "2.x";
@NotNull
@Override