app_create_file

1. Introduction

Create a Blockly File.

2. Request & Response

{
    "cmd": "app_create_file",
    "data": {
        "userId": "test",
        "version": "lite6",
        "folderName": "test111",
        "xmlData": "<xml xmlns='https://developers.google.com/blockly/xml'><block type='set_angle_acceleration' id='TUM:^s#`fiBaLI=KXSG5' x='-602' y='-32'><field name='acceleration'>500</field></block></xml>"
    },
    "id": "1"
}

3. Code Example

background

user_id = data.get('userId', 'test')
xarm_version = data.get('version', GLOBAL.XArm.xarm_type)
root_path = os.path.join(projects_path, user_id, xarm_version, 'app', 'myapp')
file_name = data.get('folderName')
xml_data = data.get('xmlData')
folder_path = os.path.join(root_path, file_name)
code, _ = create_folder(root_path, folder_path)
code, _ = create_file(root_path, file_name, xml_data, xarm_version)
response(client, cmd_id, code, _)

front_end

self.appCreateFile = (obj, callback) => {
  const params = window.GlobalConstant.INIT_CMD_PARAMS_COMMON_DATA();
  Object.assign(params.data, obj);
  self.sendCmd(window.GlobalConstant.APP_CREATE_FILE, params, (dict) => {
    if (callback) {
      callback(dict);
    }
  });
};

Last updated