Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions mathweave-studio-onefile.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- mode: python ; coding: utf-8 -*-

import os
from PyInstaller.utils.hooks import (
collect_all,
collect_data_files,
Expand All @@ -9,6 +10,11 @@ from PyInstaller.utils.hooks import (

block_cipher = None

# Base directory of the project, resolved from spec file location
project_dir = SPECPATH
assets_dir = os.path.join(project_dir, "assets")
icon_path = os.path.join(assets_dir, "icon.ico")

datas = []
binaries = []
hiddenimports = []
Expand All @@ -20,7 +26,7 @@ for pkg in ["nicegui", "plotly", "latex2mathml"]:

# Application modules and assets
hiddenimports += collect_submodules("math_app")
datas += [("assets", "assets")]
datas += [(assets_dir, "assets")]

# Pywebview and webview backend
datas += collect_data_files("webview")
Expand Down Expand Up @@ -59,8 +65,8 @@ hiddenimports += [
]

a = Analysis(
["run.py"],
pathex=["src"],
[os.path.join(project_dir, "run.py")],
pathex=[os.path.join(project_dir, "src")],
binaries=binaries,
datas=datas,
hiddenimports=hiddenimports,
Expand Down Expand Up @@ -96,5 +102,5 @@ exe = EXE(
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon="assets/icon.ico",
icon=icon_path,
)
15 changes: 10 additions & 5 deletions mathweave-studio.spec
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
# -*- mode: python ; coding: utf-8 -*-

import os
from PyInstaller.utils.hooks import (
collect_all,
collect_data_files,
collect_dynamic_libs,
collect_submodules,
)
from pathlib import Path

block_cipher = None

# Base directory of the project, resolved from spec file location
project_dir = SPECPATH
assets_dir = os.path.join(project_dir, "assets")
icon_path = os.path.join(assets_dir, "icon.ico")

datas = []
binaries = []
hiddenimports = []
Expand All @@ -19,7 +24,7 @@ for pkg in ["nicegui", "plotly", "latex2mathml"]:
hiddenimports += collect_submodules(pkg)

hiddenimports += collect_submodules("math_app")
datas += [("assets", "assets")]
datas += [(assets_dir, "assets")]

datas += collect_data_files("webview")
binaries += collect_dynamic_libs("webview")
Expand Down Expand Up @@ -53,8 +58,8 @@ hiddenimports += [
]

a = Analysis(
["run.py"],
pathex=["src"],
[os.path.join(project_dir, "run.py")],
pathex=[os.path.join(project_dir, "src")],
binaries=binaries,
datas=datas,
hiddenimports=hiddenimports,
Expand All @@ -81,7 +86,7 @@ exe = EXE(
strip=False,
upx=True,
console=False,
icon="assets/icon.ico",
icon=icon_path,
)

coll = COLLECT(
Expand Down
7 changes: 5 additions & 2 deletions src/math_app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,10 @@ def main() -> None:
"MathWeave Studio yêu cầu WebView2 Runtime để chạy ở chế độ cửa sổ ứng dụng desktop.\n\n"
"Vui lòng tải và cài đặt Microsoft Edge WebView2 Runtime từ:\n"
"https://go.microsoft.com/fwlink/p/?LinkId=2124703\n\n"
"Hoặc khởi chạy ứng dụng từ dòng lệnh với tham số --browser để mở qua trình duyệt."
"Hoặc khởi chạy ứng dụng từ dòng lệnh với tham số --browser để mở qua trình duyệt.\n"
"--------------------------------------------------\n"
"Microsoft Edge WebView2 Runtime is not installed on this system.\n"
"Please install it from the link above or launch with --browser."
)
sys.stderr.write(f"\n[ERROR] {msg}\n\n")
sys.stderr.flush()
Expand All @@ -222,7 +225,7 @@ def main() -> None:
except Exception:
pass
sys.exit(1)
except ImportError:
except Exception:
pass
elif sys.platform.startswith("linux"):
app.native.start_args["gui"] = "qt"
Expand Down
Loading