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:
parent
d0996f7f6d
commit
70a39b7d5a
|
@ -1069,10 +1069,13 @@ StringObjectException Print::check_multi_filament_valid(const Print& print)
|
||||||
|
|
||||||
StringObjectException ret;
|
StringObjectException ret;
|
||||||
|
|
||||||
|
std::string hypertext = "filament_mix_print";
|
||||||
|
|
||||||
if(compatibility == FilamentCompatibilityType::HighLowMixed){
|
if(compatibility == FilamentCompatibilityType::HighLowMixed){
|
||||||
if(enable_mix_printing){
|
if(enable_mix_printing){
|
||||||
ret.string =L("Printing high-temp and low-temp filaments together may cause nozzle clogging or printer damage.");
|
ret.string =L("Printing high-temp and low-temp filaments together may cause nozzle clogging or printer damage.");
|
||||||
ret.is_warning = true;
|
ret.is_warning = true;
|
||||||
|
ret.hypetext = hypertext;
|
||||||
}
|
}
|
||||||
else{
|
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.");
|
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) {
|
else if (compatibility == FilamentCompatibilityType::HighMidMixed) {
|
||||||
ret.is_warning = true;
|
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.");
|
ret.string =L("Printing high-temp and mid-temp filaments together may cause nozzle clogging or printer damage.");
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (compatibility == FilamentCompatibilityType::LowMidMixed) {
|
else if (compatibility == FilamentCompatibilityType::LowMidMixed) {
|
||||||
ret.is_warning = true;
|
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.");
|
ret.string = L("Printing mid-temp and low-temp filaments together may cause nozzle clogging or printer damage.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ struct StringObjectException
|
||||||
StringExceptionType type; // warning type for tips
|
StringExceptionType type; // warning type for tips
|
||||||
bool is_warning = false;
|
bool is_warning = false;
|
||||||
std::vector<std::string> params; // warning params for tips
|
std::vector<std::string> params; // warning params for tips
|
||||||
|
std::string hypetext;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CanceledException : public std::exception
|
class CanceledException : public std::exception
|
||||||
|
|
|
@ -6786,7 +6786,7 @@ void Plater::priv::process_validation_warning(StringObjectException const &warni
|
||||||
std::string text = warning.string;
|
std::string text = warning.string;
|
||||||
auto po = dynamic_cast<PrintObjectBase const *>(warning.object);
|
auto po = dynamic_cast<PrintObjectBase const *>(warning.object);
|
||||||
auto mo = po ? po->model_object() : dynamic_cast<ModelObject 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 & objects = wxGetApp().model().objects;
|
||||||
auto iter = id.id ? std::find_if(objects.begin(), objects.end(), [id](auto o) { return o->id() == id; }) : objects.end();
|
auto iter = id.id ? std::find_if(objects.begin(), objects.end(), [id](auto o) { return o->id() == id; }) : objects.end();
|
||||||
if (iter != 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"");
|
wxGetApp().sidebar().jump_to_option(opt, Preset::TYPE_PRINT, L"");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} : std::function<bool(wxEvtHandler *)>();
|
};
|
||||||
auto hypertext = (mo || !warning.opt_key.empty()) ? _u8L("Jump to") : "";
|
auto action_fn = (mo || !warning.opt_key.empty()) ? obj_call_fn : std::function<bool(wxEvtHandler *)>();
|
||||||
if (mo) hypertext += std::string(" [") + mo->name + "]";
|
std::string hypertext;
|
||||||
if (!warning.opt_key.empty()) hypertext += std::string(" (") + warning.opt_key + ")";
|
// 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
|
// BBS disable support enforcer
|
||||||
//if (text == "_SUPPORTS_OFF") {
|
//if (text == "_SUPPORTS_OFF") {
|
||||||
|
|
Loading…
Reference in New Issue