diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..a489ecd --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,16 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Run MissionGenerator.py", + "type": "python", + "request": "launch", + "program": "${workspaceFolder}/Generator/MissionGenerator.py", + "console": "integratedTerminal", + "justMyCode": true + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..301622b --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,22 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "Build the Mission Generator (run build.bat)", + "type": "shell", + "command": "cd .\\Generator ; .\\build.bat -nopause", + "problemMatcher": [], + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "label": "Install the Python requirements (run install-requirements.bat)", + "type": "shell", + "command": "cd .\\Generator ; .\\install-requirements.bat -nopause", + } + ] +} \ No newline at end of file diff --git a/Generator/README.md b/Generator/README.md index b03a060..cb700ee 100644 --- a/Generator/README.md +++ b/Generator/README.md @@ -1,3 +1,40 @@ +# Install a development environment + +## Install VSCode + +Download and install VSCode: https://code.visualstudio.com/ + +VS Code is a free, open source, cross-platform code editor. It is a great tool for editing and debugging python code. It also has a built-in terminal that can be used to run commands. +## Install python + +If using VSCode, you can install the Python extension to get started: [VS Marketplace Link](https://marketplace.visualstudio.com/items?itemName=ms-python.python) + +If not, you may need to install python 3.8.5. If you are using Windows, you can download it here: https://www.python.org/downloads/release/python-385/ + +## Create a python virtual environment + +If using VSCode, you can use the ">Python: create environment" command. + +If not, run the following command in the root of the project: `python -m venv .\Generator\venv` + +## Install python dependencies + +If using VSCode, you can use the ">Run task: " command and choose the "Install the Python requirements" task. + +If not, type `install-requirements.bat` in a terminal. + +## Build the mission generator + +If using VSCode, you can use the ">Run task: " command and choose the "Build the Mission Generator" task. + +If not, type `build.bat` in a terminal. + +## Run the mission generator + +Using VS Code, you can use the provided launch configuration to run the mission generator. + +Otherwise, you can run the following command in a terminal: `python .\Generator\MissionGenerator.py` + # Building the exe with build.bat **Use build.bat to compile the UI files and build the exe.** diff --git a/Generator/build.bat b/Generator/build.bat index 3e07e56..59ddaa1 100644 --- a/Generator/build.bat +++ b/Generator/build.bat @@ -1,4 +1,15 @@ -call .\venv\Scripts\activate.bat +IF EXIST ".\venv" ( + call .\venv\Scripts\activate.bat +) ELSE ( + IF EXIST "..\.venv" ( + rem try to activate venv from root directory (VS Code default) + call ..\.venv\Scripts\activate.bat + ) ELSE ( + echo "venv not found. Please create a virtual environment and activate it." + pause >nul + exit + ) +) echo activated python venv. pyuic5 -x MissionGeneratorUI.ui -o MissionGeneratorUI.py @@ -10,4 +21,6 @@ echo compiled ui resource files. echo building exe with pyinstaller... pyinstaller MissionGenerator.spec --distpath ..\ --clean -pause >nul \ No newline at end of file +if not %1=="-nopause" ( + pause >nul +) \ No newline at end of file diff --git a/Generator/install-requirements.bat b/Generator/install-requirements.bat new file mode 100644 index 0000000..45f6b88 --- /dev/null +++ b/Generator/install-requirements.bat @@ -0,0 +1,20 @@ +IF EXIST ".\venv" ( + call .\venv\Scripts\activate.bat +) ELSE ( + IF EXIST "..\.venv" ( + rem try to activate venv from root directory (VS Code default) + call ..\.venv\Scripts\activate.bat + ) ELSE ( + echo "venv not found. Please create a virtual environment and activate it." + pause >nul + exit + ) +) +echo activated python venv. + +pip install -r requirements.txt +echo installed python requirements. + +if not %1=="-nopause" ( + pause >nul +) \ No newline at end of file diff --git a/Generator/requirements.txt b/Generator/requirements.txt index 973a365..3c7812d 100644 Binary files a/Generator/requirements.txt and b/Generator/requirements.txt differ