61 lines
1.8 KiB
Python
61 lines
1.8 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
测试简化后的坐标轴系统
|
|
验证选中物体自动显示坐标轴功能
|
|
"""
|
|
|
|
import warnings
|
|
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
|
|
|
import sys
|
|
from PyQt5.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QWidget, QLabel, QPushButton, QHBoxLayout
|
|
from PyQt5.QtCore import Qt
|
|
from QPanda3D.QPanda3DWidget import QPanda3DWidget
|
|
sys.path.append('..')
|
|
from main import MyWorld, CustomPanda3DWidget
|
|
|
|
def main():
|
|
print("启动简化坐标轴测试...")
|
|
|
|
app = QApplication(sys.argv)
|
|
|
|
# 创建主窗口
|
|
mainWindow = QMainWindow()
|
|
mainWindow.setWindowTitle("简化坐标轴测试 - 选中物体自动显示坐标轴")
|
|
mainWindow.setGeometry(100, 100, 1000, 800)
|
|
|
|
# 创建布局
|
|
centralWidget = QWidget()
|
|
layout = QVBoxLayout(centralWidget)
|
|
|
|
# 添加说明
|
|
infoLayout = QHBoxLayout()
|
|
label = QLabel("简化坐标轴测试 - 点击任何物体都会自动显示坐标轴,无需移动工具")
|
|
label.setAlignment(Qt.AlignCenter)
|
|
label.setStyleSheet("background-color: lightgreen; padding: 10px; font-size: 12px;")
|
|
infoLayout.addWidget(label)
|
|
|
|
layout.addLayout(infoLayout)
|
|
|
|
# 创建世界
|
|
world = MyWorld()
|
|
|
|
# 创建部件
|
|
pandaWidget = CustomPanda3DWidget(world)
|
|
layout.addWidget(pandaWidget)
|
|
|
|
mainWindow.setCentralWidget(centralWidget)
|
|
mainWindow.show()
|
|
|
|
print("\n测试说明:")
|
|
print("1. 程序启动后会显示一个空的3D场景")
|
|
print("2. 可以导入模型或创建基本几何体")
|
|
print("3. 点击任何物体都会自动显示坐标轴")
|
|
print("4. 不再需要选择移动工具")
|
|
print("5. 直接拖拽坐标轴即可移动物体")
|
|
|
|
return app.exec_()
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main()) |