mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	ENH:clear virtual tray when change printers
Change-Id: I894c9ba54512a1b833bfd9da33f901457d297aed
This commit is contained in:
		
							parent
							
								
									c0bcb2270a
								
							
						
					
					
						commit
						e2b8bff660
					
				
					 4 changed files with 28 additions and 11 deletions
				
			
		|  | @ -419,7 +419,7 @@ void AMSMaterialsSetting::on_select_reset(wxCommandEvent& event) { | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         // set k / n value
 |         // set k / n value
 | ||||||
|         if (obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI)) { |         if (obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY)) { | ||||||
|             // set extrusion cali ratio
 |             // set extrusion cali ratio
 | ||||||
|             int cali_tray_id = ams_id * 4 + tray_id; |             int cali_tray_id = ams_id * 4 + tray_id; | ||||||
| 
 | 
 | ||||||
|  | @ -477,7 +477,7 @@ void AMSMaterialsSetting::on_select_ok(wxCommandEvent &event) | ||||||
|     else { |     else { | ||||||
|         if (!m_is_third) { |         if (!m_is_third) { | ||||||
|             // check and set k n
 |             // check and set k n
 | ||||||
|             if (obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI)) { |             if (obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY)) { | ||||||
|                 if (!ExtrusionCalibration::check_k_validation(k_text)) { |                 if (!ExtrusionCalibration::check_k_validation(k_text)) { | ||||||
|                     wxString k_tips = _L("Please input a valid value (K in 0~0.5)"); |                     wxString k_tips = _L("Please input a valid value (K in 0~0.5)"); | ||||||
|                     wxString kn_tips = _L("Please input a valid value (K in 0~0.5, N in 0.6~2.0)"); |                     wxString kn_tips = _L("Please input a valid value (K in 0~0.5, N in 0.6~2.0)"); | ||||||
|  | @ -489,7 +489,7 @@ void AMSMaterialsSetting::on_select_ok(wxCommandEvent &event) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|             // set k / n value
 |             // set k / n value
 | ||||||
|             if (obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI)) { |             if (obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY)) { | ||||||
|                 // set extrusion cali ratio
 |                 // set extrusion cali ratio
 | ||||||
|                 int cali_tray_id = ams_id * 4 + tray_id; |                 int cali_tray_id = ams_id * 4 + tray_id; | ||||||
| 
 | 
 | ||||||
|  | @ -575,7 +575,7 @@ void AMSMaterialsSetting::on_select_ok(wxCommandEvent &event) | ||||||
|         } |         } | ||||||
|         else { |         else { | ||||||
|             if (obj) { |             if (obj) { | ||||||
|                 if (obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI)) { |                 if (obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY)) { | ||||||
|                     if (!ExtrusionCalibration::check_k_validation(k_text)) { |                     if (!ExtrusionCalibration::check_k_validation(k_text)) { | ||||||
|                         wxString k_tips = _L("Please input a valid value (K in 0~0.5)"); |                         wxString k_tips = _L("Please input a valid value (K in 0~0.5)"); | ||||||
|                         wxString kn_tips = _L("Please input a valid value (K in 0~0.5, N in 0.6~2.0)"); |                         wxString kn_tips = _L("Please input a valid value (K in 0~0.5, N in 0.6~2.0)"); | ||||||
|  | @ -596,7 +596,7 @@ void AMSMaterialsSetting::on_select_ok(wxCommandEvent &event) | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 // set k / n value
 |                 // set k / n value
 | ||||||
|                 if (obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI)) { |                 if (obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY)) { | ||||||
|                     // set extrusion cali ratio
 |                     // set extrusion cali ratio
 | ||||||
|                     int cali_tray_id = ams_id * 4 + tray_id; |                     int cali_tray_id = ams_id * 4 + tray_id; | ||||||
| 
 | 
 | ||||||
|  | @ -698,7 +698,7 @@ void AMSMaterialsSetting::update_widgets() | ||||||
|         else |         else | ||||||
|             m_panel_normal->Hide(); |             m_panel_normal->Hide(); | ||||||
|         m_panel_kn->Show(); |         m_panel_kn->Show(); | ||||||
|     } else if (obj && obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI)) { |     } else if (obj && obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY)) { | ||||||
|         m_panel_normal->Show(); |         m_panel_normal->Show(); | ||||||
|         m_panel_kn->Show(); |         m_panel_kn->Show(); | ||||||
|     } else { |     } else { | ||||||
|  | @ -749,7 +749,7 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi | ||||||
| 
 | 
 | ||||||
|         if (!m_is_third) { |         if (!m_is_third) { | ||||||
|             m_button_reset->Hide(); |             m_button_reset->Hide(); | ||||||
|             if (obj && obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI)) { |             if (obj && obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY)) { | ||||||
|                 m_button_confirm->Show(); |                 m_button_confirm->Show(); | ||||||
|             } else { |             } else { | ||||||
|                 m_button_confirm->Hide(); |                 m_button_confirm->Hide(); | ||||||
|  |  | ||||||
|  | @ -1921,7 +1921,9 @@ void StatusPanel::update_ams(MachineObject *obj) | ||||||
|             BOOST_LOG_TRIVIAL(trace) << "machine object" << obj->dev_name << " was disconnected, set show_ams_group is false"; |             BOOST_LOG_TRIVIAL(trace) << "machine object" << obj->dev_name << " was disconnected, set show_ams_group is false"; | ||||||
|         } |         } | ||||||
|         bool is_support_extrusion_cali = obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI); |         bool is_support_extrusion_cali = obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI); | ||||||
|         if (is_support_extrusion_cali) { |         bool is_support_virtual_tray = obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY); | ||||||
|  | 
 | ||||||
|  |         if (is_support_virtual_tray) { | ||||||
|             m_ams_control->update_vams_kn_value(obj->vt_tray); |             m_ams_control->update_vams_kn_value(obj->vt_tray); | ||||||
|         } |         } | ||||||
|         show_ams_group(false, obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY), obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI), obj->is_support_filament_edit_virtual_tray); |         show_ams_group(false, obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY), obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI), obj->is_support_filament_edit_virtual_tray); | ||||||
|  | @ -1929,7 +1931,9 @@ void StatusPanel::update_ams(MachineObject *obj) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     bool is_support_extrusion_cali = obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI); |     bool is_support_extrusion_cali = obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI); | ||||||
|     if (is_support_extrusion_cali) { |     bool is_support_virtual_tray = obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY); | ||||||
|  | 
 | ||||||
