Compare commits

..

3 Commits

Author SHA1 Message Date
0b0708f704 Standalone Linux build 2024-07-28 16:13:50 -07:00
d8964a7a0c Add about page 2024-07-28 16:11:16 -07:00
55c9722b27 Format code 2024-07-28 15:54:02 -07:00
5 changed files with 66 additions and 14 deletions

View File

@ -1,19 +1,20 @@
#!/bin/sh #!/bin/sh
arch=$(uname -m) arch=$(uname -m)
distDir=navpoint-linux-$arch distName=navpoint-linux-$arch
rm -rf dist/$distDir rm -rf dist/$distName-bundle
mkdir -p dist/$distDir mkdir -p dist/$distName-bundle
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 dist/main dist/$distName-standalone
cp icon.png dist/$distDir/navpoint.png mv dist/main dist/$distName-bundle/navpoint
cp GPL-3.0.txt CC-BY-SA-4.0.txt dist/$distDir/ cp icon.png dist/$distName-bundle/navpoint.png
pandoc -s --metadata "title=Navpoint Desktop" README.md | grep -v 'h1 id="navpoint-desktop"' > dist/$distDir/README.html cp GPL-3.0.txt CC-BY-SA-4.0.txt dist/$distName-bundle/
pandoc -s --metadata "title=Navpoint Desktop" README.md | grep -v 'h1 id="navpoint-desktop"' > dist/$distName-bundle/README.html
cat > dist/$distDir/navpoint.desktop << HERE cat > dist/$distName-bundle/navpoint.desktop << HERE
[Desktop Entry] [Desktop Entry]
Type=Application Type=Application
Terminal=false Terminal=false
@ -24,7 +25,7 @@ Categories=Application;Network
StartupWMClass=navpoint StartupWMClass=navpoint
HERE HERE
cat > dist/$distDir/install.sh << HERE cat > dist/$distName-bundle/install.sh << HERE
#!/bin/sh #!/bin/sh
binary_target=~/.local/bin/ binary_target=~/.local/bin/
@ -40,8 +41,8 @@ cp navpoint.desktop \$desktop_target/navpoint.desktop
cp navpoint.png \$icon_target/navpoint.png cp navpoint.png \$icon_target/navpoint.png
HERE HERE
chmod +x dist/$distDir/install.sh chmod +x dist/$distName-bundle/install.sh
cd dist cd dist
tar -czf $distDir.tar.gz $distDir tar -czf $distName-bundle.tar.gz $distName-bundle

View File

@ -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 "C:\Program Files (x86)\NSIS\makensis.exe" .\windows_installer.nsi
move "dist\navpoint.exe" "dist\navpoint-windows-%PROCESSOR_ARCHITECTURE%-portable.exe" move "dist\navpoint.exe" "dist\navpoint-windows-%PROCESSOR_ARCHITECTURE%-portable.exe"
move "dist\NavpointInstaller.exe" "dist\navpoint-windows-%PROCESSOR_ARCHITECTURE%-installer.exe" move "dist\NavpointInstaller.exe" "dist\navpoint-windows-%PROCESSOR_ARCHITECTURE%-installer.exe"

44
navpoint/about.py Normal file
View File

@ -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"""\
<!DOCTYPE html>
<html>
<head>
<title>Navpoint Desktop</title>
</head>
<body>
<a id="top"></a>{readme}
<h3 id="gpl">GNU General Public License v3.0</h3>
<pre>{gpl}</pre>
<p><a href="#top">Back to top</a></p>
<h3 id="cc">Creative Commons Attribution-ShareAlike 4.0 International</h3>
<pre>{cc}</pre>
<p><a href="#top">Back to top</a></p>
</body>
</html>
"""
)
f.flush()
webbrowser.open(f.name)
time.sleep(0.5) # Give the browser time to open the file

View File

@ -4,6 +4,7 @@ import navpoint.fix_path
import navpoint.local_server import navpoint.local_server
import navpoint.phone_server import navpoint.phone_server
import navpoint.usb import navpoint.usb
import navpoint.about
def run(): def run():
@ -33,6 +34,12 @@ def run():
window, text="Phone running Navpoint Mobile", command=_mobile_clicked window, text="Phone running Navpoint Mobile", command=_mobile_clicked
) )
mobile_button.pack() 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: try:
window.iconbitmap(navpoint.fix_path.fix_path("icon.ico")) window.iconbitmap(navpoint.fix_path.fix_path("icon.ico"))

View File

@ -28,7 +28,7 @@ def main(port, intercom):
lon = parsed_data.lon lon = parsed_data.lon
time = parsed_data.time time = parsed_data.time
date = parsed_data.date date = parsed_data.date
if lat or lon: # ignore 0, 0 fixes if lat or lon: # ignore 0, 0 fixes
navpoint.content.content = f"""<?xml version='1.0' encoding='us-ascii'?><kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2"><Document><Style id="icon"><IconStyle><Icon><href>http://127.0.0.1:8888/marker.png</href></Icon></IconStyle></Style><name>Navpoint</name><open>1</open><Placemark><name>Position</name><styleUrl>#icon</styleUrl><Point><coordinates>{lon},{lat},0</coordinates></Point><description>{date} {time} UTC</description></Placemark></Document></kml>""" navpoint.content.content = f"""<?xml version='1.0' encoding='us-ascii'?><kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2"><Document><Style id="icon"><IconStyle><Icon><href>http://127.0.0.1:8888/marker.png</href></Icon></IconStyle></Style><name>Navpoint</name><open>1</open><Placemark><name>Position</name><styleUrl>#icon</styleUrl><Point><coordinates>{lon},{lat},0</coordinates></Point><description>{date} {time} UTC</description></Placemark></Document></kml>"""
intercom.put( intercom.put(
"LocationUpdate", "LocationUpdate",