Fix modal dialogs screwing comboboxes on Mac

This commit is contained in:
Vojtech Kral 2019-02-28 16:19:53 +01:00
parent b642784e91
commit 0c44cceaa1

View file

@ -177,33 +177,40 @@ bool GUI_App::OnInit()
if (this->plater() != nullptr) if (this->plater() != nullptr)
this->obj_manipul()->update_if_dirty(); this->obj_manipul()->update_if_dirty();
});
// On OS X the UI tends to freeze in weird ways if modal dialogs(config wizard, update notifications, ...) // Preset updating & Configwizard are done after the above initializations,
// are shown before or in the same event callback with the main frame creation. // and after MainFrame is created & shown.
// Therefore we schedule them for later using CallAfter. // The extra CallAfter() is needed because of Mac, where this is the only way
CallAfter([this]() { // to popup a modal dialog on start without screwing combo boxes.
try { // This is ugly but I honestly found not better way to do it.
if (!preset_updater->config_update()) // Neither wxShowEvent nor wxWindowCreateEvent work reliably.
mainframe->Close(); static bool once = true;
} catch (const std::exception &ex) { if (once) {
show_error(nullptr, ex.what()); once = false;
try {
if (!preset_updater->config_update()) {
mainframe->Close();
}
} catch (const std::exception &ex) {
show_error(nullptr, ex.what());
}
CallAfter([this] {
if (!config_wizard_startup(app_conf_exists)) {
// Only notify if there was not wizard so as not to bother too much ...
preset_updater->slic3r_update_notify();
}
preset_updater->sync(preset_bundle);
});
load_current_presets();
} }
}); });
CallAfter([this]() {
if (!config_wizard_startup(app_conf_exists)) {
// Only notify if there was not wizard so as not to bother too much ...
preset_updater->slic3r_update_notify();
}
preset_updater->sync(preset_bundle);
load_current_presets();
});
mainframe->Show(true); mainframe->Show(true);
return m_initialized = true; m_initialized = true;
return true;
} }
unsigned GUI_App::get_colour_approx_luma(const wxColour &colour) unsigned GUI_App::get_colour_approx_luma(const wxColour &colour)