diff --git a/.gitignore b/.gitignore index e48d0d8f7c..1a0dee043a 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,4 @@ src/OrcaSlicer-doc/ .idea/ bbl/i18n/es/OrcaSlicer_es.mo bbl/i18n/es/OrcaSlicer.mo +/.cache/ \ No newline at end of file diff --git a/src/slic3r/GUI/Camera.cpp b/src/slic3r/GUI/Camera.cpp index 4bc9a82e81..e96bbda03c 100644 --- a/src/slic3r/GUI/Camera.cpp +++ b/src/slic3r/GUI/Camera.cpp @@ -39,7 +39,6 @@ void Camera::set_type(EType type) m_type = type; if (m_update_config_on_type_change_enabled) { wxGetApp().app_config->set_bool("use_perspective_camera", m_type == EType::Perspective); - wxGetApp().app_config->save(); } } } diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 1cd1baeebd..f1a700cb69 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -2322,8 +2322,9 @@ bool GUI_App::on_init_inner() } } - app_config->set("version", SLIC3R_VERSION); - app_config->save(); + if(app_config->get("version") != SLIC3R_VERSION) { + app_config->set("version", SLIC3R_VERSION); + } BBLSplashScreen * scrn = nullptr; const bool show_splash_screen = true; @@ -2623,9 +2624,6 @@ bool GUI_App::on_init_inner() if (! plater_) return; - if (app_config->dirty()) - app_config->save(); - // BBS //this->obj_manipul()->update_if_dirty(); @@ -2650,6 +2648,9 @@ bool GUI_App::on_init_inner() m_download_file_url = ""; } } + + if (m_post_initialized && app_config->dirty()) + app_config->save(); }); m_initialized = true; @@ -4220,12 +4221,10 @@ void GUI_App::show_check_privacy_dlg(wxCommandEvent& evt) privacy_dlg.Bind(EVT_PRIVACY_UPDATE_CONFIRM, [this, online_login](wxCommandEvent &e) { app_config->set("privacy_version", privacy_version_info.version_str); app_config->set_bool("privacy_update_checked", true); - app_config->save(); request_user_handle(online_login); }); privacy_dlg.Bind(EVT_PRIVACY_UPDATE_CANCEL, [this](wxCommandEvent &e) { app_config->set_bool("privacy_update_checked", false); - app_config->save(); if (m_agent) { m_agent->user_logout(); } @@ -4777,7 +4776,6 @@ bool GUI_App::select_language() // m_wxLocale->GetCanonicalName() // 3) new_language_info->CanonicalName is a safe bet. It points to a valid dictionary name. app_config->set("language", new_language_info->CanonicalName.ToUTF8().data()); - app_config->save(); return true; } } @@ -5019,7 +5017,6 @@ void GUI_App::save_mode(const /*ConfigOptionMode*/int mode) mode == comSimple ? "simple" : mode == comDevelop ? "develop" : "simple"; app_config->set("user_mode", mode_str); - app_config->save(); update_mode(); } diff --git a/src/slic3r/GUI/GUI_Utils.cpp b/src/slic3r/GUI/GUI_Utils.cpp index d683e33f14..56c1ce6bc1 100644 --- a/src/slic3r/GUI/GUI_Utils.cpp +++ b/src/slic3r/GUI/GUI_Utils.cpp @@ -272,7 +272,6 @@ void update_dark_config() { wxSystemAppearance app = wxSystemSettings::GetAppearance(); GUI::wxGetApp().app_config->set("dark_color_mode", app.IsDark() ? "1" : "0"); - GUI::wxGetApp().app_config->save(); wxGetApp().Update_dark_mode_flag(); } diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 27dc7f8b65..63ec229cfd 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -837,7 +837,8 @@ void MainFrame::shutdown() //wxGetApp().other_instance_message_handler()->shutdown(this); // Save the slic3r.ini.Usually the ini file is saved from "on idle" callback, // but in rare cases it may not have been called yet. - wxGetApp().app_config->save(); + if(wxGetApp().app_config->dirty()) + wxGetApp().app_config->save(); // if (m_plater) // m_plater->print = undef; // Slic3r::GUI::deregister_on_request_update_callback(); @@ -2799,7 +2800,6 @@ void MainFrame::set_max_recent_count(int max) recent_projects.push_back(into_u8(m_recent_projects.GetHistoryFile(i))); } wxGetApp().app_config->set_recent_projects(recent_projects); - wxGetApp().app_config->save(); m_webview->SendRecentList(""); } } @@ -3266,7 +3266,6 @@ void MainFrame::add_to_recent_projects(const wxString& filename) recent_projects.push_back(into_u8(m_recent_projects.GetHistoryFile(i))); } wxGetApp().app_config->set_recent_projects(recent_projects); - wxGetApp().app_config->save(); m_webview->SendRecentList(""); } } @@ -3366,7 +3365,6 @@ void MainFrame::open_recent_project(size_t file_id, wxString const & filename) recent_projects.push_back(into_u8(m_recent_projects.GetHistoryFile(i))); } wxGetApp().app_config->set_recent_projects(recent_projects); - wxGetApp().app_config->save(); m_webview->SendRecentList(""); } } @@ -3390,7 +3388,6 @@ void MainFrame::remove_recent_project(size_t file_id, wxString const &filename) recent_projects.push_back(into_u8(m_recent_projects.GetHistoryFile(i))); } wxGetApp().app_config->set_recent_projects(recent_projects); - wxGetApp().app_config->save(); m_webview->SendRecentList(""); } diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index a4b135b0f4..a844d46e47 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -6375,7 +6375,6 @@ void Plater::priv::update_plugin_when_launch(wxCommandEvent &event) else if (result == wxID_NO) { app_config->set("update_network_plugin", "false"); } - app_config->save(); } void Plater::priv::show_install_plugin_hint(wxCommandEvent &event) diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index d190b0cc6f..57c3102a21 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -81,7 +81,6 @@ wxBoxSizer *PreferencesDialog::create_item_combobox(wxString title, wxWindow *pa //// save config combobox->GetDropDown().Bind(wxEVT_COMBOBOX, [this, param](wxCommandEvent &e) { app_config->set(param, std::to_string(e.GetSelection())); - app_config->save(); e.Skip(); }); return m_sizer_combox; @@ -199,7 +198,6 @@ wxBoxSizer *PreferencesDialog::create_item_language_combobox( m_current_language_selected = combobox->GetSelection(); if (m_current_language_selected >= 0 && m_current_language_selected < vlist.size()) { app_config->set(param, vlist[m_current_language_selected]->CanonicalName.ToUTF8().data()); - app_config->save(); wxGetApp().load_language(vlist[m_current_language_selected]->CanonicalName, false); Close(); @@ -324,7 +322,6 @@ wxBoxSizer *PreferencesDialog::create_item_loglevel_combobox(wxString title, wxW auto level = Slic3r::get_string_logging_level(e.GetSelection()); Slic3r::set_logging_level(Slic3r::level_string_to_boost(level)); app_config->set("severity_level",level); - app_config->save(); e.Skip(); }); return m_sizer_combox; @@ -376,14 +373,12 @@ wxBoxSizer *PreferencesDialog::create_item_multiple_combobox( combobox_left->GetDropDown().Bind(wxEVT_COMBOBOX, [this, param, combobox_right](wxCommandEvent &e) { auto config = e.GetString() + wxString("/") + combobox_right->GetValue(); app_config->set(param, std::string(config.mb_str())); - app_config->save(); e.Skip(); }); combobox_right->GetDropDown().Bind(wxEVT_COMBOBOX, [this, param, combobox_left](wxCommandEvent &e) { auto config = combobox_left->GetValue() + wxString("/") + e.GetString(); app_config->set(param, std::string(config.mb_str())); - app_config->save(); e.Skip(); }); @@ -427,7 +422,6 @@ wxBoxSizer *PreferencesDialog::create_item_input(wxString title, wxString title2 input->GetTextCtrl()->Bind(wxEVT_KILL_FOCUS, [this, param, input, onchange](wxFocusEvent &e) { auto value = input->GetTextCtrl()->GetValue(); app_config->set(param, std::string(value.mb_str())); - app_config->save(); onchange(value); e.Skip(); });