From e7b6615a5f62f17d012bae9895cc3a17b43ea571 Mon Sep 17 00:00:00 2001 From: "maosheng.wei" Date: Sun, 8 Oct 2023 10:23:34 +0800 Subject: [PATCH] FIX: [4670] Cloud disabled rating interface, displaying error prompt Jira: STUDIO-4670 Change-Id: Ie571fd042010d5972aaef76063a52b67ef7ccb6a --- src/slic3r/GUI/DeviceManager.cpp | 1 + src/slic3r/GUI/DeviceManager.hpp | 1 + src/slic3r/GUI/StatusPanel.cpp | 11 +++++++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index cfa516982..b318e2882 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -4590,6 +4590,7 @@ void MachineObject::update_model_task() request_model_result++; BOOST_LOG_TRIVIAL(info) << "request times: " << request_model_result << " http code: " << http_code; rating_info = new RatingInfo(); + rating_info->http_code = http_code; if (0 == res && 200 == http_code) { try { json rating_json = json::parse(rating_result); diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index 9ff53a5e5..6da70deab 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -133,6 +133,7 @@ enum ManualPaCaliMethod { struct RatingInfo { bool request_successful; + int http_code; int rating_id; int start_count; bool success_printed; diff --git a/src/slic3r/GUI/StatusPanel.cpp b/src/slic3r/GUI/StatusPanel.cpp index b053b4628..7cdbded3c 100644 --- a/src/slic3r/GUI/StatusPanel.cpp +++ b/src/slic3r/GUI/StatusPanel.cpp @@ -2759,6 +2759,7 @@ void StatusPanel::update_subtask(MachineObject *obj) } else if (obj->is_in_printing() || obj->print_status == "FINISH") { if (obj->is_in_prepare() || obj->print_status == "SLICING") { m_project_task_panel->market_scoring_hide(); + m_project_task_panel->get_request_failed_panel()->Hide(); m_project_task_panel->enable_abort_button(false); m_project_task_panel->enable_pause_resume_button(false, "pause_disable"); wxString prepare_text; @@ -2828,8 +2829,13 @@ void StatusPanel::update_subtask(MachineObject *obj) m_project_task_panel->market_scoring_show(); } else if (obj && obj->rating_info && !obj->rating_info->request_successful) { BOOST_LOG_TRIVIAL(info) << "model mall result request failed"; - m_project_task_panel->get_market_retry_buttom()->Enable(!obj->get_model_mall_result_need_retry); - m_project_task_panel->get_request_failed_panel()->Show(); + if (403 != obj->rating_info->http_code) { + BOOST_LOG_TRIVIAL(info) << "Request need retry"; + m_project_task_panel->get_market_retry_buttom()->Enable(!obj->get_model_mall_result_need_retry); + m_project_task_panel->get_request_failed_panel()->Show(); + } else { + BOOST_LOG_TRIVIAL(info) << "Request rejected"; + } } } else { m_project_task_panel->market_scoring_hide(); @@ -2940,6 +2946,7 @@ void StatusPanel::reset_printing_values() m_project_task_panel->market_scoring_hide(); + m_project_task_panel->get_request_failed_panel()->Hide(); update_basic_print_data(false); m_project_task_panel->update_left_time(NA_STR); m_project_task_panel->update_layers_num(true, wxString::Format(_L("Layer: %s"), NA_STR));