1+ /*
2+ * Project Name : Visual Python
3+ * Description : GUI-based Python code generator
4+ * File Name : instance.js
5+ * Author : Black Logic
6+ * Note : Instance app
7+ * License : GNU GPLv3 with Visual Python special exception
8+ * Date : 2021. 10. 05
9+ * Change Date :
10+ */
11+
112define ( [
213 'require'
314 , 'jquery'
@@ -80,22 +91,6 @@ define([
8091
8192 // 옵션 속성 할당.
8293 varPackage . setOptionProp ( funcOptProp ) ;
83-
84- // load metadata
85- // if (meta != undefined && meta.options != undefined) {
86- // try {
87- // var leftMeta = decodeURIComponent(meta.options[0].value);
88- // var rightMeta = decodeURIComponent(meta.options[1].value);
89-
90- // var leftBlocks = JSON.parse(leftMeta);
91- // var rightBlocks = JSON.parse(rightMeta);
92-
93- // varPackage.state.left.board.loadBoard(leftBlocks);
94- // varPackage.state.right.board.loadBoard(rightBlocks);
95- // } catch {
96- // ;
97- // }
98- // }
9994
10095 // html 설정.
10196 varPackage . initHtml ( ) ;
@@ -129,11 +124,6 @@ define([
129124 subsetEditor : undefined ,
130125 codeEditor : undefined ,
131126 stack : [ ]
132- }
133- , allocate : {
134- subsetEditor : undefined ,
135- codeEditor : undefined ,
136- stack : [ ]
137127 } ,
138128 selectedBox : 'variable'
139129 }
@@ -189,31 +179,32 @@ define([
189179 $ ( '.vp-instance-box.variable .CodeMirror' ) . addClass ( 'selected' ) ;
190180
191181 // allocate - codemirror
192- this . state . allocate . codeEditor = CodeMirror . fromTextArea ( $ ( this . wrapSelector ( '#vp_instanceAllocate' ) ) [ 0 ] , this . cmconfig ) ;
193- this . updateValue ( 'allocate' , '' ) ;
182+ // this.state.allocate.codeEditor = CodeMirror.fromTextArea($(this.wrapSelector('#vp_instanceAllocate'))[0], this.cmconfig);
183+ // this.updateValue('allocate', '');
194184
195185 // load metadata
196186 var variable = this . getMetadata ( 'vp_instanceVariable' ) ;
197187 var allocate = this . getMetadata ( 'vp_instanceAllocate' ) ;
198188 this . updateValue ( 'variable' , variable ) ;
199- this . updateValue ( 'allocate' , allocate ) ;
189+ $ ( this . wrapSelector ( '#vp_instanceAllocate' ) ) . val ( allocate ) ;
190+ // this.updateValue('allocate', allocate);
200191
201192 // vpSubsetEditor
202193 this . state . variable . subsetEditor = new vpSubsetEditor ( this , "vp_instanceVariable" , true ) ;
203- this . state . allocate . subsetEditor = new vpSubsetEditor ( this , "vp_instanceAllocate" , true ) ;
194+ // this.state.allocate.subsetEditor = new vpSubsetEditor(this, "vp_instanceAllocate", true);
204195 this . state . variable . subsetEditor . disableButton ( ) ;
205- this . state . allocate . subsetEditor . disableButton ( ) ;
196+ // this.state.allocate.subsetEditor.disableButton();
206197
207198 this . ALLOW_SUBSET_TYPES = that . pointer . subsetEditor . getAllowSubsetTypes ( ) ;
208199
209200 // vpInstanceEditor
210201 this . state . variable . insEditor = new vpInstanceEditor ( this , "vp_instanceVariable" , 'vp_variableInsEditContainer' ) ;
211202
212203 // vpInstanceEditor
213- this . state . allocate . insEditor = new vpInstanceEditor ( this , "vp_instanceAllocate" , 'vp_allocateInsEditContainer' ) ;
204+ // this.state.allocate.insEditor = new vpInstanceEditor(this, "vp_instanceAllocate", 'vp_allocateInsEditContainer');
214205
215206 that . state . variable . insEditor . show ( ) ;
216- that . state . allocate . insEditor . show ( ) ;
207+ // that.state.allocate.insEditor.show();
217208
218209 // variable load
219210 that . reloadInsEditor ( ) ;
@@ -253,14 +244,10 @@ define([
253244 $ ( that . wrapSelector ( '.CodeMirror' ) ) . removeClass ( 'selected' ) ;
254245 if ( insEditorType == 'variable' ) {
255246 // variable
256- // that.state.variable.insEditor.show();
257- // that.state.allocate.insEditor.hide();
258247 that . pointer = that . state . variable ;
259248 $ ( that . wrapSelector ( '.variable .CodeMirror' ) ) . addClass ( 'selected' ) ;
260249 } else if ( insEditorType == 'allocate' ) {
261250 // allocate
262- // that.state.variable.insEditor.hide();
263- // that.state.allocate.insEditor.show();
264251 that . pointer = that . state . allocate ;
265252 $ ( that . wrapSelector ( '.allocate .CodeMirror' ) ) . addClass ( 'selected' ) ;
266253 } else {
@@ -293,20 +280,14 @@ define([
293280
294281 if ( insEditorType == 'variable' ) {
295282 // variable
296- // that.state.variable.insEditor.show();
297- // that.state.allocate.insEditor.hide();
298283 that . state . selectedBox = 'variable' ;
299284 that . pointer = that . state . variable ;
300285 } else if ( insEditorType == 'allocate' ) {
301286 // allocate
302- // that.state.variable.insEditor.hide();
303- // that.state.allocate.insEditor.show();
304287 that . state . selectedBox = 'allocate' ;
305288 that . pointer = that . state . allocate ;
306289 } else {
307290 that . state . selectedBox = '' ;
308- // that.state.variable.insEditor.hide();
309- // that.state.allocate.insEditor.hide();
310291 }
311292 } ) ;
312293
@@ -327,19 +308,6 @@ define([
327308 that . reloadInsEditor ( 'variable' ) ;
328309 } ) ;
329310
330- // instance_editor_selected - allocate
331- $ ( document ) . on ( 'instance_editor_selected' , this . wrapSelector ( '#vp_instanceAllocate' ) , function ( event ) {
332- that . addStack ( ) ;
333-
334- var nowCode = that . state . allocate . codeEditor . getValue ( ) ;
335- if ( nowCode != '' ) {
336- nowCode += '.'
337- }
338- var selectedVariable = event . varName ;
339- that . updateValue ( 'allocate' , nowCode + selectedVariable ) ;
340- that . reloadInsEditor ( 'allocate' ) ;
341- } ) ;
342-
343311 // instance_editor_replaced - variable
344312 $ ( document ) . on ( 'instance_editor_replaced' , this . wrapSelector ( '#vp_instanceVariable' ) , function ( event ) {
345313 that . addStack ( ) ;
@@ -348,15 +316,6 @@ define([
348316 that . updateValue ( 'variable' , newCode ) ;
349317 that . reloadInsEditor ( 'variable' ) ;
350318 } ) ;
351-
352- // instance_editor_replaced - allocate
353- $ ( document ) . on ( 'instance_editor_replaced' , this . wrapSelector ( '#vp_instanceAllocate' ) , function ( event ) {
354- that . addStack ( ) ;
355-
356- var newCode = event . newCode ;
357- that . updateValue ( 'allocate' , newCode ) ;
358- that . reloadInsEditor ( 'allocate' ) ;
359- } ) ;
360319 }
361320
362321 VariablePackage . prototype . updateValue = function ( type , value ) {
@@ -421,7 +380,8 @@ define([
421380 var sbCode = new sb . StringBuilder ( ) ;
422381
423382 // 변수 내용 조회
424- var leftCode = this . state . allocate . codeEditor . getValue ( ) ;
383+ // var leftCode = this.state.allocate.codeEditor.getValue();
384+ var leftCode = $ ( this . wrapSelector ( '#vp_instanceAllocate' ) ) . val ( ) ;
425385 var rightCode = this . state . variable . codeEditor . getValue ( ) ;
426386 if ( leftCode && leftCode != '' ) {
427387 sbCode . appendFormat ( '{0} = {1}' , leftCode , rightCode ) ;
0 commit comments