Quality of life (#50)

* updated requirements.txt according to GRIMM's instructions

* added launch configuration and build tasks for VS Code

* updated build scripts and documentation
This commit is contained in:
David Pierron 2023-05-19 07:16:38 +02:00 committed by GitHub
parent bca47d63d6
commit e8bd6b2972
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 110 additions and 2 deletions

16
.vscode/launch.json vendored Normal file
View File

@ -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
}
]
}

22
.vscode/tasks.json vendored Normal file
View File

@ -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",
}
]
}

View File

@ -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.**

View File

@ -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
if not %1=="-nopause" (
pause >nul
)

View File

@ -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
)

Binary file not shown.