From 5b6200ffd998f36686356b21800455e92ec9025a Mon Sep 17 00:00:00 2001 From: kimorkim Date: Wed, 22 Nov 2017 11:38:13 +0900 Subject: [PATCH] =?UTF-8?q?1.6.0=20qa=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/src/header.js | 41 +++++++++++++++++------------ src/renderer/src/native_controll.js | 16 +++++++++-- src/renderer/src/workspace.js | 12 ++++++++- 3 files changed, 49 insertions(+), 20 deletions(-) diff --git a/src/renderer/src/header.js b/src/renderer/src/header.js index bb11180d0..3d2c1336a 100644 --- a/src/renderer/src/header.js +++ b/src/renderer/src/header.js @@ -75,13 +75,12 @@ angular.module('workspace').controller('HeaderController', ['$scope', '$rootScop $scope.setWorkspaceMode = function (type) { var isPracticalCourse = localStorage.getItem('isPracticalCourse') === 'true'; - saveLocalStorageProject(); - if (isPracticalCourse && type === 'default') { - localStorage.setItem('isPracticalCourse', false); - Entry.plugin.reloadApplication(true); - } else if (!isPracticalCourse && type !== 'default') { - localStorage.setItem('isPracticalCourse', true); - Entry.plugin.reloadApplication(true); + if ((isPracticalCourse && type === 'default') || (!isPracticalCourse && type !== 'default')) { + $scope.setMode(0, ()=> { + localStorage.setItem('isPracticalCourse', !isPracticalCourse); + saveLocalStorageProject(); + Entry.plugin.reloadApplication(true); + }); } } @@ -133,18 +132,26 @@ angular.module('workspace').controller('HeaderController', ['$scope', '$rootScop } } - $scope.setMode = function (mode) { - if (myProject.programmingMode === mode) return; - applied = true; - if (mode === 1) { - var isShown = localStorage.getItem('python_manual'); - if (!isShown) { - $scope.showPythonTooltip(); - localStorage.setItem('python_manual', true); + $scope.setMode = function (mode, callback) { + var checkChange = true; + if (myProject.programmingMode !== mode) { + applied = true; + if (mode === 1) { + var isShown = localStorage.getItem('python_manual'); + if (!isShown) { + $scope.showPythonTooltip(); + localStorage.setItem('python_manual', true); + } + } + $scope._setMode(mode); + applied = false; + if (mode !== Entry.getMainWS().getMode()) { + checkChange = false; } } - $scope._setMode(mode); - applied = false; + if (checkChange && callback) { + callback(); + } }; $scope._setMode = function (mode) { diff --git a/src/renderer/src/native_controll.js b/src/renderer/src/native_controll.js index cabe9f11a..49d01371b 100644 --- a/src/renderer/src/native_controll.js +++ b/src/renderer/src/native_controll.js @@ -446,20 +446,32 @@ Entry.plugin = (function () { }); }); + localStorage.setItem('isPracticalCourse', jsonObj.isPracticalCourse); + var isPracticalCourse = !!jsonObj.isPracticalCourse; + if (isPracticalCourse) { + $('html').removeClass('default_mode'); + $('html').addClass('practical_course_mode'); + window.EntryStatic = require('./bower_components/entryjs/extern/util/static_mini.js').EntryStatic; + } else { + $('html').removeClass('practical_course_mode'); + $('html').addClass('default_mode'); + window.EntryStatic = require('./bower_components/entryjs/extern/util/static.js').EntryStatic; + } + if (jsonObj.objects[0] && jsonObj.objects[0].script.substr(0,4) === "