FIX: 1. add auto sync on connect printer

2. remove printer list in prepare page
jira: none

Change-Id: Iab4009c5249663f309221d3fcc02e0bd676e554b
(cherry picked from commit 19e8ab26481cfcc9b81dded0bc91c5075c940012)
This commit is contained in:
zhimin.zeng 2025-01-16 12:11:13 +08:00 committed by Noisyfox
parent 125ab80729
commit ea06ea32f9
4 changed files with 23 additions and 21 deletions

View file

@ -301,6 +301,7 @@ void MonitorPanel::on_update_all(wxMouseEvent &event)
obj_->reset_pa_cali_history_result();
obj_->reset_pa_cali_result();
GUI::wxGetApp().sidebar().load_ams_list(obj_->dev_id, obj_);
GUI::wxGetApp().sidebar().auto_sync_extruder_list_on_connect_priner(obj_);
}
Layout();

View file

@ -1120,7 +1120,7 @@ bool Sidebar::priv::sync_extruder_list()
printer_tab->set_extruder_volume_type(0, NozzleVolumeType::nvtHighFlow);
printer_tab->set_extruder_volume_type(1, NozzleVolumeType::nvtStandard);
MachineObject *obj = wxGetApp().getDeviceManager()->get_selected_machine();
if (obj == nullptr || !obj->is_info_ready(false)) {
if (obj == nullptr) {
MessageDialog dlg(this->plater, _L("Please select a printer in 'Device' page first."), _L("Sync extruder infomation"), wxOK);
dlg.ShowModal();
return false;
@ -2626,30 +2626,31 @@ bool Sidebar::sync_extruder_list()
return p->sync_extruder_list();
}
bool Sidebar::auto_sync_extruder_list_on_connect_priner(const MachineObject *obj)
{
if(!obj)
return false;
std::string machine_print_name = obj->printer_type;
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
std::string target_model_id = preset_bundle->printers.get_selected_preset().get_printer_type(preset_bundle);
if (machine_print_name != target_model_id) {
return false;
}
if (preset_bundle->get_printer_extruder_count() <= 1)
return false;
return p->sync_extruder_list();
}
void Sidebar::update_sync_status(const MachineObject *obj)
{
p->update_sync_status(obj);
}
bool Sidebar::should_sync_extruder_list(MachineObject *obj)
{
if (obj && obj->is_connected() && obj->is_multi_extruders() && wxGetApp().plater()->is_multi_extruder_ams_empty()) {
std::string machine_print_name = obj->printer_type;
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
std::string target_model_id = preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle);
if (machine_print_name == target_model_id) {
return true;
}
}
return false;
}
void Sidebar::load_ams_list(std::string const &device, MachineObject* obj)
{
// Remove auto sync
//if (should_sync_extruder_list(obj))
// sync_extruder_list();
std::map<int, DynamicPrintConfig> filament_ams_list = build_filament_ams_list(obj);
p->ams_list_device = device;

View file

@ -168,7 +168,7 @@ public:
std::map<int, DynamicPrintConfig> build_filament_ams_list(MachineObject* obj);
void sync_ams_list();
bool sync_extruder_list();
bool should_sync_extruder_list(MachineObject* obj);
bool auto_sync_extruder_list_on_connect_priner(const MachineObject* obj);
void update_sync_status(const MachineObject* obj);
// Orca
void show_SEMM_buttons(bool bshow);

View file

@ -1184,8 +1184,8 @@ void PlaterPresetComboBox::update()
//if (i + 1 == m_collection->num_default_presets())
// set_label_marker(Append(separator(L("System presets")), wxNullBitmap));
}
if (m_type == Preset::TYPE_PRINTER)
add_connected_printers("", true);
//if (m_type == Preset::TYPE_PRINTER)
// add_connected_printers("", true);
if (m_type == Preset::TYPE_FILAMENT && m_preset_bundle->is_bbl_vendor()) {
set_replace_text("Bambu", "BambuStudioBlack");