ENH: fix unable to load video

1. also  add protect for filament map read

jira:NONE

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I321be9f49d7696d02ed7771852713c0cef5d5ebd
This commit is contained in:
xun.zhang 2025-02-15 11:19:06 +08:00 committed by lane.wei
parent 0ea2a8dabe
commit 8b735631b1
2 changed files with 15 additions and 3 deletions

View File

@ -4173,8 +4173,15 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
}
}
else if (key == FILAMENT_MAP_ATTR) {
if (m_curr_plater)
m_curr_plater->config.set_key_value("filament_map", new ConfigOptionInts(get_vector_from_string(value)));
if (m_curr_plater){
auto filament_map = get_vector_from_string(value);
for (size_t idx = 0; idx < filament_map.size(); ++idx) {
if (filament_map[idx] < 1) {
filament_map[idx] = 1;
}
}
m_curr_plater->config.set_key_value("filament_map", new ConfigOptionInts(filament_map));
}
}
else if (key == UNPRINTABLE_FILAMENT_MAP_ATTR)
{

View File

@ -1665,7 +1665,12 @@ wxBoxSizer* MainFrame::create_side_tools()
MessageDialog dlg(this, _L("This is your first time slicing with the H2D machine.\nWould you like to watch a quick tutorial video?"), _L("First Guide"), wxYES_NO);
auto res = dlg.ShowModal();
if (res == wxID_YES) {
fs::path video_path = fs::path(resources_dir()) / "videos/dual_extruder_slicing.mp4";
bool is_zh = wxGetApp().app_config->get("language") == "zh_CN";
fs::path video_path;
if (is_zh)
video_path = fs::path(resources_dir()) / "videos/dual_extruder_slicing_zh.mp4";
else
video_path = fs::path(resources_dir()) / "videos/dual_extruder_slicing_en.mp4";
wxString video_path_str = wxString::FromUTF8(video_path.string());
if (wxFileExists(video_path_str)) {