Skip to content

Commit ab01bfc

Browse files
committed
Removed faked code that returned a list of component names.
Added TODO where the component name dropdown is created in mrc_call_python_function.
1 parent f635e79 commit ab01bfc

File tree

2 files changed

+3
-43
lines changed

2 files changed

+3
-43
lines changed

src/blocks/mrc_call_python_function.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,9 @@ const CALL_PYTHON_FUNCTION = {
539539
break;
540540
}
541541
case FunctionKind.INSTANCE_COMPONENT: {
542-
const componentNames = Editor.getComponentNames(this.workspace, this.mrcComponentClassName);
542+
// TODO: We need the list of component names for this.mrcComponentClassName so we can
543+
// create a dropdown that has the appropriate component names.
544+
const componentNames = [];
543545
const componentName = this.getComponentName();
544546
if (!componentNames.includes(componentName)) {
545547
componentNames.push(componentName);

src/editor/editor.ts

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -244,46 +244,4 @@ export class Editor {
244244
throw e;
245245
}
246246
}
247-
248-
private getComponentNamesImpl(componentClassName: string): string[] {
249-
if (!this.projectContent) {
250-
throw new Error('getComponentNames: this.projectContent is null.');
251-
}
252-
const components = commonStorage.extractComponents(this.projectContent);
253-
254-
// TODO(lizlooney): Remove this fake code after getComponents (above) has been implemented.
255-
components.push({name: 'frontTouch', className: 'rev_touch_sensor.RevTouchSensor'});
256-
components.push({name: 'backTouch', className: 'rev_touch_sensor.RevTouchSensor'});
257-
components.push({name: 'leftMotor', className: 'smart_motor.SmartMotor'});
258-
components.push({name: 'rightMotor', className: 'smart_motor.SmartMotor'});
259-
components.push({name: 'clawServo', className: 'servo.Servo'});
260-
components.push({name: 'colorSensor', className: 'color_range_sensor.ColorRangeSensor'});
261-
components.push({name: 'ledStick', className: 'sparkfun_led_stick.SparkFunLEDStick'});
262-
// End of fake code
263-
264-
const componentNames: string[] = [];
265-
components.forEach((component) => {
266-
if (component.className === componentClassName) {
267-
componentNames.push(component.name);
268-
}
269-
});
270-
return componentNames;
271-
}
272-
273-
public static getComponentNames(
274-
workspace: Blockly.Workspace, componentClassName: string): string[] {
275-
276-
let editor: Editor | null = null;
277-
if (workspace.id in Editor.workspaceIdToEditor) {
278-
editor = Editor.workspaceIdToEditor[workspace.id];
279-
} else {
280-
// If the workspace id was not found, it might be because the workspace is associated with the
281-
// toolbox flyout, not a real workspace. In that case, use the first editor.
282-
const allEditors = Object.values(Editor.workspaceIdToEditor);
283-
if (allEditors.length) {
284-
editor = allEditors[0];
285-
}
286-
}
287-
return editor ? editor.getComponentNamesImpl(componentClassName) : [];
288-
}
289247
}

0 commit comments

Comments
 (0)