mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 06:05:53 +08:00
ConfigWizard: Update of "Configuration sources" page, when user is logged from "Login" page
+ Fixed some conflicts after "Login" page implementation
This commit is contained in:
parent
68003fa119
commit
4b352d8ff6
@ -678,7 +678,7 @@ PageUpdateManager::PageUpdateManager(ConfigWizard* parent_in)
|
||||
|
||||
auto revert_page_selection = [this]() -> void {
|
||||
CallAfter([this]() {
|
||||
wizard_p()->index->go_to(1);
|
||||
wizard_p()->index->go_to(this);
|
||||
if (!this->IsShown())
|
||||
this->Show();
|
||||
});
|
||||
@ -2774,7 +2774,7 @@ void ConfigWizard::priv::load_vendors()
|
||||
|
||||
void ConfigWizard::priv::add_page(ConfigWizardPage *page)
|
||||
{
|
||||
const int proportion = (page->shortname == _L("Filaments")) || (page->shortname == _L("SLA Materials") || page->shortname == _L("Log in")) ? 1 : 0;
|
||||
const int proportion = (page == page_login || page == page_filaments || page == page_sla_materials);
|
||||
hscroll_sizer->Add(page, proportion, wxEXPAND);
|
||||
all_pages.push_back(page);
|
||||
}
|
||||
@ -4036,8 +4036,9 @@ ConfigWizard::ConfigWizard(wxWindow *parent)
|
||||
// In that case don't leave the page and the function above queried the user whether to install default materials.
|
||||
return;
|
||||
if (active_page == p->page_update_manager && p->index->active_is_last()) {
|
||||
size_t next_active = p->index->pages_cnt();
|
||||
p->page_update_manager->Hide();
|
||||
p->index->go_to(2);
|
||||
p->index->go_to(next_active);
|
||||
return;
|
||||
}
|
||||
this->p->index->go_next();
|
||||
@ -4137,12 +4138,11 @@ bool ConfigWizard::run(RunReason reason, StartPage start_page)
|
||||
|
||||
void ConfigWizard::update_login()
|
||||
{
|
||||
if(!p->page_login) {
|
||||
return;
|
||||
}
|
||||
if (p->page_login->login_changed()) {
|
||||
if (p->page_login && p->page_login->login_changed()) {
|
||||
// repos changed - we need rebuild
|
||||
p->set_config_updated_from_archive(p->is_config_from_archive, true);
|
||||
wxGetApp().plater()->get_preset_archive_database()->sync_blocking();
|
||||
// now change PageUpdateManager
|
||||
p->page_update_manager->manager->update();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ wxDEFINE_EVENT(EVT_LOGIN_VIA_WIZARD, Event<std::string>);
|
||||
|
||||
ConfigWizardWebViewPage::ConfigWizardWebViewPage(ConfigWizard *parent)
|
||||
// TRN Config wizard page headline.
|
||||
: ConfigWizardPage(parent, _L("Log into the Prusa Account"), _L("Log in"))
|
||||
: ConfigWizardPage(parent, _L("Log into the Prusa Account (optional)"), _L("Log in (optional)"))
|
||||
{
|
||||
p_user_account = wxGetApp().plater()->get_user_account();
|
||||
assert(p_user_account);
|
||||
@ -37,12 +37,8 @@ ConfigWizardWebViewPage::ConfigWizardWebViewPage(ConfigWizard *parent)
|
||||
// TRN Config wizard page with a log in web. first line of text.
|
||||
m_text = new wxStaticText(this, wxID_ANY, _L("Please log into your Prusa Account."));
|
||||
// TRN Config wizard page with a log in web. second line of text.
|
||||
m_bold_text = new wxStaticText(this, wxID_ANY, _L("This step is optional."));
|
||||
m_bold_text->SetFont(wxGetApp().bold_font());
|
||||
m_bold_text->Wrap(WRAP_WIDTH);
|
||||
}
|
||||
append(m_text);
|
||||
append(m_bold_text);
|
||||
m_browser_sizer->Add(m_browser, 1, wxEXPAND);
|
||||
append(m_browser_sizer, 1, wxEXPAND);
|
||||
|
||||
@ -56,10 +52,9 @@ ConfigWizardWebViewPage::ConfigWizardWebViewPage(ConfigWizard *parent)
|
||||
|
||||
bool ConfigWizardWebViewPage::login_changed()
|
||||
{
|
||||
assert(p_user_account && m_browser_sizer && m_text && m_bold_text);
|
||||
assert(p_user_account && m_browser_sizer && m_text);
|
||||
bool logged = p_user_account->is_logged();
|
||||
m_browser_sizer->Show(!logged);
|
||||
m_bold_text->Show(!logged);
|
||||
if (logged) {
|
||||
// TRN Config wizard page with a log in web.
|
||||
m_text->SetLabel(format_wxstr("You are logged as %1%.", p_user_account->get_username()));
|
||||
|
@ -57,7 +57,6 @@ private:
|
||||
UserAccount *p_user_account{nullptr};
|
||||
wxBoxSizer *m_browser_sizer{nullptr};
|
||||
wxStaticText *m_text{nullptr};
|
||||
wxStaticText *m_bold_text{nullptr};
|
||||
};
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
|
@ -550,6 +550,7 @@ public:
|
||||
size_t active_item() const { return item_active; }
|
||||
ConfigWizardPage* active_page() const;
|
||||
bool active_is_last() const { return item_active < items.size() && item_active == last_page; }
|
||||
size_t pages_cnt() const { return items.size(); }
|
||||
|
||||
void go_prev();
|
||||
void go_next();
|
||||
|
@ -60,8 +60,6 @@ class RepositoryUpdateUIManager
|
||||
void fill_entries(bool init_selection = false);
|
||||
void fill_grids();
|
||||
|
||||
void update();
|
||||
|
||||
void remove_offline_repos(const std::string& id);
|
||||
void load_offline_repos();
|
||||
void check_selection();
|
||||
@ -71,6 +69,8 @@ public:
|
||||
RepositoryUpdateUIManager(wxWindow* parent, PresetArchiveDatabase* pad, int em);
|
||||
~RepositoryUpdateUIManager() {}
|
||||
|
||||
void update();
|
||||
|
||||
wxSizer* get_sizer() { return m_main_sizer; }
|
||||
bool set_selected_repositories();
|
||||
bool is_selection_changed() const { return m_is_selection_changed; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user