diff --git a/resources/web/orca/missing_connection.html b/resources/web/orca/missing_connection.html new file mode 100644 index 0000000000..3556acaec0 --- /dev/null +++ b/resources/web/orca/missing_connection.html @@ -0,0 +1,33 @@ + + + + + + Printer Connection Required + + + +
+

Printer Connection

+

Please set up your printer connection to view the device.

+ Printer connection setup demonstration +
+ + diff --git a/resources/web/orca/setup_connection.gif b/resources/web/orca/setup_connection.gif new file mode 100644 index 0000000000..3e28ac8001 Binary files /dev/null and b/resources/web/orca/setup_connection.gif differ diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 6d49ab5888..2f525893c5 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -864,13 +864,13 @@ void MainFrame::show_option(bool show) } } -void MainFrame::init_tabpanel() -{ - // wxNB_NOPAGETHEME: Disable Windows Vista theme for the Notebook background. The theme performance is terrible on Windows 10 - // with multiple high resolution displays connected. - // BBS - wxBoxSizer* side_tools = create_side_tools(); - m_tabpanel = new Notebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, side_tools, wxNB_TOP | wxTAB_TRAVERSAL | wxNB_NOPAGETHEME); +void MainFrame::init_tabpanel() { + // wxNB_NOPAGETHEME: Disable Windows Vista theme for the Notebook background. The theme performance is terrible on + // Windows 10 with multiple high resolution displays connected. + // BBS + wxBoxSizer *side_tools = create_side_tools(); + m_tabpanel = new Notebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, side_tools, + wxNB_TOP | wxTAB_TRAVERSAL | wxNB_NOPAGETHEME); m_tabpanel->SetBackgroundColour(*wxWHITE); #ifndef __WXOSX__ // Don't call SetFont under OSX to avoid name cutting in ObjectList @@ -879,21 +879,32 @@ void MainFrame::init_tabpanel() m_tabpanel->Hide(); m_settings_dialog.set_tabpanel(m_tabpanel); - m_tabpanel->Bind(wxEVT_NOTEBOOK_PAGE_CHANGING, [this](wxBookCtrlEvent& e) { - int old_sel = e.GetOldSelection(); - int new_sel = e.GetSelection(); - if (wxGetApp().preset_bundle && - wxGetApp().preset_bundle->printers.get_edited_preset().is_bbl_vendor_preset(wxGetApp().preset_bundle) && - new_sel == tpMonitor) { - if (!wxGetApp().getAgent()) { - e.Veto(); - BOOST_LOG_TRIVIAL(info) << boost::format("skipped tab switch from %1% to %2%, lack of network plugins")%old_sel %new_sel; - if (m_plater) { - wxCommandEvent *evt = new wxCommandEvent(EVT_INSTALL_PLUGIN_HINT); - wxQueueEvent(m_plater, evt); - } - } + m_tabpanel->Bind(wxEVT_NOTEBOOK_PAGE_CHANGING, [this](wxBookCtrlEvent &e) { + int old_sel = e.GetOldSelection(); + int new_sel = e.GetSelection(); + if (wxGetApp().preset_bundle && + wxGetApp().preset_bundle->printers.get_edited_preset().is_bbl_vendor_preset(wxGetApp().preset_bundle) && + new_sel == tpMonitor) { + if (!wxGetApp().getAgent()) { + e.Veto(); + BOOST_LOG_TRIVIAL(info) << boost::format("skipped tab switch from %1% to %2%, lack of network plugins") % + old_sel % new_sel; + if (m_plater) { + wxCommandEvent *evt = new wxCommandEvent(EVT_INSTALL_PLUGIN_HINT); + wxQueueEvent(m_plater, evt); + } } + } else { + if (new_sel == tpMonitor && wxGetApp().preset_bundle != nullptr) { + auto cfg = wxGetApp().preset_bundle->printers.get_edited_preset().config; + wxString url = cfg.opt_string("print_host_webui").empty() ? cfg.opt_string("print_host") + : cfg.opt_string("print_host_webui"); + if (url.empty()) { + wxString url = wxString::Format("file://%s/web/orca/missing_connection.html", from_u8(resources_dir())); + m_printer_view->load_url(url); + } + } + } }); #ifdef __WXMSW__ diff --git a/src/slic3r/Utils/OctoPrint.cpp b/src/slic3r/Utils/OctoPrint.cpp index 5116795c5e..9d9d7ef5a3 100644 --- a/src/slic3r/Utils/OctoPrint.cpp +++ b/src/slic3r/Utils/OctoPrint.cpp @@ -161,7 +161,7 @@ bool OctoPrint::test(wxString &msg) const wxString OctoPrint::get_test_ok_msg () const { - return _(L("Connection to OctoPrint works correctly.")); + return _(L("Connection to OctoPrint/Klipper works correctly.")); } wxString OctoPrint::get_test_failed_msg (wxString &msg) const