ENH: refine firmware upgrade interaction: ams version, translation

Change-Id: Ifc42421a4dedf8d8ef427d491cf8afc7b0e0665e
This commit is contained in:
tao.jin 2022-09-28 12:28:29 +08:00 committed by Lane.Wei
parent bb02d0f0ae
commit c2b2c75bf2
1 changed files with 54 additions and 44 deletions

View File

@ -13,10 +13,6 @@ namespace GUI {
static const wxColour TEXT_NORMAL_CLR = wxColour(0, 174, 66);
static const wxColour TEXT_FAILED_CLR = wxColour(255, 111, 0);
wxString normal_upgrade_hint = _L("Are you sure you want to update? This will take about 10 minutes. Do not turn off the power while the printer is updating.");
wxString force_upgrade_hint = _L("An important update was detected and needs to be run before printing can continue. Do you want to update now? You can also update later from 'Upgrade firmware'.");
wxString consistency_upgrade_hint = _L("The firmware version is abnormal. Repairing and updating are required before printing. Do you want to update now? You can also update later on printer or update next time starting the studio.");
MachineInfoPanel::MachineInfoPanel(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name)
:wxPanel(parent, id, pos, size, style)
{
@ -503,6 +499,11 @@ void MachineInfoPanel::update_ams(MachineObject *obj)
ams_sn = "-";
ams_ver = "-";
} else {
if (m_obj->upgrade_display_state == (int)MachineObject::UpgradingDisplayState::UpgradingInProgress) {
ams_ver = "-";
amspanel->m_ams_new_version_img->Hide();
}
else {
// update ams img
wxString ams_text = wxString::Format("AMS%s", std::to_string(ams_id + 1));
ams_name = ams_text;
@ -547,6 +548,7 @@ void MachineInfoPanel::update_ams(MachineObject *obj)
}
}
}
}
// update ams sn
if (it->second.sn.empty()) {
@ -658,7 +660,9 @@ void MachineInfoPanel::upgrade_firmware_internal() {
void MachineInfoPanel::on_upgrade_firmware(wxCommandEvent &event)
{
ConfirmHintDialog* confirm_dlg = new ConfirmHintDialog(this->GetParent(), wxID_ANY, _L("Upgrade firmware"));
confirm_dlg->SetHint(normal_upgrade_hint);
confirm_dlg->SetHint(_L(
"Are you sure you want to update? This will take about 10 minutes. Do not turn off the power while the printer is updating."
));
confirm_dlg->Bind(EVT_CONFIRM_HINT, [this](wxCommandEvent &e) {
if (m_obj){
m_obj->command_upgrade_confirm();
@ -671,7 +675,9 @@ void MachineInfoPanel::on_upgrade_firmware(wxCommandEvent &event)
void MachineInfoPanel::on_consisitency_upgrade_firmware(wxCommandEvent &event)
{
ConfirmHintDialog* confirm_dlg = new ConfirmHintDialog(this->GetParent(), wxID_ANY, _L("Upgrade firmware"));
confirm_dlg->SetHint(normal_upgrade_hint);
confirm_dlg->SetHint(_L(
"Are you sure you want to update? This will take about 10 minutes. Do not turn off the power while the printer is updating."
));
confirm_dlg->Bind(EVT_CONFIRM_HINT, [this](wxCommandEvent &e) {
if (m_obj){
m_obj->command_consistency_upgrade_confirm();
@ -794,7 +800,9 @@ void UpgradePanel::update(MachineObject *obj)
if (m_obj->upgrade_force_upgrade) {
m_show_forced_hint = false; //lock hint
ConfirmHintDialog* force_dlg = new ConfirmHintDialog(m_scrolledWindow, wxID_ANY, _L("Upgrade firmware"));
force_dlg->SetHint(force_upgrade_hint);
force_dlg->SetHint(_L(
"An important update was detected and needs to be run before printing can continue. Do you want to update now? You can also update later from 'Upgrade firmware'."
));
force_dlg->Bind(EVT_CONFIRM_HINT, &MachineInfoPanel::on_upgrade_firmware, m_push_upgrade_panel);
if (force_dlg->ShowModal())
delete force_dlg;
@ -810,7 +818,9 @@ void UpgradePanel::update(MachineObject *obj)
if (m_obj->upgrade_consistency_request) {
m_show_consistency_hint = false;
ConfirmHintDialog* consistency_dlg = new ConfirmHintDialog(m_scrolledWindow, wxID_ANY, _L("Upgrade firmware"));
consistency_dlg->SetHint(consistency_upgrade_hint);
consistency_dlg->SetHint(_L(
"The firmware version is abnormal. Repairing and updating are required before printing. Do you want to update now? You can also update later on printer or update next time starting the studio."
));
consistency_dlg->Bind(EVT_CONFIRM_HINT, &MachineInfoPanel::on_consisitency_upgrade_firmware, m_push_upgrade_panel);
if (consistency_dlg->ShowModal())
delete consistency_dlg;