@@ -36,9 +36,9 @@ export class Editor {
36
36
private blocklyWorkspace : Blockly . WorkspaceSvg ;
37
37
private currentModule : commonStorage . Module | null = null ;
38
38
private modulePath : string = '' ;
39
- private workspacePath : string = '' ;
39
+ private projectPath : string = '' ;
40
40
private moduleContent : string = '' ;
41
- private workspaceContent : string = '' ;
41
+ private projectContent : string = '' ;
42
42
private bindedOnChange : any = null ;
43
43
private toolbox : Blockly . utils . toolbox . ToolboxDefinition = EMPTY_TOOLBOX ;
44
44
@@ -59,11 +59,11 @@ export class Editor {
59
59
60
60
// TODO(lizlooney): As blocks are loaded, determine whether any blocks
61
61
// are accessing variable or calling functions thar are defined in another
62
- // blocks file (like a Workspace ) and check whether the variable or function
62
+ // blocks file (like a Project ) and check whether the variable or function
63
63
// definition has changed. This might happen if the user defines a variable
64
- // or function in the Workspace , uses the variable or function in the
64
+ // or function in the Project , uses the variable or function in the
65
65
// OpMode, and then removes or changes the variable or function in the
66
- // Workspace .
66
+ // Project .
67
67
68
68
// TODO(lizlooney): We will need a way to identify which variable or
69
69
// function, other than by the variable name or function name, because the
@@ -74,15 +74,15 @@ export class Editor {
74
74
// TODO(lizlooney): Look at blocks with type 'mrc_get_python_variable' or
75
75
// 'mrc_set_python_variable', and where block.mrcExportedVariable === true.
76
76
// Look at block.mrcImportModule and get the exported blocks for that module.
77
- // (It should be the workspace and we already have the workspace content.)
77
+ // (It should be the project and we already have the project content.)
78
78
// Check whether block.mrcActualVariableName matches any exportedBlock's
79
79
// extraState.actualVariableName. If there is no match, put a warning on the
80
80
// block.
81
81
82
82
// TODO(lizlooney): Look at blocks with type 'mrc_call_python_function' and
83
83
// where block.mrcExportedFunction === true.
84
84
// Look at block.mrcImportModule and get the exported blocks for that module.
85
- // (It should be the workspace and we already have the workspace content.)
85
+ // (It should be the project and we already have the project content.)
86
86
// Check whether block.mrcActualFunctionName matches any exportedBlock's
87
87
// extraState.actualFunctionName. If there is no match, put a warning on the block.
88
88
// If there is a match, check whether
@@ -106,13 +106,13 @@ export class Editor {
106
106
this . currentModule = currentModule ;
107
107
if ( currentModule ) {
108
108
this . modulePath = currentModule . modulePath ;
109
- this . workspacePath = commonStorage . makeWorkspacePath ( currentModule . workspaceName ) ;
109
+ this . projectPath = commonStorage . makeProjectPath ( currentModule . projectName ) ;
110
110
} else {
111
111
this . modulePath = '' ;
112
- this . workspacePath = '' ;
112
+ this . projectPath = '' ;
113
113
}
114
114
this . moduleContent = '' ;
115
- this . workspaceContent = '' ;
115
+ this . projectContent = '' ;
116
116
this . clearBlocklyWorkspace ( ) ;
117
117
118
118
if ( currentModule ) {
@@ -125,30 +125,30 @@ export class Editor {
125
125
}
126
126
if ( moduleContent ) {
127
127
this . moduleContent = moduleContent ;
128
- if ( this . workspacePath === this . modulePath ) {
129
- this . workspaceContent = moduleContent
128
+ if ( this . projectPath === this . modulePath ) {
129
+ this . projectContent = moduleContent
130
130
}
131
131
132
- // If both the workspace content and the module content have been
132
+ // If both the project content and the module content have been
133
133
// loaded, load the blocks into the blockly workspace.
134
- if ( this . workspaceContent ) {
134
+ if ( this . projectContent ) {
135
135
this . loadBlocksIntoBlocklyWorkspace ( ) ;
136
136
}
137
137
}
138
138
}
139
139
) ;
140
- if ( this . workspacePath !== this . modulePath ) {
140
+ if ( this . projectPath !== this . modulePath ) {
141
141
storage . fetchModuleContent (
142
- this . workspacePath ,
143
- ( workspaceContent : string | null , errorMessage : string ) => {
142
+ this . projectPath ,
143
+ ( projectContent : string | null , errorMessage : string ) => {
144
144
if ( errorMessage ) {
145
145
alert ( errorMessage ) ;
146
146
return ;
147
147
}
148
- if ( workspaceContent ) {
149
- this . workspaceContent = workspaceContent ;
148
+ if ( projectContent ) {
149
+ this . projectContent = projectContent ;
150
150
151
- // If both the workspace and the module have been loaded, load the
151
+ // If both the project and the module have been loaded, load the
152
152
// blocks into the blockly workspace.
153
153
if ( this . moduleContent ) {
154
154
this . loadBlocksIntoBlocklyWorkspace ( ) ;
@@ -189,22 +189,22 @@ export class Editor {
189
189
190
190
public updateToolbox ( shownPythonToolboxCategories : Set < string > ) : void {
191
191
if ( this . currentModule ) {
192
- if ( this . currentModule . moduleType === commonStorage . MODULE_TYPE_WORKSPACE ) {
193
- // If we are editing a Workspace , we don't add any additional blocks to
192
+ if ( this . currentModule . moduleType === commonStorage . MODULE_TYPE_PROJECT ) {
193
+ // If we are editing a Project , we don't add any additional blocks to
194
194
// the toolbox.
195
195
this . setToolbox ( getToolboxJSON ( [ ] , shownPythonToolboxCategories ) ) ;
196
196
return ;
197
197
}
198
- // Otherwise, we add the exported blocks from the Workspace .
199
- if ( ! this . workspaceContent ) {
200
- // The workspace content hasn't been fetched yet. Try again in a bit.
198
+ // Otherwise, we add the exported blocks from the Project .
199
+ if ( ! this . projectContent ) {
200
+ // The Project content hasn't been fetched yet. Try again in a bit.
201
201
setTimeout ( ( ) => {
202
202
this . updateToolbox ( shownPythonToolboxCategories )
203
203
} , 50 ) ;
204
204
return ;
205
205
}
206
206
const exportedBlocks = commonStorage . extractExportedBlocks (
207
- this . currentModule . workspaceName , this . workspaceContent ) ;
207
+ this . currentModule . projectName , this . projectContent ) ;
208
208
this . setToolbox ( getToolboxJSON ( exportedBlocks , shownPythonToolboxCategories ) ) ;
209
209
}
210
210
}
0 commit comments