夹爪可视化界面部分更新,主要是3D模型
This commit is contained in:
@@ -8,6 +8,11 @@ from pathlib import Path
|
||||
|
||||
BUILD_DIR = Path(__file__).resolve().parent
|
||||
PROJECT_ROOT = BUILD_DIR.parent
|
||||
VISUALIZATION_DIR = PROJECT_ROOT / "crt_ctag2f90d_gripper_visualization"
|
||||
LOGO_FILES = (
|
||||
PROJECT_ROOT / "gripper" / "logo.png",
|
||||
PROJECT_ROOT / "gripper" / "logo_topbar.png",
|
||||
)
|
||||
|
||||
|
||||
def module_exists(name):
|
||||
@@ -88,6 +93,29 @@ def build(app_name, clean_dist):
|
||||
"pyqtgraph",
|
||||
]
|
||||
|
||||
if VISUALIZATION_DIR.exists():
|
||||
args.extend(
|
||||
[
|
||||
"--add-data",
|
||||
data_arg(VISUALIZATION_DIR, "crt_ctag2f90d_gripper_visualization"),
|
||||
]
|
||||
)
|
||||
else:
|
||||
print(f"Warning: visualization assets were not found: {VISUALIZATION_DIR}")
|
||||
|
||||
for logo_file in LOGO_FILES:
|
||||
if logo_file.exists():
|
||||
args.extend(["--add-data", data_arg(logo_file, "gripper")])
|
||||
else:
|
||||
print(f"Warning: logo asset was not found: {logo_file}")
|
||||
|
||||
if module_exists("OpenGL"):
|
||||
args.extend(["--collect-all", "OpenGL"])
|
||||
else:
|
||||
print(
|
||||
"Warning: module 'OpenGL' was not found; install PyOpenGL for the solid 3D model."
|
||||
)
|
||||
|
||||
if module_exists("orisys"):
|
||||
args.extend(["--collect-submodules", "orisys"])
|
||||
else:
|
||||
@@ -104,11 +132,28 @@ def build(app_name, clean_dist):
|
||||
app_dir = exe_path.parent
|
||||
config_dir = copy_runtime_dir(PROJECT_ROOT / "config", app_dir, "config")
|
||||
sdk_dir = copy_runtime_dir(PROJECT_ROOT / "sdk", app_dir, "sdk")
|
||||
visualization_dir = None
|
||||
if VISUALIZATION_DIR.exists():
|
||||
visualization_dir = copy_runtime_dir(
|
||||
VISUALIZATION_DIR,
|
||||
app_dir,
|
||||
"crt_ctag2f90d_gripper_visualization",
|
||||
)
|
||||
runtime_logo_dir = app_dir / "gripper"
|
||||
runtime_logo_dir.mkdir(exist_ok=True)
|
||||
copied_logos = []
|
||||
for logo_file in LOGO_FILES:
|
||||
if logo_file.exists():
|
||||
copied_logos.append(shutil.copy2(logo_file, runtime_logo_dir / logo_file.name))
|
||||
|
||||
print()
|
||||
print(f"Build complete: {exe_path}")
|
||||
print(f"Runtime config copied to: {config_dir}")
|
||||
print(f"Runtime sdk copied to: {sdk_dir}")
|
||||
if visualization_dir is not None:
|
||||
print(f"Runtime 3D model copied to: {visualization_dir}")
|
||||
for logo_path in copied_logos:
|
||||
print(f"Runtime logo copied to: {logo_path}")
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
Reference in New Issue
Block a user