1
0
forked from Rowland/EG

1.合并版本

This commit is contained in:
陈横 2025-09-25 17:51:46 +08:00
parent 75a9df709f
commit d32993b903
3 changed files with 88 additions and 5 deletions

View File

@ -640,7 +640,12 @@ class AssemblyInteractionManager(DirectObject):
if self.step_dialog:
self.step_dialog.close()
self.step_dialog = StepGuideDialog(self)
# 获取主窗口作为父窗口
parent_window = None
if hasattr(self.world, 'main_window') and self.world.main_window:
parent_window = self.world.main_window
self.step_dialog = StepGuideDialog(self, parent_window)
self.step_dialog.show()
def start_current_step(self):
@ -1573,8 +1578,8 @@ class AssemblyInteractionManager(DirectObject):
class StepGuideDialog(QDialog):
"""步骤指引对话框UI代码保持不变"""
def __init__(self, interaction_manager):
super().__init__()
def __init__(self, interaction_manager, parent=None):
super().__init__(parent)
self.interaction_manager = interaction_manager
self.current_required_tool = "" # 当前步骤要求的工具
self.mode = interaction_manager.mode # 获取模式

View File

@ -1995,7 +1995,7 @@ class SceneManager:
new_element = gui_manager.createGUI2DImage(
pos=tuple(absolute_position),
image_path=image_path,
size=scale_value * 0.2
size=scale_value * 0.1
)
elif gui_type == "3d_text" and hasattr(gui_manager, 'createGUI3DText'):
size = absolute_scale[0] if absolute_scale and len(absolute_scale) > 0 else 0.5

View File

@ -28,7 +28,7 @@ try:
WEB_ENGINE_AVAILABLE = True
except ImportError:
QWebEngineView = None
WEB_ENGINE_AVAILABLE = False
WEB_ENGINE_AVAILABLE = False
class MainWindow(QMainWindow):
"""主窗口类"""
@ -720,6 +720,9 @@ class MainWindow(QMainWindow):
self.interactionMenu.addSeparator()
self.startAssemblyInteractionAction = self.interactionMenu.addAction('开始拆装交互')
self.startAssemblyInteractionAction.triggered.connect(self.onStartAssemblyInteraction)
self.interactionMenu.addSeparator()
self.maintenanceSystemAction = self.interactionMenu.addAction('🔧 维修系统')
self.maintenanceSystemAction.triggered.connect(self.onOpenMaintenanceSystem)
self.cesiumMenu = menubar.addMenu('Cesium')
self.loadCesiumTilesetAction = self.cesiumMenu.addAction('加载3Dtiles')
@ -3236,6 +3239,16 @@ class MainWindow(QMainWindow):
try:
print("🔄 正在关闭应用程序...")
# 关闭拆装交互相关的弹窗
if hasattr(self.world, 'assembly_interaction') and self.world.assembly_interaction:
print("🧹 关闭拆装交互弹窗...")
if hasattr(self.world.assembly_interaction, 'step_dialog') and self.world.assembly_interaction.step_dialog:
self.world.assembly_interaction.step_dialog.close()
self.world.assembly_interaction.step_dialog = None
# 停止交互模式
if self.world.assembly_interaction.is_active:
self.world.assembly_interaction.stop_interaction_mode()
# 清理工具管理器中的进程
if hasattr(self.world, 'tool_manager') and self.world.tool_manager:
print("🧹 清理工具管理器进程...")
@ -3469,6 +3482,71 @@ class MainWindow(QMainWindow):
import traceback
traceback.print_exc()
def onOpenMaintenanceSystem(self):
"""打开维修系统"""
try:
# 导入简化的登录界面
from ui.simple_maintenance_login import SimpleMaintenanceLoginDialog
from ui.maintenance_system import MaintenanceSubjectDialog, MaintenanceSystemManager
print("🔧 启动维修系统...")
# 显示登录界面
login_dialog = SimpleMaintenanceLoginDialog(self)
if login_dialog.exec_() == QDialog.Accepted:
print("✅ 登录成功,显示科目选择界面")
# 获取当前项目路径
project_path = None
if hasattr(self.world, 'project_manager') and self.world.project_manager:
project_path = self.world.project_manager.getCurrentProjectPath()
# 显示科目选择界面
subject_dialog = MaintenanceSubjectDialog(project_path, self)
def on_subject_selected(subject_path, mode):
"""处理科目选择"""
try:
print(f"🎯 启动维修科目: {subject_path}")
print(f"📝 模式: {mode}")
# 加载科目配置
import json
with open(subject_path, 'r', encoding='utf-8') as f:
subject_config = json.load(f)
# 启动拆装交互系统
if hasattr(self.world, 'assembly_interaction') and self.world.assembly_interaction:
# 设置配置
self.world.assembly_interaction.config_data = subject_config
# 启动交互模式
self.world.assembly_interaction.start_interaction_mode(mode=mode)
print(f"✅ 维修科目启动成功")
else:
print("❌ 错误:拆装交互系统未初始化")
QMessageBox.warning(self, "错误", "拆装交互系统未初始化")
except Exception as e:
print(f"❌ 启动维修科目失败: {e}")
QMessageBox.critical(self, "错误", f"启动维修科目失败:\n{str(e)}")
import traceback
traceback.print_exc()
subject_dialog.subject_selected.connect(on_subject_selected)
subject_dialog.exec_()
else:
print(" 用户取消了登录")
except Exception as e:
print(f"❌ 打开维修系统失败: {e}")
QMessageBox.critical(self, "错误", f"打开维修系统失败:\n{str(e)}")
import traceback
traceback.print_exc()
class AssemblyModeSelectionDialog(QDialog):
"""拆装模式选择对话框"""