mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-15 20:15:58 +08:00
check version: now working
also update some gui to display full version
This commit is contained in:
parent
657f6bbb14
commit
d726b33759
@ -24,7 +24,7 @@ namespace Slic3r {
|
|||||||
|
|
||||||
static const std::string VENDOR_PREFIX = "vendor:";
|
static const std::string VENDOR_PREFIX = "vendor:";
|
||||||
static const std::string MODEL_PREFIX = "model:";
|
static const std::string MODEL_PREFIX = "model:";
|
||||||
static const std::string VERSION_CHECK_URL = "https://files.prusa3d.com/wp-content/uploads/repository/PrusaSlicer-settings-master/live/PrusaSlicer.version";
|
static const std::string VERSION_CHECK_URL = "https://api.github.com/repos/supermerill/superslicer/releases";
|
||||||
|
|
||||||
const std::string AppConfig::SECTION_FILAMENTS = "filaments";
|
const std::string AppConfig::SECTION_FILAMENTS = "filaments";
|
||||||
const std::string AppConfig::SECTION_MATERIALS = "sla_materials";
|
const std::string AppConfig::SECTION_MATERIALS = "sla_materials";
|
||||||
@ -61,7 +61,7 @@ void AppConfig::set_defaults()
|
|||||||
set("freecad_path", ".");
|
set("freecad_path", ".");
|
||||||
|
|
||||||
if (get("version_check").empty())
|
if (get("version_check").empty())
|
||||||
set("version_check", "0");
|
set("version_check", "1");
|
||||||
if (get("preset_update").empty())
|
if (get("preset_update").empty())
|
||||||
set("preset_update", "0");
|
set("preset_update", "0");
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#define SLIC3R_APP_NAME "@SLIC3R_APP_NAME@"
|
#define SLIC3R_APP_NAME "@SLIC3R_APP_NAME@"
|
||||||
#define SLIC3R_APP_KEY "@SLIC3R_APP_KEY@"
|
#define SLIC3R_APP_KEY "@SLIC3R_APP_KEY@"
|
||||||
#define SLIC3R_VERSION "@SLIC3R_VERSION@"
|
#define SLIC3R_VERSION "@SLIC3R_VERSION@"
|
||||||
|
#define SLIC3R_VERSION_FULL "@SLIC3R_VERSION_FULL@"
|
||||||
#define SLIC3R_BUILD_ID "@SLIC3R_BUILD_ID@"
|
#define SLIC3R_BUILD_ID "@SLIC3R_BUILD_ID@"
|
||||||
|
|
||||||
#endif /* __SLIC3R_VERSION_H */
|
#endif /* __SLIC3R_VERSION_H */
|
||||||
|
@ -253,7 +253,7 @@ AboutDialog::AboutDialog()
|
|||||||
|
|
||||||
// version
|
// version
|
||||||
{
|
{
|
||||||
auto version_string = _L("Version")+ " " + std::string(SLIC3R_VERSION);
|
auto version_string = _L("Version")+ " " + std::string(SLIC3R_VERSION_FULL);
|
||||||
wxStaticText* version = new wxStaticText(this, wxID_ANY, version_string.c_str(), wxDefaultPosition, wxDefaultSize);
|
wxStaticText* version = new wxStaticText(this, wxID_ANY, version_string.c_str(), wxDefaultPosition, wxDefaultSize);
|
||||||
wxFont version_font = GetFont();
|
wxFont version_font = GetFont();
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
|
@ -244,7 +244,7 @@ private:
|
|||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
// dynamically get the version to display
|
// dynamically get the version to display
|
||||||
version = _L("Version") + " " + std::string(SLIC3R_VERSION);
|
version = _L("Version") + " " + std::string(SLIC3R_VERSION_FULL);
|
||||||
|
|
||||||
// credits infornation
|
// credits infornation
|
||||||
credits = title + " " + _L("is based on PrusaSlicer by Prusa and Slic3r by Alessandro Ranellucci and the RepRap community.") + "\n\n" +
|
credits = title + " " + _L("is based on PrusaSlicer by Prusa and Slic3r by Alessandro Ranellucci and the RepRap community.") + "\n\n" +
|
||||||
@ -806,7 +806,7 @@ bool GUI_App::on_init_inner()
|
|||||||
}
|
}
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
app_config->set("version", SLIC3R_VERSION);
|
app_config->set("version", SLIC3R_VERSION_FULL);
|
||||||
app_config->save();
|
app_config->save();
|
||||||
|
|
||||||
wxInitAllImageHandlers();
|
wxInitAllImageHandlers();
|
||||||
@ -846,19 +846,19 @@ bool GUI_App::on_init_inner()
|
|||||||
if (is_editor()) {
|
if (is_editor()) {
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
associate_3mf_files();
|
associate_3mf_files();
|
||||||
#endif // __WXMSW__
|
#endif // __WXMSW__
|
||||||
|
|
||||||
preset_updater = new PresetUpdater();
|
preset_updater = new PresetUpdater();
|
||||||
Bind(EVT_SLIC3R_VERSION_ONLINE, [this](const wxCommandEvent& evt) {
|
Bind(EVT_SLIC3R_VERSION_ONLINE, [this](const wxCommandEvent& evt) {
|
||||||
app_config->set("version_online", into_u8(evt.GetString()));
|
app_config->set("version_online", into_u8(evt.GetString()));
|
||||||
app_config->save();
|
app_config->save();
|
||||||
if (this->plater_ != nullptr) {
|
if (this->plater_ != nullptr) {
|
||||||
if (*Semver::parse(SLIC3R_VERSION) < *Semver::parse(into_u8(evt.GetString()))) {
|
//if (*Semver::parse(SLIC3R_VERSION_FULL) < *Semver::parse(into_u8(evt.GetString()))) {
|
||||||
this->plater_->get_notification_manager()->push_notification(NotificationType::NewAppAvailable, *(this->plater_->get_current_canvas3D()));
|
this->plater_->get_notification_manager()->push_notification(NotificationType::NewAppAvailable, *(this->plater_->get_current_canvas3D()));
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
#if ENABLE_GCODE_VIEWER
|
#if ENABLE_GCODE_VIEWER
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#include "GLCanvas3D.hpp"
|
#include "GLCanvas3D.hpp"
|
||||||
#include "ImGuiWrapper.hpp"
|
#include "ImGuiWrapper.hpp"
|
||||||
|
|
||||||
|
#include "libslic3r/AppConfig.hpp"
|
||||||
|
|
||||||
#include "wxExtensions.hpp"
|
#include "wxExtensions.hpp"
|
||||||
|
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
@ -626,7 +628,7 @@ bool NotificationManager::PopNotification::on_text_click()
|
|||||||
wxPostEvent(m_evt_handler, PresetUpdateAvailableClickedEvent(EVT_PRESET_UPDATE_AVAILABLE_CLICKED));
|
wxPostEvent(m_evt_handler, PresetUpdateAvailableClickedEvent(EVT_PRESET_UPDATE_AVAILABLE_CLICKED));
|
||||||
break;
|
break;
|
||||||
case NotificationType::NewAppAvailable:
|
case NotificationType::NewAppAvailable:
|
||||||
wxLaunchDefaultBrowser("https://github.com/prusa3d/PrusaSlicer/releases");
|
wxLaunchDefaultBrowser("https://github.com/supermerill/SuperSlicer/releases/tag/" + Slic3r::GUI::get_app_config()->get("version_online"));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -39,7 +39,7 @@ std::string get_main_info(bool format_as_html)
|
|||||||
#else
|
#else
|
||||||
out << b_start << SLIC3R_APP_NAME << b_end << line_end;
|
out << b_start << SLIC3R_APP_NAME << b_end << line_end;
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
out << b_start << "Version: " << b_end << SLIC3R_VERSION << line_end;
|
out << b_start << "Version: " << b_end << SLIC3R_VERSION_FULL << line_end;
|
||||||
#if ENABLE_GCODE_VIEWER
|
#if ENABLE_GCODE_VIEWER
|
||||||
out << b_start << "Build: " << b_end << (wxGetApp().is_editor() ? SLIC3R_BUILD_ID : GCODEVIEWER_BUILD_ID) << line_end;
|
out << b_start << "Build: " << b_end << (wxGetApp().is_editor() ? SLIC3R_BUILD_ID : GCODEVIEWER_BUILD_ID) << line_end;
|
||||||
#else
|
#else
|
||||||
|
@ -37,7 +37,7 @@ static const std::string CONFIG_UPDATE_WIKI_URL("https://github.com/prusa3d/Prus
|
|||||||
MsgUpdateSlic3r::MsgUpdateSlic3r(const Semver &ver_current, const Semver &ver_online)
|
MsgUpdateSlic3r::MsgUpdateSlic3r(const Semver &ver_current, const Semver &ver_online)
|
||||||
: MsgDialog(nullptr, _(L("Update available")), wxString::Format(_(L("New version of %s is available")), SLIC3R_APP_NAME))
|
: MsgDialog(nullptr, _(L("Update available")), wxString::Format(_(L("New version of %s is available")), SLIC3R_APP_NAME))
|
||||||
{
|
{
|
||||||
const bool dev_version = ver_online.prerelease() != nullptr;
|
const bool dev_version = true;// ver_online.prerelease() != nullptr; // SuperSlicer is always a dev version
|
||||||
|
|
||||||
auto *versions = new wxFlexGridSizer(2, 0, VERT_SPACING);
|
auto *versions = new wxFlexGridSizer(2, 0, VERT_SPACING);
|
||||||
versions->Add(new wxStaticText(this, wxID_ANY, _(L("Current version:"))));
|
versions->Add(new wxStaticText(this, wxID_ANY, _(L("Current version:"))));
|
||||||
@ -222,7 +222,7 @@ MsgDataIncompatible::MsgDataIncompatible(const std::unordered_map<std::string, w
|
|||||||
text->Wrap(CONTENT_WIDTH * wxGetApp().em_unit());
|
text->Wrap(CONTENT_WIDTH * wxGetApp().em_unit());
|
||||||
content_sizer->Add(text);
|
content_sizer->Add(text);
|
||||||
|
|
||||||
auto *text2 = new wxStaticText(this, wxID_ANY, wxString::Format(_(L("This %s version: %s")), SLIC3R_APP_NAME, SLIC3R_VERSION));
|
auto *text2 = new wxStaticText(this, wxID_ANY, wxString::Format(_(L("This %s version: %s")), SLIC3R_APP_NAME, SLIC3R_VERSION_FULL));
|
||||||
text2->Wrap(CONTENT_WIDTH * wxGetApp().em_unit());
|
text2->Wrap(CONTENT_WIDTH * wxGetApp().em_unit());
|
||||||
content_sizer->Add(text2);
|
content_sizer->Add(text2);
|
||||||
content_sizer->AddSpacer(VERT_SPACING);
|
content_sizer->AddSpacer(VERT_SPACING);
|
||||||
|
@ -246,7 +246,6 @@ void PresetUpdater::priv::sync_version() const
|
|||||||
BOOST_LOG_TRIVIAL(info) << format("Downloading %1% online version from: `%2%`", SLIC3R_APP_NAME, version_check_url);
|
BOOST_LOG_TRIVIAL(info) << format("Downloading %1% online version from: `%2%`", SLIC3R_APP_NAME, version_check_url);
|
||||||
|
|
||||||
Http::get(version_check_url)
|
Http::get(version_check_url)
|
||||||
.size_limit(SLIC3R_VERSION_BODY_MAX)
|
|
||||||
.on_progress([this](Http::Progress, bool &cancel) {
|
.on_progress([this](Http::Progress, bool &cancel) {
|
||||||
cancel = this->cancel;
|
cancel = this->cancel;
|
||||||
})
|
})
|
||||||
@ -258,21 +257,38 @@ void PresetUpdater::priv::sync_version() const
|
|||||||
error);
|
error);
|
||||||
})
|
})
|
||||||
.on_complete([&](std::string body, unsigned /* http_status */) {
|
.on_complete([&](std::string body, unsigned /* http_status */) {
|
||||||
boost::trim(body);
|
boost::property_tree::ptree root;
|
||||||
const auto nl_pos = body.find_first_of("\n\r");
|
std::stringstream json_stream(body);
|
||||||
if (nl_pos != std::string::npos) {
|
boost::property_tree::read_json(json_stream, root);
|
||||||
body.resize(nl_pos);
|
bool i_am_pre = false;
|
||||||
|
std::string best_pre = "1";
|
||||||
|
std::string best_release = "1";
|
||||||
|
std::string best_pre_url;
|
||||||
|
std::string best_release_url;
|
||||||
|
for (auto json_version : root) {
|
||||||
|
std::string tag = json_version.second.get<std::string>("tag_name");
|
||||||
|
if (SLIC3R_VERSION_FULL == tag)
|
||||||
|
i_am_pre = json_version.second.get<bool>("prerelease");
|
||||||
|
if (json_version.second.get<bool>("prerelease")) {
|
||||||
|
if (best_pre < tag) {
|
||||||
|
best_pre = tag;
|
||||||
|
best_pre_url = json_version.second.get<std::string>("html_url");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (best_release < tag) {
|
||||||
|
best_release = tag;
|
||||||
|
best_release_url = json_version.second.get<std::string>("html_url");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! Semver::parse(body)) {
|
if ((i_am_pre ? best_pre : best_release) <= SLIC3R_VERSION_FULL)
|
||||||
BOOST_LOG_TRIVIAL(warning) << format("Received invalid contents from `%1%`: Not a correct semver: `%2%`", SLIC3R_APP_NAME, body);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(info) << format("Got %1% online version: `%2%`. Sending to GUI thread...", SLIC3R_APP_NAME, body);
|
BOOST_LOG_TRIVIAL(info) << format("Got %1% online version: `%2%`. Sending to GUI thread...", SLIC3R_APP_NAME, i_am_pre? best_pre:best_release);
|
||||||
|
|
||||||
wxCommandEvent* evt = new wxCommandEvent(EVT_SLIC3R_VERSION_ONLINE);
|
wxCommandEvent* evt = new wxCommandEvent(EVT_SLIC3R_VERSION_ONLINE);
|
||||||
evt->SetString(GUI::from_u8(body));
|
evt->SetString(i_am_pre ? best_pre : best_release);
|
||||||
GUI::wxGetApp().QueueEvent(evt);
|
GUI::wxGetApp().QueueEvent(evt);
|
||||||
})
|
})
|
||||||
.perform_sync();
|
.perform_sync();
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
set(SLIC3R_APP_NAME "SuperSlicer")
|
set(SLIC3R_APP_NAME "SuperSlicer")
|
||||||
set(SLIC3R_APP_KEY "SuperSlicer")
|
set(SLIC3R_APP_KEY "SuperSlicer")
|
||||||
set(SLIC3R_VERSION "2.3.55")
|
set(SLIC3R_VERSION "2.3.55")
|
||||||
set(SLIC3R_BUILD_ID "SuperSlicer_${SLIC3R_RC_VERSION}")
|
set(SLIC3R_VERSION_FULL "2.3.55.1")
|
||||||
|
set(SLIC3R_BUILD_ID "SuperSlicer_${SLIC3R_VERSION_FULL}")
|
||||||
set(SLIC3R_RC_VERSION "2,3,55,1")
|
set(SLIC3R_RC_VERSION "2,3,55,1")
|
||||||
set(SLIC3R_RC_VERSION_DOTS "2.3.55.1")
|
set(SLIC3R_RC_VERSION_DOTS "${SLIC3R_VERSION_FULL}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user