From 865d8f6c360fb8f4f35d363a0658693ad09fbec8 Mon Sep 17 00:00:00 2001 From: toshan-luktuke Date: Thu, 4 Aug 2022 18:29:47 +0530 Subject: [PATCH 1/2] Add .vc3 file to build and download application --- backend/synthesis/synthesis.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/synthesis/synthesis.py b/backend/synthesis/synthesis.py index 0af239a1..2797abd7 100644 --- a/backend/synthesis/synthesis.py +++ b/backend/synthesis/synthesis.py @@ -14,6 +14,7 @@ 'ObjectDetector': 'utils/models/yolov3/*' } +PROJECT_FILE_EXTENSION = '.vc3' def get_number_or_default(num, default): try: @@ -144,6 +145,8 @@ def synthesize(data: dict) -> Tuple[str, BytesIO]: zipfile, optional_files = syntheize_modules(data, zipfile) zipfile = synthesize_executioner(zipfile, optional_files) zipfile = syntesize_extras(zipfile) + # Add the .vc3 file to the built application, this will let us easily load the project in Visual Circuit + zipfile.append(data['package']['name'] + PROJECT_FILE_EXTENSION, json.dumps(data)) # Project name (zipfile name) project_name = f"{data['package']['name']}.zip" if data['package']['name'] != '' else 'Project.zip' From e402d4b3754bae42d8e725948ca5080d214b7c60 Mon Sep 17 00:00:00 2001 From: toshan-luktuke Date: Wed, 10 Aug 2022 20:39:41 +0530 Subject: [PATCH 2/2] Add default name as Project.vc3 --- backend/synthesis/synthesis.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/backend/synthesis/synthesis.py b/backend/synthesis/synthesis.py index 2797abd7..d5f0e53f 100644 --- a/backend/synthesis/synthesis.py +++ b/backend/synthesis/synthesis.py @@ -145,10 +145,13 @@ def synthesize(data: dict) -> Tuple[str, BytesIO]: zipfile, optional_files = syntheize_modules(data, zipfile) zipfile = synthesize_executioner(zipfile, optional_files) zipfile = syntesize_extras(zipfile) - # Add the .vc3 file to the built application, this will let us easily load the project in Visual Circuit - zipfile.append(data['package']['name'] + PROJECT_FILE_EXTENSION, json.dumps(data)) # Project name (zipfile name) - project_name = f"{data['package']['name']}.zip" if data['package']['name'] != '' else 'Project.zip' + project_name = f"{data['package']['name']}" if data['package']['name'] != '' else 'Project' + + # Add the .vc3 file to the built application, this will let us easily load the project in Visual Circuit + zipfile.append(project_name + PROJECT_FILE_EXTENSION, json.dumps(data)) + # .zip is required for the name of the full package + project_name += '.zip' return project_name, zipfile.get_zip() \ No newline at end of file