FIX:add "check_empty_project" api

jira: none
Change-Id: Ic0b0b558c8786749b1ac036b87dc08519002b17f
This commit is contained in:
zhou.xu 2025-02-13 18:30:04 +08:00 committed by lane.wei
parent 86e31adc76
commit 93d0c59ed0
3 changed files with 31 additions and 20 deletions

View File

@ -2995,6 +2995,7 @@ void Sidebar::sync_ams_list(bool is_from_big_sync_btn)
return; return;
auto sync_result = m_sync_dlg->get_result(); auto sync_result = m_sync_dlg->get_result();
if (!sync_result.is_same_printer) { if (!sync_result.is_same_printer) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "check error: sync_result.is_same_printer value is false";
return; return;
} }
list2.resize(list.size()); list2.resize(list.size());

View File

@ -284,6 +284,7 @@ void SyncAmsInfoDialog::deal_ok()
if (m_input_info.connected_printer && !m_is_empty_project) { if (m_input_info.connected_printer && !m_is_empty_project) {
if (m_map_mode == MapModeEnum::Override || !m_result.is_same_printer) { if (m_map_mode == MapModeEnum::Override || !m_result.is_same_printer) {
m_is_empty_project = true; m_is_empty_project = true;
m_result.direct_sync = true;
return; return;
} }
m_result.direct_sync = false; m_result.direct_sync = false;
@ -317,9 +318,13 @@ bool SyncAmsInfoDialog::is_need_show()
if (!m_input_info.connected_printer) { if (!m_input_info.connected_printer) {
return true; return true;
} }
check_empty_project();
if (m_is_empty_project && !is_dirty_filament()) { if (m_is_empty_project && !is_dirty_filament()) {
return false; return false;
} }
auto mode =PageType::ptColorMap;
update_panel_status(mode);
update_when_change_map_mode(mode);
return true; return true;
} }
@ -698,20 +703,7 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) :
//m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(11)); //m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(11));
auto &bSizer = m_sizer_main; auto &bSizer = m_sizer_main;
{ // content { // content
GUI::PartPlateList &plate_list = wxGetApp().plater()->get_partplate_list(); check_empty_project();
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 == false) { if (m_is_empty_project == false) {
//use map mode //use map mode
m_mode_combox_sizer = new wxBoxSizer(wxHORIZONTAL); 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); 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)); 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); 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() void SyncAmsInfoDialog::init_bind()
{ {
Bind(wxEVT_TIMER, &SyncAmsInfoDialog::on_timer, this); Bind(wxEVT_TIMER, &SyncAmsInfoDialog::on_timer, this);

View File

@ -169,6 +169,7 @@ protected:
wxGridSizer *m_sizer_ams_mapping_right{nullptr}; wxGridSizer *m_sizer_ams_mapping_right{nullptr};
public: public:
void check_empty_project();
void init_bind(); void init_bind();
void init_timer(); void init_timer();
void check_focus(wxWindow *window); void check_focus(wxWindow *window);