ENH: add wiki in mix printing warning

jira: NONE

Signed-off-by: zhimin.zeng <zhimin.zeng@bambulab.com>
Change-Id: Ib0b321fd7dd207cef6d8e36556d8e635b363bacb
This commit is contained in:
zhimin.zeng 2025-04-15 14:30:57 +08:00 committed by lane.wei
parent d0996f7f6d
commit 70a39b7d5a
3 changed files with 29 additions and 5 deletions

View File

@ -1069,10 +1069,13 @@ StringObjectException Print::check_multi_filament_valid(const Print& print)
StringObjectException ret;
std::string hypertext = "filament_mix_print";
if(compatibility == FilamentCompatibilityType::HighLowMixed){
if(enable_mix_printing){
ret.string =L("Printing high-temp and low-temp filaments together may cause nozzle clogging or printer damage.");
ret.is_warning = true;
ret.hypetext = hypertext;
}
else{
ret.string =L("Printing high-temp and low-temp filaments together may cause nozzle clogging or printer damage. If you still want to print, you can enable the option in Preferences.");
@ -1080,11 +1083,13 @@ StringObjectException Print::check_multi_filament_valid(const Print& print)
}
else if (compatibility == FilamentCompatibilityType::HighMidMixed) {
ret.is_warning = true;
ret.hypetext = hypertext;
ret.string =L("Printing high-temp and mid-temp filaments together may cause nozzle clogging or printer damage.");
}
else if (compatibility == FilamentCompatibilityType::LowMidMixed) {
ret.is_warning = true;
ret.hypetext = hypertext;
ret.string = L("Printing mid-temp and low-temp filaments together may cause nozzle clogging or printer damage.");
}

View File

@ -35,6 +35,7 @@ struct StringObjectException
StringExceptionType type; // warning type for tips
bool is_warning = false;
std::vector<std::string> params; // warning params for tips
std::string hypetext;
};
class CanceledException : public std::exception

View File

@ -6786,7 +6786,7 @@ void Plater::priv::process_validation_warning(StringObjectException const &warni
std::string text = warning.string;
auto po = dynamic_cast<PrintObjectBase const *>(warning.object);
auto mo = po ? po->model_object() : dynamic_cast<ModelObject const *>(warning.object);
auto action_fn = (mo || !warning.opt_key.empty()) ? [id = mo ? mo->id() : 0, opt = warning.opt_key](wxEvtHandler *) {
auto obj_call_fn= [id = mo ? mo->id() : 0, opt = warning.opt_key](wxEvtHandler *) {
auto & objects = wxGetApp().model().objects;
auto iter = id.id ? std::find_if(objects.begin(), objects.end(), [id](auto o) { return o->id() == id; }) : objects.end();
if (iter != objects.end()) {
@ -6799,10 +6799,28 @@ void Plater::priv::process_validation_warning(StringObjectException const &warni
wxGetApp().sidebar().jump_to_option(opt, Preset::TYPE_PRINT, L"");
}
return false;
} : std::function<bool(wxEvtHandler *)>();
auto hypertext = (mo || !warning.opt_key.empty()) ? _u8L("Jump to") : "";
if (mo) hypertext += std::string(" [") + mo->name + "]";
if (!warning.opt_key.empty()) hypertext += std::string(" (") + warning.opt_key + ")";
};
auto action_fn = (mo || !warning.opt_key.empty()) ? obj_call_fn : std::function<bool(wxEvtHandler *)>();
std::string hypertext;
// hack code
if (warning.hypetext == "filament_mix_print") {
hypertext = _u8L("Click Wiki for help.");
action_fn = [](wxEvtHandler *)->bool {
bool is_zh = wxGetApp().app_config->get("language") == "zh_CN";
if (is_zh) {
wxLaunchDefaultBrowser("https://wiki.bambulab.com/zh/filament-acc/filament/h2d-filament-config-limit");
} else {
wxLaunchDefaultBrowser("https://wiki.bambulab.com/en/filament-acc/filament/h2d-filament-config-limit");
}
return false;
};
} else if (!warning.hypetext.empty()) {
hypertext = warning.hypetext;
} else {
if (mo || !warning.opt_key.empty()) hypertext = _u8L("Jump to");
if (mo) hypertext += std::string(" [") + mo->name + "]";
if (!warning.opt_key.empty()) hypertext += std::string(" (") + warning.opt_key + ")";
}
// BBS disable support enforcer
//if (text == "_SUPPORTS_OFF") {