FIX: gui: fix the wrongly popup of selfdefined material

jira: no-jira
Change-Id: Ied899da1e24ec9fcc63f363975dfd41983bc9409
This commit is contained in:
lane.wei 2025-03-28 14:50:12 +08:00 committed by Lane.Wei
parent ec9193ffb0
commit 0c0c8a6678
3 changed files with 13 additions and 7 deletions

View File

@ -3805,7 +3805,8 @@ void GUI_App::ShowUserGuide() {
bool res = false;
GuideFrame GuideDlg(this);
//if (GuideDlg.IsFirstUse())
res = GuideDlg.run();
bool config_applied = false;
res = GuideDlg.run(config_applied);
if (res) {
load_current_presets();
update_publish_status();
@ -3860,7 +3861,8 @@ void GUI_App::ShowOnlyFilament() {
bool res = false;
GuideFrame GuideDlg(this);
GuideDlg.SetStartPage(GuideFrame::GuidePage::BBL_FILAMENT_ONLY);
res = GuideDlg.run();
bool config_applied = false;
res = GuideDlg.run(config_applied);
if (res) {
load_current_presets();
@ -7042,7 +7044,9 @@ bool GUI_App::run_wizard(ConfigWizard::RunReason reason, ConfigWizard::StartPage
start_page == ConfigWizard::SP_PRINTERS ? GuideFrame::BBL_MODELS_ONLY :
GuideFrame::BBL_MODELS;
wizard.SetStartPage(page);
bool res = wizard.run();
bool config_applied = false;
bool res = wizard.run(config_applied);
if (res) {
load_current_presets();
@ -7050,7 +7054,7 @@ bool GUI_App::run_wizard(ConfigWizard::RunReason reason, ConfigWizard::StartPage
mainframe->refresh_plugin_tips();
// BBS: remove SLA related message
}
else {
else if (config_applied){
MessageDialog msg_dlg(mainframe, m_install_preset_fail_text, _L("Install presets failed"), wxAPPLY | wxOK);
msg_dlg.ShowModal();
}

View File

@ -943,7 +943,7 @@ bool GuideFrame::apply_config(AppConfig *app_config, PresetBundle *preset_bundle
return true;
}
bool GuideFrame::run()
bool GuideFrame::run(bool& config_applied)
{
//BOOST_LOG_TRIVIAL(info) << boost::format("Running ConfigWizard, reason: %1%, start_page: %2%") % reason % start_page;
@ -969,8 +969,10 @@ bool GuideFrame::run()
if (result == wxID_OK) {
bool apply_keeped_changes = false;
BOOST_LOG_TRIVIAL(info) << "GuideFrame returned ok";
if (! this->apply_config(app.app_config, app.preset_bundle, app.preset_updater, apply_keeped_changes))
if (! this->apply_config(app.app_config, app.preset_bundle, app.preset_updater, apply_keeped_changes)) {
config_applied = true;
return false;
}
if (apply_keeped_changes)
app.apply_keeped_preset_modifications();

View File

@ -81,7 +81,7 @@ public:
bool apply_config(AppConfig *app_config, PresetBundle *preset_bundle, const PresetUpdater *updater, bool& apply_keeped_changes);
bool run();
bool run(bool& config_applied);
void StrReplace(std::string &strBase, std::string strSrc, std::string strDes);
std::string w2s(wxString sSrc);