mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 05:35:59 +08:00
ConfigWizard: Set enable conditions for "Finish" and "Select all standard" buttons
* Disable "Finish" button, when no one printer is selected or "Configuration Manager" page is active * Disable "Select all standard" button, when no one printer page is added or "Configuration Manager" page is active + Check and install missing materials after reload configurations from archive + Activate Vendor page, if no one printer is selected from loaded archive
This commit is contained in:
parent
4b7b5e4643
commit
7c315dc60d
@ -678,6 +678,9 @@ PageUpdateManager::PageUpdateManager(ConfigWizard* parent_in)
|
|||||||
is_active = true;
|
is_active = true;
|
||||||
else if (is_active && parent_in->IsShown()) {
|
else if (is_active && parent_in->IsShown()) {
|
||||||
if (manager->has_selections()) {
|
if (manager->has_selections()) {
|
||||||
|
if (wizard_p()->is_first_start)
|
||||||
|
wizard_p()->is_first_start = false;
|
||||||
|
|
||||||
wxBusyCursor wait;
|
wxBusyCursor wait;
|
||||||
if (manager->set_selected_repositories())
|
if (manager->set_selected_repositories())
|
||||||
wizard_p()->set_config_updated_from_archive(true);
|
wizard_p()->set_config_updated_from_archive(true);
|
||||||
@ -2619,13 +2622,12 @@ void ConfigWizard::priv::load_pages()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (former_active != page_update_manager)
|
if (former_active != page_update_manager) {
|
||||||
index->go_to(former_active); // Will restore the active item/page if possible
|
if (pages_fff.empty() && pages_msla.empty() && !repositories.empty())
|
||||||
|
index->go_to(repositories[0].vendors_page); // Activate Vendor page, if no one printer is selected
|
||||||
// set visibility for "Select all..."
|
else
|
||||||
btn_sel_all->Show(!pages_fff.empty() || !pages_msla.empty());
|
index->go_to(former_active); // Will restore the active item/page if possible
|
||||||
// Set enabling fo "Finish" button -> there should to be selected at least one printer
|
}
|
||||||
btn_finish->Enable(any_fff_selected || any_sla_selected || custom_printer_selected || custom_printer_in_bundle);
|
|
||||||
|
|
||||||
q->Layout();
|
q->Layout();
|
||||||
// This Refresh() is needed to avoid ugly artifacts after printer selection, when no one vendor was selected from the very beginnig
|
// This Refresh() is needed to avoid ugly artifacts after printer selection, when no one vendor was selected from the very beginnig
|
||||||
@ -3050,6 +3052,22 @@ void ConfigWizard::priv::on_3rdparty_install(const VendorProfile *vendor, bool i
|
|||||||
load_pages();
|
load_pages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ConfigWizard::priv::can_finish()
|
||||||
|
{
|
||||||
|
if (index->active_page() == page_update_manager)
|
||||||
|
return false;
|
||||||
|
// Set enabling fo "Finish" button -> there should to be selected at least one printer
|
||||||
|
return any_fff_selected || any_sla_selected || custom_printer_selected || custom_printer_in_bundle;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ConfigWizard::priv::can_select_all()
|
||||||
|
{
|
||||||
|
if (index->active_page() == page_update_manager)
|
||||||
|
return false;
|
||||||
|
// set enabling for "Select all..." -> there should to be exist at least one printer page
|
||||||
|
return !pages_fff.empty() || !pages_msla.empty();
|
||||||
|
}
|
||||||
|
|
||||||
bool ConfigWizard::priv::on_bnt_finish()
|
bool ConfigWizard::priv::on_bnt_finish()
|
||||||
{
|
{
|
||||||
wxBusyCursor wait;
|
wxBusyCursor wait;
|
||||||
@ -3746,6 +3764,10 @@ void ConfigWizard::priv::load_pages_from_archive()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (only_sla_mode && !repositories.empty()) {
|
||||||
|
only_sla_mode = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!only_sla_mode) {
|
if (!only_sla_mode) {
|
||||||
add_page(page_custom = new PageCustom(q));
|
add_page(page_custom = new PageCustom(q));
|
||||||
custom_printer_selected = page_custom->custom_wanted();
|
custom_printer_selected = page_custom->custom_wanted();
|
||||||
@ -3754,7 +3776,9 @@ void ConfigWizard::priv::load_pages_from_archive()
|
|||||||
any_sla_selected = check_sla_selected();
|
any_sla_selected = check_sla_selected();
|
||||||
any_fff_selected = !only_sla_mode && check_fff_selected();
|
any_fff_selected = !only_sla_mode && check_fff_selected();
|
||||||
|
|
||||||
|
check_and_install_missing_materials(T_ANY);
|
||||||
update_materials(T_ANY);
|
update_materials(T_ANY);
|
||||||
|
|
||||||
if (!page_filaments && !only_sla_mode) {
|
if (!page_filaments && !only_sla_mode) {
|
||||||
add_page(page_filaments = new PageMaterials(q, &filaments,
|
add_page(page_filaments = new PageMaterials(q, &filaments,
|
||||||
_L("Filament Profiles Selection"), _L("Filaments"), _L("Type:")));
|
_L("Filament Profiles Selection"), _L("Filaments"), _L("Type:")));
|
||||||
@ -3891,6 +3915,11 @@ ConfigWizard::ConfigWizard(wxWindow *parent)
|
|||||||
this->EndModal(wxID_OK);
|
this->EndModal(wxID_OK);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
p->btn_finish->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt)
|
||||||
|
{
|
||||||
|
evt.Enable(p->can_finish());
|
||||||
|
});
|
||||||
|
|
||||||
p->btn_sel_all->Bind(wxEVT_BUTTON, [this](const wxCommandEvent &) {
|
p->btn_sel_all->Bind(wxEVT_BUTTON, [this](const wxCommandEvent &) {
|
||||||
// p->any_sla_selected = true;
|
// p->any_sla_selected = true;
|
||||||
p->load_pages();
|
p->load_pages();
|
||||||
@ -3903,6 +3932,11 @@ ConfigWizard::ConfigWizard(wxWindow *parent)
|
|||||||
p->index->go_to(p->page_mode);
|
p->index->go_to(p->page_mode);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
p->btn_sel_all->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt)
|
||||||
|
{
|
||||||
|
evt.Enable(p->can_select_all());
|
||||||
|
});
|
||||||
|
|
||||||
p->index->Bind(EVT_INDEX_PAGE, [this](const wxCommandEvent &) {
|
p->index->Bind(EVT_INDEX_PAGE, [this](const wxCommandEvent &) {
|
||||||
const bool is_last = p->index->active_is_last();
|
const bool is_last = p->index->active_is_last();
|
||||||
p->btn_next->Show(! is_last || p->is_first_start);
|
p->btn_next->Show(! is_last || p->is_first_start);
|
||||||
|
@ -611,8 +611,8 @@ struct ConfigWizard::priv
|
|||||||
PresetAliases aliases_fff; // Map of alias to material presets
|
PresetAliases aliases_fff; // Map of alias to material presets
|
||||||
PresetAliases aliases_sla; // Map of alias to material presets
|
PresetAliases aliases_sla; // Map of alias to material presets
|
||||||
std::unique_ptr<DynamicPrintConfig> custom_config; // Backing for custom printer definition
|
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_fff_selected { false }; // Used to decide whether to display Filaments page
|
||||||
bool any_sla_selected; // Used to decide whether to display SLA Materials page
|
bool any_sla_selected { false }; // Used to decide whether to display SLA Materials page
|
||||||
bool custom_printer_selected { false }; // New custom printer is requested
|
bool custom_printer_selected { false }; // New custom printer is requested
|
||||||
bool custom_printer_in_bundle { false }; // Older custom printer already exists when wizard starts
|
bool custom_printer_in_bundle { false }; // Older custom printer already exists when wizard starts
|
||||||
// Set to true if there are none FFF printers on the main FFF page. If true, only SLA printers are shown (not even custom printers)
|
// Set to true if there are none FFF printers on the main FFF page. If true, only SLA printers are shown (not even custom printers)
|
||||||
@ -691,6 +691,8 @@ struct ConfigWizard::priv
|
|||||||
void select_default_materials_for_printer_models(Technology technology, const std::set<const VendorProfile::PrinterModel*> &printer_models);
|
void select_default_materials_for_printer_models(Technology technology, const std::set<const VendorProfile::PrinterModel*> &printer_models);
|
||||||
void on_3rdparty_install(const VendorProfile *vendor, bool install);
|
void on_3rdparty_install(const VendorProfile *vendor, bool install);
|
||||||
|
|
||||||
|
bool can_finish();
|
||||||
|
bool can_select_all();
|
||||||
bool on_bnt_finish();
|
bool on_bnt_finish();
|
||||||
bool check_and_install_missing_materials(Technology technology, const std::string &only_for_model_id = std::string());
|
bool check_and_install_missing_materials(Technology technology, const std::string &only_for_model_id = std::string());
|
||||||
bool apply_config(AppConfig *app_config, PresetBundle *preset_bundle, const PresetUpdater *updater, bool& apply_keeped_changes);
|
bool apply_config(AppConfig *app_config, PresetBundle *preset_bundle, const PresetUpdater *updater, bool& apply_keeped_changes);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user