mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 21:55:59 +08:00
ConfigWizard: added a modeless 'progress' dialog when loading
This commit is contained in:
parent
bfaa960c23
commit
f08264dbe3
@ -90,6 +90,23 @@ using Config::Snapshot;
|
||||
using Config::SnapshotDB;
|
||||
|
||||
|
||||
|
||||
ConfigWizardLoadingDialog::ConfigWizardLoadingDialog(wxWindow* parent, const wxString& message)
|
||||
: wxDialog(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxFRAME_FLOAT_ON_PARENT)
|
||||
{
|
||||
auto* text = new wxStaticText(this, wxID_ANY, message, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL);
|
||||
auto* vsizer = new wxBoxSizer(wxVERTICAL);
|
||||
auto *top_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
vsizer->Add(text, 1, wxEXPAND);
|
||||
top_sizer->Add(vsizer, 1, wxEXPAND | wxALL, 15);
|
||||
SetSizer(top_sizer);
|
||||
#ifdef _WIN32
|
||||
wxGetApp().UpdateDlgDarkUI(this);
|
||||
#endif
|
||||
Fit();
|
||||
}
|
||||
|
||||
|
||||
// Configuration data structures extensions needed for the wizard
|
||||
|
||||
bool Bundle::load(fs::path source_path, BundleLocation location, bool ais_prusa_bundle)
|
||||
|
@ -25,6 +25,12 @@ class PresetUpdater;
|
||||
|
||||
namespace GUI {
|
||||
|
||||
class ConfigWizardLoadingDialog : public wxDialog
|
||||
{
|
||||
public:
|
||||
ConfigWizardLoadingDialog(wxWindow* parent, const wxString& message);
|
||||
};
|
||||
|
||||
namespace DownloaderUtils {
|
||||
class Worker : public wxBoxSizer
|
||||
{
|
||||
|
@ -3224,9 +3224,19 @@ bool GUI_App::run_wizard(ConfigWizard::RunReason reason, ConfigWizard::StartPage
|
||||
#endif // 0
|
||||
plater()->get_preset_archive_database()->sync_blocking();
|
||||
|
||||
// ConfigWizard can take some time to start. Because it is a wxWidgets window, it has to be done in UI thread,
|
||||
// so displaying a nice modal dialog and letting the CW start in a worker thread is not an option.
|
||||
// Let's at least show a modeless dialog before the UI thread freezes.
|
||||
auto cw_loading_dlg = new ConfigWizardLoadingDialog(mainframe, _L("Loading Configuration Wizard..."));
|
||||
cw_loading_dlg->CenterOnParent();
|
||||
cw_loading_dlg->Show();
|
||||
wxYield();
|
||||
auto wizard = new ConfigWizard(mainframe);
|
||||
cw_loading_dlg->Close();
|
||||
|
||||
const bool res = wizard->run(reason, start_page);
|
||||
|
||||
|
||||
// !!! Deallocate memory after close ConfigWizard.
|
||||
// Note, that mainframe is a parent of ConfigWizard.
|
||||
// So, wizard will be destroyed only during destroying of mainframe
|
||||
|
Loading…
x
Reference in New Issue
Block a user