ENH:Optimize the case with only external components

jira: STUDIO-9989
Change-Id: I7be626e8c86f684029a4c34fc8b800b880fe1fcd
This commit is contained in:
zhou.xu 2025-03-07 09:53:57 +08:00 committed by lane.wei
parent 519797ef19
commit 1ea13f9846
4 changed files with 57 additions and 15 deletions

View File

@ -711,6 +711,7 @@ public:
std::chrono::system_clock::time_point extrusion_cali_set_hold_start;
std::string extrusion_cali_filament_name;
bool only_exist_ext_spool() { return amsList.empty(); }
bool is_in_extrusion_cali();
bool is_extrusion_cali_finished();
void _parse_tray_now(std::string tray_now);

View File

@ -3025,6 +3025,7 @@ void Sidebar::sync_ams_list(bool is_from_big_sync_btn)
}
int dlg_res{(int) wxID_CANCEL};
if (m_sync_dlg->is_need_show()) {
m_sync_dlg->deal_only_exist_ext_spool(obj);
if (m_sync_dlg->is_dirty_filament()) {
wxGetApp().get_tab(Preset::TYPE_FILAMENT)->select_preset(wxGetApp().preset_bundle->filament_presets[0], false, "", false, true);
wxGetApp().preset_bundle->export_selections(*wxGetApp().app_config);
@ -3265,6 +3266,7 @@ void Sidebar::deal_btn_sync() {
}
void Sidebar::pop_sync_nozzle_and_ams_dialog() {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " begin pop_sync_nozzle_and_ams_dialog";
wxTheApp->CallAfter([this]() {
SyncNozzleAndAmsDialog::InputInfo temp_na_info;
wxPoint big_btn_pt;

View File

@ -1340,6 +1340,7 @@ bool SyncAmsInfoDialog::do_ams_mapping(MachineObject *obj_)
BOOST_LOG_TRIVIAL(info) << "ams_mapping_array2=" << ams_array2;
BOOST_LOG_TRIVIAL(info) << "ams_mapping_info=" << mapping_info;
}
deal_only_exist_ext_spool(obj_);
show_thumbnail_page();
return obj_->is_valid_mapping_result(m_ams_mapping_result);
} else {
@ -1354,6 +1355,7 @@ bool SyncAmsInfoDialog::do_ams_mapping(MachineObject *obj_)
}
}
sync_ams_mapping_result(m_ams_mapping_result);
deal_only_exist_ext_spool(obj_);
show_thumbnail_page();
return is_valid;
}
@ -1361,6 +1363,27 @@ bool SyncAmsInfoDialog::do_ams_mapping(MachineObject *obj_)
return true;
}
void SyncAmsInfoDialog::deal_only_exist_ext_spool(MachineObject *obj_) {
if (!obj_)
return;
if (!m_append_color_text) { return; }
bool only_exist_ext_spool_flag = m_only_exist_ext_spool_flag = obj_->only_exist_ext_spool();
auto temp_str = only_exist_ext_spool_flag ? "" : "AMS ";
SetTitle(wxString::Format(_L("Synchronize %sFilament Information"), temp_str));
m_append_color_text->SetLabel(wxString::Format(_L("Unused %sfilaments should also be added to the filament list."), temp_str));
if (m_map_mode == MapModeEnum::ColorMap) {
m_tip_attention_color_map = wxString::Format(_L("Only synchronize filament type and color, not including %sslot information."), temp_str);
m_tip_text->SetLabel(m_tip_attention_color_map);
}
if (m_ams_or_ext_text_in_colormap) {
m_ams_or_ext_text_in_colormap->SetLabel((only_exist_ext_spool_flag ? _L("Ext spool") : _L("AMS")) + ":");
}
if (m_ams_or_ext_text_in_override) {
m_ams_or_ext_text_in_override->SetLabel((only_exist_ext_spool_flag ? _L("Ext spool") : _L("AMS")) + ":");
}
}
void SyncAmsInfoDialog::show_thumbnail_page()
{
m_pages->ChangeSelection(1);
@ -2881,15 +2904,19 @@ void SyncAmsInfoDialog::reset_and_sync_ams_list()
wxBoxSizer *ams_tip_sizer = new wxBoxSizer(wxVERTICAL);
if (is_first_row) {
is_first_row = false;
auto tip0_text = new wxStaticText(m_filament_panel, wxID_ANY, _CTX(L_CONTEXT("Original", "Sync_AMS"), "Sync_AMS") + ":");
tip0_text->SetForegroundColour(wxColour(107, 107, 107, 100));
tip0_text->SetFont(::Label::Head_12);
ams_tip_sizer->Add(tip0_text, 0, wxALIGN_LEFT | wxTOP, FromDIP(6));
if (!m_original_in_colormap) {
m_original_in_colormap = new wxStaticText(m_filament_panel, wxID_ANY, _CTX(L_CONTEXT("Original", "Sync_AMS"), "Sync_AMS") + ":");
m_original_in_colormap->SetForegroundColour(wxColour(107, 107, 107, 100));
m_original_in_colormap->SetFont(::Label::Head_12);
}
ams_tip_sizer->Add(m_original_in_colormap, 0, wxALIGN_LEFT | wxTOP, FromDIP(6));
auto tip1_text = new wxStaticText(m_filament_panel, wxID_ANY, _L("AMS") + ":");
tip1_text->SetForegroundColour(wxColour(107, 107, 107, 100));
tip1_text->SetFont(::Label::Head_12);
ams_tip_sizer->Add(tip1_text, 0, wxALIGN_LEFT | wxTOP, FromDIP(9));
if (!m_ams_or_ext_text_in_colormap) {
m_ams_or_ext_text_in_colormap = new wxStaticText(m_filament_panel, wxID_ANY, _L("AMS") + ":");
m_ams_or_ext_text_in_colormap->SetForegroundColour(wxColour(107, 107, 107, 100));
m_ams_or_ext_text_in_colormap->SetFont(::Label::Head_12);
}
ams_tip_sizer->Add(m_ams_or_ext_text_in_colormap, 0, wxALIGN_LEFT | wxTOP, FromDIP(9));
}
m_sizer_ams_mapping->Add(ams_tip_sizer, 0, wxALIGN_LEFT | wxTOP, FromDIP(2));
contronal_index++;
@ -3085,13 +3112,20 @@ void SyncAmsInfoDialog::generate_override_fix_ams_list()
wxBoxSizer *ams_tip_sizer = new wxBoxSizer(wxVERTICAL);
if (is_first_row) {
is_first_row = false;
auto tip0_text = new wxStaticText(m_fix_filament_panel, wxID_ANY, _CTX(L_CONTEXT("Original", "Sync_AMS"), "Sync_AMS"));
tip0_text->SetForegroundColour(wxColour(107, 107, 107, 100));
ams_tip_sizer->Add(tip0_text, 0, wxALIGN_LEFT | wxTOP, FromDIP(2));
if (!m_original_in_override) {
m_original_in_override = new wxStaticText(m_fix_filament_panel, wxID_ANY, _CTX(L_CONTEXT("Original", "Sync_AMS"), "Sync_AMS") + ":");
m_original_in_override->SetForegroundColour(wxColour(107, 107, 107, 100));
m_original_in_override->SetFont(::Label::Head_12);
}
ams_tip_sizer->Add(m_original_in_override, 0, wxALIGN_LEFT | wxTOP, FromDIP(6));
auto tip1_text = new wxStaticText(m_fix_filament_panel, wxID_ANY, _L("AMS"));
tip1_text->SetForegroundColour(wxColour(107, 107, 107, 100));
ams_tip_sizer->Add(tip1_text, 0, wxALIGN_LEFT | wxTOP, FromDIP(6));
if (!m_ams_or_ext_text_in_override) {
auto text = (m_only_exist_ext_spool_flag ? _L("Ext spool") : _L("AMS")) + ":";
m_ams_or_ext_text_in_override = new wxStaticText(m_fix_filament_panel, wxID_ANY, text);
m_ams_or_ext_text_in_override->SetForegroundColour(wxColour(107, 107, 107, 100));
m_ams_or_ext_text_in_override->SetFont(::Label::Head_12);
}
ams_tip_sizer->Add(m_ams_or_ext_text_in_override, 0, wxALIGN_LEFT | wxTOP, FromDIP(9));
}
m_fix_sizer_ams_mapping->Add(ams_tip_sizer, 0, wxALIGN_LEFT | wxTOP, FromDIP(2));
contronal_index++;

View File

@ -18,6 +18,7 @@ class CapsuleButton;
class SyncAmsInfoDialog : public DPIDialog
{
enum PageType { ptColorMap = 0, ptOverride };
bool m_only_exist_ext_spool_flag{false};
int m_current_filament_id{0};
int m_print_plate_idx{0};
int m_print_plate_total{0};
@ -87,7 +88,10 @@ protected:
Label * m_statictext_ams_msg{nullptr};
Label * m_text_printer_msg{nullptr};
wxStaticText * m_staticText_bed_title{nullptr};
wxStaticText * m_stext_sending{nullptr};
wxStaticText * m_original_in_colormap{nullptr};
wxStaticText * m_original_in_override{nullptr};
wxStaticText * m_ams_or_ext_text_in_colormap{nullptr};
wxStaticText * m_ams_or_ext_text_in_override{nullptr};
wxTimer * m_refresh_timer{nullptr};
ScalableBitmap * ams_mapping_help_icon{nullptr};
@ -208,6 +212,7 @@ public:
int update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name, std::string file_path);
void set_print_type(PrintFromType type) { m_print_type = type; };
bool do_ams_mapping(MachineObject *obj_);
void deal_only_exist_ext_spool(MachineObject *obj_);
void show_thumbnail_page();
bool get_ams_mapping_result(std::string &mapping_array_str, std::string &mapping_array_str2, std::string &ams_mapping_info);
bool build_nozzles_info(std::string &nozzles_info);