修正了cofing文件打包配置
This commit is contained in:
parent
298f4f5aa5
commit
365d0b54fd
@ -42,7 +42,8 @@ a = Analysis(
|
|||||||
('dll/femtobolt/bin/ob_usb.dll', 'dll/femtobolt/bin'), # Orbbec USB库
|
('dll/femtobolt/bin/ob_usb.dll', 'dll/femtobolt/bin'), # Orbbec USB库
|
||||||
('dll/femtobolt/bin/live555.dll', 'dll/femtobolt/bin'), # Live555库
|
('dll/femtobolt/bin/live555.dll', 'dll/femtobolt/bin'), # Live555库
|
||||||
('dll/femtobolt/bin/OrbbecSDKConfig_v1.0.xml', 'dll/femtobolt/bin'), # Orbbec配置文件 ('dll/smitsense/SMiTSenseUsb-F3.0.dll', 'dll/smitsense'), # SMiTSense传感器库
|
('dll/femtobolt/bin/OrbbecSDKConfig_v1.0.xml', 'dll/femtobolt/bin'), # Orbbec配置文件 ('dll/smitsense/SMiTSenseUsb-F3.0.dll', 'dll/smitsense'), # SMiTSense传感器库
|
||||||
('dll/smitsense/SMiTSenseUsbWrapper.dll', 'dll/smitsense'), # SMiTSense传感器库包装类
|
('dll/smitsense/SMiTSenseUsb-F3.0.dll', 'dll/smitsense'), # SMiTSenseUsb库
|
||||||
|
('dll/smitsense/Wrapper.dll', 'dll/smitsense'), # SMiTSense传感器库包装类
|
||||||
],
|
],
|
||||||
hiddenimports=[
|
hiddenimports=[
|
||||||
'flask',
|
'flask',
|
||||||
|
@ -29,7 +29,7 @@ depth_range_max = 1700
|
|||||||
|
|
||||||
[DEVICES]
|
[DEVICES]
|
||||||
imu_device_type = real
|
imu_device_type = real
|
||||||
imu_port = COM3
|
imu_port = COM7
|
||||||
imu_baudrate = 9600
|
imu_baudrate = 9600
|
||||||
pressure_device_type = real
|
pressure_device_type = real
|
||||||
pressure_use_mock = False
|
pressure_use_mock = False
|
||||||
|
@ -43,19 +43,38 @@ class ConfigManager:
|
|||||||
Returns:
|
Returns:
|
||||||
str: 配置文件路径
|
str: 配置文件路径
|
||||||
"""
|
"""
|
||||||
|
import sys
|
||||||
|
|
||||||
# 可能的配置文件路径
|
# 可能的配置文件路径
|
||||||
possible_paths = [
|
possible_paths = []
|
||||||
os.path.join(os.path.dirname(__file__), 'config.ini')
|
|
||||||
]
|
# 如果是打包后的exe文件,从exe文件同级目录获取
|
||||||
|
if getattr(sys, 'frozen', False):
|
||||||
|
# 打包后的exe文件路径
|
||||||
|
exe_dir = os.path.dirname(sys.executable)
|
||||||
|
possible_paths.append(os.path.join(exe_dir, 'config.ini'))
|
||||||
|
|
||||||
|
# 开发环境下的路径
|
||||||
|
possible_paths.extend([
|
||||||
|
os.path.join(os.path.dirname(__file__), 'config.ini'),
|
||||||
|
os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'config.ini'), # backend/config.ini
|
||||||
|
os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))), 'config.ini') # 项目根目录/config.ini
|
||||||
|
])
|
||||||
|
|
||||||
for path in possible_paths:
|
for path in possible_paths:
|
||||||
abs_path = os.path.abspath(path)
|
abs_path = os.path.abspath(path)
|
||||||
if os.path.exists(abs_path):
|
if os.path.exists(abs_path):
|
||||||
self.logger.info(f"找到配置文件: {abs_path}")
|
self.logger.info(f"找到配置文件: {abs_path}")
|
||||||
return abs_path
|
return abs_path
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 如果都找不到,返回默认路径(exe同级目录或backend目录)
|
||||||
|
if getattr(sys, 'frozen', False):
|
||||||
|
default_path = os.path.join(os.path.dirname(sys.executable), 'config.ini')
|
||||||
|
else:
|
||||||
|
default_path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'config.ini')
|
||||||
|
|
||||||
|
self.logger.warning(f"未找到配置文件,使用默认路径: {default_path}")
|
||||||
|
return default_path
|
||||||
def _load_config(self):
|
def _load_config(self):
|
||||||
"""
|
"""
|
||||||
加载配置文件
|
加载配置文件
|
||||||
|
Binary file not shown.
@ -205,9 +205,9 @@ class AppServer:
|
|||||||
self.logger.info('正在初始化设备管理器...')
|
self.logger.info('正在初始化设备管理器...')
|
||||||
self.device_managers = {
|
self.device_managers = {
|
||||||
'camera': CameraManager(self.socketio, self.config_manager),
|
'camera': CameraManager(self.socketio, self.config_manager),
|
||||||
'femtobolt': FemtoBoltManager(self.socketio, self.config_manager),
|
# 'femtobolt': FemtoBoltManager(self.socketio, self.config_manager),
|
||||||
'imu': IMUManager(self.socketio, self.config_manager),
|
# 'imu': IMUManager(self.socketio, self.config_manager),
|
||||||
'pressure': PressureManager(self.socketio, self.config_manager)
|
# 'pressure': PressureManager(self.socketio, self.config_manager)
|
||||||
}
|
}
|
||||||
|
|
||||||
# 为每个设备添加状态变化回调
|
# 为每个设备添加状态变化回调
|
||||||
|
@ -1,40 +0,0 @@
|
|||||||
[08/18 20:41:43.488456][debug][24904][Context.cpp:30] Context creating, work_dir=D:\Trae_space\BodyBalanceEvaluation\frontend\src\renderer\dist-electron\win-unpacked\resources\backend
|
|
||||||
[08/18 20:41:43.488655][debug][24904][Context.cpp:49] Config file version=1.1
|
|
||||||
[08/18 20:41:43.488739][debug][24904][FrameBufferManager.cpp:23] Max global frame buffer size updated! size=2048.000MB
|
|
||||||
[08/18 20:41:43.488782][info][24904][Context.cpp:68] Context created with config: default config!
|
|
||||||
[08/18 20:41:43.488823][info][24904][Context.cpp:73] Work directory=D:\Trae_space\BodyBalanceEvaluation\frontend\src\renderer\dist-electron\win-unpacked\resources\backend, SDK version=v1.10.11-20240724-aeaa107e5
|
|
||||||
[08/18 20:41:43.489074][debug][24904][DeviceManager.cpp:30] DeviceManager init ...
|
|
||||||
[08/18 20:41:43.489100][info][24904][MfPal.cpp:105] createObPal: create WinPal!
|
|
||||||
[08/18 20:41:43.489124][debug][24904][MfPal.cpp:110] WmfPal init ...
|
|
||||||
[08/18 20:41:43.520661][debug][24904][MfPal.cpp:117] WmfPal created!
|
|
||||||
[08/18 20:41:43.520721][debug][24904][DeviceManager.cpp:34] Enable USB Device Enumerator ...
|
|
||||||
[08/18 20:41:43.553521][debug][24904][EnumeratorLibusb.cpp:321] queryDevicesInfo done!
|
|
||||||
[08/18 20:41:43.553940][debug][24904][MfPal.cpp:216] Create WinEventDeviceWatcher!
|
|
||||||
[08/18 20:41:43.554220][debug][24904][UsbDeviceEnumerator.cpp:78] No matched usb device found!
|
|
||||||
[08/18 20:41:43.554276][info][24904][DeviceManager.cpp:15] Current found device(s): (0)
|
|
||||||
[08/18 20:41:43.554305][debug][24904][DeviceManager.cpp:52] DeviceManager construct done!
|
|
||||||
[08/18 20:41:43.554347][debug][24904][Context.cpp:81] Context destroying ...
|
|
||||||
[08/18 20:41:43.554360][debug][24904][DeviceManager.cpp:56] DeviceManager destroy ...
|
|
||||||
[08/18 20:41:43.554371][debug][24904][DeviceManager.cpp:64] DeviceManager Destructors done
|
|
||||||
[08/18 20:41:43.558317][debug][24904][MfPal.cpp:128] WmfPal destroyed!
|
|
||||||
[08/18 20:41:43.558735][info][24904][Context.cpp:84] Context destroyed
|
|
||||||
[08/18 20:43:03.299275][debug][29780][Context.cpp:30] Context creating, work_dir=D:\Trae_space\BodyBalanceEvaluation\frontend\src\renderer\dist-electron\win-unpacked\resources\backend
|
|
||||||
[08/18 20:43:03.299338][debug][29780][Context.cpp:49] Config file version=1.1
|
|
||||||
[08/18 20:43:03.299358][debug][29780][FrameBufferManager.cpp:23] Max global frame buffer size updated! size=2048.000MB
|
|
||||||
[08/18 20:43:03.299375][info][29780][Context.cpp:68] Context created with config: default config!
|
|
||||||
[08/18 20:43:03.299399][info][29780][Context.cpp:73] Work directory=D:\Trae_space\BodyBalanceEvaluation\frontend\src\renderer\dist-electron\win-unpacked\resources\backend, SDK version=v1.10.11-20240724-aeaa107e5
|
|
||||||
[08/18 20:43:03.299416][debug][29780][DeviceManager.cpp:30] DeviceManager init ...
|
|
||||||
[08/18 20:43:03.299428][info][29780][MfPal.cpp:105] createObPal: create WinPal!
|
|
||||||
[08/18 20:43:03.299441][debug][29780][MfPal.cpp:110] WmfPal init ...
|
|
||||||
[08/18 20:43:03.340690][debug][29780][MfPal.cpp:117] WmfPal created!
|
|
||||||
[08/18 20:43:03.340727][debug][29780][DeviceManager.cpp:34] Enable USB Device Enumerator ...
|
|
||||||
[08/18 20:43:03.367003][debug][29780][EnumeratorLibusb.cpp:321] queryDevicesInfo done!
|
|
||||||
[08/18 20:43:03.367322][debug][29780][MfPal.cpp:216] Create WinEventDeviceWatcher!
|
|
||||||
[08/18 20:43:03.367577][debug][29780][UsbDeviceEnumerator.cpp:78] No matched usb device found!
|
|
||||||
[08/18 20:43:03.367605][info][29780][DeviceManager.cpp:15] Current found device(s): (0)
|
|
||||||
[08/18 20:43:03.367629][debug][29780][DeviceManager.cpp:52] DeviceManager construct done!
|
|
||||||
[08/18 20:43:03.367646][debug][29780][Context.cpp:81] Context destroying ...
|
|
||||||
[08/18 20:43:03.367657][debug][29780][DeviceManager.cpp:56] DeviceManager destroy ...
|
|
||||||
[08/18 20:43:03.367667][debug][29780][DeviceManager.cpp:64] DeviceManager Destructors done
|
|
||||||
[08/18 20:43:03.369012][debug][29780][MfPal.cpp:128] WmfPal destroyed!
|
|
||||||
[08/18 20:43:03.369386][info][29780][Context.cpp:84] Context destroyed
|
|
Loading…
Reference in New Issue
Block a user