From 82cd618c1449c64d150be8257bc0831406c3c260 Mon Sep 17 00:00:00 2001 From: "chunmao.guo" Date: Wed, 21 Jun 2023 10:58:08 +0800 Subject: [PATCH] FIX: [STUDIO-3308] check has_model_mall Change-Id: I9b7477af12a5d59855f7ef176aac24731665c343 --- src/slic3r/GUI/GUI_App.cpp | 17 +++++++++++------ src/slic3r/GUI/GUI_App.hpp | 1 + src/slic3r/GUI/Preferences.cpp | 14 ++++++++++++-- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index f394a5c65..cf7e71f93 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -1771,7 +1771,7 @@ void GUI_App::restart_networking() start_sync_user_preset(); } if (mainframe && this->app_config->get("staff_pick_switch") == "true") { - if (mainframe->m_webview) { mainframe->m_webview->SendDesignStaffpick(true); } + if (mainframe->m_webview) { mainframe->m_webview->SendDesignStaffpick(has_model_mall()); } } } BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< boost::format(" exit, m_agent=%1%")%m_agent; @@ -2993,14 +2993,19 @@ void GUI_App::update_label_colours_from_appconfig() void GUI_App::update_publish_status() { - if (app_config->get_country_code() == "CN") { - mainframe->show_publish_button(false); - } - else { - mainframe->show_publish_button(true); + mainframe->show_publish_button(has_model_mall()); + if (app_config->get("staff_pick_switch") == "true") { + mainframe->m_webview->SendDesignStaffpick(has_model_mall()); } } +bool GUI_App::has_model_mall() +{ + if (app_config->get_country_code() == "CN") + return false; + return true; +} + void GUI_App::update_label_colours() { for (Tab* tab : tabs_list) diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index 93fb16d15..1a7315f08 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -338,6 +338,7 @@ public: void init_label_colours(); void update_label_colours_from_appconfig(); void update_publish_status(); + bool has_model_mall(); void update_label_colours(); // update color mode for window void UpdateDarkUI(wxWindow *window, bool highlited = false, bool just_font = false); diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index 48fbebc25..05707b37f 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -1020,8 +1020,18 @@ wxWindow* PreferencesDialog::create_general_page() sizer_page->Add(item_associate_stl, 0, wxTOP, FromDIP(3)); sizer_page->Add(item_associate_step, 0, wxTOP, FromDIP(3)); #endif // _WIN32 - sizer_page->Add(title_modelmall, 0, wxTOP | wxEXPAND, FromDIP(20)); - sizer_page->Add(item_modelmall, 0, wxTOP, FromDIP(3)); + auto item_title_modelmall = sizer_page->Add(title_modelmall, 0, wxTOP | wxEXPAND, FromDIP(20)); + auto item_item_modelmall = sizer_page->Add(item_modelmall, 0, wxTOP, FromDIP(3)); + auto update_modelmall = [this, item_title_modelmall, item_item_modelmall] (wxEvent & e) { + bool has_model_mall = wxGetApp().has_model_mall(); + item_title_modelmall->Show(has_model_mall); + item_item_modelmall->Show(has_model_mall); + Layout(); + Fit(); + }; + wxCommandEvent eee(wxEVT_COMBOBOX); + update_modelmall(eee); + item_region->GetItem(size_t(2))->GetWindow()->Bind(wxEVT_COMBOBOX, update_modelmall); sizer_page->Add(title_project, 0, wxTOP| wxEXPAND, FromDIP(20)); sizer_page->Add(item_max_recent_count, 0, wxTOP, FromDIP(3)); sizer_page->Add(item_save_choise, 0, wxTOP, FromDIP(3));