Fix of Physical Printer Dialog #9695
This commit is contained in:
parent
e2045a60ee
commit
2125996837
1 changed files with 4 additions and 3 deletions
|
@ -462,7 +462,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
|
||||||
choice->set_selection();
|
choice->set_selection();
|
||||||
}
|
}
|
||||||
|
|
||||||
update();
|
update(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicalPrinterDialog::update_printhost_buttons()
|
void PhysicalPrinterDialog::update_printhost_buttons()
|
||||||
|
@ -632,11 +632,12 @@ void PhysicalPrinterDialog::update_host_type(bool printer_change)
|
||||||
|
|
||||||
Choice* choice = dynamic_cast<Choice*>(ht);
|
Choice* choice = dynamic_cast<Choice*>(ht);
|
||||||
choice->set_values(types);
|
choice->set_values(types);
|
||||||
int index_in_choice = (printer_change ? 0 : last_in_conf);
|
int dif = (int)ht->m_opt.enum_def->values().size() - (int)types.size();
|
||||||
|
int index_in_choice = (printer_change ? std::clamp(last_in_conf - ((int)ht->m_opt.enum_def->values().size() - (int)types.size()), 0, (int)ht->m_opt.enum_def->values().size() - 1) : last_in_conf);
|
||||||
choice->set_value(index_in_choice);
|
choice->set_value(index_in_choice);
|
||||||
if (link.supported && link.label == _(ht->m_opt.enum_def->label(index_in_choice)))
|
if (link.supported && link.label == _(ht->m_opt.enum_def->label(index_in_choice)))
|
||||||
m_config->set_key_value("host_type", new ConfigOptionEnum<PrintHostType>(htPrusaLink));
|
m_config->set_key_value("host_type", new ConfigOptionEnum<PrintHostType>(htPrusaLink));
|
||||||
else if (link.supported && link.label == _(ht->m_opt.enum_def->label(index_in_choice)))
|
else if (connect.supported && connect.label == _(ht->m_opt.enum_def->label(index_in_choice)))
|
||||||
m_config->set_key_value("host_type", new ConfigOptionEnum<PrintHostType>(htPrusaConnect));
|
m_config->set_key_value("host_type", new ConfigOptionEnum<PrintHostType>(htPrusaConnect));
|
||||||
else {
|
else {
|
||||||
int host_type = std::clamp(index_in_choice + ((int)ht->m_opt.enum_def->values().size() - (int)types.size()), 0, (int)ht->m_opt.enum_def->values().size() - 1);
|
int host_type = std::clamp(index_in_choice + ((int)ht->m_opt.enum_def->values().size() - (int)types.size()), 0, (int)ht->m_opt.enum_def->values().size() - 1);
|
||||||
|
|
Loading…
Add table
Reference in a new issue