mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	Fixed a preset selection after a config wizard running (SPE-841)
This commit is contained in:
		
							parent
							
								
									a6ec3ea883
								
							
						
					
					
						commit
						2ddd2ed4c7
					
				
					 3 changed files with 25 additions and 9 deletions
				
			
		|  | @ -30,6 +30,8 @@ | ||||||
| 
 | 
 | ||||||
| #include "libslic3r/Utils.hpp" | #include "libslic3r/Utils.hpp" | ||||||
| #include "libslic3r/Print.hpp" | #include "libslic3r/Print.hpp" | ||||||
|  | #include "Tab.hpp" | ||||||
|  | #include "GUI_ObjectList.hpp" | ||||||
| 
 | 
 | ||||||
| namespace Slic3r { namespace GUI { | namespace Slic3r { namespace GUI { | ||||||
| 
 | 
 | ||||||
|  | @ -123,6 +125,9 @@ void config_wizard(int reason) | ||||||
|     if (! wxGetApp().check_unsaved_changes()) |     if (! wxGetApp().check_unsaved_changes()) | ||||||
|     	return; |     	return; | ||||||
| 
 | 
 | ||||||
|  |     // save selected preset before config wizard running
 | ||||||
|  |     const auto printer_preset_name = wxGetApp().preset_bundle->printers.get_edited_preset().name; | ||||||
|  | 
 | ||||||
| 	try { | 	try { | ||||||
| 		ConfigWizard wizard(nullptr, static_cast<ConfigWizard::RunReason>(reason)); | 		ConfigWizard wizard(nullptr, static_cast<ConfigWizard::RunReason>(reason)); | ||||||
|         wizard.run(wxGetApp().preset_bundle, wxGetApp().preset_updater); |         wizard.run(wxGetApp().preset_bundle, wxGetApp().preset_updater); | ||||||
|  | @ -131,8 +136,21 @@ void config_wizard(int reason) | ||||||
| 		show_error(nullptr, e.what()); | 		show_error(nullptr, e.what()); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// Load the currently selected preset into the GUI, update the preset selection box.
 |     // select old(before config wizard running) preset
 | ||||||
| 	wxGetApp().load_current_presets(); | 	wxGetApp().get_tab(Preset::TYPE_PRINTER)->select_preset(printer_preset_name);  | ||||||
|  |     // If old preset if invisible now, then first visible preset will be selected
 | ||||||
|  |     // So, let control the case if multi-part object is on the scene and first visible preset is SLA
 | ||||||
|  |     if (wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptSLA && | ||||||
|  |         wxGetApp().obj_list()->has_multi_part_objects()) | ||||||
|  |     { | ||||||
|  |         show_info(nullptr, | ||||||
|  |             _(L("It's impossible to print multi-part object(s) with SLA technology.")) + "\n\n" + | ||||||
|  |             _(L("Please check and fixe your object list.")), | ||||||
|  |             _(L("Attention!"))); | ||||||
|  |     } | ||||||
|  |         | ||||||
|  |     // Load the currently selected preset into the GUI, update the preset selection box.
 | ||||||
|  |     // 	wxGetApp().load_current_presets(); // #ys_FIXME_to_delete presets are loaded now in select_preset function
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // opt_index = 0, by the reason of zero-index in ConfigOptionVector by default (in case only one element)
 | // opt_index = 0, by the reason of zero-index in ConfigOptionVector by default (in case only one element)
 | ||||||
|  |  | ||||||
|  | @ -38,6 +38,11 @@ FreqSettingsBundle FREQ_SETTINGS_BUNDLE_SLA = | ||||||
|     { L("Pad and Support")      , { "supports_enable", "pad_enable" } } |     { L("Pad and Support")      , { "supports_enable", "pad_enable" } } | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | static PrinterTechnology printer_technology() | ||||||
|  | { | ||||||
|  |     return wxGetApp().preset_bundle->printers.get_selected_preset().printer_technology(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| ObjectList::ObjectList(wxWindow* parent) : | ObjectList::ObjectList(wxWindow* parent) : | ||||||
|     wxDataViewCtrl(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_MULTIPLE), |     wxDataViewCtrl(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_MULTIPLE), | ||||||
|     m_parent(parent) |     m_parent(parent) | ||||||
|  | @ -667,11 +672,6 @@ void ObjectList::get_options_menu(settings_menu_hierarchy& settings_menu, const | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Slic3r::PrinterTechnology ObjectList::printer_technology() const  |  | ||||||
| { |  | ||||||
|     return wxGetApp().preset_bundle->printers.get_selected_preset().printer_technology(); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void ObjectList::get_settings_choice(const wxString& category_name) | void ObjectList::get_settings_choice(const wxString& category_name) | ||||||
| { | { | ||||||
|     wxArrayString names; |     wxArrayString names; | ||||||
|  |  | ||||||
|  | @ -284,8 +284,6 @@ private: | ||||||
|     std::vector<std::string>        get_options(const bool is_part); |     std::vector<std::string>        get_options(const bool is_part); | ||||||
|     const std::vector<std::string>& get_options_for_bundle(const wxString& bundle_name); |     const std::vector<std::string>& get_options_for_bundle(const wxString& bundle_name); | ||||||
|     void                            get_options_menu(settings_menu_hierarchy& settings_menu, const bool is_part); |     void                            get_options_menu(settings_menu_hierarchy& settings_menu, const bool is_part); | ||||||
| 
 |  | ||||||
|     PrinterTechnology printer_technology() const ; |  | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 YuSanka
						YuSanka