添加拆配交互
This commit is contained in:
parent
0d898b498a
commit
367cde9e54
@ -16,7 +16,7 @@ from PyQt5.QtWidgets import (QApplication, QMainWindow, QMenuBar, QMenu, QAction
|
||||
QLabel, QLineEdit, QFormLayout, QDoubleSpinBox, QScrollArea,
|
||||
QFileSystemModel, QButtonGroup, QToolButton, QPushButton, QHBoxLayout,
|
||||
QComboBox, QGroupBox, QInputDialog, QFileDialog, QMessageBox, QDesktopWidget, QDialog,
|
||||
QSpinBox, QFrame, QRadioButton, QTextEdit)
|
||||
QSpinBox, QFrame, QRadioButton, QTextEdit, QCheckBox)
|
||||
from PyQt5.QtCore import Qt, QDir, QTimer, QSize, QPoint, QUrl, QRect
|
||||
from direct.showbase.ShowBaseGlobal import aspect2d
|
||||
from panda3d.core import OrthographicLens
|
||||
@ -3572,115 +3572,6 @@ class MainWindow(QMainWindow):
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
class AssemblyModeSelectionDialog(QDialog):
|
||||
"""拆装模式选择对话框"""
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.selected_mode = "training" # 默认选择训练模式
|
||||
self.setupUI()
|
||||
|
||||
def setupUI(self):
|
||||
self.setWindowTitle("选择拆装模式")
|
||||
self.setFixedSize(400, 300)
|
||||
self.setModal(True)
|
||||
|
||||
layout = QVBoxLayout(self)
|
||||
|
||||
# 标题
|
||||
title_label = QLabel("请选择拆装交互模式")
|
||||
title_label.setStyleSheet("font-size: 16px; font-weight: bold; color: #2E86C1; margin: 10px;")
|
||||
title_label.setAlignment(Qt.AlignCenter)
|
||||
layout.addWidget(title_label)
|
||||
|
||||
# 模式选择组
|
||||
mode_group = QGroupBox("模式选择")
|
||||
mode_layout = QVBoxLayout(mode_group)
|
||||
|
||||
# 训练模式
|
||||
self.training_radio = QRadioButton("训练模式")
|
||||
self.training_radio.setChecked(True) # 默认选中
|
||||
self.training_radio.setStyleSheet("font-size: 14px; margin: 5px;")
|
||||
mode_layout.addWidget(self.training_radio)
|
||||
|
||||
training_desc = QTextEdit()
|
||||
training_desc.setMaximumHeight(60)
|
||||
training_desc.setReadOnly(True)
|
||||
training_desc.setPlainText("• 显示详细的步骤描述和操作提示\n• 提供工具选择的正确性提示\n• 播放语音指导")
|
||||
training_desc.setStyleSheet("background-color: #f0f8ff; border: 1px solid #ccc; margin-left: 20px;")
|
||||
mode_layout.addWidget(training_desc)
|
||||
|
||||
# 考核模式
|
||||
self.exam_radio = QRadioButton("考核模式")
|
||||
self.exam_radio.setStyleSheet("font-size: 14px; margin: 5px;")
|
||||
mode_layout.addWidget(self.exam_radio)
|
||||
|
||||
exam_desc = QTextEdit()
|
||||
exam_desc.setMaximumHeight(60)
|
||||
exam_desc.setReadOnly(True)
|
||||
exam_desc.setPlainText("• 不显示步骤描述\n• 工具选择错误时不提示,直接扣分\n• 不播放语音指导")
|
||||
exam_desc.setStyleSheet("background-color: #fff5f5; border: 1px solid #ccc; margin-left: 20px;")
|
||||
mode_layout.addWidget(exam_desc)
|
||||
|
||||
layout.addWidget(mode_group)
|
||||
|
||||
# 按钮
|
||||
button_layout = QHBoxLayout()
|
||||
|
||||
self.ok_button = QPushButton("开始")
|
||||
self.ok_button.setStyleSheet("""
|
||||
QPushButton {
|
||||
background-color: #27AE60;
|
||||
color: white;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
padding: 8px 20px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
}
|
||||
QPushButton:hover {
|
||||
background-color: #2ECC71;
|
||||
}
|
||||
""")
|
||||
self.ok_button.clicked.connect(self.accept)
|
||||
|
||||
self.cancel_button = QPushButton("取消")
|
||||
self.cancel_button.setStyleSheet("""
|
||||
QPushButton {
|
||||
background-color: #95A5A6;
|
||||
color: white;
|
||||
font-size: 14px;
|
||||
padding: 8px 20px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
}
|
||||
QPushButton:hover {
|
||||
background-color: #BDC3C7;
|
||||
}
|
||||
""")
|
||||
self.cancel_button.clicked.connect(self.reject)
|
||||
|
||||
button_layout.addStretch()
|
||||
button_layout.addWidget(self.ok_button)
|
||||
button_layout.addWidget(self.cancel_button)
|
||||
|
||||
layout.addLayout(button_layout)
|
||||
|
||||
# 连接单选按钮信号
|
||||
self.training_radio.toggled.connect(self.on_mode_changed)
|
||||
self.exam_radio.toggled.connect(self.on_mode_changed)
|
||||
|
||||
def on_mode_changed(self):
|
||||
"""模式改变时的处理"""
|
||||
if self.training_radio.isChecked():
|
||||
self.selected_mode = "training"
|
||||
elif self.exam_radio.isChecked():
|
||||
self.selected_mode = "exam"
|
||||
print(f"🔄 模式选择改变: {self.selected_mode}")
|
||||
|
||||
def get_selected_mode(self):
|
||||
"""获取选中的模式"""
|
||||
return self.selected_mode
|
||||
|
||||
|
||||
# ==================== VR事件处理 ====================
|
||||
@ -4234,4 +4125,114 @@ def setup_main_window(world,path = None):
|
||||
if path:
|
||||
openProjectForPath(path,main_window)
|
||||
|
||||
return app, main_window
|
||||
return app, main_window
|
||||
|
||||
class AssemblyModeSelectionDialog(QDialog):
|
||||
"""拆装模式选择对话框"""
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.selected_mode = "training" # 默认选择训练模式
|
||||
self.setupUI()
|
||||
|
||||
def setupUI(self):
|
||||
self.setWindowTitle("选择拆装模式")
|
||||
self.setFixedSize(400, 300)
|
||||
self.setModal(True)
|
||||
|
||||
layout = QVBoxLayout(self)
|
||||
|
||||
# 标题
|
||||
title_label = QLabel("请选择拆装交互模式")
|
||||
title_label.setStyleSheet("font-size: 16px; font-weight: bold; color: #2E86C1; margin: 10px;")
|
||||
title_label.setAlignment(Qt.AlignCenter)
|
||||
layout.addWidget(title_label)
|
||||
|
||||
# 模式选择组
|
||||
mode_group = QGroupBox("模式选择")
|
||||
mode_layout = QVBoxLayout(mode_group)
|
||||
|
||||
# 训练模式
|
||||
self.training_radio = QRadioButton("训练模式")
|
||||
self.training_radio.setChecked(True) # 默认选中
|
||||
self.training_radio.setStyleSheet("font-size: 14px; margin: 5px;")
|
||||
mode_layout.addWidget(self.training_radio)
|
||||
|
||||
training_desc = QTextEdit()
|
||||
training_desc.setMaximumHeight(60)
|
||||
training_desc.setReadOnly(True)
|
||||
training_desc.setPlainText("• 显示详细的步骤描述和操作提示\n• 提供工具选择的正确性提示\n• 播放语音指导")
|
||||
training_desc.setStyleSheet("background-color: #f0f8ff; border: 1px solid #ccc; margin-left: 20px;")
|
||||
mode_layout.addWidget(training_desc)
|
||||
|
||||
# 考核模式
|
||||
self.exam_radio = QRadioButton("考核模式")
|
||||
self.exam_radio.setStyleSheet("font-size: 14px; margin: 5px;")
|
||||
mode_layout.addWidget(self.exam_radio)
|
||||
|
||||
exam_desc = QTextEdit()
|
||||
exam_desc.setMaximumHeight(60)
|
||||
exam_desc.setReadOnly(True)
|
||||
exam_desc.setPlainText("• 不显示步骤描述\n• 工具选择错误时不提示,直接扣分\n• 不播放语音指导")
|
||||
exam_desc.setStyleSheet("background-color: #fff5f5; border: 1px solid #ccc; margin-left: 20px;")
|
||||
mode_layout.addWidget(exam_desc)
|
||||
|
||||
layout.addWidget(mode_group)
|
||||
|
||||
# 按钮
|
||||
button_layout = QHBoxLayout()
|
||||
|
||||
self.ok_button = QPushButton("开始")
|
||||
self.ok_button.setStyleSheet("""
|
||||
QPushButton {
|
||||
background-color: #27AE60;
|
||||
color: white;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
padding: 8px 20px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
}
|
||||
QPushButton:hover {
|
||||
background-color: #2ECC71;
|
||||
}
|
||||
""")
|
||||
self.ok_button.clicked.connect(self.accept)
|
||||
|
||||
self.cancel_button = QPushButton("取消")
|
||||
self.cancel_button.setStyleSheet("""
|
||||
QPushButton {
|
||||
background-color: #95A5A6;
|
||||
color: white;
|
||||
font-size: 14px;
|
||||
padding: 8px 20px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
}
|
||||
QPushButton:hover {
|
||||
background-color: #BDC3C7;
|
||||
}
|
||||
""")
|
||||
self.cancel_button.clicked.connect(self.reject)
|
||||
|
||||
button_layout.addStretch()
|
||||
button_layout.addWidget(self.ok_button)
|
||||
button_layout.addWidget(self.cancel_button)
|
||||
|
||||
layout.addLayout(button_layout)
|
||||
|
||||
# 连接单选按钮信号
|
||||
self.training_radio.toggled.connect(self.on_mode_changed)
|
||||
self.exam_radio.toggled.connect(self.on_mode_changed)
|
||||
|
||||
def on_mode_changed(self):
|
||||
"""模式改变时的处理"""
|
||||
if self.training_radio.isChecked():
|
||||
self.selected_mode = "training"
|
||||
elif self.exam_radio.isChecked():
|
||||
self.selected_mode = "exam"
|
||||
print(f"🔄 模式选择改变: {self.selected_mode}")
|
||||
|
||||
def get_selected_mode(self):
|
||||
"""获取选中的模式"""
|
||||
return self.selected_mode
|
||||
|
||||
Loading…
Reference in New Issue
Block a user