Spaces:
Sleeping
Sleeping
Raymond Weitekamp
commited on
Commit
·
5c0089e
1
Parent(s):
1dbdf62
Add Space configuration metadata to README
Browse files- README.md +9 -0
- cadviewer.py +9 -3
README.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# nice123d
|
| 2 |
A nicegui-based CAD customizer, editor, and viewer for OCP-based projects like build123d
|
| 3 |
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Nice123d
|
| 3 |
+
emoji: 🛠️
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: green
|
| 6 |
+
sdk: docker
|
| 7 |
+
pinned: false
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
# nice123d
|
| 11 |
A nicegui-based CAD customizer, editor, and viewer for OCP-based projects like build123d
|
| 12 |
|
cadviewer.py
CHANGED
|
@@ -36,6 +36,11 @@ license:
|
|
| 36 |
from nicegui import app, ui
|
| 37 |
from nicegui.events import KeyEventArguments
|
| 38 |
import subprocess
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
app.native.window_args["resizable"] = True
|
| 41 |
app.native.start_args["debug"] = True
|
|
@@ -110,11 +115,12 @@ keyboard = ui.keyboard(on_key=handle_key)
|
|
| 110 |
# TODO: consider separating this module and how best to organize it (if name == main, etc.)
|
| 111 |
app.on_shutdown(shutdown_all) # register shutdown handler
|
| 112 |
ui.run(
|
| 113 |
-
native=True
|
| 114 |
-
|
|
|
|
| 115 |
title="nicegui-cadviewer",
|
| 116 |
-
fullscreen=False,
|
| 117 |
reload=False,
|
|
|
|
| 118 |
)
|
| 119 |
# ui.run(native=True, window_size=(1800, 900), fullscreen=False, reload=True) #use reload=True when developing rapidly, False helps exit behavior
|
| 120 |
|
|
|
|
| 36 |
from nicegui import app, ui
|
| 37 |
from nicegui.events import KeyEventArguments
|
| 38 |
import subprocess
|
| 39 |
+
import os
|
| 40 |
+
|
| 41 |
+
# Get the Spaces URL from environment
|
| 42 |
+
SPACE_URL = os.getenv('SPACE_URL', '')
|
| 43 |
+
BASE_URL = f"/{SPACE_URL}" if SPACE_URL else ""
|
| 44 |
|
| 45 |
app.native.window_args["resizable"] = True
|
| 46 |
app.native.start_args["debug"] = True
|
|
|
|
| 115 |
# TODO: consider separating this module and how best to organize it (if name == main, etc.)
|
| 116 |
app.on_shutdown(shutdown_all) # register shutdown handler
|
| 117 |
ui.run(
|
| 118 |
+
native=False, # Changed from True to False for web deployment
|
| 119 |
+
host='0.0.0.0', # Listen on all interfaces
|
| 120 |
+
port=8080, # Use port 8080 for Spaces
|
| 121 |
title="nicegui-cadviewer",
|
|
|
|
| 122 |
reload=False,
|
| 123 |
+
base_url=BASE_URL # Add base_url for Spaces
|
| 124 |
)
|
| 125 |
# ui.run(native=True, window_size=(1800, 900), fullscreen=False, reload=True) #use reload=True when developing rapidly, False helps exit behavior
|
| 126 |
|