From 93d0c59ed0692b7cfa3a7684e5d18f3157d6f0e7 Mon Sep 17 00:00:00 2001 From: "zhou.xu" Date: Thu, 13 Feb 2025 18:30:04 +0800 Subject: [PATCH] FIX:add "check_empty_project" api jira: none Change-Id: Ic0b0b558c8786749b1ac036b87dc08519002b17f --- src/slic3r/GUI/Plater.cpp | 1 + src/slic3r/GUI/SyncAmsInfoDialog.cpp | 49 ++++++++++++++++------------ src/slic3r/GUI/SyncAmsInfoDialog.hpp | 1 + 3 files changed, 31 insertions(+), 20 deletions(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index ed5f492dc..a8e55c263 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -2995,6 +2995,7 @@ void Sidebar::sync_ams_list(bool is_from_big_sync_btn) return; auto sync_result = m_sync_dlg->get_result(); if (!sync_result.is_same_printer) { + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "check error: sync_result.is_same_printer value is false"; return; } list2.resize(list.size()); diff --git a/src/slic3r/GUI/SyncAmsInfoDialog.cpp b/src/slic3r/GUI/SyncAmsInfoDialog.cpp index fd8036a39..b64141df4 100644 --- a/src/slic3r/GUI/SyncAmsInfoDialog.cpp +++ b/src/slic3r/GUI/SyncAmsInfoDialog.cpp @@ -284,6 +284,7 @@ void SyncAmsInfoDialog::deal_ok() if (m_input_info.connected_printer && !m_is_empty_project) { if (m_map_mode == MapModeEnum::Override || !m_result.is_same_printer) { m_is_empty_project = true; + m_result.direct_sync = true; return; } m_result.direct_sync = false; @@ -317,9 +318,13 @@ bool SyncAmsInfoDialog::is_need_show() if (!m_input_info.connected_printer) { return true; } + check_empty_project(); if (m_is_empty_project && !is_dirty_filament()) { return false; } + auto mode =PageType::ptColorMap; + update_panel_status(mode); + update_when_change_map_mode(mode); return true; } @@ -698,20 +703,7 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) : //m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(11)); auto &bSizer = m_sizer_main; { // content - GUI::PartPlateList &plate_list = wxGetApp().plater()->get_partplate_list(); - GUI::PartPlate * curr_plate = GUI::wxGetApp().plater()->get_partplate_list().get_selected_plate(); - m_is_empty_project = true; - m_plate_number_choices_str.clear(); - for (size_t i = 0; i < plate_list.get_plate_count(); i++) { - auto temp_plate = GUI::wxGetApp().plater()->get_partplate_list().get_plate(i); - if (!temp_plate->get_objects_on_this_plate().empty()) { - if (m_is_empty_project) { - m_is_empty_project = false; - } - m_plate_number_choices_str.Add(i < 10 ? ("0" + std::to_wstring(i + 1)) : std::to_wstring(i)); - m_plate_choices.emplace_back(i); - } - } + check_empty_project(); if (m_is_empty_project == false) { //use map mode m_mode_combox_sizer = new wxBoxSizer(wxHORIZONTAL); @@ -728,12 +720,6 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) : m_override_btn->Bind(wxEVT_BUTTON, &SyncAmsInfoDialog::update_when_change_map_mode,this); bSizer->Add(m_mode_combox_sizer, FromDIP(0), wxEXPAND | wxALIGN_LEFT | wxTOP, FromDIP(10)); - m_specify_plate_idx = GUI::wxGetApp().plater()->get_partplate_list().get_curr_plate_index(); - - bool not_exist = std::find(m_plate_choices.begin(), m_plate_choices.end(), m_specify_plate_idx) == m_plate_choices.end(); - if (not_exist) { - m_specify_plate_idx = m_plate_choices[0]; - } } } @@ -1380,6 +1366,29 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) : wxGetApp().UpdateDlgDarkUI(this); } +void SyncAmsInfoDialog::check_empty_project() +{ + GUI::PartPlateList &plate_list = wxGetApp().plater()->get_partplate_list(); + GUI::PartPlate * curr_plate = GUI::wxGetApp().plater()->get_partplate_list().get_selected_plate(); + m_is_empty_project = true; + m_plate_number_choices_str.clear(); + for (size_t i = 0; i < plate_list.get_plate_count(); i++) { + auto temp_plate = GUI::wxGetApp().plater()->get_partplate_list().get_plate(i); + if (!temp_plate->get_objects_on_this_plate().empty()) { + if (m_is_empty_project) { m_is_empty_project = false; } + m_plate_number_choices_str.Add(i < 10 ? ("0" + std::to_wstring(i + 1)) : std::to_wstring(i)); + m_plate_choices.emplace_back(i); + } + } + if (!m_is_empty_project) { + m_specify_plate_idx = GUI::wxGetApp().plater()->get_partplate_list().get_curr_plate_index(); + bool not_exist = std::find(m_plate_choices.begin(), m_plate_choices.end(), m_specify_plate_idx) == m_plate_choices.end(); + if (not_exist) { + m_specify_plate_idx = m_plate_choices[0]; + } + } +} + void SyncAmsInfoDialog::init_bind() { Bind(wxEVT_TIMER, &SyncAmsInfoDialog::on_timer, this); diff --git a/src/slic3r/GUI/SyncAmsInfoDialog.hpp b/src/slic3r/GUI/SyncAmsInfoDialog.hpp index c8fd67446..2be9f9f63 100644 --- a/src/slic3r/GUI/SyncAmsInfoDialog.hpp +++ b/src/slic3r/GUI/SyncAmsInfoDialog.hpp @@ -169,6 +169,7 @@ protected: wxGridSizer *m_sizer_ams_mapping_right{nullptr}; public: + void check_empty_project(); void init_bind(); void init_timer(); void check_focus(wxWindow *window);