Skip to content

Commit 38872c1

Browse files
authored
Merge pull request #48 from lizlooney/pr_workspace_project
Change the "Workspace" terminology to "Project"
2 parents a07823c + 99464d6 commit 38872c1

File tree

10 files changed

+269
-266
lines changed

10 files changed

+269
-266
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ WARNING! This is not ready for use and is under heavy development of basic featu
1515
1. Mechanisms aren't limited to init
1616
2. Mechanisms aren't limited to only Robot or Mechanism class
1717
3. No way to specify whether an opmode is auto or teleop
18+
4. Since we changed the "Workspace" terminology to "Project", existing Workspaces are no longer supported. They can be deleted via the browser's Developer Tools - Application tab.

src/App.tsx

Lines changed: 128 additions & 128 deletions
Large diffs are not rendered by default.

src/blocks/mrc_call_python_function.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ type CallPythonFunctionExtraState = {
9090
actualFunctionName?: string,
9191
/**
9292
* True if this blocks refers to an exported function (for example, from a
93-
* user's Workspace).
93+
* user's Project).
9494
*/
9595
exportedFunction: boolean,
9696
};

src/blocks/mrc_get_python_variable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ type GetPythonVariableExtraState = {
118118
actualVariableName?: string,
119119
/**
120120
* True if this blocks refers to an exported variable (for example, from a
121-
* user's Workspace).
121+
* user's Project).
122122
*/
123123
exportedVariable: boolean,
124124
};

src/blocks/mrc_set_python_variable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ type SetPythonVariableExtraState = {
119119
actualVariableName?: string,
120120
/**
121121
* True if this blocks refers to an exported variable (for example, from a
122-
* user's Workspace).
122+
* user's Project).
123123
*/
124124
exportedVariable: boolean,
125125
};

src/editor/editor.ts

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ export class Editor {
3636
private blocklyWorkspace: Blockly.WorkspaceSvg;
3737
private currentModule: commonStorage.Module | null = null;
3838
private modulePath: string = '';
39-
private workspacePath: string = '';
39+
private projectPath: string = '';
4040
private moduleContent: string = '';
41-
private workspaceContent: string = '';
41+
private projectContent: string = '';
4242
private bindedOnChange: any = null;
4343
private toolbox: Blockly.utils.toolbox.ToolboxDefinition = EMPTY_TOOLBOX;
4444

@@ -59,11 +59,11 @@ export class Editor {
5959

6060
// TODO(lizlooney): As blocks are loaded, determine whether any blocks
6161
// 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
6363
// 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
6565
// OpMode, and then removes or changes the variable or function in the
66-
// Workspace.
66+
// Project.
6767

6868
// TODO(lizlooney): We will need a way to identify which variable or
6969
// function, other than by the variable name or function name, because the
@@ -74,15 +74,15 @@ export class Editor {
7474
// TODO(lizlooney): Look at blocks with type 'mrc_get_python_variable' or
7575
// 'mrc_set_python_variable', and where block.mrcExportedVariable === true.
7676
// 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.)
7878
// Check whether block.mrcActualVariableName matches any exportedBlock's
7979
// extraState.actualVariableName. If there is no match, put a warning on the
8080
// block.
8181

8282
// TODO(lizlooney): Look at blocks with type 'mrc_call_python_function' and
8383
// where block.mrcExportedFunction === true.
8484
// 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.)
8686
// Check whether block.mrcActualFunctionName matches any exportedBlock's
8787
// extraState.actualFunctionName. If there is no match, put a warning on the block.
8888
// If there is a match, check whether
@@ -106,13 +106,13 @@ export class Editor {
106106
this.currentModule = currentModule;
107107
if (currentModule) {
108108
this.modulePath = currentModule.modulePath;
109-
this.workspacePath = commonStorage.makeWorkspacePath(currentModule.workspaceName);
109+
this.projectPath = commonStorage.makeProjectPath(currentModule.projectName);
110110
} else {
111111
this.modulePath = '';
112-
this.workspacePath = '';
112+
this.projectPath = '';
113113
}
114114
this.moduleContent = '';
115-
this.workspaceContent = '';
115+
this.projectContent = '';
116116
this.clearBlocklyWorkspace();
117117

118118
if (currentModule) {
@@ -125,30 +125,30 @@ export class Editor {
125125
}
126126
if (moduleContent) {
127127
this.moduleContent = moduleContent;
128-
if (this.workspacePath === this.modulePath) {
129-
this.workspaceContent = moduleContent
128+
if (this.projectPath === this.modulePath) {
129+
this.projectContent = moduleContent
130130
}
131131

132-
// If both the workspace content and the module content have been
132+
// If both the project content and the module content have been
133133
// loaded, load the blocks into the blockly workspace.
134-
if (this.workspaceContent) {
134+
if (this.projectContent) {
135135
this.loadBlocksIntoBlocklyWorkspace();
136136
}
137137
}
138138
}
139139
);
140-
if (this.workspacePath !== this.modulePath) {
140+
if (this.projectPath !== this.modulePath) {
141141
storage.fetchModuleContent(
142-
this.workspacePath,
143-
(workspaceContent: string | null, errorMessage: string) => {
142+
this.projectPath,
143+
(projectContent: string | null, errorMessage: string) => {
144144
if (errorMessage) {
145145
alert(errorMessage);
146146
return;
147147
}
148-
if (workspaceContent) {
149-
this.workspaceContent = workspaceContent;
148+
if (projectContent) {
149+
this.projectContent = projectContent;
150150

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
152152
// blocks into the blockly workspace.
153153
if (this.moduleContent) {
154154
this.loadBlocksIntoBlocklyWorkspace();
@@ -189,22 +189,22 @@ export class Editor {
189189

190190
public updateToolbox(shownPythonToolboxCategories: Set<string>): void {
191191
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
194194
// the toolbox.
195195
this.setToolbox(getToolboxJSON([], shownPythonToolboxCategories));
196196
return;
197197
}
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.
201201
setTimeout(() => {
202202
this.updateToolbox(shownPythonToolboxCategories)
203203
}, 50);
204204
return;
205205
}
206206
const exportedBlocks = commonStorage.extractExportedBlocks(
207-
this.currentModule.workspaceName, this.workspaceContent);
207+
this.currentModule.projectName, this.projectContent);
208208
this.setToolbox(getToolboxJSON(exportedBlocks, shownPythonToolboxCategories));
209209
}
210210
}

src/editor/extended_python_generator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export class ExtendedPythonGenerator extends PythonGenerator {
160160
}
161161

162162
classParentFromModuleType(moduleType : string) : string{
163-
if(moduleType == commonStorage.MODULE_TYPE_WORKSPACE){
163+
if(moduleType == commonStorage.MODULE_TYPE_PROJECT){
164164
return "RobotBase";
165165
}
166166
if(moduleType == commonStorage.MODULE_TYPE_OPMODE){

0 commit comments

Comments
 (0)