Correct updating of "Machine limits" and "Single extruder MM setup" pages

This commit is contained in:
YuSanka 2018-06-25 16:03:43 +02:00
parent b5f97baa28
commit f9b85b6700
2 changed files with 9 additions and 4 deletions

View file

@ -1634,7 +1634,7 @@ void TabPrinter::build()
if (opt_key.compare("silent_mode") == 0) {
bool val = boost::any_cast<bool>(value);
if (m_use_silent_mode != val) {
m_rebuil_kinematics_page = true;
m_rebuild_kinematics_page = true;
m_use_silent_mode = val;
}
}
@ -1798,7 +1798,7 @@ void TabPrinter::build_extruder_pages()
size_t existed_page = 0;
for (int i = n_before_extruders; i < m_pages.size(); ++i) // first make sure it's not there already
if (m_pages[i]->title().find(_(L("Machine limits"))) != std::string::npos) {
if (!is_marlin_flavor || m_rebuil_kinematics_page)
if (!is_marlin_flavor || m_rebuild_kinematics_page)
m_pages.erase(m_pages.begin() + i);
else
existed_page = i;
@ -1922,6 +1922,10 @@ void TabPrinter::update(){
bool is_marlin_flavor = m_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value == gcfMarlin;
get_field("silent_mode")->toggle(is_marlin_flavor);
if (m_use_silent_mode != m_config->opt_bool("silent_mode")) {
m_rebuild_kinematics_page = true;
m_use_silent_mode = m_config->opt_bool("silent_mode");
}
for (size_t i = 0; i < m_extruders_count; ++i) {
bool have_retract_length = m_config->opt_float("retract_length", i) > 0;
@ -2039,7 +2043,8 @@ void Tab::rebuild_page_tree()
auto itemId = m_treectrl->AppendItem(rootItem, p->title(), p->iconID());
m_treectrl->SetItemTextColour(itemId, p->get_item_colour());
if (p->title() == selected) {
m_disable_tree_sel_changed_event = 1;
if (!(p->title() == _(L("Machine limits")) || p->title() == _(L("Single extruder MM setup")))) // These Pages have to be updated inside OnTreeSelChange
m_disable_tree_sel_changed_event = 1;
m_treectrl->SelectItem(itemId);
m_disable_tree_sel_changed_event = 0;
have_selection = 1;

View file

@ -315,7 +315,7 @@ class TabPrinter : public Tab
bool m_has_single_extruder_MM_page = false;
bool m_use_silent_mode = false;
void append_option_line(ConfigOptionsGroupShp optgroup, const std::string opt_key);
bool m_rebuil_kinematics_page = false;
bool m_rebuild_kinematics_page = false;
public:
wxButton* m_serial_test_btn;
wxButton* m_octoprint_host_test_btn;