SLA only mode in wizard

Activates only if PrusaSlicer.ini does NOT contains any FFF printers.
Added only_default_printers() function to activate wizard if none printers are installed.
This commit is contained in:
David Kocik 2021-11-11 17:01:43 +01:00
parent e324643a04
commit 217bcfd37d
5 changed files with 62 additions and 30 deletions

View file

@ -1379,6 +1379,14 @@ const Preset* PrinterPresetCollection::find_system_preset_by_model_and_variant(c
return it != cend() ? &*it : nullptr;
}
bool PrinterPresetCollection::only_default_printers() const
{
for (const auto& printer : get_presets()) {
if (!boost::starts_with(printer.name,"- default"))
return false;
}
return true;
}
// -------------------------
// *** PhysicalPrinter ***
// -------------------------

View file

@ -597,6 +597,7 @@ public:
const Preset* find_system_preset_by_model_and_variant(const std::string &model_id, const std::string &variant) const;
bool only_default_printers() const;
private:
PrinterPresetCollection() = default;
PrinterPresetCollection(const PrinterPresetCollection &other) = default;

View file

@ -559,7 +559,9 @@ PagePrinters::PagePrinters(ConfigWizard *parent,
append(picker);
printer_pickers.push_back(picker);
has_printers = true;
}
}
void PagePrinters::select_all(bool select, bool alternates)
@ -599,7 +601,7 @@ std::set<std::string> PagePrinters::get_selected_models()
void PagePrinters::set_run_reason(ConfigWizard::RunReason run_reason)
{
if (technology == T_FFF
if (is_primary_printer_page
&& (run_reason == ConfigWizard::RR_DATA_EMPTY || run_reason == ConfigWizard::RR_DATA_LEGACY)
&& printer_pickers.size() > 0
&& printer_pickers[0]->vendor_id == PresetBundle::PRUSA_BUNDLE) {
@ -1904,25 +1906,28 @@ void ConfigWizard::priv::load_pages()
index->add_page(page_welcome);
// Printers
index->add_page(page_fff);
if (!only_sla_mode)
index->add_page(page_fff);
index->add_page(page_msla);
index->add_page(page_vendors);
for (const auto &pages : pages_3rdparty) {
for ( PagePrinters* page : { pages.second.first, pages.second.second })
if (page && page->install)
index->add_page(page);
}
index->add_page(page_custom);
if (page_custom->custom_wanted()) {
index->add_page(page_firmware);
index->add_page(page_bed);
index->add_page(page_diams);
index->add_page(page_temps);
}
if (!only_sla_mode) {
index->add_page(page_vendors);
for (const auto &pages : pages_3rdparty) {
for ( PagePrinters* page : { pages.second.first, pages.second.second })
if (page && page->install)
index->add_page(page);
}
index->add_page(page_custom);
if (page_custom->custom_wanted()) {
index->add_page(page_firmware);
index->add_page(page_bed);
index->add_page(page_diams);
index->add_page(page_temps);
}
// Filaments & Materials
if (any_fff_selected) { index->add_page(page_filaments); }
if (any_fff_selected) { index->add_page(page_filaments); }
}
if (any_sla_selected) { index->add_page(page_sla_materials); }
// there should to be selected at least one printer
@ -1956,7 +1961,7 @@ void ConfigWizard::priv::init_dialog_size()
9*disp_rect.width / 10,
9*disp_rect.height / 10);
const int width_hint = index->GetSize().GetWidth() + page_fff->get_width() + 30 * em(); // XXX: magic constant, I found no better solution
const int width_hint = index->GetSize().GetWidth() + std::max(90 * em(), (only_sla_mode ? page_msla->get_width() : page_fff->get_width()) + 30 * em()); // XXX: magic constant, I found no better solution
if (width_hint < window_rect.width) {
window_rect.x += (window_rect.width - width_hint) / 2;
window_rect.width = width_hint;
@ -2725,7 +2730,7 @@ bool ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese
preset_bundle->load_presets(*app_config, ForwardCompatibilitySubstitutionRule::EnableSilentDisableSystem,
{preferred_model, preferred_variant, first_added_filament, first_added_sla_material});
if (page_custom->custom_wanted()) {
if (!only_sla_mode && page_custom->custom_wanted()) {
// if unsaved changes was not cheched till this moment
if (!check_unsaved_preset_changes &&
!wxGetApp().check_and_keep_current_preset_changes(caption, _L("Custom printer was installed and it will be activated."), act_btns, &apply_keeped_changes))
@ -2838,25 +2843,38 @@ ConfigWizard::ConfigWizard(wxWindow *parent)
p->add_page(p->page_welcome = new PageWelcome(this));
p->page_fff = new PagePrinters(this, _L("Prusa FFF Technology Printers"), "Prusa FFF", *vendor_prusa, 0, T_FFF);
p->add_page(p->page_fff);
p->only_sla_mode = !p->page_fff->has_printers;
if (!p->only_sla_mode) {
p->add_page(p->page_fff);
p->page_fff->is_primary_printer_page = true;
}
p->page_msla = new PagePrinters(this, _L("Prusa MSLA Technology Printers"), "Prusa MSLA", *vendor_prusa, 0, T_SLA);
p->add_page(p->page_msla);
if (p->only_sla_mode) {
p->page_msla->is_primary_printer_page = true;
}
// Pages for 3rd party vendors
p->create_3rdparty_pages(); // Needs to be done _before_ creating PageVendors
p->add_page(p->page_vendors = new PageVendors(this));
p->add_page(p->page_custom = new PageCustom(this));
p->custom_printer_selected = p->page_custom->custom_wanted();
if (!p->only_sla_mode) {
// Pages for 3rd party vendors
p->create_3rdparty_pages(); // Needs to be done _before_ creating PageVendors
p->add_page(p->page_vendors = new PageVendors(this));
p->add_page(p->page_custom = new PageCustom(this));
p->custom_printer_selected = p->page_custom->custom_wanted();
}
p->any_sla_selected = p->check_sla_selected();
p->any_fff_selected = p->check_fff_selected();
if (p->only_sla_mode)
p->any_fff_selected = p->check_fff_selected();
p->update_materials(T_ANY);
if (!p->only_sla_mode)
p->add_page(p->page_filaments = new PageMaterials(this, &p->filaments,
_L("Filament Profiles Selection"), _L("Filaments"), _L("Type:") ));
p->add_page(p->page_filaments = new PageMaterials(this, &p->filaments,
_L("Filament Profiles Selection"), _L("Filaments"), _L("Type:") ));
p->add_page(p->page_sla_materials = new PageMaterials(this, &p->sla_materials,
_L("SLA Material Profiles Selection") + " ", _L("SLA Materials"), _L("Type:") ));

View file

@ -257,6 +257,9 @@ struct PagePrinters: ConfigWizardPage
std::string get_vendor_id() const { return printer_pickers.empty() ? "" : printer_pickers[0]->vendor_id; }
virtual void set_run_reason(ConfigWizard::RunReason run_reason) override;
bool has_printers { false };
bool is_primary_printer_page { false };
};
// Here we extend wxListBox and wxCheckListBox
@ -548,7 +551,9 @@ struct ConfigWizard::priv
std::unique_ptr<DynamicPrintConfig> custom_config; // Backing for custom printer definition
bool any_fff_selected; // Used to decide whether to display Filaments page
bool any_sla_selected; // Used to decide whether to display SLA Materials page
bool custom_printer_selected;
bool custom_printer_selected { false };
// Set to true if there are none FFF printers on the main FFF page. If true, only SLA printers are shown (not even custum printers)
bool only_sla_mode { false };
wxScrolledWindow *hscroll = nullptr;
wxBoxSizer *hscroll_sizer = nullptr;

View file

@ -2879,7 +2879,7 @@ void GUI_App::window_pos_sanitize(wxTopLevelWindow* window)
bool GUI_App::config_wizard_startup()
{
if (!m_app_conf_exists || preset_bundle->printers.size() <= 1) {
if (!m_app_conf_exists || preset_bundle->printers.only_default_printers()) {
run_wizard(ConfigWizard::RR_DATA_EMPTY);
return true;
} else if (get_app_config()->legacy_datadir()) {