mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 03:05:56 +08:00
Further debugging of issue 7583
This commit is contained in:
parent
ecd10dbc5b
commit
5010f0c2af
@ -2722,11 +2722,13 @@ bool ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese
|
|||||||
if (!check_unsaved_preset_changes) {
|
if (!check_unsaved_preset_changes) {
|
||||||
if ((check_unsaved_preset_changes = !preferred_model.empty())) {
|
if ((check_unsaved_preset_changes = !preferred_model.empty())) {
|
||||||
header = _L("A new Printer was installed and it will be activated.");
|
header = _L("A new Printer was installed and it will be activated.");
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "ConfigWizard::priv::apply_config 15a";
|
||||||
if (!wxGetApp().check_and_keep_current_preset_changes(caption, header, act_btns, &apply_keeped_changes))
|
if (!wxGetApp().check_and_keep_current_preset_changes(caption, header, act_btns, &apply_keeped_changes))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if ((check_unsaved_preset_changes = enabled_vendors_old != enabled_vendors)) {
|
else if ((check_unsaved_preset_changes = enabled_vendors_old != enabled_vendors)) {
|
||||||
header = _L("Some Printers were uninstalled.");
|
header = _L("Some Printers were uninstalled.");
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "ConfigWizard::priv::apply_config 15b";
|
||||||
if (!wxGetApp().check_and_keep_current_preset_changes(caption, header, act_btns, &apply_keeped_changes))
|
if (!wxGetApp().check_and_keep_current_preset_changes(caption, header, act_btns, &apply_keeped_changes))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2497,14 +2497,23 @@ void GUI_App::apply_keeped_preset_modifications()
|
|||||||
// Note: no_nullptr postponed_apply_of_keeped_changes indicates that thie function is called after ConfigWizard is closed
|
// Note: no_nullptr postponed_apply_of_keeped_changes indicates that thie function is called after ConfigWizard is closed
|
||||||
bool GUI_App::check_and_keep_current_preset_changes(const wxString& caption, const wxString& header, int action_buttons, bool* postponed_apply_of_keeped_changes/* = nullptr*/)
|
bool GUI_App::check_and_keep_current_preset_changes(const wxString& caption, const wxString& header, int action_buttons, bool* postponed_apply_of_keeped_changes/* = nullptr*/)
|
||||||
{
|
{
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "GUI_App::check_and_keep_current_preset_changes 1";
|
||||||
|
|
||||||
if (has_current_preset_changes()) {
|
if (has_current_preset_changes()) {
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "GUI_App::check_and_keep_current_preset_changes 2";
|
||||||
bool is_called_from_configwizard = postponed_apply_of_keeped_changes != nullptr;
|
bool is_called_from_configwizard = postponed_apply_of_keeped_changes != nullptr;
|
||||||
|
|
||||||
const std::string app_config_key = is_called_from_configwizard ? "" : "default_action_on_new_project";
|
const std::string app_config_key = is_called_from_configwizard ? "" : "default_action_on_new_project";
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "GUI_App::check_and_keep_current_preset_changes 3";
|
||||||
UnsavedChangesDialog dlg(caption, header, app_config_key, action_buttons);
|
UnsavedChangesDialog dlg(caption, header, app_config_key, action_buttons);
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "GUI_App::check_and_keep_current_preset_changes 4";
|
||||||
std::string act = app_config_key.empty() ? "none" : wxGetApp().app_config->get(app_config_key);
|
std::string act = app_config_key.empty() ? "none" : wxGetApp().app_config->get(app_config_key);
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "GUI_App::check_and_keep_current_preset_changes 5";
|
||||||
if (act == "none" && dlg.ShowModal() == wxID_CANCEL)
|
if (act == "none" && dlg.ShowModal() == wxID_CANCEL)
|
||||||
return false;
|
return false;
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "GUI_App::check_and_keep_current_preset_changes 6";
|
||||||
|
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "GUI_App::check_and_keep_current_preset_changes 7";
|
||||||
|
|
||||||
auto reset_modifications = [this, is_called_from_configwizard]() {
|
auto reset_modifications = [this, is_called_from_configwizard]() {
|
||||||
if (is_called_from_configwizard)
|
if (is_called_from_configwizard)
|
||||||
@ -2518,10 +2527,15 @@ bool GUI_App::check_and_keep_current_preset_changes(const wxString& caption, con
|
|||||||
load_current_presets(false);
|
load_current_presets(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (dlg.discard())
|
BOOST_LOG_TRIVIAL(error) << "GUI_App::check_and_keep_current_preset_changes 8";
|
||||||
|
|
||||||
|
if (dlg.discard()) {
|
||||||
reset_modifications();
|
reset_modifications();
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "GUI_App::check_and_keep_current_preset_changes 9";
|
||||||
|
}
|
||||||
else // save selected changes
|
else // save selected changes
|
||||||
{
|
{
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "GUI_App::check_and_keep_current_preset_changes 10";
|
||||||
const auto& preset_names_and_types = dlg.get_names_and_types();
|
const auto& preset_names_and_types = dlg.get_names_and_types();
|
||||||
if (dlg.save_preset()) {
|
if (dlg.save_preset()) {
|
||||||
for (const std::pair<std::string, Preset::Type>& nt : preset_names_and_types)
|
for (const std::pair<std::string, Preset::Type>& nt : preset_names_and_types)
|
||||||
|
@ -772,17 +772,28 @@ UnsavedChangesDialog::UnsavedChangesDialog(const wxString& caption, const wxStri
|
|||||||
m_app_config_key(app_config_key),
|
m_app_config_key(app_config_key),
|
||||||
m_buttons(act_buttons)
|
m_buttons(act_buttons)
|
||||||
{
|
{
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "UnsavedChangesDialog::UnsavedChangesDialog 1";
|
||||||
|
|
||||||
build(Preset::TYPE_INVALID, nullptr, "", header);
|
build(Preset::TYPE_INVALID, nullptr, "", header);
|
||||||
|
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "UnsavedChangesDialog::UnsavedChangesDialog 2";
|
||||||
|
|
||||||
const std::string& def_action = m_app_config_key.empty() ? none : wxGetApp().app_config->get(m_app_config_key);
|
const std::string& def_action = m_app_config_key.empty() ? none : wxGetApp().app_config->get(m_app_config_key);
|
||||||
|
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "UnsavedChangesDialog::UnsavedChangesDialog 3";
|
||||||
|
|
||||||
if (def_action == none)
|
if (def_action == none)
|
||||||
this->CenterOnScreen();
|
this->CenterOnScreen();
|
||||||
else {
|
else {
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "UnsavedChangesDialog::UnsavedChangesDialog 4";
|
||||||
|
|
||||||
m_exit_action = def_action == ActTransfer ? Action::Transfer :
|
m_exit_action = def_action == ActTransfer ? Action::Transfer :
|
||||||
def_action == ActSave ? Action::Save : Action::Discard;
|
def_action == ActSave ? Action::Save : Action::Discard;
|
||||||
if (m_exit_action != Action::Discard)
|
if (m_exit_action != Action::Discard)
|
||||||
save(nullptr, m_exit_action == Action::Save);
|
save(nullptr, m_exit_action == Action::Save);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "UnsavedChangesDialog::UnsavedChangesDialog 5";
|
||||||
}
|
}
|
||||||
|
|
||||||
UnsavedChangesDialog::UnsavedChangesDialog(Preset::Type type, PresetCollection* dependent_presets, const std::string& new_selected_preset)
|
UnsavedChangesDialog::UnsavedChangesDialog(Preset::Type type, PresetCollection* dependent_presets, const std::string& new_selected_preset)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user