Skip to content

Commit 5d4a9ff

Browse files
committed
reset to v0.0.1 and make a few updates for use with static build
1 parent 1dbdf62 commit 5d4a9ff

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

cadviewer.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,23 @@
3636
from nicegui import app, ui
3737
from nicegui.events import KeyEventArguments
3838
import subprocess
39-
4039
app.native.window_args["resizable"] = True
4140
app.native.start_args["debug"] = True
4241
# app.native.settings['ALLOW_DOWNLOADS'] = True # export "downloads" ?
43-
app.native.settings["MATPLOTLIB"] = False
4442

4543
editor_fontsize = 18
4644
# TODO: consider separate editor execution thread from nicegui thread
47-
45+
import platform
4846

4947
# run ocp_vscode in a subprocess
5048
def startup_all():
5149
global ocpcv_proc
50+
51+
if platform.system == "Windows":
52+
ocpcv_proc = subprocess.Popen([r"uv\uv.exe", "run", "python", "-m", "ocp_vscode"])
53+
else:
54+
ocpcv_proc = subprocess.Popen([r"uv/uv", "run", "python", "-m", "ocp_vscode"])
5255
# spawn separate viewer process
53-
ocpcv_proc = subprocess.Popen(["python", "-m", "ocp_vscode"])
5456
# pre-import build123d and ocp_vscode in main thread
5557
exec("from build123d import *\nfrom ocp_vscode import *")
5658

@@ -83,7 +85,7 @@ def shutdown_all():
8385
# ui.button('shutdown', on_click=lambda: shutdown_all()) # just close the window
8486
code = (
8587
ui.codemirror(
86-
'print("Edit me!")\nprint("hello world")',
88+
'from build123d import *\nfrom ocp_vscode import *\nset_port(3939)\na_box = Box(1,2,3)\nshow(a_box)',
8789
language="Python",
8890
theme="vscodeLight",
8991
)
@@ -111,8 +113,8 @@ def handle_key(e: KeyEventArguments):
111113
app.on_shutdown(shutdown_all) # register shutdown handler
112114
ui.run(
113115
native=True,
114-
window_size=(1800, 900),
115-
title="nicegui-cadviewer",
116+
window_size=(1700, 900),
117+
title="nice123d",
116118
fullscreen=False,
117119
reload=False,
118120
)

0 commit comments

Comments
 (0)