Skip to content

Commit

Permalink
Finally made an icon
Browse files Browse the repository at this point in the history
  • Loading branch information
randomouscrap98 committed Aug 5, 2023
1 parent b20af30 commit 63689cc
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 8 deletions.
Binary file added appresource/icon.ico
Binary file not shown.
23 changes: 19 additions & 4 deletions main_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

ACTIONS = [
"scan",
"upload",
"sketchupload",
"sketchbackup",
"eeprombackup",
"eepromrestore",
"eepromerase",
Expand All @@ -36,8 +37,10 @@ def main():

if args.action == "scan":
scan_action(args)
elif args.action == "upload":
upload_action(args)
elif args.action == "sketchupload":
sketchupload_action(args)
elif args.action == "sketchbackup":
sketchbackup_action(args)
elif args.action == "fxupload":
fxupload_action(args)
elif args.action == "fxbackup":
Expand Down Expand Up @@ -136,7 +139,7 @@ def scan_action(args):
print(f"Found {len(devices)} devices:")
pp.pprint(devices)

def upload_action(args):
def sketchupload_action(args):
infile = get_required_input(args)
records = arduboy.file.read_arduhex(infile)
parsed = arduboy.file.parse_arduhex(records)
Expand All @@ -158,6 +161,18 @@ def do_work(s_port):
arduboy.serial.verify_arduhex(parsed, s_port, basic_reporting)
work_per_device(args, do_work)

def sketchbackup_action(args):
outfile = args.output_file if args.output_file else time.strftime("fx-backup-%Y%m%d-%H%M%S.bin", time.localtime())
device = 1
raise Exception("Not implemented yet!")
def do_work(s_port):
nonlocal device
# Not the most elegant way to do this, I might change it later
real_outfile = outfile if device == 1 else f"{device}-{outfile}"
device += 1
arduboy.serial.backup_fx(s_port, real_outfile, basic_reporting)
work_per_device(args, do_work)

def fxupload_action(args):
infile = get_required_input(args)
flashbytes = arduboy.file.read_fx_cart(infile)
Expand Down
19 changes: 15 additions & 4 deletions main_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from PyQt5.QtWidgets import QApplication, QWidget, QLabel
from PyQt5 import QtGui


def main():

# Some initial setup
Expand All @@ -14,12 +15,15 @@ def main():
window.show()
sys.exit(app.exec_())

def resource_file(name):
basedir = os.path.dirname(__file__)
return os.path.join(basedir, 'appresource', name)


def make_app():
basedir = os.path.dirname(__file__)

app = QApplication(sys.argv)
app.setWindowIcon(QtGui.QIcon(os.path.join(basedir, 'ignore', 'tempicon.png')))
app.setWindowIcon(QtGui.QIcon(resource_file("icon.ico")))

window = QWidget()
window.setWindowTitle("Hello, PyQt!")
Expand All @@ -28,10 +32,17 @@ def make_app():
label = QLabel("Hello, World!", parent=window)
label.move(100, 40)



return (app, window)



if __name__ == "__main__":
try:
# This apparently only matters for windows and for GUI apps
from ctypes import windll # Only exists on Windows.
myappid = 'Haloopdy.ArduboyToolset' # 'mycompany.myproduct.subproduct.version'
windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
except ImportError:
pass

main()

0 comments on commit 63689cc

Please sign in to comment.