FIX:fixed display conflict between speed popup and humidity popup
Change-Id: Ib344aa829d3172e29a5d58a7b7f3b5d2d7d6c9a1
This commit is contained in:
parent
78b6e75955
commit
ddf8c216c6
3 changed files with 20 additions and 4 deletions
|
@ -2879,15 +2879,29 @@ void StatusPanel::on_switch_speed(wxCommandEvent &event)
|
|||
obj->command_set_printing_speed((PrintingSpeedLevel)this->speed_lvl);
|
||||
}
|
||||
});
|
||||
popUp->Bind(wxEVT_SHOW, [this](auto &e) {
|
||||
popUp->Bind(wxEVT_SHOW, [this, popUp](auto &e) {
|
||||
if (!e.IsShown()) {
|
||||
wxGetApp().CallAfter([popUp = e.GetEventObject()] { delete popUp; });
|
||||
/* wxGetApp().CallAfter([this, popUp] {
|
||||
|
||||
});*/
|
||||
popUp->Destroy();
|
||||
m_showing_speed_popup = false;
|
||||
speed_dismiss_time = boost::posix_time::microsec_clock::universal_time();
|
||||
}
|
||||
});
|
||||
|
||||
m_ams_control->Bind(EVT_AMS_SHOW_HUMIDITY_TIPS, [this, popUp](auto& e) {
|
||||
if (m_showing_speed_popup) {
|
||||
if (popUp && popUp->IsShown()) {
|
||||
popUp->Show(false);
|
||||
}
|
||||
}
|
||||
e.Skip();
|
||||
});
|
||||
wxPoint pos = m_switch_speed->ClientToScreen(wxPoint(0, -6));
|
||||
popUp->Position(pos, {0, m_switch_speed->GetSize().y + 12});
|
||||
popUp->Popup();
|
||||
m_showing_speed_popup = true;
|
||||
}
|
||||
|
||||
void StatusPanel::on_printing_fan_switch(wxCommandEvent &event)
|
||||
|
|
|
@ -295,6 +295,7 @@ protected:
|
|||
int speed_lvl = 1; // 0 - 3
|
||||
int speed_lvl_timeout {0};
|
||||
boost::posix_time::ptime speed_dismiss_time;
|
||||
bool m_showing_speed_popup = false;
|
||||
|
||||
std::map<wxString, wxImage> img_list; // key: url, value: wxBitmap png Image
|
||||
std::map<std::string, std::string> m_print_connect_types;
|
||||
|
|
|
@ -834,8 +834,8 @@ AMSRoad::AMSRoad(wxWindow *parent, wxWindowID id, Caninfo info, int canindex, in
|
|||
auto mouse_pos = ClientToScreen(e.GetPosition());
|
||||
auto rect = ClientToScreen(wxPoint(0, 0));
|
||||
|
||||
if (mouse_pos.x > rect.x + GetSize().x - FromDIP(20) &&
|
||||
mouse_pos.y > rect.y + GetSize().y - FromDIP(40)) {
|
||||
if (mouse_pos.x > rect.x + GetSize().x - FromDIP(25) &&
|
||||
mouse_pos.y > rect.y + GetSize().y - FromDIP(25)) {
|
||||
wxCommandEvent event(EVT_AMS_SHOW_HUMIDITY_TIPS);
|
||||
wxPostEvent(GetParent()->GetParent(), event);
|
||||
}
|
||||
|
@ -1947,6 +1947,7 @@ AMSControl::AMSControl(wxWindow *parent, wxWindowID id, const wxPoint &pos, cons
|
|||
wxPoint popup_pos(img_pos.x, img_pos.y + GetRect().height);
|
||||
m_Humidity_tip_popup.Position(popup_pos, wxSize(0, 0));
|
||||
m_Humidity_tip_popup.Popup();
|
||||
m_Humidity_tip_popup.GetParent()->SetFocus();
|
||||
});
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue