Skip to content

Commit

Permalink
flasher gui: add version
Browse files Browse the repository at this point in the history
Add version to the flasher GUI.
Fix the build command to properly include the mini driver.

PROD-10321

Signed-off-by: Ryan Erickson <[email protected]>
  • Loading branch information
rerickson1 committed May 9, 2024
1 parent 39ad779 commit 0c20c95
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
14 changes: 7 additions & 7 deletions if820_flasher_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
pyinstaller command to produce a single executable file:
pyinstaller --clean --windowed --noconfirm --onefile --add-data "img/IF820_fw_upgrade_header.png:img" --add-data "files/v1.4.12.12_int-ant/minidriver-20820A1-uart-patchram.hex:files" --collect-all pyocd --collect-all cmsis_pack_manager -p common_lib/libraries if820_flasher_gui.py
pyinstaller --clean --windowed --noconfirm --onefile --add-data "img/IF820_fw_upgrade_header.png:img" --add-data "files/v1.4.12.12_int-ant/minidriver-20820A1-uart-patchram.hex:files/v1.4.12.12_int-ant" --collect-all pyocd --collect-all cmsis_pack_manager -p common_lib/libraries if820_flasher_gui.py
"""

Expand All @@ -22,7 +22,7 @@
LOG_MODULE_HCI_PORT = 'hci_port'
PROGRAM_TITLE = 'Vela IF820 Firmware Upgrade Tool'
LOGGING_FORMAT = '%(asctime)s | %(levelname)s | %(message)s'

VERSION = '2.0.0'

def resource_path(relative_path):
""" Get absolute path to resource, works for dev and for PyInstaller """
Expand All @@ -41,8 +41,8 @@ def emit(self, record):
wx.CallAfter(self.ctrl.AppendText, s)


header_img = resource_path('img/IF820_fw_upgrade_header.png')
minidriver = resource_path('files/v1.4.12.12_int-ant/minidriver-20820A1-uart-patchram.hex')
HEADER_IMG = resource_path(f'img{os.sep}IF820_fw_upgrade_header.png')
MINIDRIVER = resource_path(f'files{os.sep}v1.4.12.12_int-ant{os.sep}minidriver-20820A1-uart-patchram.hex')


class Window(wx.Frame):
Expand All @@ -61,7 +61,7 @@ def __init__(self, *args, **kw):
vbox = wx.BoxSizer(wx.VERTICAL)

# Place a nice image to the top
bmpl = wx.Image(header_img, wx.BITMAP_TYPE_ANY)
bmpl = wx.Image(HEADER_IMG, wx.BITMAP_TYPE_ANY)
img_header = wx.StaticBitmap(panel, -1, bmpl, (0, 0))
hbox_image = wx.BoxSizer(wx.HORIZONTAL)
hbox_image.Add(img_header)
Expand Down Expand Up @@ -140,7 +140,7 @@ def __init__(self, *args, **kw):

# Create a status bar and populate with version number
self.CreateStatusBar()
self.SetStatusText("Version 0.1")
self.SetStatusText(f"Version {VERSION}")

# Add a log handler to the root logger to show log messages in the GUI
log_handler = WxTextCtrlLogHandler(self.tx_logoutput)
Expand All @@ -162,7 +162,7 @@ def flash_firmware(self):
"""
try:
self.selected_board.flash_firmware(
minidriver, f'{self.picker_firmware.GetTextCtrl().GetValue()}', self.ch_chiperase.GetValue())
MINIDRIVER, f'{self.picker_firmware.GetTextCtrl().GetValue()}', self.ch_chiperase.GetValue())
except Exception as e:
# Log any error
logging.error(e)
Expand Down
9 changes: 2 additions & 7 deletions if820_flasher_gui.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- mode: python ; coding: utf-8 -*-
from PyInstaller.utils.hooks import collect_all

datas = [('img/IF820_fw_upgrade_header.png', 'img'), ('files/v1.4.12.12_int-ant/minidriver-20820A1-uart-patchram.hex', 'files')]
datas = [('img/IF820_fw_upgrade_header.png', 'img'), ('files/v1.4.12.12_int-ant/minidriver-20820A1-uart-patchram.hex', 'files/v1.4.12.12_int-ant')]
binaries = []
hiddenimports = []
tmp_ret = collect_all('pyocd')
Expand All @@ -21,6 +21,7 @@ a = Analysis(
runtime_hooks=[],
excludes=[],
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure)

Expand All @@ -44,9 +45,3 @@ exe = EXE(
codesign_identity=None,
entitlements_file=None,
)
app = BUNDLE(
exe,
name='if820_flasher_gui.app',
icon=None,
bundle_identifier=None,
)

0 comments on commit 0c20c95

Please sign in to comment.