|  |     if (is_support_virtual_tray) { | ||||||
|         m_ams_control->update_vams_kn_value(obj->vt_tray); |         m_ams_control->update_vams_kn_value(obj->vt_tray); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -757,7 +757,7 @@ void AMSLib::render(wxDC &dc) | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         //draw k&n
 |         //draw k&n
 | ||||||
|         if (m_obj && m_obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI)) { |         if (m_obj && m_obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY)) { | ||||||
|             if (m_show_kn){ |             if (m_show_kn){ | ||||||
|                 wxString str_k = wxString::Format("K %1.3f", m_info.k); |                 wxString str_k = wxString::Format("K %1.3f", m_info.k); | ||||||
|                 wxString str_n = wxString::Format("N %1.3f", m_info.n); |                 wxString str_n = wxString::Format("N %1.3f", m_info.n); | ||||||
|  | @ -2563,6 +2563,18 @@ void AMSControl::update_vams_kn_value(AmsTray tray) | ||||||
|     m_vams_lib->Refresh(); |     m_vams_lib->Refresh(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void AMSControl::reset_vams() | ||||||
|  | { | ||||||
|  |     m_vams_lib->m_info.k = 0; | ||||||
|  |     m_vams_lib->m_info.n = 0; | ||||||
|  |     m_vams_lib->m_info.material_name = wxEmptyString; | ||||||
|  |     m_vams_lib->m_info.material_colour = AMS_CONTROL_WHITE_COLOUR; | ||||||
|  |     m_vams_info.material_name = wxEmptyString; | ||||||
|  |     m_vams_info.material_colour = AMS_CONTROL_WHITE_COLOUR; | ||||||
|  |     m_vams_lib->Refresh(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| void AMSControl::UpdateAms(std::vector<AMSinfo> info, bool keep_selection, bool has_extrusion_cali, bool is_reset) | void AMSControl::UpdateAms(std::vector<AMSinfo> info, bool keep_selection, bool has_extrusion_cali, bool is_reset) | ||||||
| { | { | ||||||
|     std::string curr_ams_id = GetCurentAms(); |     std::string curr_ams_id = GetCurentAms(); | ||||||
|  |  | ||||||
|  | @ -617,7 +617,8 @@ public: | ||||||
|     void show_vams_kn_value(bool show); |     void show_vams_kn_value(bool show); | ||||||
|     void update_vams_kn_value(AmsTray tray); |     void update_vams_kn_value(AmsTray tray); | ||||||
| 
 | 
 | ||||||
|     void post_event(wxEvent &&event); |     void reset_vams(); | ||||||
|  |     void post_event(wxEvent&& event); | ||||||
| 
 | 
 | ||||||
|     virtual bool Enable(bool enable = true); |     virtual bool Enable(bool enable = true); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 tao wang
						tao wang