diff --git a/src/slic3r/GUI/AmsMappingPopup.cpp b/src/slic3r/GUI/AmsMappingPopup.cpp index e52405957..4d29f93a8 100644 --- a/src/slic3r/GUI/AmsMappingPopup.cpp +++ b/src/slic3r/GUI/AmsMappingPopup.cpp @@ -1161,7 +1161,7 @@ void MappingContainer::doRender(wxDC& dc) } AmsReplaceMaterialDialog::AmsReplaceMaterialDialog(wxWindow* parent) - : DPIDialog(parent, wxID_ANY, _L("Filaments Auto refill"), wxDefaultPosition, wxDefaultSize, wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX) + : DPIDialog(parent, wxID_ANY, _L("Auto Refill"), wxDefaultPosition, wxDefaultSize, wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX) { #ifdef __WINDOWS__ SetDoubleBuffered(true); @@ -1187,7 +1187,7 @@ void AmsReplaceMaterialDialog::create() m_main_sizer->Add(m_top_line, 0, wxEXPAND, 0); - auto label_title = new Label(this, _L("Auto refill")); + auto label_title = new Label(this, _L("Auto Refill")); label_title->SetFont(Label::Head_14); label_title->SetForegroundColour(0x00AE42); auto label_txt = new Label(this, _L("When the current material run out, the printer will continue to print in the following order.")); diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index 5c8aca5f0..e449e1d41 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -1106,9 +1106,8 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater) m_sizer_material_area->Add(m_sizer_material_tips, 0, wxALIGN_CENTER|wxLEFT, FromDIP(8)); m_sizer_material_area->Add(m_sizer_material, 0, wxLEFT, FromDIP(15)); -#ifdef FILAMENT_BACKUP - auto m_sizer_backup = new wxBoxSizer(wxHORIZONTAL); - auto m_ams_backup_tip = new Label(this, _L("Ams filament backup")); + m_sizer_backup = new wxBoxSizer(wxHORIZONTAL); + auto m_ams_backup_tip = new Label(this, _L("Auto Refill")); m_ams_backup_tip->SetFont(::Label::Head_12); m_ams_backup_tip->SetForegroundColour(wxColour(0x00AE42)); m_ams_backup_tip->SetBackgroundColour(*wxWHITE); @@ -1118,6 +1117,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater) m_sizer_backup->Add(0, 0, 1, wxEXPAND, 0); m_sizer_backup->Add(img_ams_backup, 0, wxALL, FromDIP(3)); m_sizer_backup->Add(m_ams_backup_tip, 0, wxTOP, FromDIP(5)); + m_sizer_backup->Show(false); m_ams_backup_tip->Bind(wxEVT_ENTER_WINDOW, [this, img_amsmapping_tip](auto& e) {SetCursor(wxCURSOR_HAND); }); img_ams_backup->Bind(wxEVT_ENTER_WINDOW, [this, img_amsmapping_tip](auto& e) {SetCursor(wxCURSOR_HAND); }); @@ -1127,7 +1127,6 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater) m_ams_backup_tip->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {popup_filament_backup(); on_rename_enter(); }); img_ams_backup->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {popup_filament_backup(); }); -#endif m_statictext_ams_msg = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL); m_statictext_ams_msg->SetFont(::Label::Body_13); @@ -1358,10 +1357,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater) m_sizer_main->Add(m_line_top, 0, wxEXPAND, 0); m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(13)); m_sizer_main->Add(m_scrollable_view, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT, FromDIP(25)); - -#ifdef FILAMENT_BACKUP m_sizer_main->Add(m_sizer_backup, 0, wxALIGN_CENTER_HORIZONTAL, 0); -#endif m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(6)); m_sizer_main->Add(m_statictext_ams_msg, 0, wxALIGN_CENTER_HORIZONTAL, 0); @@ -1413,7 +1409,7 @@ void SelectMachineDialog::init_bind() if (e.GetInt() == 0) { DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager(); if (!dev) return; - if (dev->get_selected_machine()) { + if (dev->get_selected_machine()->dev_id == e.GetString()) { m_comboBox_printer->SetValue(dev->get_selected_machine()->dev_name + "(LAN)"); } }else if(e.GetInt() == 1){ @@ -2876,6 +2872,20 @@ void SelectMachineDialog::on_timer(wxTimerEvent &event) { wxGetApp().reset_to_active(); update_show_status(); + + ///show auto refill + DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager(); + if(!dev) return; + MachineObject* obj_ = dev->get_selected_machine(); + if(!obj_) return; + if (!obj_ || obj_->amsList.empty() || obj_->ams_exist_bits == 0 || !obj_->ams_auto_switch_filament_flag || !obj_->is_function_supported(PrinterFunction::FUNC_FILAMENT_BACKUP)) { + m_sizer_backup->Show(false); + Layout(); + } + else { + m_sizer_backup->Show(true); + Layout(); + } } void SelectMachineDialog::on_selection_changed(wxCommandEvent &event) @@ -2926,6 +2936,7 @@ void SelectMachineDialog::on_selection_changed(wxCommandEvent &event) return; } + //reset print status show_status(PrintDialogStatus::PrintStatusInit); @@ -2965,7 +2976,6 @@ void SelectMachineDialog::update_show_status() } if (!dev) return; dev->check_pushing(); - PartPlate* plate = m_plater->get_partplate_list().get_curr_plate(); // blank plate has no valid gcode file @@ -2975,7 +2985,6 @@ void SelectMachineDialog::update_show_status() return; } } - MachineObject* obj_ = dev->get_my_machine(m_printer_last_select); if (!obj_) { update_ams_check(nullptr); diff --git a/src/slic3r/GUI/SelectMachine.hpp b/src/slic3r/GUI/SelectMachine.hpp index 5bef6b721..f757d8339 100644 --- a/src/slic3r/GUI/SelectMachine.hpp +++ b/src/slic3r/GUI/SelectMachine.hpp @@ -330,6 +330,7 @@ protected: wxBoxSizer* m_sizer_scrollable_region{ nullptr }; wxBoxSizer* rename_sizer_v{ nullptr }; wxBoxSizer* rename_sizer_h{ nullptr }; + wxBoxSizer* m_sizer_backup{ nullptr }; Button* m_button_refresh{ nullptr }; Button* m_button_ensure{ nullptr }; ScalableButton * m_rename_button{nullptr}; diff --git a/src/slic3r/GUI/StatusPanel.cpp b/src/slic3r/GUI/StatusPanel.cpp index 92c1720b2..0ed8b4187 100644 --- a/src/slic3r/GUI/StatusPanel.cpp +++ b/src/slic3r/GUI/StatusPanel.cpp @@ -2012,7 +2012,9 @@ void StatusPanel::update_ams(MachineObject *obj) } if (m_filament_setting_dlg) { m_filament_setting_dlg->obj = obj; } - bool is_none_ams_mode = false; + bool is_support_extrusion_cali = obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI); + bool is_support_virtual_tray = obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY); + bool is_support_filament_backup = obj->is_function_supported(PrinterFunction::FUNC_FILAMENT_BACKUP); if (!obj || !obj->is_connected() @@ -2027,31 +2029,19 @@ void StatusPanel::update_ams(MachineObject *obj) last_ams_version = -1; 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_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, obj); - } - 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); - is_none_ams_mode = true; - //return; + show_ams_group(false, obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY), is_support_extrusion_cali, obj->is_support_filament_edit_virtual_tray); + m_ams_control->show_auto_refill(false); + } + else { + + show_ams_group(true, obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY), is_support_extrusion_cali, obj->is_support_filament_edit_virtual_tray); + m_ams_control->show_auto_refill(is_support_filament_backup); + if(is_support_filament_backup) m_ams_control->show_auto_refill(obj->ams_auto_switch_filament_flag); } - bool is_support_extrusion_cali = obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI); - bool is_support_virtual_tray = obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY); - bool is_support_filament_backup = obj->is_function_supported(PrinterFunction::FUNC_FILAMENT_BACKUP); - m_ams_control->show_filament_backup(is_support_filament_backup); - - if (is_support_virtual_tray) { - m_ams_control->update_vams_kn_value(obj->vt_tray, obj); - } - - if (!is_none_ams_mode) { - show_ams_group(true, obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY), obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI), obj->is_support_filament_edit_virtual_tray); - } - + if (is_support_virtual_tray) m_ams_control->update_vams_kn_value(obj->vt_tray, obj); if (m_filament_setting_dlg) m_filament_setting_dlg->update(); std::vector ams_info; diff --git a/src/slic3r/GUI/Widgets/AMSControl.cpp b/src/slic3r/GUI/Widgets/AMSControl.cpp index b9798b99e..1e3bb18e8 100644 --- a/src/slic3r/GUI/Widgets/AMSControl.cpp +++ b/src/slic3r/GUI/Widgets/AMSControl.cpp @@ -1886,13 +1886,11 @@ AMSControl::AMSControl(wxWindow *parent, wxWindowID id, const wxPoint &pos, cons //backup tips - -#ifdef FILAMENT_BACKUP - auto m_ams_backup_tip = new Label(m_amswin, _L("Ams filament backup")); + m_ams_backup_tip = new Label(m_amswin, _L("Auto Refill")); m_ams_backup_tip->SetFont(::Label::Head_12); m_ams_backup_tip->SetForegroundColour(wxColour(0x00AE42)); m_ams_backup_tip->SetBackgroundColour(*wxWHITE); - auto m_img_ams_backup = new wxStaticBitmap(m_amswin, wxID_ANY, create_scaled_bitmap("automatic_material_renewal", this, 16), wxDefaultPosition, wxSize(FromDIP(16), FromDIP(16)), 0); + m_img_ams_backup = new wxStaticBitmap(m_amswin, wxID_ANY, create_scaled_bitmap("automatic_material_renewal", this, 16), wxDefaultPosition, wxSize(FromDIP(16), FromDIP(16)), 0); m_img_ams_backup->SetBackgroundColour(*wxWHITE); m_sizer_ams_tips->Add(0, 0, 1, wxEXPAND, 0); @@ -1907,11 +1905,8 @@ AMSControl::AMSControl(wxWindow *parent, wxWindowID id, const wxPoint &pos, cons m_ams_backup_tip->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {post_event(SimpleEvent(EVT_AMS_FILAMENT_BACKUP)); }); m_img_ams_backup->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {post_event(SimpleEvent(EVT_AMS_FILAMENT_BACKUP)); }); -#endif // FILAMENT_BACKUP - - //ams cans m_panel_can = new StaticBox(m_amswin, wxID_ANY, wxDefaultPosition, AMS_CANS_SIZE, wxBORDER_NONE); m_panel_can->SetMinSize(AMS_CANS_SIZE); @@ -2656,8 +2651,15 @@ void AMSControl::show_noams_mode(bool show, bool support_virtual_tray, bool supp } show?ExitNoneAMSMode() : EnterNoneAMSMode(support_vt_load); - if (simple_mode) - EnterSimpleMode(); + if (simple_mode)EnterSimpleMode(); +} + +void AMSControl::show_auto_refill(bool show) +{ + m_ams_backup_tip->Show(show); + m_img_ams_backup->Show(show); + m_amswin->Layout(); + m_amswin->Fit(); } void AMSControl::show_vams(bool show) @@ -2697,10 +2699,6 @@ void AMSControl::update_vams_kn_value(AmsTray tray, MachineObject* obj) m_vams_lib->Refresh(); } -void AMSControl::show_filament_backup(bool show) -{ -} - void AMSControl::reset_vams() { m_vams_lib->m_info.k = 0; @@ -2761,22 +2759,6 @@ void AMSControl::UpdateAms(std::vector info, bool keep_selection, bool } } - /*if (m_current_senect.empty() && info.size() > 0) { - if (curr_ams_id.empty()) { - SwitchAms(info[0].ams_id); - return; - } - - if (keep_selection) { - SwitchAms(curr_ams_id); - for (auto i = 0; i < m_ams_cans_list.GetCount(); i++) { - AmsCansWindow *cans = m_ams_cans_list[i]; - if (i < info.size()) { cans->amsCans->SelectCan(curr_can_id); } - } - return; - } - }*/ - if ( m_current_show_ams.empty() && !is_reset ) { if (info.size() > 0) { SwitchAms(info[0].ams_id); diff --git a/src/slic3r/GUI/Widgets/AMSControl.hpp b/src/slic3r/GUI/Widgets/AMSControl.hpp index 29c01d47a..ff70ef223 100644 --- a/src/slic3r/GUI/Widgets/AMSControl.hpp +++ b/src/slic3r/GUI/Widgets/AMSControl.hpp @@ -13,7 +13,6 @@ #include #include -#define FILAMENT_BACKUP 1 #define AMS_CONTROL_BRAND_COLOUR wxColour(0, 174, 66) #define AMS_CONTROL_GRAY700 wxColour(107, 107, 107) #define AMS_CONTROL_GRAY800 wxColour(50, 58, 61) @@ -564,6 +563,7 @@ protected: wxBoxSizer* m_vams_sizer = {nullptr}; wxBoxSizer* m_sizer_vams_tips = {nullptr}; + Label* m_ams_backup_tip = {nullptr}; Caninfo m_vams_info; StaticBox* m_panel_virtual = {nullptr}; AMSLib* m_vams_lib = {nullptr}; @@ -583,6 +583,7 @@ protected: Button *m_button_extruder_feed = {nullptr}; Button *m_button_extruder_back = {nullptr}; wxStaticBitmap* m_button_ams_setting = {nullptr}; + wxStaticBitmap* m_img_ams_backup = {nullptr}; ScalableBitmap m_button_ams_setting_normal; ScalableBitmap m_button_ams_setting_hover; ScalableBitmap m_button_ams_setting_press; @@ -640,10 +641,10 @@ public: void Reset(); void show_noams_mode(bool show, bool support_virtual_tray, bool support_extrustion_cali, bool support_vt_load = false, bool simple_mode = false); + void show_auto_refill(bool show); void show_vams(bool show); void show_vams_kn_value(bool show); void update_vams_kn_value(AmsTray tray, MachineObject* obj); - void show_filament_backup(bool show); void reset_vams(); void post_event(wxEvent&& event);