FIX: MediaFilePanel error state
Change-Id: I318ef59fb97478ffee16dff594022b2b9029964a Jira: STUDIO-5638
This commit is contained in:
parent
dc47541220
commit
a9227daca1
|
@ -27,6 +27,7 @@ MediaFilePanel::MediaFilePanel(wxWindow * parent)
|
||||||
, m_bmp_loading(this, "media_loading", 0)
|
, m_bmp_loading(this, "media_loading", 0)
|
||||||
, m_bmp_failed(this, "media_failed", 0)
|
, m_bmp_failed(this, "media_failed", 0)
|
||||||
, m_bmp_empty(this, "media_empty", 0)
|
, m_bmp_empty(this, "media_empty", 0)
|
||||||
|
, m_machine("<null>")
|
||||||
{
|
{
|
||||||
SetBackgroundColour(0xEEEEEE);
|
SetBackgroundColour(0xEEEEEE);
|
||||||
Hide();
|
Hide();
|
||||||
|
@ -219,14 +220,14 @@ void MediaFilePanel::SetMachineObject(MachineObject* obj)
|
||||||
m_model_download_support = false;
|
m_model_download_support = false;
|
||||||
}
|
}
|
||||||
Enable(obj && obj->is_connected() && obj->m_push_count > 0);
|
Enable(obj && obj->is_connected() && obj->m_push_count > 0);
|
||||||
if (machine == m_machine && (m_image_grid->GetFileSystem() || (!m_local_support && !m_remote_support))) {
|
if (machine == m_machine) {
|
||||||
if (m_waiting_enable && IsEnabled()) {
|
if ((m_waiting_enable && IsEnabled()) || (m_waiting_support && (m_local_support || m_remote_support))) {
|
||||||
auto fs = m_image_grid->GetFileSystem();
|
auto fs = m_image_grid->GetFileSystem();
|
||||||
if (fs) fs->Retry();
|
if (fs) fs->Retry();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_machine = machine;
|
m_machine.swap(machine);
|
||||||
m_last_errors.clear();
|
m_last_errors.clear();
|
||||||
auto fs = m_image_grid->GetFileSystem();
|
auto fs = m_image_grid->GetFileSystem();
|
||||||
if (fs) {
|
if (fs) {
|
||||||
|
@ -238,10 +239,6 @@ void MediaFilePanel::SetMachineObject(MachineObject* obj)
|
||||||
SetSelecting(false);
|
SetSelecting(false);
|
||||||
if (m_machine.empty()) {
|
if (m_machine.empty()) {
|
||||||
m_image_grid->SetStatus(m_bmp_failed, _L("No printers."));
|
m_image_grid->SetStatus(m_bmp_failed, _L("No printers."));
|
||||||
} else if (!IsEnabled()) {
|
|
||||||
m_image_grid->SetStatus(m_bmp_failed, _L("Initialize failed (Device connection not ready)!"));
|
|
||||||
} 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 {
|
} else {
|
||||||
boost::shared_ptr<PrinterFileSystem> fs(new PrinterFileSystem);
|
boost::shared_ptr<PrinterFileSystem> fs(new PrinterFileSystem);
|
||||||
fs->Attached();
|
fs->Attached();
|
||||||
|
@ -431,10 +428,12 @@ void MediaFilePanel::fetchUrl(boost::weak_ptr<PrinterFileSystem> wfs)
|
||||||
}
|
}
|
||||||
m_waiting_enable = false;
|
m_waiting_enable = false;
|
||||||
if (!m_local_support && !m_remote_support) {
|
if (!m_local_support && !m_remote_support) {
|
||||||
|
m_waiting_support = true;
|
||||||
m_image_grid->SetStatus(m_bmp_failed, _L("Initialize failed (Not supported on the current printer version)!"));
|
m_image_grid->SetStatus(m_bmp_failed, _L("Initialize failed (Not supported on the current printer version)!"));
|
||||||
fs->SetUrl("0");
|
fs->SetUrl("0");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
m_waiting_support = false;
|
||||||
if ((m_lan_mode || !m_remote_support) && m_local_support && !m_lan_ip.empty()) {
|
if ((m_lan_mode || !m_remote_support) && m_local_support && !m_lan_ip.empty()) {
|
||||||
std::string url = "bambu:///local/" + m_lan_ip + ".?port=6000&user=" + m_lan_user + "&passwd=" + m_lan_passwd +
|
std::string url = "bambu:///local/" + m_lan_ip + ".?port=6000&user=" + m_lan_user + "&passwd=" + m_lan_passwd +
|
||||||
"&device=" + m_machine + "&dev_ver=" + m_dev_ver;
|
"&device=" + m_machine + "&dev_ver=" + m_dev_ver;
|
||||||
|
|
|
@ -87,6 +87,7 @@ private:
|
||||||
bool m_remote_support = false;
|
bool m_remote_support = false;
|
||||||
bool m_model_download_support = false;
|
bool m_model_download_support = false;
|
||||||
bool m_waiting_enable = false;
|
bool m_waiting_enable = false;
|
||||||
|
bool m_waiting_support = false;
|
||||||
|
|
||||||
int m_last_mode = 0;
|
int m_last_mode = 0;
|
||||||
int m_last_type = 0;
|
int m_last_type = 0;
|
||||||
|
|
|
@ -1281,6 +1281,8 @@ void PrinterFileSystem::Reconnect(boost::unique_lock<boost::mutex> &l, int resul
|
||||||
if (url.size() < 2) {
|
if (url.size() < 2) {
|
||||||
wxLogMessage("PrinterFileSystem::Reconnect Initialize failed: %s", wxString::FromUTF8(url));
|
wxLogMessage("PrinterFileSystem::Reconnect Initialize failed: %s", wxString::FromUTF8(url));
|
||||||
m_last_error = atoi(url.c_str());
|
m_last_error = atoi(url.c_str());
|
||||||
|
if (m_last_error == 0)
|
||||||
|
m_stopped = true;
|
||||||
} else {
|
} else {
|
||||||
wxLogMessage("PrinterFileSystem::Reconnect Initialized: %s", Slic3r::GUI::hide_passwd(wxString::FromUTF8(url), {"authkey=", "passwd="}));
|
wxLogMessage("PrinterFileSystem::Reconnect Initialized: %s", Slic3r::GUI::hide_passwd(wxString::FromUTF8(url), {"authkey=", "passwd="}));
|
||||||
l.unlock();
|
l.unlock();
|
||||||
|
|
Loading…
Reference in New Issue