ConfigWizard & updating: Fixes & cleanups
This commit is contained in:
parent
b506aa11fa
commit
6286c9ee7c
@ -1,7 +1,6 @@
|
|||||||
# This is an example configuration version index.
|
# This is an example configuration version index.
|
||||||
# The index contains version numbers
|
# The index contains version numbers
|
||||||
min_slic3r_version =1.39.0
|
min_slic3r_version =1.39.0
|
||||||
max_slic3r_version= 1.39.5
|
|
||||||
1.1.1
|
1.1.1
|
||||||
1.1.0
|
1.1.0
|
||||||
0.2.0-alpha "some test comment"
|
0.2.0-alpha "some test comment"
|
||||||
|
@ -203,7 +203,7 @@ void ConfigWizardPage::enable_next(bool enable) { parent->p->enable_next(enable)
|
|||||||
// Wizard pages
|
// Wizard pages
|
||||||
|
|
||||||
PageWelcome::PageWelcome(ConfigWizard *parent) :
|
PageWelcome::PageWelcome(ConfigWizard *parent) :
|
||||||
ConfigWizardPage(parent, _(L("Welcome to the Slic3r Configuration assistant")), _(L("Welcome"))),
|
ConfigWizardPage(parent, wxString::Format(_(L("Welcome to the Slic3r %s")), ConfigWizard::name()), _(L("Welcome"))),
|
||||||
printer_picker(nullptr),
|
printer_picker(nullptr),
|
||||||
others_buttons(new wxPanel(parent))
|
others_buttons(new wxPanel(parent))
|
||||||
{
|
{
|
||||||
@ -257,16 +257,26 @@ PageUpdate::PageUpdate(ConfigWizard *parent) :
|
|||||||
preset_update(true)
|
preset_update(true)
|
||||||
{
|
{
|
||||||
const AppConfig *app_config = GUI::get_app_config();
|
const AppConfig *app_config = GUI::get_app_config();
|
||||||
|
auto boldfont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
|
||||||
|
boldfont.SetWeight(wxFONTWEIGHT_BOLD);
|
||||||
|
|
||||||
append_text(_(L("TODO: text")));
|
auto *box_slic3r = new wxCheckBox(this, wxID_ANY, _(L("Check for application updates")));
|
||||||
auto *box_slic3r = new wxCheckBox(this, wxID_ANY, _(L("Check for Slic3r updates")));
|
|
||||||
box_slic3r->SetValue(app_config->get("version_check") == "1");
|
box_slic3r->SetValue(app_config->get("version_check") == "1");
|
||||||
append(box_slic3r);
|
append(box_slic3r);
|
||||||
|
append_text(_(L("If enabled, Slic3r checks for new versions of Slic3r PE online. When a new version becomes available a notification is displayed at the next application startup (never during program usage). This is only a notification mechanisms, no automatic installation is done.")));
|
||||||
|
|
||||||
|
append_spacer(VERTICAL_SPACING);
|
||||||
|
|
||||||
append_text(_(L("TODO: text")));
|
|
||||||
auto *box_presets = new wxCheckBox(this, wxID_ANY, _(L("Update built-in Presets automatically")));
|
auto *box_presets = new wxCheckBox(this, wxID_ANY, _(L("Update built-in Presets automatically")));
|
||||||
box_presets->SetValue(app_config->get("preset_update") == "1");
|
box_presets->SetValue(app_config->get("preset_update") == "1");
|
||||||
append(box_presets);
|
append(box_presets);
|
||||||
|
append_text(_(L("If enabled, Slic3r downloads updates of built-in system presets in the background. These updates are downloaded into a separate temporary location. When a new preset version becomes available it is offered at application startup.")));
|
||||||
|
const auto text_bold = _(L("Updates are never applied without user's consent and never overwrite user's customized settings."));
|
||||||
|
auto *label_bold = new wxStaticText(this, wxID_ANY, text_bold);
|
||||||
|
label_bold->SetFont(boldfont);
|
||||||
|
label_bold->Wrap(CONTENT_WIDTH);
|
||||||
|
append(label_bold);
|
||||||
|
append_text(_(L("Additionally a backup snapshot of the whole configuration is created before an update is applied.")));
|
||||||
|
|
||||||
box_slic3r->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent &event) { this->version_check = event.IsChecked(); });
|
box_slic3r->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent &event) { this->version_check = event.IsChecked(); });
|
||||||
box_presets->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent &event) { this->preset_update = event.IsChecked(); });
|
box_presets->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent &event) { this->preset_update = event.IsChecked(); });
|
||||||
@ -277,15 +287,12 @@ PageVendors::PageVendors(ConfigWizard *parent) :
|
|||||||
{
|
{
|
||||||
append_text(_(L("Pick another vendor supported by Slic3r PE:")));
|
append_text(_(L("Pick another vendor supported by Slic3r PE:")));
|
||||||
|
|
||||||
// const PresetBundle &bundle = wizard_p()->bundle_vendors;
|
|
||||||
// const auto &vendors = wizard_p()->vendors;
|
|
||||||
auto boldfont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
|
auto boldfont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
|
||||||
boldfont.SetWeight(wxFONTWEIGHT_BOLD);
|
boldfont.SetWeight(wxFONTWEIGHT_BOLD);
|
||||||
|
|
||||||
AppConfig &appconfig_vendors = this->wizard_p()->appconfig_vendors;
|
AppConfig &appconfig_vendors = this->wizard_p()->appconfig_vendors;
|
||||||
wxArrayString choices_vendors;
|
wxArrayString choices_vendors;
|
||||||
|
|
||||||
// for (const auto &vendor : vendors) {
|
|
||||||
for (const auto vendor_pair : wizard_p()->vendors) {
|
for (const auto vendor_pair : wizard_p()->vendors) {
|
||||||
const auto &vendor = vendor_pair.second;
|
const auto &vendor = vendor_pair.second;
|
||||||
if (vendor.id == "PrusaResearch") { continue; }
|
if (vendor.id == "PrusaResearch") { continue; }
|
||||||
@ -737,7 +744,7 @@ void ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese
|
|||||||
// Public
|
// Public
|
||||||
|
|
||||||
ConfigWizard::ConfigWizard(wxWindow *parent, bool fresh_start) :
|
ConfigWizard::ConfigWizard(wxWindow *parent, bool fresh_start) :
|
||||||
wxDialog(parent, wxID_ANY, _(L("Configuration Assistant")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
|
wxDialog(parent, wxID_ANY, name(), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
|
||||||
p(new priv(this))
|
p(new priv(this))
|
||||||
{
|
{
|
||||||
p->fresh_start = fresh_start;
|
p->fresh_start = fresh_start;
|
||||||
@ -804,5 +811,16 @@ void ConfigWizard::run(PresetBundle *preset_bundle, PresetUpdater *updater)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const wxString& ConfigWizard::name()
|
||||||
|
{
|
||||||
|
// A different naming convention is used for the Wizard on Windows vs. OSX & GTK.
|
||||||
|
#if WIN32
|
||||||
|
static const wxString config_wizard_name = _(L("Configuration Wizard"));
|
||||||
|
#else
|
||||||
|
static const wxString config_wizard_name = _(L("Configuration Assistant"));
|
||||||
|
#endif
|
||||||
|
return config_wizard_name;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,8 @@ public:
|
|||||||
~ConfigWizard();
|
~ConfigWizard();
|
||||||
|
|
||||||
void run(PresetBundle *preset_bundle, PresetUpdater *updater);
|
void run(PresetBundle *preset_bundle, PresetUpdater *updater);
|
||||||
|
|
||||||
|
static const wxString& name();
|
||||||
private:
|
private:
|
||||||
struct priv;
|
struct priv;
|
||||||
std::unique_ptr<priv> p;
|
std::unique_ptr<priv> p;
|
||||||
|
@ -377,16 +377,9 @@ void add_config_menu(wxMenuBar *menu, int event_preferences_changed, int event_l
|
|||||||
auto local_menu = new wxMenu();
|
auto local_menu = new wxMenu();
|
||||||
wxWindowID config_id_base = wxWindow::NewControlId((int)ConfigMenuCnt);
|
wxWindowID config_id_base = wxWindow::NewControlId((int)ConfigMenuCnt);
|
||||||
|
|
||||||
// A different naming convention is used for the Wizard on Windows vs. OSX & GTK.
|
const auto config_wizard_tooltip = wxString::Format(_(L("Run %s")), ConfigWizard::name());
|
||||||
#if WIN32
|
|
||||||
auto config_wizard_menu = _(L("Configuration Wizard"));
|
|
||||||
auto config_wizard_tooltip = _(L("Run configuration wizard"));
|
|
||||||
#else
|
|
||||||
auto config_wizard_menu = _(L("Configuration Assistant"));
|
|
||||||
auto config_wizard_tooltip = _(L("Run configuration Assistant"));
|
|
||||||
#endif
|
|
||||||
// Cmd+, is standard on OS X - what about other operating systems?
|
// Cmd+, is standard on OS X - what about other operating systems?
|
||||||
local_menu->Append(config_id_base + ConfigMenuWizard, config_wizard_menu + "\u2026", config_wizard_tooltip);
|
local_menu->Append(config_id_base + ConfigMenuWizard, ConfigWizard::name() + "\u2026", config_wizard_tooltip);
|
||||||
local_menu->Append(config_id_base + ConfigMenuSnapshots, _(L("Configuration Snapshots\u2026")), _(L("Inspect / activate configuration snapshots")));
|
local_menu->Append(config_id_base + ConfigMenuSnapshots, _(L("Configuration Snapshots\u2026")), _(L("Inspect / activate configuration snapshots")));
|
||||||
local_menu->Append(config_id_base + ConfigMenuTakeSnapshot, _(L("Take Configuration Snapshot")), _(L("Capture a configuration snapshot")));
|
local_menu->Append(config_id_base + ConfigMenuTakeSnapshot, _(L("Take Configuration Snapshot")), _(L("Capture a configuration snapshot")));
|
||||||
local_menu->Append(config_id_base + ConfigMenuUpdate, _(L("Check for updates")), _(L("Check for configuration updates")));
|
local_menu->Append(config_id_base + ConfigMenuUpdate, _(L("Check for updates")), _(L("Check for configuration updates")));
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/filesystem/fstream.hpp>
|
#include <boost/filesystem/fstream.hpp>
|
||||||
|
#include <boost/log/trivial.hpp>
|
||||||
|
|
||||||
#include <wx/app.h>
|
#include <wx/app.h>
|
||||||
#include <wx/event.h>
|
#include <wx/event.h>
|
||||||
@ -114,8 +115,6 @@ bool PresetUpdater::priv::get_file(const std::string &url, const fs::path &targe
|
|||||||
{
|
{
|
||||||
std::cerr << "get_file(): " << url << " -> " << target_path << std::endl;
|
std::cerr << "get_file(): " << url << " -> " << target_path << std::endl;
|
||||||
|
|
||||||
// TODO: Proper caching
|
|
||||||
|
|
||||||
bool res = false;
|
bool res = false;
|
||||||
fs::path tmp_path = target_path;
|
fs::path tmp_path = target_path;
|
||||||
tmp_path += TMP_EXTENSION;
|
tmp_path += TMP_EXTENSION;
|
||||||
@ -251,7 +250,8 @@ Updates PresetUpdater::priv::config_update() const
|
|||||||
|
|
||||||
const auto ver_current = idx.find(vp.config_version);
|
const auto ver_current = idx.find(vp.config_version);
|
||||||
if (ver_current == idx.end()) {
|
if (ver_current == idx.end()) {
|
||||||
// TODO: throw / ignore ?
|
BOOST_LOG_TRIVIAL(warning) << boost::format("Preset bundle (`%1%`) version not found in index: %2%") % idx.vendor() % vp.config_version.to_string();
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto recommended = idx.recommended();
|
const auto recommended = idx.recommended();
|
||||||
|
Loading…
Reference in New Issue
Block a user