FIX: PrinterFileSystem: retry connect on user action
Change-Id: I3e8902298385ed2e5906fd15d1817b6e33522a76 Jira: STUDIO-6354
This commit is contained in:
parent
b9061b6fb6
commit
2c1b0d6510
|
@ -337,7 +337,9 @@ void MediaFilePanel::SetMachineObject(MachineObject* obj)
|
|||
|
||||
int result = e.GetExtraLong();
|
||||
if (result > 1 && !e.GetString().IsEmpty())
|
||||
MessageDialog(this, e.GetString(), _L("Download failed"), wxOK | wxICON_ERROR).ShowModal();
|
||||
CallAfter([this, m = e.GetString()] {
|
||||
MessageDialog(this, m, _L("Download failed"), wxOK | wxICON_ERROR).ShowModal();
|
||||
});
|
||||
|
||||
NetworkAgent* agent = wxGetApp().getAgent();
|
||||
if (result > 1 || result == 0) {
|
||||
|
@ -558,9 +560,11 @@ void MediaFilePanel::doAction(size_t index, int action)
|
|||
if (result == PrinterFileSystem::ERROR_CANCEL)
|
||||
return;
|
||||
if (result != 0) {
|
||||
MessageDialog(this,
|
||||
_L("Failed to fetch model information from printer."),
|
||||
_L("Error"), wxOK).ShowModal();
|
||||
wxString msg = data.empty() ? _L("Failed to fetch model information from printer.") :
|
||||
from_u8(data);
|
||||
CallAfter([this, msg] {
|
||||
MessageDialog(this, msg, _L("Print"), wxOK).ShowModal();
|
||||
});
|
||||
return;
|
||||
}
|
||||
Slic3r::DynamicPrintConfig config;
|
||||
|
@ -572,7 +576,7 @@ void MediaFilePanel::doAction(size_t index, int action)
|
|||
|| plate_data_list.empty()) {
|
||||
MessageDialog(this,
|
||||
_L("Failed to parse model information."),
|
||||
_L("Error"), wxOK).ShowModal();
|
||||
_L("Print"), wxOK).ShowModal();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -315,7 +315,8 @@ void MediaPlayCtrl::Play()
|
|||
SetStatus(_L("Initializing..."));
|
||||
|
||||
if (agent) {
|
||||
agent->get_camera_url(m_machine, [this, m = m_machine, v = agent_version, dv = m_dev_ver](std::string url) {
|
||||
agent->get_camera_url(m_machine,
|
||||
[this, m = m_machine, v = agent_version, dv = m_dev_ver](std::string url) {
|
||||
if (boost::algorithm::starts_with(url, "bambu:///")) {
|
||||
url += "&device=" + into_u8(m);
|
||||
url += "&net_ver=" + v;
|
||||
|
|
|
@ -45,7 +45,7 @@ wxDEFINE_EVENT(EVT_FILE_CALLBACK, wxCommandEvent);
|
|||
static wxBitmap default_thumbnail;
|
||||
|
||||
static std::map<int, std::string> error_messages = {
|
||||
{PrinterFileSystem::ERROR_PIPE, L("The printer has been logged out and cannot connect.")},
|
||||
{PrinterFileSystem::ERROR_PIPE, L("Reconnecting the printer, the operation cannot be completed immediately, please try again later.")},
|
||||
{PrinterFileSystem::ERROR_RES_BUSY, L("Over 4 studio/handy are using remote access, you can close some and try again.")},
|
||||
{PrinterFileSystem::FILE_NO_EXIST, L("File does not exist.")},
|
||||
{PrinterFileSystem::FILE_CHECK_ERR, L("File checksum error. Please retry.")},
|
||||
|
@ -358,6 +358,13 @@ void PrinterFileSystem::FetchModel(size_t index, std::function<void(int, std::st
|
|||
[this, file_data, callback](int result, Void const &) {
|
||||
if (result == CONTINUE) return;
|
||||
m_task_flags &= ~FF_FETCH_MODEL;
|
||||
if (result != 0) {
|
||||
auto iter = error_messages.find(result);
|
||||
if (iter != error_messages.end())
|
||||
*file_data = _u8L(iter->second.c_str());
|
||||
else
|
||||
file_data->clear();
|
||||
}
|
||||
callback(result, *file_data);
|
||||
});
|
||||
}
|
||||
|
@ -1026,10 +1033,7 @@ void PrinterFileSystem::DumpLog(void * thiz, int, tchar const *msg)
|
|||
boost::uint32_t PrinterFileSystem::SendRequest(int type, json const &req, callback_t2 const &callback)
|
||||
{
|
||||
if (m_session.tunnel == nullptr) {
|
||||
{
|
||||
boost::unique_lock l(m_mutex);
|
||||
m_cond.notify_all();
|
||||
}
|
||||
Retry();
|
||||
callback(ERROR_PIPE, json(), nullptr);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue