ConfigWizard: Other vendor sample data, minor fixes

This commit is contained in:
Vojtech Kral 2018-04-06 12:15:28 +02:00
parent d1c1dcbe8f
commit 9dcec6662e
13 changed files with 1990 additions and 25 deletions

View file

@ -135,8 +135,6 @@ void AppConfig::save()
bool AppConfig::get_variant(const std::string &vendor, const std::string &model, const std::string &variant) const
{
// std::cerr << "AppConfig::get_variant(" << vendor << ", " << model << ", " << variant << ") " << std::endl;
const auto it_v = m_vendors.find(vendor);
if (it_v == m_vendors.end()) { return false; }
const auto it_m = it_v->second.find(model);

View file

@ -68,9 +68,9 @@ public:
void clear_section(const std::string &section)
{ m_storage[section].clear(); }
bool get_variant(const std::string &vendor, const std::string &model, const std::string &variant) const;
void set_variant(const std::string &vendor, const std::string &model, const std::string &variant, bool enable);
void set_vendors(const AppConfig &from);
bool get_variant(const std::string &vendor, const std::string &model, const std::string &variant) const;
void set_variant(const std::string &vendor, const std::string &model, const std::string &variant, bool enable);
void set_vendors(const AppConfig &from);
// return recent/skein_directory or recent/config_directory or empty string.
std::string get_last_dir() const;
@ -86,8 +86,8 @@ public:
void reset_selections();
// Whether the Slic3r version available online differs from this one
bool version_check_enabled() const;
bool slic3r_update_avail() const;
bool version_check_enabled() const;
bool slic3r_update_avail() const;
// Get the default config path from Slic3r::data_dir().
static std::string config_path();

View file

@ -1,6 +1,5 @@
#include "ConfigWizard_private.hpp"
#include <iostream> // XXX
#include <algorithm>
#include <utility>
#include <boost/filesystem.hpp>
@ -23,9 +22,6 @@ namespace Slic3r {
namespace GUI {
// FIXME: scrolling
// Printer model picker GUI control
struct PrinterPickerEvent : public wxEvent
@ -296,7 +292,7 @@ void PageVendors::on_vendor_pick(size_t i)
for (PrinterPicker *picker : pickers) { picker->Hide(); }
if (i < pickers.size()) {
pickers[i]->Show();
Layout();
wizard_p()->layout_fit();
}
}
@ -352,7 +348,7 @@ PageBedShape::PageBedShape(ConfigWizard *parent) :
{
append_text(_(L("Set the shape of your printer's bed.")));
shape_panel->build_panel(wizard_p()->custom_config.option<ConfigOptionPoints>("bed_shape"));
shape_panel->build_panel(wizard_p()->custom_config->option<ConfigOptionPoints>("bed_shape"));
append(shape_panel);
}
@ -583,7 +579,13 @@ void ConfigWizard::priv::set_page(ConfigWizardPage *page)
btn_next->Show(page->page_next() != nullptr);
btn_finish->Show(page->page_next() == nullptr);
layout_fit();
}
void ConfigWizard::priv::layout_fit()
{
q->Layout();
q->Fit();
}
void ConfigWizard::priv::enable_next(bool enable)
@ -619,9 +621,9 @@ void ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese
preset_bundle->load_presets(*app_config);
} else {
for (ConfigWizardPage *page = page_firmware; page != nullptr; page = page->page_next()) {
page->apply_custom_config(custom_config);
page->apply_custom_config(*custom_config);
}
preset_bundle->load_config("My Settings", custom_config);
preset_bundle->load_config("My Settings", *custom_config);
}
}
@ -632,10 +634,9 @@ ConfigWizard::ConfigWizard(wxWindow *parent) :
p(new priv(this))
{
p->load_vendors();
std::unique_ptr<DynamicPrintConfig> custom_config_defaults(DynamicPrintConfig::new_from_defaults_keys({
p->custom_config.reset(DynamicPrintConfig::new_from_defaults_keys({
"gcode_flavor", "bed_shape", "nozzle_diameter", "filament_diameter", "temperature", "bed_temperature",
}));
p->custom_config.apply(*custom_config_defaults);
p->index = new ConfigWizardIndex(this);

View file

@ -22,6 +22,8 @@ namespace GUI {
enum {
CONTENT_WIDTH = 500,
DIALOG_MARGIN = 15,
INDEX_MARGIN = 40,
BTN_SPACING = 10,
@ -38,10 +40,6 @@ struct PrinterPicker: wxPanel
struct ConfigWizardPage: wxPanel
{
enum {
CONTENT_WIDTH = 500,
};
ConfigWizard *parent;
const wxString shortname;
wxBoxSizer *content;
@ -171,7 +169,7 @@ struct ConfigWizard::priv
ConfigWizard *q;
AppConfig appconfig_vendors;
PresetBundle bundle_vendors;
DynamicPrintConfig custom_config;
std::unique_ptr<DynamicPrintConfig> custom_config;
wxBoxSizer *topsizer = nullptr;
wxBoxSizer *btnsizer = nullptr;
@ -196,6 +194,7 @@ struct ConfigWizard::priv
void add_page(ConfigWizardPage *page);
void index_refresh();
void set_page(ConfigWizardPage *page);
void layout_fit();
void go_prev() { if (page_current != nullptr) { set_page(page_current->page_prev()); } }
void go_next() { if (page_current != nullptr) { set_page(page_current->page_next()); } }
void enable_next(bool enable);

View file

@ -235,9 +235,6 @@ PresetHints* O_OBJECT_SLIC3R
Ref<PresetHints> O_OBJECT_SLIC3R_T
TabIface* O_OBJECT_SLIC3R
Ref<TabIface> O_OBJECT_SLIC3R_T
# TODO: remove:
# ConfigWizard* O_OBJECT_SLIC3R
# Ref<ConfigWizard> O_OBJECT_SLIC3R_T
PresetUpdater* O_OBJECT_SLIC3R
Ref<PresetUpdater> O_OBJECT_SLIC3R_T