Merge branch 'lm_moonraker_rename' (PR #10255)

This commit is contained in:
Lukas Matena 2023-06-07 16:38:49 +02:00
commit 341857ab9b
6 changed files with 26 additions and 23 deletions

View File

@ -68,7 +68,7 @@ static const t_config_enum_values s_keys_map_PrintHostType {
{ "prusalink", htPrusaLink }, { "prusalink", htPrusaLink },
{ "prusaconnect", htPrusaConnect }, { "prusaconnect", htPrusaConnect },
{ "octoprint", htOctoPrint }, { "octoprint", htOctoPrint },
{ "mainsail", htMainSail }, { "moonraker", htMoonraker },
{ "duet", htDuet }, { "duet", htDuet },
{ "flashair", htFlashAir }, { "flashair", htFlashAir },
{ "astrobox", htAstroBox }, { "astrobox", htAstroBox },
@ -1953,7 +1953,7 @@ void PrintConfigDef::init_fff_params()
{ "prusalink", "PrusaLink" }, { "prusalink", "PrusaLink" },
{ "prusaconnect", "PrusaConnect" }, { "prusaconnect", "PrusaConnect" },
{ "octoprint", "OctoPrint" }, { "octoprint", "OctoPrint" },
{ "mainsail", "Mainsail/Fluidd" }, { "moonraker", "Klipper (via Moonraker)" },
{ "duet", "Duet" }, { "duet", "Duet" },
{ "flashair", "FlashAir" }, { "flashair", "FlashAir" },
{ "astrobox", "AstroBox" }, { "astrobox", "AstroBox" },
@ -4214,6 +4214,9 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
else if (value == "marlinfirmware") else if (value == "marlinfirmware")
// the "new" marlin firmware flavor used to be called "marlinfirmware" for some time during PrusaSlicer 2.4.0-alpha development. // the "new" marlin firmware flavor used to be called "marlinfirmware" for some time during PrusaSlicer 2.4.0-alpha development.
value = "marlin2"; value = "marlin2";
} else if (opt_key == "host_type" && value == "mainsail") {
// the "mainsail" key (introduced in 2.6.0-alpha6) was renamed to "moonraker" (in 2.6.0-rc1).
value = "moonraker";
} else if (opt_key == "fill_density" && value.find("%") == std::string::npos) { } else if (opt_key == "fill_density" && value.find("%") == std::string::npos) {
try { try {
// fill_density was turned into a percent value // fill_density was turned into a percent value

View File

@ -44,7 +44,7 @@ enum class MachineLimitsUsage {
}; };
enum PrintHostType { enum PrintHostType {
htPrusaLink, htPrusaConnect, htOctoPrint, htMainSail, htDuet, htFlashAir, htAstroBox, htRepetier, htMKS htPrusaLink, htPrusaConnect, htOctoPrint, htMoonraker, htDuet, htFlashAir, htAstroBox, htRepetier, htMKS
}; };
enum AuthorizationType { enum AuthorizationType {

View File

@ -251,8 +251,8 @@ set(SLIC3R_GUI_SOURCES
Utils/Http.hpp Utils/Http.hpp
Utils/FixModelByWin10.cpp Utils/FixModelByWin10.cpp
Utils/FixModelByWin10.hpp Utils/FixModelByWin10.hpp
Utils/Mainsail.cpp Utils/Moonraker.cpp
Utils/Mainsail.hpp Utils/Moonraker.hpp
Utils/OctoPrint.cpp Utils/OctoPrint.cpp
Utils/OctoPrint.hpp Utils/OctoPrint.hpp
Utils/Duet.cpp Utils/Duet.cpp

View File

@ -1,4 +1,4 @@
#include "Mainsail.hpp" #include "Moonraker.hpp"
#include <algorithm> #include <algorithm>
#include <sstream> #include <sstream>
@ -63,28 +63,28 @@ std::string substitute_host(const std::string& orig_addr, std::string sub_addr)
} }
#endif #endif
} }
Mainsail::Mainsail(DynamicPrintConfig *config) : Moonraker::Moonraker(DynamicPrintConfig *config) :
m_host(config->opt_string("print_host")), m_host(config->opt_string("print_host")),
m_apikey(config->opt_string("printhost_apikey")), m_apikey(config->opt_string("printhost_apikey")),
m_cafile(config->opt_string("printhost_cafile")), m_cafile(config->opt_string("printhost_cafile")),
m_ssl_revoke_best_effort(config->opt_bool("printhost_ssl_ignore_revoke")) m_ssl_revoke_best_effort(config->opt_bool("printhost_ssl_ignore_revoke"))
{} {}
const char* Mainsail::get_name() const { return "Mainsail"; } const char* Moonraker::get_name() const { return "Moonraker"; }
wxString Mainsail::get_test_ok_msg () const wxString Moonraker::get_test_ok_msg () const
{ {
return _(L("Connection to Mainsail works correctly.")); return _(L("Connection to Moonraker works correctly."));
} }
wxString Mainsail::get_test_failed_msg (wxString &msg) const wxString Moonraker::get_test_failed_msg (wxString &msg) const
{ {
return GUI::format_wxstr("%s: %s" return GUI::format_wxstr("%s: %s"
, _L("Could not connect to Mainsail") , _L("Could not connect to Moonraker")
, msg); , msg);
} }
bool Mainsail::test(wxString& msg) const bool Moonraker::test(wxString& msg) const
{ {
// GET /server/info // GET /server/info
@ -142,7 +142,7 @@ bool Mainsail::test(wxString& msg) const
return res; return res;
} }
bool Mainsail::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn, InfoFn info_fn) const bool Moonraker::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn, InfoFn info_fn) const
{ {
// POST /server/files/upload // POST /server/files/upload
@ -232,7 +232,7 @@ bool Mainsail::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, Error
return res; return res;
} }
void Mainsail::set_auth(Http &http) const void Moonraker::set_auth(Http &http) const
{ {
if (!m_apikey.empty()) if (!m_apikey.empty())
http.header("X-Api-Key", m_apikey); http.header("X-Api-Key", m_apikey);
@ -240,7 +240,7 @@ void Mainsail::set_auth(Http &http) const
http.ca_file(m_cafile); http.ca_file(m_cafile);
} }
std::string Mainsail::make_url(const std::string &path) const std::string Moonraker::make_url(const std::string &path) const
{ {
if (m_host.find("http://") == 0 || m_host.find("https://") == 0) { if (m_host.find("http://") == 0 || m_host.find("https://") == 0) {
if (m_host.back() == '/') { if (m_host.back() == '/') {

View File

@ -1,5 +1,5 @@
#ifndef slic3r_Mainsail_hpp_ #ifndef slic3r_Moonraker_hpp_
#define slic3r_Mainsail_hpp_ #define slic3r_Moonraker_hpp_
#include <string> #include <string>
#include <wx/string.h> #include <wx/string.h>
@ -16,11 +16,11 @@ class DynamicPrintConfig;
class Http; class Http;
// https://moonraker.readthedocs.io/en/latest/web_api // https://moonraker.readthedocs.io/en/latest/web_api
class Mainsail : public PrintHost class Moonraker : public PrintHost
{ {
public: public:
Mainsail(DynamicPrintConfig *config); Moonraker(DynamicPrintConfig *config);
~Mainsail() override = default; ~Moonraker() override = default;
const char* get_name() const override; const char* get_name() const override;

View File

@ -19,7 +19,7 @@
#include "AstroBox.hpp" #include "AstroBox.hpp"
#include "Repetier.hpp" #include "Repetier.hpp"
#include "MKS.hpp" #include "MKS.hpp"
#include "Mainsail.hpp" #include "Moonraker.hpp"
#include "../GUI/PrintHostDialogs.hpp" #include "../GUI/PrintHostDialogs.hpp"
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
@ -55,7 +55,7 @@ PrintHost* PrintHost::get_print_host(DynamicPrintConfig *config)
case htPrusaLink: return new PrusaLink(config); case htPrusaLink: return new PrusaLink(config);
case htPrusaConnect: return new PrusaConnect(config); case htPrusaConnect: return new PrusaConnect(config);
case htMKS: return new MKS(config); case htMKS: return new MKS(config);
case htMainSail: return new Mainsail(config); case htMoonraker: return new Moonraker(config);
default: return nullptr; default: return nullptr;
} }
} else { } else {