FIX: Bed type display

jira: none

Change-Id: Ibac2a7a80d6841ebea639e0a58547413df6f5c74
This commit is contained in:
hang.xu 2024-08-16 11:50:18 +08:00 committed by lane.wei
parent 6fb06eb779
commit 2c3fa062c9
1 changed files with 22 additions and 15 deletions

View File

@ -4958,28 +4958,35 @@ bool SelectMachineDialog::Show(bool show)
{
show_status(PrintDialogStatus::PrintStatusInit);
const ConfigOptionDef* bed_type_def = print_config_def.get("curr_bed_type");
PresetBundle& preset_bundle = *wxGetApp().preset_bundle;
auto cur_preset_name = preset_bundle.printers.get_edited_preset().name;
auto name = wxGetApp().app_config->get_section("user_bed_type_list");
std::string plate_name = "";
for (auto it : name) {
if (it.first == cur_preset_name) {
plate_name = it.second;
break;
}
}
if (bed_type_def != nullptr){
for (auto it : bed_type_def->enum_labels) {
if (it.find(plate_name) != std::string::npos) {
plate_name = it;
if (wxGetApp().app_config->has_section("user_bed_type_list")) {
std::string plate_name = "";
auto name = wxGetApp().app_config->get_section("user_bed_type_list");
for (auto it : name) {
if (it.first == cur_preset_name) {
plate_name = it.second;
break;
}
}
const ConfigOptionDef* bed_type_def = print_config_def.get("curr_bed_type");
if (bed_type_def != nullptr) {
for (auto it : bed_type_def->enum_labels) {
if (it.find(plate_name) != std::string::npos) {
plate_name = it;
break;
}
}
}
plate_name = "Plate: " + plate_name;
m_text_bed_type->SetLabelText(plate_name);
m_text_bed_type->Show();
}
else{
m_text_bed_type->Hide();
}
plate_name = "Plate: " + plate_name;
m_text_bed_type->SetLabelText(plate_name);
// set default value when show this dialog
if (show) {