fix path errors
This commit is contained in:
@@ -646,22 +646,42 @@ class FingerDashboardWindow(QMainWindow):
|
||||
self._update_play_enabled_for_source()
|
||||
|
||||
def _select_config(self) -> None:
|
||||
from .preferences import (
|
||||
default_finger_config,
|
||||
normalize_config_preference,
|
||||
packaged_finger_bundle_root,
|
||||
)
|
||||
|
||||
start = packaged_finger_bundle_root()
|
||||
start_dir = str(start) if start is not None else "sensors/finger"
|
||||
path, _ = QFileDialog.getOpenFileName(
|
||||
self,
|
||||
"选择配置文件",
|
||||
"config",
|
||||
start_dir,
|
||||
"JSON (*.json);;所有文件 (*)",
|
||||
)
|
||||
if path:
|
||||
self.settings_panel.set_config_path(path)
|
||||
self.config.config = path
|
||||
config = normalize_config_preference(path) or default_finger_config()
|
||||
self.settings_panel.set_config_path(config)
|
||||
self.config.config = config
|
||||
self._save_preferences()
|
||||
|
||||
def _select_finger_assets(self) -> None:
|
||||
from .preferences import (
|
||||
default_finger_assets_dir,
|
||||
default_finger_config,
|
||||
normalize_assets_preference,
|
||||
normalize_config_preference,
|
||||
packaged_finger_bundle_root,
|
||||
)
|
||||
|
||||
start = packaged_finger_bundle_root()
|
||||
path = QFileDialog.getExistingDirectory(
|
||||
self,
|
||||
"选择传感器 bundle 目录",
|
||||
self.settings_panel.sensor_bundle_dir() or "sensors/finger",
|
||||
str(start) if start is not None else (
|
||||
self.settings_panel.sensor_bundle_dir() or "sensors/finger"
|
||||
),
|
||||
)
|
||||
if path:
|
||||
bundle_dir = Path(path)
|
||||
@@ -677,12 +697,13 @@ class FingerDashboardWindow(QMainWindow):
|
||||
if isinstance(rel_assets, str) and rel_assets.strip():
|
||||
assets_dir = bundle_dir / rel_assets
|
||||
if config_path.is_file():
|
||||
self.settings_panel.set_config_path(str(config_path))
|
||||
self.config.config = str(config_path)
|
||||
self.settings_panel.set_finger_export_dir(str(assets_dir))
|
||||
self.config.export_dir = str(assets_dir)
|
||||
config = normalize_config_preference(str(config_path)) or default_finger_config()
|
||||
self.settings_panel.set_config_path(config)
|
||||
self.config.config = config
|
||||
assets = normalize_assets_preference(str(assets_dir)) or default_finger_assets_dir()
|
||||
self.settings_panel.set_finger_export_dir(assets)
|
||||
self.config.export_dir = assets
|
||||
self._save_preferences()
|
||||
|
||||
def _select_csv_dir(self) -> None:
|
||||
path = QFileDialog.getExistingDirectory(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user