ENH: disable model download for P1s

Change-Id: I6913f35015119adc8abfbd0a1f0e27c65f9d6c58
Jira: none
This commit is contained in:
chunmao.guo 2023-10-25 10:24:30 +08:00 committed by Lane.Wei
parent 82f59993c7
commit 92f4ba705e
9 changed files with 28 additions and 10 deletions

View File

@ -9,7 +9,8 @@
"remote": "enabled"
},
"file": {
"remote": "enabled"
"remote": "enabled",
"model_download": "enabled"
}
},
"support_motor_noise_cali":false,

View File

@ -9,7 +9,8 @@
"remote": "enabled"
},
"file": {
"remote": "enabled"
"remote": "enabled",
"model_download": "enabled"
}
},
"support_motor_noise_cali":false,

View File

@ -9,7 +9,8 @@
"remote": "enabled"
},
"file": {
"remote": "enabled"
"remote": "enabled",
"model_download": "enabled"
}
},
"support_motor_noise_cali":false,

View File

@ -3512,6 +3512,7 @@ int MachineObject::parse_json(std::string payload)
if (ipcam.contains("file")) {
file_local = ipcam["file"].value<std::string>("local", "disabled") == "enabled";
file_remote = ipcam["file"].value<std::string>("remote", "disabled") == "enabled";
file_model_download = ipcam["file"].value<std::string>("model_download", "disabled") == "enabled";
}
virtual_camera = ipcam.value<std::string>("virtual_camera", "disabled") == "enabled";
if (ipcam.contains("rtsp_url")) {

View File

@ -689,6 +689,7 @@ public:
bool liveview_remote{false};
bool file_local{false};
bool file_remote{false};
bool file_model_download{false};
bool virtual_camera{false};
bool xcam_ai_monitoring{ false };

View File

@ -122,6 +122,12 @@ void Slic3r::GUI::ImageGrid::SetSelecting(bool selecting)
void Slic3r::GUI::ImageGrid::DoActionOnSelection(int action) { DoAction(-1, action); }
void Slic3r::GUI::ImageGrid::ShowDownload(bool show)
{
m_show_download = show;
Refresh();
}
void Slic3r::GUI::ImageGrid::Rescale()
{
m_title_mask = wxBitmap();
@ -598,7 +604,7 @@ void Slic3r::GUI::ImageGrid::renderContent1(wxDC &dc, wxPoint const &pt, int ind
// dc.GradientFillLinear({pt.x, pt.y, m_border_size.GetWidth(), 60}, wxColour(0x6F, 0x6F, 0x6F, 0x99), wxColour(0x6F, 0x6F, 0x6F, 0), wxBOTTOM);
else if (m_file_sys->GetGroupMode() == PrinterFileSystem::G_NONE) {
wxString nonHoverText;
wxString secondAction = _L("Download");
wxString secondAction = m_show_download ? _L("Download") : "";
wxString thirdAction;
int states = 0;
// Draw download progress

View File

@ -48,6 +48,8 @@ public:
void DoActionOnSelection(int action);
void ShowDownload(bool show);
public:
void Rescale();
@ -126,6 +128,7 @@ private:
// wxBitmap m_button_background;
bool m_selecting = false;
bool m_show_download = false;
enum HitType {
HIT_NONE,

View File

@ -202,23 +202,23 @@ void MediaFilePanel::SetMachineObject(MachineObject* obj)
{
std::string machine = obj ? obj->dev_id : "";
if (obj) {
m_supported = true;
m_lan_mode = obj->is_lan_mode_printer();
m_lan_ip = obj->dev_ip;
m_lan_passwd = obj->get_access_code();
m_dev_ver = obj->get_ota_version();
m_local_support = obj->file_local;
m_remote_support = obj->file_remote;
m_model_download_support = obj->file_model_download;
} else {
m_supported = false;
m_lan_mode = false;
m_lan_ip.clear();
m_lan_passwd.clear();
m_dev_ver.clear();
m_local_support = false;
m_remote_support = false;
m_model_download_support = false;
}
if (machine == m_machine) {
if (machine == m_machine && m_image_grid->GetFileSystem()) {
if (m_waiting_enable && IsEnabled()) {
auto fs = m_image_grid->GetFileSystem();
if (fs) fs->Retry();
@ -237,7 +237,7 @@ void MediaFilePanel::SetMachineObject(MachineObject* obj)
SetSelecting(false);
if (m_machine.empty()) {
m_image_grid->SetStatus(m_bmp_failed, _L("No printers."));
} else if (!m_supported) {
} else if (!m_local_support && !m_remote_support) {
m_image_grid->SetStatus(m_bmp_failed, _L("Initialize failed (Not supported on the current printer version)!"));
} else {
boost::shared_ptr<PrinterFileSystem> fs(new PrinterFileSystem);
@ -252,6 +252,8 @@ void MediaFilePanel::SetMachineObject(MachineObject* obj)
m_time_panel->Show(fs->GetFileType() < PrinterFileSystem::F_MODEL);
//m_manage_panel->Show(fs->GetFileType() < PrinterFileSystem::F_MODEL);
m_button_management->Enable(fs->GetCount() > 0);
bool download_support = fs->GetFileType() < PrinterFileSystem::F_MODEL || m_model_download_support;
m_image_grid->ShowDownload(download_support);
if (fs->GetCount() == 0)
SetSelecting(false);
});
@ -388,7 +390,9 @@ void MediaFilePanel::SetSelecting(bool selecting)
{
m_image_grid->SetSelecting(selecting);
m_button_management->SetLabel(selecting ? _L("Cancel") : _L("Select"));
m_manage_panel->GetSizer()->Show(m_button_download, selecting);
auto fs = m_image_grid->GetFileSystem();
bool download_support = fs && fs->GetFileType() < PrinterFileSystem::F_MODEL || m_model_download_support;
m_manage_panel->GetSizer()->Show(m_button_download, selecting && download_support);
m_manage_panel->GetSizer()->Show(m_button_delete, selecting);
m_manage_panel->Layout();
}

View File

@ -80,10 +80,10 @@ private:
std::string m_lan_user;
std::string m_lan_passwd;
std::string m_dev_ver;
bool m_supported = false;
bool m_lan_mode = false;
bool m_local_support = false;
bool m_remote_support = false;
bool m_model_download_support = false;
bool m_waiting_enable = false;
int m_last_mode = 0;