FIX: flowrate fine cali lacks a sending progressbar

Jira: STUDIO-4013

Change-Id: I794ce788fc6048e11abe762b54aaabe7a904d76f
This commit is contained in:
liz.li
2023-09-15 14:17:52 +08:00
committed by Lane.Wei
parent 0c1d536925
commit 47edbfb34f
7 changed files with 284 additions and 197 deletions

View File

@@ -754,6 +754,152 @@ void CaliPageActionPanel::enable_button(CaliPageActionType action_type, bool ena
}
}
CaliPageSendingPanel::CaliPageSendingPanel(wxWindow* parent, /*CalibMode cali_mode, CaliPageType page_type, */wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
{
SetBackgroundColour(*wxWHITE);
SetMinSize({ FromDIP(475), FromDIP(200) });
SetMaxSize({ FromDIP(475), FromDIP(200) });
create(this);
Bind(EVT_SHOW_ERROR_INFO, [this](auto& e) {
show_send_failed_info(true);
});
}
void CaliPageSendingPanel::create(wxWindow* parent)
{
auto panel_sizer = new wxBoxSizer(wxVERTICAL);
parent->SetSizer(panel_sizer);
m_send_progress_bar = std::shared_ptr<BBLStatusBarSend>(new BBLStatusBarSend(parent));
panel_sizer->Add(m_send_progress_bar->get_panel(), 0, wxEXPAND);
m_sw_print_failed_info = new wxScrolledWindow(parent, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(380), FromDIP(125)), wxVSCROLL);
m_sw_print_failed_info->SetBackgroundColour(*wxWHITE);
m_sw_print_failed_info->SetScrollRate(0, 5);
m_sw_print_failed_info->SetMinSize(wxSize(FromDIP(380), FromDIP(125)));
m_sw_print_failed_info->SetMaxSize(wxSize(FromDIP(380), FromDIP(125)));
m_sw_print_failed_info->Hide();
panel_sizer->Add(m_sw_print_failed_info, 0, wxEXPAND);
// create error info panel
wxBoxSizer* sizer_print_failed_info = new wxBoxSizer(wxVERTICAL);
m_sw_print_failed_info->SetSizer(sizer_print_failed_info);
wxBoxSizer* sizer_error_code = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer* sizer_error_desc = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer* sizer_extra_info = new wxBoxSizer(wxHORIZONTAL);
auto st_title_error_code = new Label(m_sw_print_failed_info, _L("Error code"));
auto st_title_error_code_doc = new Label(m_sw_print_failed_info, ": ");
m_st_txt_error_code = new Label(m_sw_print_failed_info, wxEmptyString);
st_title_error_code->SetForegroundColour(0x909090);
st_title_error_code_doc->SetForegroundColour(0x909090);
m_st_txt_error_code->SetForegroundColour(0x909090);
st_title_error_code->SetFont(::Label::Body_13);
st_title_error_code_doc->SetFont(::Label::Body_13);
m_st_txt_error_code->SetFont(::Label::Body_13);
st_title_error_code->SetMinSize(wxSize(FromDIP(74), -1));
st_title_error_code->SetMaxSize(wxSize(FromDIP(74), -1));
m_st_txt_error_code->SetMinSize(wxSize(FromDIP(260), -1));
m_st_txt_error_code->SetMaxSize(wxSize(FromDIP(260), -1));
sizer_error_code->Add(st_title_error_code, 0, wxALL, 0);
sizer_error_code->Add(st_title_error_code_doc, 0, wxALL, 0);
sizer_error_code->Add(m_st_txt_error_code, 0, wxALL, 0);
auto st_title_error_desc = new Label(m_sw_print_failed_info, _L("Error desc"));
auto st_title_error_desc_doc = new Label(m_sw_print_failed_info, ": ");
m_st_txt_error_desc = new Label(m_sw_print_failed_info, wxEmptyString);
st_title_error_desc->SetForegroundColour(0x909090);
st_title_error_desc_doc->SetForegroundColour(0x909090);
m_st_txt_error_desc->SetForegroundColour(0x909090);
st_title_error_desc->SetFont(::Label::Body_13);
st_title_error_desc_doc->SetFont(::Label::Body_13);
m_st_txt_error_desc->SetFont(::Label::Body_13);
st_title_error_desc->SetMinSize(wxSize(FromDIP(74), -1));
st_title_error_desc->SetMaxSize(wxSize(FromDIP(74), -1));
m_st_txt_error_desc->SetMinSize(wxSize(FromDIP(260), -1));
m_st_txt_error_desc->SetMaxSize(wxSize(FromDIP(260), -1));
sizer_error_desc->Add(st_title_error_desc, 0, wxALL, 0);
sizer_error_desc->Add(st_title_error_desc_doc, 0, wxALL, 0);
sizer_error_desc->Add(m_st_txt_error_desc, 0, wxALL, 0);
auto st_title_extra_info = new Label(m_sw_print_failed_info, _L("Extra info"));
auto st_title_extra_info_doc = new Label(m_sw_print_failed_info, ": ");
m_st_txt_extra_info = new Label(m_sw_print_failed_info, wxEmptyString);
st_title_extra_info->SetForegroundColour(0x909090);
st_title_extra_info_doc->SetForegroundColour(0x909090);
m_st_txt_extra_info->SetForegroundColour(0x909090);
st_title_extra_info->SetFont(::Label::Body_13);
st_title_extra_info_doc->SetFont(::Label::Body_13);
m_st_txt_extra_info->SetFont(::Label::Body_13);
st_title_extra_info->SetMinSize(wxSize(FromDIP(74), -1));
st_title_extra_info->SetMaxSize(wxSize(FromDIP(74), -1));
m_st_txt_extra_info->SetMinSize(wxSize(FromDIP(260), -1));
m_st_txt_extra_info->SetMaxSize(wxSize(FromDIP(260), -1));
sizer_extra_info->Add(st_title_extra_info, 0, wxALL, 0);
sizer_extra_info->Add(st_title_extra_info_doc, 0, wxALL, 0);
sizer_extra_info->Add(m_st_txt_extra_info, 0, wxALL, 0);
sizer_print_failed_info->Add(sizer_error_code, 0, wxLEFT, 5);
sizer_print_failed_info->Add(0, 0, 0, wxTOP, FromDIP(3));
sizer_print_failed_info->Add(sizer_error_desc, 0, wxLEFT, 5);
sizer_print_failed_info->Add(0, 0, 0, wxTOP, FromDIP(3));
sizer_print_failed_info->Add(sizer_extra_info, 0, wxLEFT, 5);
}
void CaliPageSendingPanel::update_print_error_info(int code, const std::string& msg, const std::string& extra)
{
m_print_error_code = code;
m_print_error_msg = msg;
m_print_error_extra = extra;
}
void CaliPageSendingPanel::show_send_failed_info(bool show, int code, wxString description, wxString extra)
{
if (show) {
if (!m_sw_print_failed_info->IsShown()) {
m_sw_print_failed_info->Show(true);
m_st_txt_error_code->SetLabelText(wxString::Format("%d", m_print_error_code));
m_st_txt_error_desc->SetLabelText(wxGetApp().filter_string(m_print_error_msg));
m_st_txt_extra_info->SetLabelText(wxGetApp().filter_string(m_print_error_extra));
m_st_txt_error_code->Wrap(FromDIP(260));
m_st_txt_error_desc->Wrap(FromDIP(260));
m_st_txt_extra_info->Wrap(FromDIP(260));
}
else {
m_sw_print_failed_info->Show(false);
}
Layout();
Fit();
}
else {
if (!m_sw_print_failed_info->IsShown()) { return; }
m_sw_print_failed_info->Show(false);
m_st_txt_error_code->SetLabelText(wxEmptyString);
m_st_txt_error_desc->SetLabelText(wxEmptyString);
m_st_txt_extra_info->SetLabelText(wxEmptyString);
Layout();
Fit();
}
}
std::shared_ptr<BBLStatusBarSend> CaliPageSendingPanel::get_sending_progress_bar()
{
return m_send_progress_bar;
}
void CaliPageSendingPanel::reset()
{
m_send_progress_bar->reset();
m_sw_print_failed_info->Show(false);
}
CalibrationWizardPage::CalibrationWizardPage(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
: wxPanel(parent, id, pos, size, style)
, m_parent(parent)
@@ -771,4 +917,5 @@ void CalibrationWizardPage::on_sys_color_changed()
m_page_caption->on_sys_color_changed();
}
}}
}
}