Skip to content

Commit

Permalink
Fix of #10210 (crash when using mainsail print host) and some related…
Browse files Browse the repository at this point in the history
… UI fixes ('OctoPrint'->'Mainsail/Fluidd')
  • Loading branch information
lukasmatena authored and kocikdav committed Apr 14, 2023
1 parent 06403ee commit f6da852
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/libslic3r/PrintConfig.hpp
Expand Up @@ -44,7 +44,7 @@ enum class MachineLimitsUsage {
};

enum PrintHostType {
htPrusaLink, htPrusaConnect, htOctoPrint, htDuet, htFlashAir, htAstroBox, htRepetier, htMKS, htMainSail
htPrusaLink, htPrusaConnect, htOctoPrint, htMainSail, htDuet, htFlashAir, htAstroBox, htRepetier, htMKS
};

enum AuthorizationType {
Expand Down
20 changes: 16 additions & 4 deletions src/slic3r/Utils/OctoPrint.cpp
Expand Up @@ -203,7 +203,7 @@ bool OctoPrint::test_with_resolved_ip(wxString &msg) const
const auto text = ptree.get_optional<std::string>("text");
res = validate_version_text(text);
if (!res) {
msg = GUI::format_wxstr(_L("Mismatched type of print host: %s"), (text ? *text : "OctoPrint"));
msg = GUI::format_wxstr(_L("Mismatched type of print host: %s"), (text ? *text : name));
}
}
catch (const std::exception&) {
Expand Down Expand Up @@ -252,7 +252,7 @@ bool OctoPrint::test(wxString& msg) const
const auto text = ptree.get_optional<std::string>("text");
res = validate_version_text(text);
if (! res) {
msg = GUI::format_wxstr(_L("Mismatched type of print host: %s"), (text ? *text : "OctoPrint"));
msg = GUI::format_wxstr(_L("Mismatched type of print host: %s"), (text ? *text : name));
}
}
catch (const std::exception &) {
Expand Down Expand Up @@ -396,7 +396,7 @@ bool OctoPrint::upload_inner_with_resolved_ip(PrintHostUpload upload_data, Progr
prorgess_fn(std::move(progress), cancel);
if (cancel) {
// Upload was canceled
BOOST_LOG_TRIVIAL(info) << "Octoprint: Upload canceled";
BOOST_LOG_TRIVIAL(info) << name << ": Upload canceled";
result = false;
}
})
Expand Down Expand Up @@ -473,7 +473,7 @@ bool OctoPrint::upload_inner_with_host(PrintHostUpload upload_data, ProgressFn p
prorgess_fn(std::move(progress), cancel);
if (cancel) {
// Upload was canceled
BOOST_LOG_TRIVIAL(info) << "Octoprint: Upload canceled";
BOOST_LOG_TRIVIAL(info) << name << ": Upload canceled";
res = false;
}
})
Expand Down Expand Up @@ -1127,4 +1127,16 @@ wxString PrusaConnect::get_test_failed_msg(wxString& msg) const
return GUI::format_wxstr("%s: %s", _L("Could not connect to Prusa Connect"), msg);
}



wxString Mainsail::get_test_ok_msg() const
{
return _(L("Connection to Mainsail/Fluidd works correctly."));
}

wxString Mainsail::get_test_failed_msg(wxString& msg) const
{
return GUI::format_wxstr("%s: %s", _L("Could not connect to MainSail/Fluidd"), msg);
}

}
2 changes: 2 additions & 0 deletions src/slic3r/Utils/OctoPrint.hpp
Expand Up @@ -125,6 +125,8 @@ class Mainsail : public OctoPrint
~Mainsail() override = default;

const char* get_name() const override { return "Mainsail/Fluidd"; }
wxString get_test_ok_msg() const override;
wxString get_test_failed_msg(wxString& msg) const override;
};

class SL1Host : public PrusaLink
Expand Down

0 comments on commit f6da852

Please sign in to comment.