FIX: refresh the preview when changed

jira: [STUDIO-9576]
Change-Id: Ic742fa3dd5011dbafc0353b20039b2f33df8d300
This commit is contained in:
xin.zhang 2025-01-12 19:49:38 +08:00 committed by lane.wei
parent 76477a1ae4
commit d1e50a4e70
2 changed files with 48 additions and 0 deletions

View File

@ -2388,6 +2388,11 @@ void AMSPreview::Close()
void AMSPreview::Update(AMSinfo amsinfo) void AMSPreview::Update(AMSinfo amsinfo)
{ {
if (m_amsinfo == amsinfo)
{
return;
}
m_amsinfo = amsinfo; m_amsinfo = amsinfo;
m_ams_item_type = amsinfo.ams_type; m_ams_item_type = amsinfo.ams_type;
@ -2398,6 +2403,8 @@ void AMSPreview::Update(AMSinfo amsinfo)
SetMinSize(AMS_PREV_SINGLE_SIZE); SetMinSize(AMS_PREV_SINGLE_SIZE);
SetMaxSize(AMS_PREV_SINGLE_SIZE); SetMaxSize(AMS_PREV_SINGLE_SIZE);
} }
Refresh();
} }
void AMSPreview::create(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size) void AMSPreview::create(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size)

View File

@ -178,6 +178,27 @@ struct Caninfo
float k = 0.0f; float k = 0.0f;
float n = 0.0f; float n = 0.0f;
std::vector<wxColour> material_cols; std::vector<wxColour> 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 struct AMSinfo
@ -194,6 +215,26 @@ public:
AMSModel ams_type = AMSModel::GENERIC_AMS; AMSModel ams_type = AMSModel::GENERIC_AMS;
AMSModelOriginType ext_type = AMSModelOriginType::GENERIC_EXT; 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); bool parse_ams_info(MachineObject* obj, Ams *ams, bool remain_flag = false, bool humidity_flag = false);
void parse_ext_info(MachineObject* obj, AmsTray tray); void parse_ext_info(MachineObject* obj, AmsTray tray);
}; };