-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added README, updated build script and added example gif
- Loading branch information
1 parent
3ec5ee7
commit 72ba35b
Showing
4 changed files
with
79 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
outputs/ | ||
documentation/example_gif_frames | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# QR Code Stencilator | ||
|
||
![Example](https://github.com/80sVectorz/qr_code_stencilator/blob/main/documentation/example.gif?raw=true) | ||
|
||
A tool that lets you generate the stencils to paint a QR code with two colors | ||
|
||
# Original problem & usage example | ||
|
||
I originally made this program for a friend, but I thought it would be nice to make it public. | ||
|
||
# Disclaimer | ||
Support is focused on Windows, but it probably works on Linux too. | ||
|
||
# Installation | ||
Download the latest zip file from [releases](https://github.com/80sVectorz/qr_code_stencilator/releases) | ||
and extract it somewhere. | ||
For now you'll need basic command line knowledge to use this program. | ||
To get info on how to use the program use the help flag: | ||
`qr_code_stencilator.exe --help` | ||
|
||
# Future plans | ||
Things I already plan to implement are: | ||
- Support for more advanced instructions to create multiple version of a QR code in one go. | ||
- A GUI version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,58 @@ | ||
import os | ||
import sys | ||
import PyInstaller.__main__ | ||
from pathlib import Path | ||
import shutil | ||
|
||
VERSION = sys.argv[-1] | ||
DIST_PATH = f".\\dist\\qr_code_stencilator_{VERSION}" | ||
VERSION_FILE = f'{DIST_PATH}\\VERSION.txt' | ||
|
||
os.system(f'mkdir "{DIST_PATH}"') | ||
|
||
try: | ||
with open(VERSION_FILE,'w') as f: | ||
f.write(VERSION) | ||
except: | ||
pass | ||
|
||
os.system(f'attrib +h "{VERSION_FILE}"') | ||
|
||
PyInstaller.__main__.run([ | ||
'./src/qr_code_stencilator/main.py', | ||
'--onefile', | ||
'--noconfirm', | ||
'--nowindow', | ||
'--name=qr_code_stencilator', | ||
f'--distpath={DIST_PATH.replace('\\','/')}' | ||
]) | ||
|
||
os.system(f'copy paper_formats.toml {DIST_PATH}') | ||
os.system(f'mkdir {DIST_PATH}\\presets') | ||
os.system(f'copy presets\\default.toml {DIST_PATH}\\presets') | ||
os.system(f'copy presets\\example_preset.toml {DIST_PATH}\\presets') | ||
os.system(f'mkdir {DIST_PATH}\\outputs') | ||
def build(program_path:Path, dist_path:Path, version:str): | ||
on_windows = (os.name == 'nt') | ||
|
||
version_file = dist_path/'VERSION.txt' | ||
if version_file.exists(): | ||
os.remove(version_file) | ||
|
||
with open(version_file,'w') as f: | ||
f.write(version) | ||
|
||
PyInstaller.__main__.run([ | ||
'./src/qr_code_stencilator/main.py', | ||
'--onefile', | ||
'--noconfirm', | ||
'--nowindow', | ||
'--name=qr_code_stencilator', | ||
f'--distpath={dist_path.as_posix()}' | ||
]) | ||
|
||
shutil.copy2(program_path/'paper_formats.toml', dist_path) | ||
|
||
presets_path = program_path/'presets/' | ||
dist_presets_path = dist_path/'presets/' | ||
dist_presets_path.mkdir(exist_ok=True) | ||
|
||
shutil.copy2(presets_path/'default.toml', dist_presets_path) | ||
shutil.copy2(presets_path/'example_preset.toml', dist_presets_path) | ||
|
||
dist_outputs_path = dist_path/'outputs/' | ||
dist_outputs_path.mkdir(exist_ok=True) | ||
|
||
shutil.copy2(program_path/'README.md', dist_path) | ||
|
||
documentation_path = program_path/'documentation/' | ||
dist_documentation_path = dist_path/'documentation/' | ||
|
||
shutil.copytree(documentation_path,dist_documentation_path, dirs_exist_ok=True) | ||
shutil.rmtree(dist_documentation_path/'example_gif_frames/') | ||
|
||
if on_windows: | ||
os.system(f'attrib +h "{version_file}"') | ||
os.system(f'attrib +h "{dist_presets_path/"default.toml"}"') | ||
|
||
if __name__ == "__main__": | ||
version = sys.argv[-1] | ||
|
||
dist_path = Path(f'./dist/qr_code_stencilator_{version}') | ||
dist_path.mkdir(parents=True,exist_ok=True) | ||
|
||
program_path = Path(os.getcwd()) | ||
|
||
build(program_path, dist_path, version) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.