ENH:blocking send/send all on p1p printers

Change-Id: If6ed8056790211d6ffa8237136318768e1a7f5d7
This commit is contained in:
tao wang 2022-12-01 20:27:05 +08:00 committed by Lane.Wei
parent 08b40dc5e8
commit 09ab775667
6 changed files with 30 additions and 9 deletions

View File

@ -18,7 +18,8 @@
"FUNC_REMOTE_TUNNEL": false, "FUNC_REMOTE_TUNNEL": false,
"FUNC_LOCAL_TUNNEL": true, "FUNC_LOCAL_TUNNEL": true,
"FUNC_PRINT_WITHOUT_SD": false, "FUNC_PRINT_WITHOUT_SD": false,
"FUNC_ALTER_RESOLUTION": false "FUNC_ALTER_RESOLUTION": false,
"FUNC_SEND_TO_SDCARD": false
}, },
"camera_resolution":["720p"], "camera_resolution":["720p"],
"bed_temperature_limit": 100, "bed_temperature_limit": 100,

View File

@ -1951,6 +1951,9 @@ bool MachineObject::is_function_supported(PrinterFunction func)
case FUNC_ALTER_RESOLUTION: case FUNC_ALTER_RESOLUTION:
func_name = "FUNC_ALTER_RESOLUTION"; func_name = "FUNC_ALTER_RESOLUTION";
break; break;
case FUNC_SEND_TO_SDCARD:
func_name = "FUNC_SEND_TO_SDCARD";
break;
default: default:
return true; return true;
} }

View File

@ -79,6 +79,7 @@ enum PrinterFunction {
FUNC_VIRTUAL_CAMERA, FUNC_VIRTUAL_CAMERA,
FUNC_USE_AMS, FUNC_USE_AMS,
FUNC_ALTER_RESOLUTION, FUNC_ALTER_RESOLUTION,
FUNC_SEND_TO_SDCARD,
FUNC_MAX FUNC_MAX
}; };

View File

@ -258,7 +258,8 @@ enum PrintDialogStatus {
PrintStatusTimelapseNoSdcard, PrintStatusTimelapseNoSdcard,
PrintStatusNotOnTheSameLAN, PrintStatusNotOnTheSameLAN,
PrintStatusNeedForceUpgrading, PrintStatusNeedForceUpgrading,
PrintStatusNeedConsistencyUpgrading PrintStatusNeedConsistencyUpgrading,
PrintStatusNotSupportedSendToSDCard
}; };
std::string get_print_status_info(PrintDialogStatus status); std::string get_print_status_info(PrintDialogStatus status);

View File

@ -915,6 +915,11 @@ void SendToPrinterDialog::update_show_status()
return; return;
} }
bool is_suppt = obj_->is_function_supported(PrinterFunction::FUNC_SEND_TO_SDCARD);
if (!is_suppt) {
show_status(PrintDialogStatus::PrintStatusNotSupportedSendToSDCard);
return;
}
show_status(PrintDialogStatus::PrintStatusReadingFinished); show_status(PrintDialogStatus::PrintStatusReadingFinished);
} }
@ -1024,6 +1029,12 @@ void SendToPrinterDialog::show_status(PrintDialogStatus status, std::vector<wxSt
Enable_Send_Button(false); Enable_Send_Button(false);
Enable_Refresh_Button(true); Enable_Refresh_Button(true);
} }
else if (status == PrintDialogStatus::PrintStatusNotSupportedSendToSDCard) {
wxString msg_text = _L("The printer does not support sending to printer SD card.");
update_print_status_msg(msg_text, true, true);
Enable_Send_Button(false);
Enable_Refresh_Button(true);
}
else { else {
Enable_Send_Button(true); Enable_Send_Button(true);
Enable_Refresh_Button(true); Enable_Refresh_Button(true);

View File

@ -367,15 +367,18 @@ void MachineInfoPanel::update_version_text(MachineObject* obj)
} else { } else {
auto ota_it = obj->new_ver_list.find("ota"); auto ota_it = obj->new_ver_list.find("ota");
if (ota_it == obj->new_ver_list.end()) { if (ota_it == obj->new_ver_list.end()) {
if (it != obj->module_vers.end()) {
wxString ver_text = wxString::Format("%s(%s)", it->second.sw_ver, _L("Latest version")); wxString ver_text = wxString::Format("%s(%s)", it->second.sw_ver, _L("Latest version"));
m_staticText_ver_val->SetLabelText(ver_text); m_staticText_ver_val->SetLabelText(ver_text);
m_ota_new_version_img->Hide(); m_ota_new_version_img->Hide();
}
} else { } else {
if (ota_it->second.sw_new_ver != ota_it->second.sw_ver) { if (ota_it->second.sw_new_ver != ota_it->second.sw_ver) {
m_ota_new_version_img->Show(); m_ota_new_version_img->Show();
wxString ver_text = wxString::Format("%s->%s", ota_it->second.sw_ver, ota_it->second.sw_new_ver); wxString ver_text = wxString::Format("%s->%s", ota_it->second.sw_ver, ota_it->second.sw_new_ver);
m_staticText_ver_val->SetLabelText(ver_text); m_staticText_ver_val->SetLabelText(ver_text);
} else { } else {
if (it != obj->module_vers.end()) {
m_ota_new_version_img->Hide(); m_ota_new_version_img->Hide();
wxString ver_text = wxString::Format("%s(%s)", it->second.sw_ver, _L("Latest version")); wxString ver_text = wxString::Format("%s(%s)", it->second.sw_ver, _L("Latest version"));
m_staticText_ver_val->SetLabelText(ver_text); m_staticText_ver_val->SetLabelText(ver_text);
@ -384,6 +387,7 @@ void MachineInfoPanel::update_version_text(MachineObject* obj)
} }
} }
} }
}
void MachineInfoPanel::update_ams(MachineObject *obj) void MachineInfoPanel::update_ams(MachineObject *obj)
{ {