mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	FIX:AMSMaterialSetting dialog
1.Set dialog readonly when printing 2.replace comboBox with text when set readonly Change-Id: Ic9d9570f3984088550b70628f4acb33c83108dde
This commit is contained in:
		
							parent
							
								
									0a1f3df697
								
							
						
					
					
						commit
						3fb942077c
					
				
					 2 changed files with 73 additions and 73 deletions
				
			
		|  | @ -44,6 +44,16 @@ void AMSMaterialsSetting::create() | |||
| #endif | ||||
| 
 | ||||
|     m_sizer_filament->Add(COMBOBOX_FILAMENT, 1, wxALIGN_CENTER, 0); | ||||
| 
 | ||||
|     m_readonly_filament = new TextInput(this, wxEmptyString, "", "", wxDefaultPosition, AMS_MATERIALS_SETTING_COMBOX_WIDTH, wxTE_READONLY); | ||||
|     m_readonly_filament->SetBorderColor(StateColor(std::make_pair(0xDBDBDB, (int)StateColor::Focused), std::make_pair(0x00AE42, (int)StateColor::Hovered), | ||||
|         std::make_pair(0xDBDBDB, (int)StateColor::Normal))); | ||||
|     m_readonly_filament->GetTextCtrl()->Bind(wxEVT_SET_FOCUS, [](auto& e) { | ||||
|         ; | ||||
|         }); | ||||
|     m_sizer_filament->Add(m_readonly_filament, 1, wxALIGN_CENTER, 0); | ||||
|     m_readonly_filament->Hide(); | ||||
| 
 | ||||
|     wxBoxSizer *m_sizer_colour = new wxBoxSizer(wxHORIZONTAL); | ||||
| 
 | ||||
|     m_title_colour = new wxStaticText(this, wxID_ANY, _L("Colour"), wxDefaultPosition, wxSize(AMS_MATERIALS_SETTING_LABEL_WIDTH, -1), 0); | ||||
|  | @ -284,21 +294,12 @@ void AMSMaterialsSetting::update() | |||
| 
 | ||||
| void AMSMaterialsSetting::enable_confirm_button(bool en) | ||||
| { | ||||
|     if (m_is_third) m_button_confirm->Show(en); | ||||
|      | ||||
|     //if (!en) {
 | ||||
|     //    if (m_button_confirm->IsEnabled()) {
 | ||||
|     //        m_button_confirm->Disable();
 | ||||
|     //        m_button_confirm->SetBackgroundColor(wxColour(0x90, 0x90, 0x90));
 | ||||
|     //        m_button_confirm->SetBorderColor(wxColour(0x90, 0x90, 0x90));
 | ||||
|     //    }
 | ||||
|     //} else {
 | ||||
|     //    if (!m_button_confirm->IsEnabled()) {
 | ||||
|     //        m_button_confirm->Enable();
 | ||||
|     //        m_button_confirm->SetBackgroundColor(m_btn_bg_green);
 | ||||
|     //        m_button_confirm->SetBorderColor(m_btn_bg_green);
 | ||||
|     //    }
 | ||||
|     //}
 | ||||
|     if (!m_is_third) return; | ||||
|     else { | ||||
|         m_button_confirm->Show(en); | ||||
|         COMBOBOX_FILAMENT->Show(en); | ||||
|         m_readonly_filament->Show(!en); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void AMSMaterialsSetting::on_select_ok(wxCommandEvent &event) | ||||
|  | @ -351,7 +352,7 @@ void AMSMaterialsSetting::set_color(wxColour color) | |||
| 
 | ||||
| void AMSMaterialsSetting::on_clr_picker(wxCommandEvent & event)  | ||||
| { | ||||
|     if(!m_is_third) | ||||
|     if(!m_is_third || obj->is_in_printing() || obj->can_resume()) | ||||
|         return; | ||||
|     auto clr_dialog = new wxColourDialog(this, m_clrData); | ||||
|     show_flag = true; | ||||
|  | @ -379,26 +380,23 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi | |||
|         m_button_confirm->Hide(); | ||||
|         m_sn_number->SetLabel(sn); | ||||
|         m_panel_SN->Show(); | ||||
| 
 | ||||
| #ifdef __APPLE__ | ||||
|         wxArrayString filament_only; | ||||
|         filament_only.push_back(filament); | ||||
|         COMBOBOX_FILAMENT->Set(filament_only); | ||||
| #else | ||||
|         COMBOBOX_FILAMENT->Set(wxArrayString()); | ||||
| #endif | ||||
|         COMBOBOX_FILAMENT->SetValue(filament); | ||||
| 
 | ||||
|         COMBOBOX_FILAMENT->Hide(); | ||||
|         m_readonly_filament->Show(); | ||||
|         m_readonly_filament->GetTextCtrl()->SetLabel("Bambu " + filament); | ||||
|         m_input_nozzle_min->GetTextCtrl()->SetValue(temp_min); | ||||
|         m_input_nozzle_max->GetTextCtrl()->SetValue(temp_max); | ||||
| 
 | ||||
|         Layout(); | ||||
|         Fit(); | ||||
|         update(); | ||||
|         ShowModal(); | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     m_button_confirm->Show(); | ||||
|     m_panel_SN->Hide(); | ||||
|     COMBOBOX_FILAMENT->Show(); | ||||
|     m_readonly_filament->Hide(); | ||||
|     Layout(); | ||||
|     Fit(); | ||||
| 
 | ||||
|  | @ -432,7 +430,8 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi | |||
|                     if (printer_it->name == printer_str) { | ||||
|                         if (filament_id_set.find(filament_it->filament_id) != filament_id_set.end()) { | ||||
|                             continue; | ||||
|                             } else { | ||||
|                         } | ||||
|                         else { | ||||
|                             filament_id_set.insert(filament_it->filament_id); | ||||
|                             // name matched
 | ||||
|                             filament_items.push_back(filament_it->alias); | ||||
|  | @ -441,7 +440,7 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi | |||
| 
 | ||||
|                                 // update if nozzle_temperature_range is found
 | ||||
|                                 ConfigOption* opt_min = filament_it->config.option("nozzle_temperature_range_low"); | ||||
|                                     if(opt_min) { | ||||
|                                 if (opt_min) { | ||||
|                                     ConfigOptionInts* opt_min_ints = dynamic_cast<ConfigOptionInts*>(opt_min); | ||||
|                                     if (opt_min_ints) { | ||||
|                                         wxString text_nozzle_temp_min = wxString::Format("%d", opt_min_ints->get_at(0)); | ||||
|  | @ -467,6 +466,7 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi | |||
|         COMBOBOX_FILAMENT->SetSelection(selection_idx); | ||||
|         post_select_event(); | ||||
|     } | ||||
| 
 | ||||
|     update(); | ||||
|     ShowModal(); | ||||
| } | ||||
|  |  | |||
|  | @ -84,12 +84,12 @@ protected: | |||
|     Button *            m_button_close; | ||||
|     Button *            m_clr_picker; | ||||
|     wxColourData *      m_clrData; | ||||
| 
 | ||||
| #ifdef __APPLE__ | ||||
|     wxComboBox *m_comboBox_filament_mac; | ||||
| #else | ||||
|     ComboBox *m_comboBox_filament; | ||||
| #endif | ||||
|     TextInput*          m_readonly_filament; | ||||
| }; | ||||
| 
 | ||||
| }} // namespace Slic3r::GUI
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 liz.li
						liz.li