refactor(packaging): PyInstaller资源路径统一适配get_resource_path

This commit is contained in:
DXC
2026-05-10 18:02:59 +08:00
parent 5a55be286f
commit 2a4a7ec7be
4 changed files with 74 additions and 47 deletions

View File

@ -410,13 +410,27 @@ class Step9Panel(QWidget):
if not existing_out or not existing_out.strip():
self.output_dir.set_path(output_dir)
# 5. 自动继承步骤1的水域掩膜作为边界文件
# 5. 自动探测原始矢量边界文件(.shp作为专题图底图
# 优先回溯 input-test/roi.shpgeopandas.read_file 仅支持矢量格式
if self.work_dir:
default_mask = Path(self.work_dir) / "1_water_mask" / "water_mask_from_shp.dat"
if default_mask.exists():
existing_boundary = (self.boundary_file.get_path() or "").strip()
if not existing_boundary:
self.boundary_file.set_path(str(default_mask))
possible_shp = None
candidates = [
Path(self.work_dir).parent / "input-test" / "roi.shp",
Path(self.work_dir) / "roi.shp",
Path(self.work_dir).parent / "roi.shp",
]
for candidate in candidates:
if candidate.exists() and candidate.suffix.lower() == ".shp":
possible_shp = candidate
break
existing_boundary = (self.boundary_file.get_path() or "").strip()
if not existing_boundary and possible_shp:
self.boundary_file.set_path(str(possible_shp))
elif not existing_boundary:
# 未找到 .shp 时清空并提示用户手动选择矢量文件
self.boundary_file.set_path("")
print("⚠️ 提示:专题图生成模块需传入标准矢量边界文件 (.shp),请手动选择。")
except Exception as e:
import traceback
print(f"{self.__class__.__name__}】自动填充失败,跳过: {e}")