From 8a9abc866d5f617809a3a4e3653ccfea389c872c Mon Sep 17 00:00:00 2001 From: Billiam Crashkopf Date: Wed, 1 Jan 2025 20:58:55 -0800 Subject: [PATCH] Quick fix attempt for issue #4076. This patch attempts to keep the printer access code from being cleared erroneously on a lost or failed connection. This only applies to LAN mode. Notes: - The setting is 'access_code'. There is also a setting named 'user_access_code', but it's function is unclear and may be vestigal. - Some parts of the network connection behavior are handled by the networking plugin. I can't seem to make the machine list refresh from outside. --- src/slic3r/GUI/GUI_App.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index d0949c68a..568869668 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -2076,11 +2076,12 @@ void GUI_App::init_networking_callbacks() event.SetString(obj->dev_id); GUI::wxGetApp().sidebar().load_ams_list(obj->dev_id, obj); } else if (state == ConnectStatus::ConnectStatusFailed) { - obj->set_access_code(""); - obj->erase_user_access_code(); + m_device_manager->localMachineList.erase(obj->dev_id); m_device_manager->set_selected_machine("", true); wxString text; if (msg == "5") { + obj->set_access_code(""); + obj->erase_user_access_code(); text = wxString::Format(_L("Incorrect password")); wxGetApp().show_dialog(text); } else { @@ -2089,9 +2090,9 @@ void GUI_App::init_networking_callbacks() } event.SetInt(-1); } else if (state == ConnectStatus::ConnectStatusLost) { - obj->set_access_code(""); - obj->erase_user_access_code(); - m_device_manager->localMachineList.erase(obj->dev_id); + //obj->set_access_code(""); + //obj->erase_user_access_code(); + //m_device_manager->localMachineList.erase(obj->dev_id); m_device_manager->set_selected_machine("", true); event.SetInt(-1); BOOST_LOG_TRIVIAL(info) << "set_on_local_connect_fn: state = lost";