Skip to content

Commit

Permalink
Prep for release
Browse files Browse the repository at this point in the history
  • Loading branch information
randomouscrap98 committed Sep 8, 2023
1 parent d6bc4ba commit 66acada
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions appresource/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ <h1>Arduboy Toolset</h1>
<li><b>Python-Slugify:</b> <a href="https://pypi.org/project/python-slugify/">https://pypi.org/project/python-slugify/</a></li>
<li><b>demjson3: </b> <a href="https://pypi.org/project/demjson3/">https://pypi.org/project/demjson3/</a></li>
<li><b>Pyinstaller: </b><a href="https://pypi.org/project/pyinstaller/">https://pypi.org/project/pyinstaller/</a></li>
<li><b>IntelHex: </b><a href="https://pypi.org/project/intelhex/">https://pypi.org/project/intelhex/</a></li>
</ul>
</p>

Expand Down
2 changes: 1 addition & 1 deletion utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def get_eeprom_backup_filename():
return f"eeprom-backup-{get_filesafe_datetime()}.bin"

def get_fx_backup_filename():
return f"fx-backup-{get_filesafe_datetime()}.bin"
return f"flashcart-backup-{get_filesafe_datetime()}.bin"

def get_arduhex_backup_filename(arduparsed: arduboy.arduhex.ArduboyParsed):
return slugify.slugify(arduparsed.title or arduparsed.original_filename or "") + f"_{get_filesafe_datetime()}.arduboy"
Expand Down
2 changes: 1 addition & 1 deletion widget_fx.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@ def do_work(device, repprog, repstatus):

dialog = widget_progress.do_progress_work(do_work, "Backup FX Flash")
if not dialog.error_state:
debug_actions.global_debug.add_action_str(f"Backed up Arduboy flash to {filepath}")
debug_actions.global_debug.add_action_str(f"Backed up Arduboy flashcart to {filepath}")
11 changes: 7 additions & 4 deletions widget_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __init__(self):
layout.addWidget(toprow_container)

# -------------- DATA CONTROLS ----------------
def mkdata(basetext, field, default_func, opentitle, filetypes, reader, setextra = None):
def mkdata(basetext, field, default_func, opentitle, filetypes, reader, setextra = None, lengthcalc = None):
container = QWidget()
container_layout = QHBoxLayout()
container_layout.setContentsMargins(0,0,0,0)
Expand All @@ -69,8 +69,9 @@ def mkdata(basetext, field, default_func, opentitle, filetypes, reader, setextra
deletebutton = QPushButton("❌")
container_layout.addWidget(deletebutton)
container_layout.setStretchFactor(deletebutton, 0)
lengthcalc = lengthcalc or (lambda: len(getattr(self, field)))
def refresh():
length = len(getattr(self, field))
length = lengthcalc()
button.setText(basetext + (f" - {length} bytes" if length else " - None"))
if length == 0:
deletebutton.setDisabled(True)
Expand Down Expand Up @@ -113,9 +114,11 @@ def setdata_extra():
self.data_raw = self.data_raw[:-unused_pages * FX_PAGESIZE]
self.refresh_fxsavetext()
self.refresh_fxdatatext()
def hexlength():
return len(arduboy.common.hex_to_bin(self.hex_raw))

self.refresh_hextext = mkdata(".hex data", "hex_raw", lambda: "", "Open .hex file", constants.HEX_FILEFILTER, read_text)
self.refresh_fxdatatext = mkdata("FX data", "data_raw", lambda: bytearray(), "Open FX data file", constants.BIN_FILEFILTER, read_binary, setdata_extra)
self.refresh_hextext = mkdata(".hex program", "hex_raw", lambda: "", "Open .hex file", constants.HEX_FILEFILTER, read_text, lengthcalc=hexlength)
self.refresh_fxdatatext = mkdata("FX data", "data_raw", lambda: bytearray(), "Open FX data file", constants.BIN_FILEFILTER, read_binary, setextra = setdata_extra)
self.refresh_fxsavetext = mkdata("FX save", "save_raw", lambda: bytearray(), "Open FX save file", constants.BIN_FILEFILTER, read_binary)

# -------------- FINAL COMPOSE ---------------
Expand Down
5 changes: 4 additions & 1 deletion widget_sketch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import arduboy.fxcart
import arduboy.patch
import arduboy.serial
import arduboy.common

import constants
import widgets_common
Expand All @@ -12,6 +13,7 @@

import logging

from arduboy.constants import *
from PyQt6.QtWidgets import QCheckBox, QVBoxLayout, QWidget, QPushButton

# A fully self contained widget which can upload and backup sketches from arduboy
Expand Down Expand Up @@ -80,6 +82,7 @@ def do_work(device, repprog, repstatus):
fx_data = arduboy.fxcart.read_data(fx_filepath)
logging.info("Adding FX data to cart")
s_port = device.connect_serial()
bindata = arduboy.common.pad_data(bindata, FLASH_PAGESIZE)
repstatus("Flashing sketch...")
arduboy.serial.flash_arduhex(bindata, s_port, repprog)
repstatus("Verifying sketch...")
Expand Down Expand Up @@ -111,4 +114,4 @@ def do_work(device, _, repstatus):

dialog = widget_progress.do_progress_work(do_work, "Backup Sketch")
if not dialog.error_state:
debug_actions.global_debug.add_action_str(f"Backuped Arduboy sketch to {filepath}")
debug_actions.global_debug.add_action_str(f"Backed up Arduboy sketch to {filepath}")

0 comments on commit 66acada

Please sign in to comment.