From d1e50a4e7020b46374d24a16e4520c97b28d51b6 Mon Sep 17 00:00:00 2001 From: "xin.zhang" Date: Sun, 12 Jan 2025 19:49:38 +0800 Subject: [PATCH] FIX: refresh the preview when changed jira: [STUDIO-9576] Change-Id: Ic742fa3dd5011dbafc0353b20039b2f33df8d300 --- src/slic3r/GUI/Widgets/AMSItem.cpp | 7 +++++ src/slic3r/GUI/Widgets/AMSItem.hpp | 41 ++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/src/slic3r/GUI/Widgets/AMSItem.cpp b/src/slic3r/GUI/Widgets/AMSItem.cpp index 0c2346d7e..36d1b7a99 100644 --- a/src/slic3r/GUI/Widgets/AMSItem.cpp +++ b/src/slic3r/GUI/Widgets/AMSItem.cpp @@ -2388,6 +2388,11 @@ void AMSPreview::Close() void AMSPreview::Update(AMSinfo amsinfo) { + if (m_amsinfo == amsinfo) + { + return; + } + m_amsinfo = amsinfo; m_ams_item_type = amsinfo.ams_type; @@ -2398,6 +2403,8 @@ void AMSPreview::Update(AMSinfo amsinfo) SetMinSize(AMS_PREV_SINGLE_SIZE); SetMaxSize(AMS_PREV_SINGLE_SIZE); } + + Refresh(); } void AMSPreview::create(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size) diff --git a/src/slic3r/GUI/Widgets/AMSItem.hpp b/src/slic3r/GUI/Widgets/AMSItem.hpp index c84ba8bd3..759be6605 100644 --- a/src/slic3r/GUI/Widgets/AMSItem.hpp +++ b/src/slic3r/GUI/Widgets/AMSItem.hpp @@ -178,6 +178,27 @@ struct Caninfo float k = 0.0f; float n = 0.0f; std::vector material_cols; + +public: + bool operator==(const Caninfo& other) const + { + if (can_id == other.can_id && + material_name == other.material_name && + material_colour == other.material_colour && + material_state == other.material_state && + ctype == other.ctype && + material_remain == other.material_remain && + cali_idx == other.cali_idx && + filament_id == other.filament_id && + k == other.k && + n == other.n && + material_cols == other.material_cols) + { + return true; + } + + return false; + }; }; struct AMSinfo @@ -194,6 +215,26 @@ public: AMSModel ams_type = AMSModel::GENERIC_AMS; AMSModelOriginType ext_type = AMSModelOriginType::GENERIC_EXT; +public: + bool operator== (const AMSinfo& other) const + { + if (ams_id == other.ams_id && + cans == other.cans && + nozzle_id == other.nozzle_id && + current_can_id == other.current_can_id && + current_step == other.current_step && + current_action == other.current_action && + curreent_filamentstep == other.curreent_filamentstep && + ams_humidity == other.ams_humidity && + ams_type == other.ams_type && + ext_type == other.ext_type) + { + return true; + } + + return false; + }; + bool parse_ams_info(MachineObject* obj, Ams *ams, bool remain_flag = false, bool humidity_flag = false); void parse_ext_info(MachineObject* obj, AmsTray tray); };