Fixed a regression bug that device URL was not reset when changing to a machine don't have connection info

This commit is contained in:
SoftFever 2024-03-11 22:37:06 +08:00
parent 6689087e6f
commit f83a3377ab
2 changed files with 10 additions and 8 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 738 KiB

After

Width:  |  Height:  |  Size: 716 KiB

View file

@ -1147,18 +1147,20 @@ void Sidebar::update_all_preset_comboboxes()
ams_btn->Hide();
auto print_btn_type = MainFrame::PrintSelectType::eExportGcode;
wxString url = cfg.opt_string("print_host_webui").empty() ? cfg.opt_string("print_host") : cfg.opt_string("print_host_webui");
if(!url.empty())
{
if(!url.Lower().starts_with("http"))
url = wxString::Format("http://%s",url);
wxString apikey;
wxString apikey;
if(url.empty())
url = wxString::Format("file://%s/web/orca/missing_connection.html", from_u8(resources_dir()));
else {
if (!url.Lower().starts_with("http"))
url = wxString::Format("http://%s", url);
if (cfg.has("printhost_apikey"))
apikey = cfg.opt_string("printhost_apikey");
p_mainframe->load_printer_url(url, apikey);
print_btn_type = MainFrame::PrintSelectType::eSendGcode;
}
p_mainframe->load_printer_url(url, apikey);
p_mainframe->set_print_button_to_default(print_btn_type);
}