diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 962ed0b..0060f27 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -71,11 +71,13 @@ static const t_config_enum_values s_keys_map_MachineLimitsUsage { }; CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(MachineLimitsUsage) +//B55 static const t_config_enum_values s_keys_map_PrintHostType { { "qidilink", htQIDILink }, { "qidiconnect", htQIDIConnect }, { "octoprint", htOctoPrint }, { "moonraker", htMoonraker }, + { "moonraker2", htMoonraker2 }, { "duet", htDuet }, { "flashair", htFlashAir }, { "astrobox", htAstroBox }, @@ -2140,6 +2142,7 @@ void PrintConfigDef::init_fff_params() def->sidetext = L("mm"); def->set_default_value(new ConfigOptionFloats { 0.4 }); +//B55 def = this->add("host_type", coEnum); def->label = L("Host Type"); def->tooltip = L("Slic3r can upload G-code files to a printer host. This field must contain " @@ -2148,7 +2151,8 @@ void PrintConfigDef::init_fff_params() { "qidilink", "QIDILink" }, { "qidiconnect", "QIDIConnect" }, { "octoprint", "OctoPrint" }, - { "moonraker", "Klipper (via Moonraker)" }, + { "moonraker", "Klipper (via QIDI)" }, + { "moonraker2", "Klipper (via Moonraker)" }, { "duet", "Duet" }, { "flashair", "FlashAir" }, { "astrobox", "AstroBox" }, diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index e3af18e..3c579f9 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -46,8 +46,9 @@ enum class MachineLimitsUsage { Count, }; +//B55 enum PrintHostType { - htQIDILink, htQIDIConnect, htOctoPrint, htMoonraker, htDuet, htFlashAir, htAstroBox, htRepetier, htMKS + htQIDILink, htQIDIConnect, htOctoPrint, htMoonraker, htMoonraker2,htDuet, htFlashAir, htAstroBox, htRepetier, htMKS }; enum AuthorizationType { diff --git a/src/slic3r/GUI/BedShapeDialog.cpp b/src/slic3r/GUI/BedShapeDialog.cpp index 868e4bc..71aa645 100644 --- a/src/slic3r/GUI/BedShapeDialog.cpp +++ b/src/slic3r/GUI/BedShapeDialog.cpp @@ -280,7 +280,16 @@ void BedShapePanel::build_panel(const ConfigOptionPoints& default_pt, const Conf // right pane with preview canvas m_canvas = new Bed_2D(this); m_canvas->SetMinSize({ FromDIP(400), FromDIP(400) }); - m_canvas->Bind(wxEVT_PAINT, [this](wxPaintEvent& e) { m_canvas->repaint(m_shape); }); + //B52 + m_canvas->Bind(wxEVT_PAINT, [this](wxPaintEvent& e) { + std::vector tem_shape = m_shape; + if (m_exclude_area.size() > 1) { + for (const auto &point : m_exclude_area) { + tem_shape.push_back({point.x(), point.y()}); + } + } + m_canvas->repaint(tem_shape); + }); m_canvas->Bind(wxEVT_SIZE, [this](wxSizeEvent& e) { m_canvas->Refresh(); }); wxSizer* left_sizer = new wxBoxSizer(wxVERTICAL); @@ -665,12 +674,12 @@ const std::vector BedShapePanel::update_exclude_area(ConfigOptionsGroupSh e_area.push_back({exclude_min_1.x(), exclude_min_1.y()}); e_area.push_back({0, 0}); } - - if (e_area.size() > 1) { - for (const auto &point : e_area) { - m_shape.push_back({point.x(), point.y()}); - } - } + + //if (e_area.size() > 1) { + // for (const auto &point : e_area) { + // m_shape.push_back({point.x(), point.y()}); + // } + //} } return e_area; } diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 4aa9ceb..eb6e7ce 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -2148,11 +2148,13 @@ void MainFrame::select_tab(size_t tab/* = size_t(-1)*/) m_printer_view->AddButton( printer_name, host, (data->model_id), (data->fullname), [host, this](wxMouseEvent &event) { - wxString formattedHost = wxString::Format("http://%s", host); + //B55 + wxString formattedHost = host; + //wxString formattedHost = wxString::Format("http://%s", host); if (!host.Lower().starts_with("http")) - wxString formattedHost = wxString::Format("http://%s", host); - if (!formattedHost.Lower().ends_with("10088")) - formattedHost = wxString::Format("%s:10088", formattedHost); + formattedHost = wxString::Format("http://%s", host); + //if (!formattedHost.Lower().ends_with("10088")) + // formattedHost = wxString::Format("%s:10088", formattedHost); this->m_printer_view->load_url(formattedHost); }, (data->selected), cfg_t); @@ -2168,18 +2170,20 @@ void MainFrame::select_tab(size_t tab/* = size_t(-1)*/) if (const DynamicPrintConfig *cfg = wxGetApp().preset_bundle->physical_printers.get_selected_printer_config(); cfg) { const PhysicalPrinter &pp = preset_bundle.physical_printers.get_selected_printer(); wxString host = pp.config.opt_string("print_host"); + //B55 //B45 - std::regex ipRegex(R"(\b(?:\d{1,3}\.){3}\d{1,3}\b)"); - bool isValidIPAddress = std::regex_match(host.ToStdString(), ipRegex); - if (host.empty() || !isValidIPAddress) { + //std::regex ipRegex(R"(\b(?:\d{1,3}\.){3}\d{1,3}\b)"); + //bool isValidIPAddress = std::regex_match(host.ToStdString(), ipRegex); + if (host.empty()) { tem_host = ""; host = wxString::Format("file://%s/web/qidi/missing_connection.html", from_u8(resources_dir())); } + //B55 else { if (!host.Lower().starts_with("http")) host = wxString::Format("http://%s", host); - if (!host.Lower().ends_with("10088")) - host = wxString::Format("%s:10088", host); + // if (!host.Lower().ends_with("10088")) + // host = wxString::Format("%s:10088", host); } if (tem_host != host) { //B45 diff --git a/src/slic3r/GUI/PhysicalPrinterDialog.cpp b/src/slic3r/GUI/PhysicalPrinterDialog.cpp index 8fdaf0c..cb38db5 100644 --- a/src/slic3r/GUI/PhysicalPrinterDialog.cpp +++ b/src/slic3r/GUI/PhysicalPrinterDialog.cpp @@ -509,7 +509,7 @@ void PhysicalPrinterDialog::update(bool printer_change) text_ctrl* printhost_win = printhost_field ? dynamic_cast(printhost_field->getWindow()) : nullptr; if (!m_opened_as_connect && printhost_win && m_last_host_type != htQIDIConnect){ m_stored_host = printhost_win->GetValue(); - printhost_win->SetValue(L"https://connect.prusa3d.com"); + printhost_win->SetValue(L"https://connect.qidi3d.com"); } } else { m_printhost_browse_btn->Show(); @@ -743,6 +743,19 @@ void PhysicalPrinterDialog::OnOK(wxEvent& event) Field* printhost_field = m_optgroup->get_field("print_host"); text_ctrl* printhost_win = printhost_field ? dynamic_cast(printhost_field->getWindow()) : nullptr; const auto opt = m_config->option>("host_type"); + if (opt->value == htMoonraker) { + Field * printhost_field = m_optgroup->get_field("print_host"); + text_ctrl *printhost_win = printhost_field ? dynamic_cast(printhost_field->getWindow()) : nullptr; + wxString temp_host = printhost_win->GetValue(); + //B55 + wxString formattedHost = temp_host; + /* if (!temp_host.Lower().starts_with("http")) + wxString formattedHost = wxString::Format("http://%s", temp_host);*/ + if (!formattedHost.Lower().ends_with("10088")) + formattedHost = wxString::Format("%s:10088", formattedHost); + m_optgroup->set_value("print_host", formattedHost, true); + m_optgroup->get_field("print_host")->field_changed(); + } if (opt->value == htQIDIConnect) { if (printhost_win && printhost_win->GetValue() != L"https://connect.qidi3d.com"){ InfoDialog msg(this, _L("Warning"), _L("URL of QIDIConnect is different from https://connect.qidi3d.com. Do you want to continue?"), true, wxYES_NO); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 5e5e498..29c1bab 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -8167,7 +8167,15 @@ void Plater::set_bed_shape() const auto bed_shape = p->config->option("bed_shape")->values; auto exclude_area = p->config->option("bed_exclude_area")->values; - set_bed_shape(bed_shape, p->config->option("max_print_height")->value, + + Pointfs tem_shape = bed_shape; + tem_shape.push_back({0, 0}); + for (const auto &point : exclude_area) { + tem_shape.push_back({point.x(), point.y()}); + } + tem_shape.push_back({0, 0}); + + set_bed_shape(tem_shape, p->config->option("max_print_height")->value, p->config->option("bed_custom_texture")->value, p->config->option("bed_custom_model")->value, exclude_area); } diff --git a/src/slic3r/GUI/PresetComboBoxes.cpp b/src/slic3r/GUI/PresetComboBoxes.cpp index c016802..bc94b4b 100644 --- a/src/slic3r/GUI/PresetComboBoxes.cpp +++ b/src/slic3r/GUI/PresetComboBoxes.cpp @@ -380,9 +380,10 @@ void PresetComboBox::open_physical_printer_url() const PhysicalPrinter &pp = m_preset_bundle->physical_printers.get_selected_printer(); std::string host = pp.config.opt_string("print_host"); assert(!host.empty()); - // B31 - if (host.find(":10088") == -1) - host = host + ":10088"; + //B55 + //// B31 + //if (host.find(":10088") == -1) + // host = host + ":10088"; wxGetApp().open_browser_with_warning_dialog(host); } diff --git a/src/slic3r/GUI/PrinterWebView.cpp b/src/slic3r/GUI/PrinterWebView.cpp index 1c0ecf3..1f0bbce 100644 --- a/src/slic3r/GUI/PrinterWebView.cpp +++ b/src/slic3r/GUI/PrinterWebView.cpp @@ -360,10 +360,11 @@ void PrinterWebView::AddButton(const wxString & devi //customButton->Bind(wxEVT_BUTTON, std::bind(&PrinterWebView::OnCustomButtonClick, this,handler)); customButton->Bind(wxEVT_BUTTON, [this, ip, customButton](wxCommandEvent &event) { wxString host = ip; + //B55 if (!host.Lower().starts_with("http")) host = wxString::Format("http://%s", host); - if (!host.Lower().ends_with("10088")) - host = wxString::Format("%s:10088", host); + // if (!host.Lower().ends_with("10088")) + // host = wxString::Format("%s:10088", host); load_url(host); customButton->ResumeStatusThread(); }); @@ -540,11 +541,13 @@ void PrinterWebView::OnAddButtonClick(wxCommandEvent &event) std::string printer_name = printer.name; wxString host = printer.config.opt_string("print_host"); - wxString formattedHost = wxString::Format("http://%s", host); + //B55 + wxString formattedHost = host; + // wxString formattedHost = wxString::Format("http://%s", host); if (!host.Lower().starts_with("http")) wxString formattedHost = wxString::Format("http://%s", host); - if (!formattedHost.Lower().ends_with("10088")) - formattedHost = wxString::Format("%s:10088", formattedHost); + // if (!formattedHost.Lower().ends_with("10088")) + // formattedHost = wxString::Format("%s:10088", formattedHost); std::string fullname = preset_bundle.physical_printers.get_selected_full_printer_name(); std::string preset_name = printer.get_preset_name(fullname); @@ -557,8 +560,9 @@ void PrinterWebView::OnAddButtonClick(wxCommandEvent &event) model_id = preset->config.opt_string("printer_model"); } - boost::regex ipRegex(R"(\b(?:\d{1,3}\.){3}\d{1,3}\b)"); - bool isValidIPAddress = boost::regex_match(host.ToStdString(), ipRegex); + //boost::regex ipRegex(R"(\b(?:\d{1,3}\.){3}\d{1,3}\b)"); + //bool isValidIPAddress = boost::regex_match(host.ToStdString(), ipRegex); + bool isValidIPAddress = true; DynamicPrintConfig *cfg_t = &(printer.config); UnSelectedButton(); @@ -760,8 +764,9 @@ void PrinterWebView::load_url(wxString& url) //m_web = url; m_browser->LoadURL(url); + //B55 url.Remove(0, 7); - url.Remove(url.length() - 6); + //url.Remove(url.length() - 6); for (MachineListButton *button : m_buttons) { if (url == (button->getIPLabel())) button->SetSelect(true); diff --git a/src/slic3r/Utils/Moonraker.cpp b/src/slic3r/Utils/Moonraker.cpp index 7266b23..6edd549 100644 --- a/src/slic3r/Utils/Moonraker.cpp +++ b/src/slic3r/Utils/Moonraker.cpp @@ -62,12 +62,15 @@ std::string substitute_host(const std::string& orig_addr, std::string sub_addr) return out; } #endif -} -Moonraker::Moonraker(DynamicPrintConfig *config) : - m_host(config->opt_string("print_host")), - m_apikey(config->opt_string("printhost_apikey")), - m_cafile(config->opt_string("printhost_cafile")), - m_ssl_revoke_best_effort(config->opt_bool("printhost_ssl_ignore_revoke")) +} // namespace +//B55 +Moonraker::Moonraker(DynamicPrintConfig *config, bool add_port) + : m_host(add_port ? config->opt_string("print_host").find(":10088") == std::string::npos ? config->opt_string("print_host") + ":10088" : + config->opt_string("print_host") : + config->opt_string("print_host")) + , m_apikey(config->opt_string("printhost_apikey")) + , m_cafile(config->opt_string("printhost_cafile")) + , m_ssl_revoke_best_effort(config->opt_bool("printhost_ssl_ignore_revoke")) {} const char* Moonraker::get_name() const { return "Moonraker"; } diff --git a/src/slic3r/Utils/Moonraker.hpp b/src/slic3r/Utils/Moonraker.hpp index 509de27..59ba281 100644 --- a/src/slic3r/Utils/Moonraker.hpp +++ b/src/slic3r/Utils/Moonraker.hpp @@ -19,7 +19,8 @@ class Http; class Moonraker : public PrintHost { public: - Moonraker(DynamicPrintConfig *config); + //B55 + Moonraker(DynamicPrintConfig *config, bool add_port); ~Moonraker() override = default; const char* get_name() const override; diff --git a/src/slic3r/Utils/PrintHost.cpp b/src/slic3r/Utils/PrintHost.cpp index 57c4ef0..66fd25d 100644 --- a/src/slic3r/Utils/PrintHost.cpp +++ b/src/slic3r/Utils/PrintHost.cpp @@ -46,6 +46,7 @@ PrintHost* PrintHost::get_print_host(DynamicPrintConfig *config) const auto opt = config->option>("host_type"); const auto host_type = opt != nullptr ? opt->value : htOctoPrint; + //B55 switch (host_type) { case htOctoPrint: return new OctoPrint(config); case htDuet: return new Duet(config); @@ -55,7 +56,8 @@ PrintHost* PrintHost::get_print_host(DynamicPrintConfig *config) case htQIDILink: return new QIDILink(config); case htQIDIConnect: return new QIDIConnect(config); case htMKS: return new MKS(config); - case htMoonraker: return new Moonraker(config); + case htMoonraker: return new Moonraker(config,true); + case htMoonraker2: return new Moonraker(config,false); default: return nullptr; } } else {