diff --git a/build-linux.sh b/build-linux.sh index 7eada45..6715977 100755 --- a/build-linux.sh +++ b/build-linux.sh @@ -6,7 +6,7 @@ distDir=navpoint-linux-$arch rm -rf dist/$distDir mkdir -p dist/$distDir -pyinstaller -w -F --hidden-import tornado.web main.py +pyinstaller -w -F --hidden-import tornado.web --add-data README.md:files --add-data GPL-3.0.txt:files --add-data CC-BY-SA-4.0.txt:files main.py mv dist/main dist/$distDir/navpoint cp icon.png dist/$distDir/navpoint.png diff --git a/build-windows.bat b/build-windows.bat index 8f680c1..c727049 100755 --- a/build-windows.bat +++ b/build-windows.bat @@ -1,4 +1,4 @@ -pyinstaller -i=icon.ico --windowed --onefile --hidden-import tornado.web --add-data icon.ico:files --name=navpoint.exe main.py +pyinstaller -i=icon.ico --windowed --onefile --hidden-import tornado.web --add-data icon.ico:files --add-data README.md:files --add-data GPL-3.0.txt:files --add-data CC-BY-SA-4.0.txt:files --name=navpoint.exe main.py "C:\Program Files (x86)\NSIS\makensis.exe" .\windows_installer.nsi move "dist\navpoint.exe" "dist\navpoint-windows-%PROCESSOR_ARCHITECTURE%-portable.exe" move "dist\NavpointInstaller.exe" "dist\navpoint-windows-%PROCESSOR_ARCHITECTURE%-installer.exe" diff --git a/navpoint/about.py b/navpoint/about.py new file mode 100644 index 0000000..686dea3 --- /dev/null +++ b/navpoint/about.py @@ -0,0 +1,44 @@ +import webbrowser +import tempfile +import time +import markdown +import navpoint.fix_path + + +def about(): + with open(navpoint.fix_path.fix_path("README.md")) as f: + readme = markdown.markdown( + f.read() + .replace("https://www.gnu.org/licenses/gpl-3.0.en.html", "#gpl") + .replace("https://creativecommons.org/licenses/by-sa/4.0/", "#cc") + ) + + with open(navpoint.fix_path.fix_path("GPL-3.0.txt")) as f: + gpl = f.read() + + with open(navpoint.fix_path.fix_path("CC-BY-SA-4.0.txt")) as f: + cc = f.read() + + with tempfile.NamedTemporaryFile("w+") as f: + f.write( + f"""\ + + +
+{gpl}+ +
{cc}+ + + +""" + ) + f.flush() + webbrowser.open(f.name) + time.sleep(0.5) # Give the browser time to open the file diff --git a/navpoint/run.py b/navpoint/run.py index 64198ff..59f9dee 100755 --- a/navpoint/run.py +++ b/navpoint/run.py @@ -4,6 +4,7 @@ import navpoint.fix_path import navpoint.local_server import navpoint.phone_server import navpoint.usb +import navpoint.about def run(): @@ -33,6 +34,12 @@ def run(): window, text="Phone running Navpoint Mobile", command=_mobile_clicked ) mobile_button.pack() + ttk.Separator(window, orient="horizontal").pack() + ttk.Label(window, text="Navpoint is free and open-source.").pack() + about_button = ttk.Button( + window, text="About Navpoint", command=navpoint.about.about + ) + about_button.pack() try: window.iconbitmap(navpoint.fix_path.fix_path("icon.ico"))