Skip to content

Commit

Permalink
added changes from review, fixed pyinstaller
Browse files Browse the repository at this point in the history
  • Loading branch information
0dm committed Jun 1, 2023
1 parent 25d82b5 commit 77818ec
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 174 deletions.
51 changes: 51 additions & 0 deletions OpenAdapt.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# -*- mode: python ; coding: utf-8 -*-
import sys ; sys.setrecursionlimit(sys.getrecursionlimit() * 5)

block_cipher = None


a = Analysis(
['/Users/aaron/Documents/GitHub/OpenAdapt/openadapt/app/main.py'],
pathex=[],
binaries=[],
datas=[('/Users/aaron/Documents/GitHub/OpenAdapt/.venv/lib/python3.10/site-packages/nicegui', 'nicegui')],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)

exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='OpenAdapt',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon=['/Users/aaron/Documents/GitHub/OpenAdapt/openadapt/app/assets/logo.ico'],
)
app = BUNDLE(
exe,
name='OpenAdapt.app',
icon='/Users/aaron/Documents/GitHub/OpenAdapt/openadapt/app/assets/logo.ico',
bundle_identifier=None,
)
File renamed without changes.
File renamed without changes
23 changes: 16 additions & 7 deletions openadapt/app/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@

import nicegui

cmd = [
"python",
"-m",
"PyInstaller",
"openadapt/app/main.py", # main file with ui.run()
"--icon=assets/logo.ico",
spec = [
"pyi-makespec",
f"{Path(__file__).parent}/main.py",
f"--icon={Path(__file__).parent}/assets/logo.ico",
"--name",
"OpenAdapt", # name
# "--onefile", # trade startup speed for smaller file size
Expand All @@ -18,4 +16,15 @@
"--add-data",
f"{Path(nicegui.__file__).parent}{os.pathsep}nicegui",
]
subprocess.call(cmd)

subprocess.call(spec)

# add import sys ; sys.setrecursionlimit(sys.getrecursionlimit() * 5) to line 2 of OpenAdapt.spec
with open("OpenAdapt.spec", "r+") as f:
lines = f.readlines()
lines[1] = "import sys ; sys.setrecursionlimit(sys.getrecursionlimit() * 5)\n"
f.seek(0)
f.truncate()
f.writelines(lines)

subprocess.call(["pyinstaller", "OpenAdapt.spec"])
133 changes: 0 additions & 133 deletions openadapt/app/deprecated/app-old.py

This file was deleted.

28 changes: 0 additions & 28 deletions openadapt/app/deprecated/console.py

This file was deleted.

17 changes: 11 additions & 6 deletions openadapt/app/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import threading
import base64
import os

from nicegui import app, ui

Expand All @@ -7,10 +9,11 @@
from openadapt.app.objects.console import Console
from openadapt.app.util import clear_db, on_export, on_import

SERVER = "127.0.0.1:8000/upload"

def run_app():
SERVER = "127.0.0.1:8000/upload"

def run_app():
file = os.path.dirname(__file__)
app.native.window_args["resizable"] = False
app.native.start_args["debug"] = True
dark = ui.dark_mode()
Expand All @@ -20,11 +23,14 @@ def run_app():
with ui.row().classes("w-full justify-right"):
# settings

# alignment trick
with ui.avatar(color="white" if dark else "black", size=128):
# TODO: remove base64 and add dark mode version of icon
ui.image(
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAEDmlDQ1BrQ0dDb2xvclNwYWNlR2VuZXJpY1JHQgAAOI2NVV1oHFUUPpu5syskzoPUpqaSDv41lLRsUtGE2uj+ZbNt3CyTbLRBkMns3Z1pJjPj/KRpKT4UQRDBqOCT4P9bwSchaqvtiy2itFCiBIMo+ND6R6HSFwnruTOzu5O4a73L3PnmnO9+595z7t4LkLgsW5beJQIsGq4t5dPis8fmxMQ6dMF90A190C0rjpUqlSYBG+PCv9rt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GYGsLAJ2suzzMe9OkcAe6zp/c8wA+peBgCtpZp/LyyPUaY4Zax92KaNvWQiMJW/ot72d+orYT7YizpeJwJDosaPp9XN0MjbO7D9jKqG9bATMxLnag/c7qeGSu/oGHRwrQMCVQLOPQ+AfiJp9UptvDVEqQkBKJssupuobM8j5l8IolSEwJE97XKssbri7QkCbeNbfATTrRUBLgKfqDR2eMwIaAuwDhPUjEEuA9+oPHREwAjEE+BLQtYNAKAHw408j9y186cEEmFrO0cALpw7uYVxvBGgh3qS87Om1cP5GEMVCoAUC8HuGvnINDTjrGwR5vQjw0n6AqmtDuLXesOB5DAJPGER4OMYAdNpA4LI2wkAUQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAIAEC/wKS2kuzL+4bNAAAAABJRU5ErkJggg==",
logo_base64 = base64.b64encode(open(f"{file}/assets/logo.png", "rb").read())
img = bytes(
f"data:image/png;base64,{(logo_base64.decode('utf-8'))}",
encoding="utf-8",
)
ui.image(img.decode("utf-8"))
ui.icon("settings").tooltip("Settings").on("click", lambda: settings(dark))
ui.icon("share").tooltip("Share").on(
"click", lambda: (_ for _ in ()).throw(Exception(NotImplementedError))
Expand All @@ -37,7 +43,6 @@ def run_app():
# Record button + popup

options = ["test"]
result = ""
logger = None

# Add buttons and log text element in a row container | split ui for console
Expand Down

0 comments on commit 77818ec

Please sign in to comment.