mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-01 04:02:02 +08:00
ConfigWizard: Added "Configuration Manager" page
This commit is contained in:
parent
12395e2173
commit
10638751af
@ -65,6 +65,9 @@
|
|||||||
#include "format.hpp"
|
#include "format.hpp"
|
||||||
#include "MsgDialog.hpp"
|
#include "MsgDialog.hpp"
|
||||||
#include "UnsavedChangesDialog.hpp"
|
#include "UnsavedChangesDialog.hpp"
|
||||||
|
#include "UpdatesUIManager.hpp"
|
||||||
|
#include "PresetArchiveDatabase.hpp"
|
||||||
|
#include "Plater.hpp" // #ysFIXME - implement getter for preset_archive_database from GetApp()???
|
||||||
#include "slic3r/Utils/AppUpdater.hpp"
|
#include "slic3r/Utils/AppUpdater.hpp"
|
||||||
#include "slic3r/GUI/I18N.hpp"
|
#include "slic3r/GUI/I18N.hpp"
|
||||||
#include "slic3r/Config/Version.hpp"
|
#include "slic3r/Config/Version.hpp"
|
||||||
@ -606,6 +609,29 @@ void PageWelcome::set_run_reason(ConfigWizard::RunReason run_reason)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PageUpdateManager::PageUpdateManager(ConfigWizard* parent)
|
||||||
|
: ConfigWizardPage(parent, _L("Manage Configuration Updates"), _L("Configuration Manager"))
|
||||||
|
{
|
||||||
|
this->SetFont(wxGetApp().normal_font());
|
||||||
|
|
||||||
|
const int em = em_unit(this);
|
||||||
|
|
||||||
|
m_manager = std::make_unique<UIManager>(this, wxGetApp().plater()->get_preset_archive_database(), em);
|
||||||
|
|
||||||
|
auto sizer = m_manager->get_sizer();
|
||||||
|
|
||||||
|
ScalableButton* btn = new ScalableButton(this, wxID_ANY, "", " " + _L("Confirm configuration update") + " ");
|
||||||
|
btn->SetFont(wxGetApp().bold_font());
|
||||||
|
wxGetApp().UpdateDarkUI(btn, true);
|
||||||
|
btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event) {
|
||||||
|
m_manager->set_used_archives();
|
||||||
|
wizard_p()->set_config_updated_from_archive(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
sizer->Add(btn, 0, wxALIGN_CENTER_HORIZONTAL | wxBOTTOM, em);
|
||||||
|
|
||||||
|
append(sizer, 0, wxTOP, 2 * em);
|
||||||
|
}
|
||||||
|
|
||||||
PagePrinters::PagePrinters(ConfigWizard *parent,
|
PagePrinters::PagePrinters(ConfigWizard *parent,
|
||||||
wxString title,
|
wxString title,
|
||||||
@ -2392,6 +2418,11 @@ void ConfigWizard::priv::load_pages()
|
|||||||
|
|
||||||
index->add_page(page_welcome);
|
index->add_page(page_welcome);
|
||||||
|
|
||||||
|
if (!m_is_config_updated_from_archive) {
|
||||||
|
index->add_page(page_update_manager);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
// Printers
|
// Printers
|
||||||
if (!only_sla_mode)
|
if (!only_sla_mode)
|
||||||
index->add_page(page_fff);
|
index->add_page(page_fff);
|
||||||
@ -2448,7 +2479,16 @@ void ConfigWizard::priv::load_pages()
|
|||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
index->add_page(page_mode);
|
index->add_page(page_mode);
|
||||||
|
|
||||||
index->go_to(former_active); // Will restore the active item/page if possible
|
}
|
||||||
|
|
||||||
|
if (m_is_config_updated_from_archive && former_active == page_update_manager)
|
||||||
|
index->go_to(1);// next page after Welcome
|
||||||
|
else
|
||||||
|
index->go_to(former_active); // Will restore the active item/page if possible
|
||||||
|
|
||||||
|
// set visibility for "Select all..." and "Finish" buttons
|
||||||
|
btn_sel_all->Show(m_is_config_updated_from_archive);
|
||||||
|
btn_finish ->Show(m_is_config_updated_from_archive);
|
||||||
|
|
||||||
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
|
||||||
@ -3333,6 +3373,12 @@ bool ConfigWizard::priv::check_sla_selected()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConfigWizard::priv::set_config_updated_from_archive(bool is_updated)
|
||||||
|
{
|
||||||
|
m_is_config_updated_from_archive = is_updated;
|
||||||
|
load_pages();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Public
|
// Public
|
||||||
|
|
||||||
@ -3399,7 +3445,7 @@ ConfigWizard::ConfigWizard(wxWindow *parent)
|
|||||||
const VendorProfile *vendor_prusa = prusa_it->second.vendor_profile;
|
const VendorProfile *vendor_prusa = prusa_it->second.vendor_profile;
|
||||||
|
|
||||||
p->add_page(p->page_welcome = new PageWelcome(this));
|
p->add_page(p->page_welcome = new PageWelcome(this));
|
||||||
|
p->add_page(p->page_update_manager = new PageUpdateManager(this));
|
||||||
|
|
||||||
p->page_fff = new PagePrinters(this, _L("Prusa FFF Technology Printers"), "Prusa FFF", *vendor_prusa, 0, T_FFF);
|
p->page_fff = new PagePrinters(this, _L("Prusa FFF Technology Printers"), "Prusa FFF", *vendor_prusa, 0, T_FFF);
|
||||||
p->only_sla_mode = !p->page_fff->has_printers;
|
p->only_sla_mode = !p->page_fff->has_printers;
|
||||||
|
@ -97,7 +97,7 @@ struct BundleMap : std::map<std::string /* = vendor ID */, Bundle>
|
|||||||
|
|
||||||
struct Materials;
|
struct Materials;
|
||||||
|
|
||||||
|
class UIManager;
|
||||||
|
|
||||||
struct PrinterPickerEvent;
|
struct PrinterPickerEvent;
|
||||||
|
|
||||||
@ -183,6 +183,13 @@ struct PageWelcome: ConfigWizardPage
|
|||||||
virtual void set_run_reason(ConfigWizard::RunReason run_reason) override;
|
virtual void set_run_reason(ConfigWizard::RunReason run_reason) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct PageUpdateManager : ConfigWizardPage
|
||||||
|
{
|
||||||
|
std::unique_ptr<UIManager> m_manager;
|
||||||
|
|
||||||
|
PageUpdateManager(ConfigWizard* parent);
|
||||||
|
};
|
||||||
|
|
||||||
struct PagePrinters: ConfigWizardPage
|
struct PagePrinters: ConfigWizardPage
|
||||||
{
|
{
|
||||||
std::vector<PrinterPicker *> printer_pickers;
|
std::vector<PrinterPicker *> printer_pickers;
|
||||||
@ -617,6 +624,7 @@ struct ConfigWizard::priv
|
|||||||
wxButton *btn_cancel = nullptr;
|
wxButton *btn_cancel = nullptr;
|
||||||
|
|
||||||
PageWelcome *page_welcome = nullptr;
|
PageWelcome *page_welcome = nullptr;
|
||||||
|
PageUpdateManager*page_update_manager = nullptr;
|
||||||
PagePrinters *page_fff = nullptr;
|
PagePrinters *page_fff = nullptr;
|
||||||
PagePrinters *page_msla = nullptr;
|
PagePrinters *page_msla = nullptr;
|
||||||
PageMaterials *page_filaments = nullptr;
|
PageMaterials *page_filaments = nullptr;
|
||||||
@ -639,6 +647,8 @@ struct ConfigWizard::priv
|
|||||||
PageTemperatures *page_temps = nullptr;
|
PageTemperatures *page_temps = nullptr;
|
||||||
PageBuildVolume* page_bvolume = nullptr;
|
PageBuildVolume* page_bvolume = nullptr;
|
||||||
|
|
||||||
|
bool m_is_config_updated_from_archive{ false };
|
||||||
|
|
||||||
// Pointers to all pages (regardless or whether currently part of the ConfigWizardIndex)
|
// Pointers to all pages (regardless or whether currently part of the ConfigWizardIndex)
|
||||||
std::vector<ConfigWizardPage*> all_pages;
|
std::vector<ConfigWizardPage*> all_pages;
|
||||||
|
|
||||||
@ -678,6 +688,7 @@ struct ConfigWizard::priv
|
|||||||
bool check_sla_selected(); // Used to decide whether to display SLA Materials page
|
bool check_sla_selected(); // Used to decide whether to display SLA Materials page
|
||||||
|
|
||||||
int em() const { return index->em(); }
|
int em() const { return index->em(); }
|
||||||
|
void set_config_updated_from_archive(bool is_updated);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user