mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-12-31 11:50:33 -07:00
ENH: use response to support the message; update the panel if SD state changed
jira: [STUDIO-12552] Change-Id: I68048c6fa358253664adbf8fe637c6c0c95e1eb9 (cherry picked from commit 65bb25d80435c28bdaa1fe4445f7fc790f5de22f)
This commit is contained in:
parent
91e27e8e95
commit
2d215d75d2
3 changed files with 25 additions and 19 deletions
|
|
@ -210,11 +210,12 @@ MediaFilePanel::MediaFilePanel(wxWindow * parent)
|
|||
|
||||
MediaFilePanel::~MediaFilePanel()
|
||||
{
|
||||
SetMachineObject(nullptr);
|
||||
UpdateByObj(nullptr);
|
||||
}
|
||||
|
||||
void MediaFilePanel::SetMachineObject(MachineObject* obj)
|
||||
void MediaFilePanel::UpdateByObj(MachineObject* obj)
|
||||
{
|
||||
bool sdcard_state_changed = false;
|
||||
std::string machine = obj ? obj->dev_id : "";
|
||||
if (obj) {
|
||||
m_lan_mode = obj->is_lan_mode_printer();
|
||||
|
|
@ -222,23 +223,32 @@ void MediaFilePanel::SetMachineObject(MachineObject* obj)
|
|||
m_lan_passwd = obj->get_access_code();
|
||||
m_dev_ver = obj->get_ota_version();
|
||||
m_device_busy = obj->is_camera_busy_off();
|
||||
m_sdcard_exist = obj->sdcard_state == MachineObject::SdcardState::HAS_SDCARD_NORMAL;
|
||||
m_local_proto = obj->file_local;
|
||||
m_remote_proto = obj->get_file_remote();
|
||||
m_model_download_support = obj->file_model_download;
|
||||
|
||||
if (m_sdcard_exist != (obj->sdcard_state == MachineObject::SdcardState::HAS_SDCARD_NORMAL)) {
|
||||
m_sdcard_exist = obj->sdcard_state == MachineObject::SdcardState::HAS_SDCARD_NORMAL;
|
||||
sdcard_state_changed = true;
|
||||
}
|
||||
} else {
|
||||
m_lan_mode = false;
|
||||
m_lan_ip.clear();
|
||||
m_lan_passwd.clear();
|
||||
m_dev_ver.clear();
|
||||
m_sdcard_exist = false;
|
||||
m_device_busy = false;
|
||||
m_local_proto = 0;
|
||||
m_remote_proto = 0;
|
||||
m_model_download_support = false;
|
||||
|
||||
if (m_sdcard_exist) {
|
||||
m_sdcard_exist = false; // reset sdcard state when no object
|
||||
sdcard_state_changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
Enable(obj && obj->is_info_ready() && obj->m_push_count > 0);
|
||||
if (machine == m_machine) {
|
||||
if (machine == m_machine && !sdcard_state_changed) {
|
||||
if ((m_waiting_enable && IsEnabled()) || (m_waiting_support && (m_local_proto || m_remote_proto))) {
|
||||
auto fs = m_image_grid->GetFileSystem();
|
||||
if (fs) fs->Retry();
|
||||
|
|
@ -446,11 +456,6 @@ void MediaFilePanel::fetchUrl(boost::weak_ptr<PrinterFileSystem> wfs)
|
|||
fs->SetUrl("0");
|
||||
return;
|
||||
}
|
||||
if (!m_sdcard_exist) {
|
||||
m_image_grid->SetStatus(m_bmp_failed, _L("Please check if the storage is inserted into the printer.\nIf it still cannot be read, you can try formatting the storage."));
|
||||
fs->SetUrl("0");
|
||||
return;
|
||||
}
|
||||
if (m_device_busy) {
|
||||
m_image_grid->SetStatus(m_bmp_failed, _L("The printer is currently busy downloading. Please try again after it finishes."));
|
||||
fs->SetUrl("0");
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public:
|
|||
|
||||
~MediaFilePanel();
|
||||
|
||||
void SetMachineObject(MachineObject * obj);
|
||||
void UpdateByObj(MachineObject * obj);
|
||||
|
||||
void SwitchStorage(bool external);
|
||||
|
||||
|
|
|
|||
|
|
@ -335,12 +335,6 @@ void MonitorPanel::update_all()
|
|||
if (!dev) return;
|
||||
obj = dev->get_selected_machine();
|
||||
|
||||
m_status_info_panel->obj = obj;
|
||||
m_upgrade_panel->update(obj);
|
||||
m_status_info_panel->m_media_play_ctrl->SetMachineObject(obj);
|
||||
m_media_file_panel->SetMachineObject(obj);
|
||||
m_side_tools->update_status(obj);
|
||||
|
||||
if (!obj) {
|
||||
show_status((int)MONITOR_NO_PRINTER);
|
||||
m_hms_panel->clear_hms_tag();
|
||||
|
|
@ -350,6 +344,9 @@ void MonitorPanel::update_all()
|
|||
}
|
||||
|
||||
if (obj->connection_type() != last_conn_type) { last_conn_type = obj->connection_type(); }
|
||||
|
||||
m_side_tools->update_status(obj);
|
||||
|
||||
if (obj->is_connecting()) {
|
||||
show_status(MONITOR_CONNECTING);
|
||||
return;
|
||||
|
|
@ -367,9 +364,13 @@ void MonitorPanel::update_all()
|
|||
|
||||
show_status(MONITOR_NORMAL);
|
||||
|
||||
|
||||
if (m_status_info_panel->IsShown()) {
|
||||
auto current_page = m_tabpanel->GetCurrentPage();
|
||||
if (current_page == m_status_info_panel) {
|
||||
m_status_info_panel->update(obj);
|
||||
} else if (current_page == m_upgrade_panel) {
|
||||
m_upgrade_panel->update(obj);
|
||||
} else if (current_page == m_media_file_panel) {
|
||||
m_media_file_panel->UpdateByObj(obj);
|
||||
}
|
||||
|
||||
if (m_hms_panel->IsShown() || (obj->hms_list.size() != m_hms_panel->temp_hms_list.size())) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue