FIX: The humidity popup with humidity_percent/temperature/dry_time

jira: [STUDIO-9268]
Change-Id: Ic6e923ae7cff56fa3e053d48e5dea6e393cd41eb
(cherry picked from commit 75da1db2f926125a0cb3595a8cae9f4d7588c6a8)
This commit is contained in:
xin.zhang
2025-02-21 15:57:10 +08:00
committed by Noisyfox
parent e924a04fb8
commit 0b98094dac
10 changed files with 375 additions and 18 deletions

View File

@@ -4,6 +4,8 @@
#include "../I18N.hpp"
#include "../GUI_App.hpp"
#include "slic3r/GUI/DeviceTab/uiAmsHumidityPopup.h"
#include <wx/simplebook.h>
#include <wx/dcgraph.h>
@@ -21,6 +23,7 @@ Description:AMSControl
AMSControl::AMSControl(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size)
: wxSimplebook(parent, wxID_ANY, pos, size)
, m_Humidity_tip_popup(AmsHumidityTipPopup(this))
, m_percent_humidity_dry_popup(new uiAmsPercentHumidityDryPopup(this))
, m_ams_introduce_popup(AmsIntroducePopup(this))
{
SetBackgroundColour(*wxWHITE);
@@ -557,19 +560,31 @@ AMSControl::AMSControl(wxWindow *parent, wxWindowID id, const wxPoint &pos, cons
});
Bind(EVT_AMS_SHOW_HUMIDITY_TIPS, [this](wxCommandEvent& evt) {
wxPoint img_pos = ClientToScreen(wxPoint(0, 0));
wxPoint popup_pos(img_pos.x - m_Humidity_tip_popup.GetSize().GetWidth() + FromDIP(150), img_pos.y - FromDIP(80));
m_Humidity_tip_popup.Position(popup_pos, wxSize(0, 0));
if (m_ams_info.size() > 0) {
for (auto i = 0; i < m_ams_info.size(); i++) {
if (m_ams_info[i].ams_id == m_current_show_ams) {
m_Humidity_tip_popup.set_humidity_level(m_ams_info[i].ams_humidity);
}
uiAmsHumidityInfo *info = (uiAmsHumidityInfo *) evt.GetClientData();
if (info)
{
if (info->humidity_percent >= 0)
{
m_percent_humidity_dry_popup->Update(info);
wxPoint img_pos = ClientToScreen(wxPoint(0, 0));
wxPoint popup_pos(img_pos.x - m_percent_humidity_dry_popup->GetSize().GetWidth() + FromDIP(150), img_pos.y - FromDIP(80));
m_percent_humidity_dry_popup->Position(popup_pos, wxSize(0, 0));
m_percent_humidity_dry_popup->Popup();
}
else
{
wxPoint img_pos = ClientToScreen(wxPoint(0, 0));
wxPoint popup_pos(img_pos.x - m_Humidity_tip_popup.GetSize().GetWidth() + FromDIP(150), img_pos.y - FromDIP(80));
m_Humidity_tip_popup.Position(popup_pos, wxSize(0, 0));
int humidity_value = info->humidity_level;
if (humidity_value > 0 && humidity_value <= 5) { m_Humidity_tip_popup.set_humidity_level(humidity_value); }
m_Humidity_tip_popup.Popup();
}
}
m_Humidity_tip_popup.Popup();
delete info;
});
@@ -788,6 +803,10 @@ void AMSControl::msw_rescale()
cans->amsCans->msw_rescale();
}
if (m_percent_humidity_dry_popup){
m_percent_humidity_dry_popup->msw_rescale();
}
Layout();
Refresh();
}