This commit is contained in:
Djuri Baars 2024-06-09 13:18:14 +02:00
parent 796befd831
commit 50e85f6c96
2 changed files with 26 additions and 3 deletions

View file

@ -6,3 +6,22 @@
- Run `python3 app.py` - Run `python3 app.py`
- Profit - Profit
## Bundle with PyInstaller
### macOS
```shell
pyinstaller --hidden-import zeroconf._utils.ipaddress --hidden-import zeroconf._handlers.answers -n BTClockOTA -i update-icon.icns --windowed app.py
````
### Windows
````
pyinstaller.exe --hidden-import zeroconf._utils.ipaddress --hidden-import zeroconf._handlers.answers -n BTClockOTA --windowed app.py`
````
### Linux
````
`pyinstaller --hidden-import zeroconf._utils.ipaddress --hidden-import zeroconf._handlers.answers -n BTClockOTA --windowed app.py`
````

View file

@ -139,6 +139,7 @@ class BTClockOTAUpdater(wx.Frame):
wx.CallAfter(self.fetch_latest_release) wx.CallAfter(self.fetch_latest_release)
def on_item_selected(self, event): def on_item_selected(self, event):
if self.release_name != "":
self.update_button.Enable() self.update_button.Enable()
self.update_fs_button.Enable() self.update_fs_button.Enable()
self.identify_button.Enable() self.identify_button.Enable()
@ -292,6 +293,8 @@ class BTClockOTAUpdater(wx.Frame):
def fetch_latest_release(self): def fetch_latest_release(self):
repo = "btclock/btclock_v3" repo = "btclock/btclock_v3"
if not os.path.exists("firmware"):
os.makedirs("firmware")
filenames_to_download = ["lolin_s3_mini_213epd_firmware.bin", "btclock_rev_b_213epd_firmware.bin", "littlefs.bin"] filenames_to_download = ["lolin_s3_mini_213epd_firmware.bin", "btclock_rev_b_213epd_firmware.bin", "littlefs.bin"]
url = f"https://api.github.com/repos/{repo}/releases/latest" url = f"https://api.github.com/repos/{repo}/releases/latest"
try: try:
@ -337,7 +340,8 @@ class BTClockOTAUpdater(wx.Frame):
local_filename = f"{release_name}_{url.split('/')[-1]}" local_filename = f"{release_name}_{url.split('/')[-1]}"
response = requests.get(url, stream=True) response = requests.get(url, stream=True)
total_length = response.headers.get('content-length') total_length = response.headers.get('content-length')
if not os.path.exists("firmware"):
os.makedirs("firmware")
if os.path.exists(f"firmware/{local_filename}"): if os.path.exists(f"firmware/{local_filename}"):
wx.CallAfter(self.SetStatusText, f"{local_filename} is already downloaded") wx.CallAfter(self.SetStatusText, f"{local_filename} is already downloaded")
return return