Skip to content

Commit ce70894

Browse files
authored
Moved types for reading python JSON files from robotpy_data.ts to python_json_types.ts. (#116)
Moved function initialize from robotpy_initialize.ts to python.ts. Update generated json file for robotpy. Add generated json file for external samples.
1 parent a335606 commit ce70894

14 files changed

+3258
-486
lines changed

src/App.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import * as commonStorage from './storage/common_storage';
4444
import * as clientSideStorage from './storage/client_side_storage';
4545

4646
import * as CustomBlocks from './blocks/setup_custom_blocks';
47-
import { initialize as initializeRobotPyBlocks } from './blocks/utils/robotpy_initialize';
47+
import { initialize as initializePythonBlocks } from './blocks/utils/python';
4848
import * as ChangeFramework from './blocks/utils/change_framework'
4949
import { mutatorOpenListener } from './blocks/mrc_class_method_def'
5050

@@ -66,7 +66,6 @@ const App: React.FC = () => {
6666
React.useEffect(() => {
6767
openStorage();
6868
initializeBlocks();
69-
//testAllBlocksInToolbox(toolbox.getToolboxJSON([], []).contents);
7069
}, []);
7170

7271
React.useEffect(() => {
@@ -133,7 +132,7 @@ const App: React.FC = () => {
133132
CustomBlocks.setup(forBlock);
134133
Object.assign(pythonGenerator.forBlock, forBlock);
135134
Object.assign(extendedPythonGenerator.forBlock, pythonGenerator.forBlock);
136-
initializeRobotPyBlocks();
135+
initializePythonBlocks();
137136
};
138137

139138
const initializeShownPythonToolboxCategories = async () => {

src/blocks/mrc_call_python_function.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { Order } from 'blockly/python';
2525

2626
import { ClassMethodDefExtraState } from './mrc_class_method_def'
2727
import { getAllowedTypesForSetCheck, getOutputCheck } from './utils/python';
28-
import { FunctionData } from './utils/robotpy_data';
28+
import { FunctionData } from './utils/python_json_types';
2929
import * as value from './utils/value';
3030
import * as variable from './utils/variable';
3131
import { Editor } from '../editor/editor';

src/blocks/mrc_get_python_enum_value.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import * as Blockly from 'blockly';
2424
import { Order } from 'blockly/python';
2525

2626
import { getOutputCheck } from './utils/python';
27-
import { EnumData } from './utils/robotpy_data';
27+
import { EnumData } from './utils/python_json_types';
2828
import { ExtendedPythonGenerator } from '../editor/extended_python_generator';
2929
import { createFieldDropdown } from '../fields/FieldDropdown';
3030
import { createFieldNonEditableText } from '../fields/FieldNonEditableText';

src/blocks/mrc_get_python_variable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {
2727
createModuleOrClassVariableSetterBlock,
2828
createInstanceVariableSetterBlock } from '../blocks/mrc_set_python_variable';
2929
import { getAllowedTypesForSetCheck, getOutputCheck } from './utils/python';
30-
import { VariableGettersAndSetters } from './utils/robotpy_data';
30+
import { VariableGettersAndSetters } from './utils/python_json_types';
3131
import * as variable from './utils/variable';
3232
import { ExtendedPythonGenerator } from '../editor/extended_python_generator';
3333
import { createFieldDropdown } from '../fields/FieldDropdown';
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* @license
3+
* Copyright 2025 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/**
19+
* @author [email protected] (Liz Looney)
20+
*/
21+
22+
import { PythonData } from './python_json_types';
23+
import generatedExternalSamplesData from './generated/external_samples_data.json';
24+
25+
export const externalSamplesData = generatedExternalSamplesData as PythonData;

0 commit comments

Comments
 (0)