FIX:fixed HMS message not cleared

jira:[STUDIO-6296]

Change-Id: Ic7692ce337fd00ece4ab8d65214a8c406f8543f8
This commit is contained in:
tao wang 2024-02-20 14:13:19 +08:00 committed by Lane.Wei
parent f1e70cb475
commit 6948a60757
3 changed files with 15 additions and 3 deletions

View File

@ -201,6 +201,11 @@ void HMSPanel::delete_hms_panels() {
m_scrolledWindow->DestroyChildren(); m_scrolledWindow->DestroyChildren();
} }
void HMSPanel::clear_hms_tag()
{
temp_hms_list.clear();
}
void HMSPanel::update(MachineObject *obj) void HMSPanel::update(MachineObject *obj)
{ {
if (obj) { if (obj) {

View File

@ -52,6 +52,7 @@ protected:
void append_hms_panel(HMSItem &item); void append_hms_panel(HMSItem &item);
void delete_hms_panels(); void delete_hms_panels();
public: public:
HMSPanel(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxTAB_TRAVERSAL); HMSPanel(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
~HMSPanel(); ~HMSPanel();
@ -64,6 +65,8 @@ public:
void show_status(int status); void show_status(int status);
void clear_hms_tag();
MachineObject *obj { nullptr }; MachineObject *obj { nullptr };
std::map<std::string, HMSItem> temp_hms_list; std::map<std::string, HMSItem> temp_hms_list;
}; };

View File

@ -302,6 +302,10 @@ void MonitorPanel::on_update_all(wxMouseEvent &event)
Slic3r::DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager(); Slic3r::DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
if (!dev) return; if (!dev) return;
if ( (dev->get_selected_machine()->dev_id != event.GetString().ToStdString()) && m_hms_panel) {
m_hms_panel->clear_hms_tag();
}
if (!dev->set_selected_machine(event.GetString().ToStdString())) if (!dev->set_selected_machine(event.GetString().ToStdString()))
return; return;
@ -412,7 +416,7 @@ void MonitorPanel::update_all()
m_status_info_panel->update(obj); m_status_info_panel->update(obj);
} }
if (m_hms_panel->IsShown()) { if (m_hms_panel->IsShown() || obj->hms_list.size() > 0) {
m_hms_panel->update(obj); m_hms_panel->update(obj);
} }