From acc6d70db946c21606fb6e4e5fe8880832d93a54 Mon Sep 17 00:00:00 2001 From: Stone Li Date: Mon, 25 Jul 2022 16:55:18 +0800 Subject: [PATCH] ENH: do not show dialog if no bambu network lib Change-Id: I9dbdb89b7161515ec7995969106764f66a5dd6e3 --- src/slic3r/GUI/Preferences.cpp | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index 224454f38..1f22c4e91 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -237,20 +237,24 @@ wxBoxSizer *PreferencesDialog::create_item_region_combobox(wxString title, wxWin else area = "Others"; - MessageDialog msg_wingow(nullptr, _L("Changing the region will log out your account.\n") + "\n" + _L("Do you want to continue?"), L("Region selection"), - wxICON_QUESTION | wxOK | wxCANCEL); - if (msg_wingow.ShowModal() == wxID_CANCEL) { - combobox->SetSelection(current_region); - return; - } else { - NetworkAgent *agent = wxGetApp().getAgent(); - wxGetApp().request_user_logout(); - AppConfig * config = GUI::wxGetApp().app_config; - if (agent) { - agent->set_country_code(area); + NetworkAgent* agent = wxGetApp().getAgent(); + AppConfig* config = GUI::wxGetApp().app_config; + if (agent) { + MessageDialog msg_wingow(this, _L("Changing the region will log out your account.\n") + "\n" + _L("Do you want to continue?"), L("Region selection"), + wxICON_QUESTION | wxOK | wxCANCEL); + if (msg_wingow.ShowModal() == wxID_CANCEL) { + combobox->SetSelection(current_region); + return; + } else { + wxGetApp().request_user_logout(); + if (agent) { + agent->set_country_code(area); + } + config->set("region", region.ToStdString()); + EndModal(wxID_CANCEL); } + } else { config->set("region", region.ToStdString()); - EndModal(wxID_CANCEL); } e.Skip();