ENH: update ams mapping result after changing use_ams checkbox

popup axis tips after axis action

Change-Id: Iadae7e645d4718dc80264f5d1f98b16edcfb9cbb
This commit is contained in:
Stone Li 2022-09-05 09:59:31 +08:00 committed by Lane.Wei
parent ee16e75a9c
commit 93b26be024
2 changed files with 32 additions and 20 deletions

View File

@ -1103,7 +1103,7 @@ wxWindow *SelectMachineDialog::create_ams_checkbox(wxString title, wxWindow *par
checkbox->SetToolTip(tooltip);
text->SetToolTip(tooltip);
text->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &) {
text->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent & event) {
ams_check->SetValue(ams_check->GetValue() ? false : true);
});
return checkbox;
@ -1200,6 +1200,16 @@ void SelectMachineDialog::finish_mode()
void SelectMachineDialog::sync_ams_mapping_result(std::vector<FilamentInfo> &result)
{
if (result.empty()) {
BOOST_LOG_TRIVIAL(trace) << "ams_mapping result is empty";
for (auto it = m_materialList.begin(); it != m_materialList.end(); it++) {
wxString ams_id = "-";
wxColour ams_col = wxColour(0xCE, 0xCE, 0xCE);
it->second->item->set_ams_info(ams_col, ams_id);
}
return;
}
for (auto f = result.begin(); f != result.end(); f++) {
BOOST_LOG_TRIVIAL(trace) << "ams_mapping f id = " << f->id << ", tray_id = " << f->tray_id << ", color = " << f->color << ", type = " << f->type;
@ -1470,7 +1480,7 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt
Enable_Refresh_Button(true);
} else if (status == PrintDialogStatus::PrintStatusDisableAms) {
update_print_status_msg(wxEmptyString, false, false);
Enable_Send_Button(false);
Enable_Send_Button(true);
Enable_Refresh_Button(true);
} else if (status == PrintDialogStatus::PrintStatusNeedUpgradingAms) {
wxString msg_text;
@ -2008,6 +2018,7 @@ void SelectMachineDialog::update_show_status()
if (obj_->ams_support_use_ams) {
if (!ams_check->GetValue()) {
m_ams_mapping_result.clear();
sync_ams_mapping_result(m_ams_mapping_result);
show_status(PrintDialogStatus::PrintStatusDisableAms);
return;
}
@ -2259,7 +2270,7 @@ void SelectMachineDialog::set_default()
pos.y += item->GetRect().height;
m_mapping_popup.Position(pos, wxSize(0, 0));
if (obj_ && obj_->has_ams()) {
if (obj_ && obj_->has_ams() && ams_check->GetValue()) {
m_mapping_popup.set_current_filament_id(extruder);
m_mapping_popup.set_tag_texture(materials[extruder]);
m_mapping_popup.update_ams_data(obj_->amsList);

View File

@ -1950,6 +1950,15 @@ void StatusPanel::reset_printing_values()
void StatusPanel::on_axis_ctrl_xy(wxCommandEvent &event)
{
if (!obj) return;
if (event.GetInt() == 0) { obj->command_axis_control("Y", 1.0, 10.0f, 3000); }
if (event.GetInt() == 1) { obj->command_axis_control("X", 1.0, -10.0f, 3000); }
if (event.GetInt() == 2) { obj->command_axis_control("Y", 1.0, -10.0f, 3000); }
if (event.GetInt() == 3) { obj->command_axis_control("X", 1.0, 10.0f, 3000); }
if (event.GetInt() == 4) { obj->command_axis_control("Y", 1.0, 1.0f, 3000); }
if (event.GetInt() == 5) { obj->command_axis_control("X", 1.0, -1.0f, 3000); }
if (event.GetInt() == 6) { obj->command_axis_control("Y", 1.0, -1.0f, 3000); }
if (event.GetInt() == 7) { obj->command_axis_control("X", 1.0, 1.0f, 3000); }
if (event.GetInt() == 8) { obj->command_go_home(); }
//check is at home
if (event.GetInt() == 1
@ -1961,25 +1970,17 @@ void StatusPanel::on_axis_ctrl_xy(wxCommandEvent &event)
show_recenter_dialog();
return;
}
} else if (event.GetInt() == 0
|| event.GetInt() == 2
|| event.GetInt() == 4
|| event.GetInt() == 6) {
}
else if (event.GetInt() == 0
|| event.GetInt() == 2
|| event.GetInt() == 4
|| event.GetInt() == 6) {
if (!obj->is_axis_at_home("Y")) {
BOOST_LOG_TRIVIAL(info) << "axis y is not at home";
show_recenter_dialog();
return;
}
}
if (event.GetInt() == 0) { obj->command_axis_control("Y", 1.0, 10.0f, 3000); }
if (event.GetInt() == 1) { obj->command_axis_control("X", 1.0, -10.0f, 3000); }
if (event.GetInt() == 2) { obj->command_axis_control("Y", 1.0, -10.0f, 3000); }
if (event.GetInt() == 3) { obj->command_axis_control("X", 1.0, 10.0f, 3000); }
if (event.GetInt() == 4) { obj->command_axis_control("Y", 1.0, 1.0f, 3000); }
if (event.GetInt() == 5) { obj->command_axis_control("X", 1.0, -1.0f, 3000); }
if (event.GetInt() == 6) { obj->command_axis_control("Y", 1.0, -1.0f, 3000); }
if (event.GetInt() == 7) { obj->command_axis_control("X", 1.0, 1.0f, 3000); }
if (event.GetInt() == 8) { obj->command_go_home(); }
}
bool StatusPanel::check_axis_z_at_home(MachineObject* obj)
@ -1998,36 +1999,36 @@ bool StatusPanel::check_axis_z_at_home(MachineObject* obj)
void StatusPanel::on_axis_ctrl_z_up_10(wxCommandEvent &event)
{
if (obj) {
obj->command_axis_control("Z", 1.0, -10.0f, 900);
if (!check_axis_z_at_home(obj))
return;
obj->command_axis_control("Z", 1.0, -10.0f, 900);
}
}
void StatusPanel::on_axis_ctrl_z_up_1(wxCommandEvent &event)
{
if (obj) {
obj->command_axis_control("Z", 1.0, -1.0f, 900);
if (!check_axis_z_at_home(obj))
return;
obj->command_axis_control("Z", 1.0, -1.0f, 900);
}
}
void StatusPanel::on_axis_ctrl_z_down_1(wxCommandEvent &event)
{
if (obj) {
obj->command_axis_control("Z", 1.0, 1.0f, 900);
if (!check_axis_z_at_home(obj))
return;
obj->command_axis_control("Z", 1.0, 1.0f, 900);
}
}
void StatusPanel::on_axis_ctrl_z_down_10(wxCommandEvent &event)
{
if (obj) {
obj->command_axis_control("Z", 1.0, 10.0f, 900);
if (!check_axis_z_at_home(obj))
return;
obj->command_axis_control("Z", 1.0, 10.0f, 900);
}
}