Fix of #1801
This commit is contained in:
parent
84f22ed50b
commit
5bc20401cd
2 changed files with 24 additions and 15 deletions
|
@ -656,6 +656,7 @@ void Tab::load_config(const DynamicPrintConfig& config)
|
||||||
bool modified = 0;
|
bool modified = 0;
|
||||||
for(auto opt_key : m_config->diff(config)) {
|
for(auto opt_key : m_config->diff(config)) {
|
||||||
m_config->set_key_value(opt_key, config.option(opt_key)->clone());
|
m_config->set_key_value(opt_key, config.option(opt_key)->clone());
|
||||||
|
m_dirty_options.emplace(opt_key);
|
||||||
modified = 1;
|
modified = 1;
|
||||||
}
|
}
|
||||||
if (modified) {
|
if (modified) {
|
||||||
|
@ -738,17 +739,7 @@ void Tab::load_key_value(const std::string& opt_key, const boost::any& value, bo
|
||||||
|
|
||||||
void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
|
void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
|
||||||
{
|
{
|
||||||
wxCommandEvent event(EVT_TAB_VALUE_CHANGED);
|
m_dirty_options.erase(opt_key);
|
||||||
event.SetEventObject(this);
|
|
||||||
event.SetString(opt_key);
|
|
||||||
if (opt_key == "extruders_count")
|
|
||||||
{
|
|
||||||
int val = boost::any_cast<size_t>(value);
|
|
||||||
event.SetInt(val);
|
|
||||||
}
|
|
||||||
|
|
||||||
wxPostEvent(this, event);
|
|
||||||
|
|
||||||
|
|
||||||
ConfigOptionsGroup* og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params(supports_printer_technology(ptFFF));
|
ConfigOptionsGroup* og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params(supports_printer_technology(ptFFF));
|
||||||
if (opt_key == "fill_density" || opt_key == "supports_enable" || opt_key == "pad_enable")
|
if (opt_key == "fill_density" || opt_key == "supports_enable" || opt_key == "pad_enable")
|
||||||
|
@ -775,6 +766,21 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
|
||||||
update_wiping_button_visibility();
|
update_wiping_button_visibility();
|
||||||
|
|
||||||
update();
|
update();
|
||||||
|
|
||||||
|
// Post event to the Plater after updating of the all dirty options
|
||||||
|
// It helps to avoid needless schedule_background_processing
|
||||||
|
if (update_completed()) {
|
||||||
|
wxCommandEvent event(EVT_TAB_VALUE_CHANGED);
|
||||||
|
event.SetEventObject(this);
|
||||||
|
event.SetString(opt_key);
|
||||||
|
if (opt_key == "extruders_count")
|
||||||
|
{
|
||||||
|
const int val = boost::any_cast<size_t>(value);
|
||||||
|
event.SetInt(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxPostEvent(this, event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show/hide the 'purging volumes' button
|
// Show/hide the 'purging volumes' button
|
||||||
|
@ -1150,8 +1156,8 @@ void TabPrint::update()
|
||||||
// KillFocus() for the wxSpinCtrl use CallAfter function. So,
|
// KillFocus() for the wxSpinCtrl use CallAfter function. So,
|
||||||
// to except the duplicate call of the update() after dialog->ShowModal(),
|
// to except the duplicate call of the update() after dialog->ShowModal(),
|
||||||
// let check if this process is already started.
|
// let check if this process is already started.
|
||||||
if (is_msg_dlg_already_exist)
|
// if (is_msg_dlg_already_exist) // ! It looks like a fixed problem after start to using of a m_dirty_options
|
||||||
return;
|
// return; // ! TODO Let delete this part of code after a common aplication testing
|
||||||
|
|
||||||
Freeze();
|
Freeze();
|
||||||
|
|
||||||
|
@ -1168,7 +1174,7 @@ void TabPrint::update()
|
||||||
"- no ensure_vertical_shell_thickness\n"
|
"- no ensure_vertical_shell_thickness\n"
|
||||||
"\nShall I adjust those settings in order to enable Spiral Vase?"));
|
"\nShall I adjust those settings in order to enable Spiral Vase?"));
|
||||||
auto dialog = new wxMessageDialog(parent(), msg_text, _(L("Spiral Vase")), wxICON_WARNING | wxYES | wxNO);
|
auto dialog = new wxMessageDialog(parent(), msg_text, _(L("Spiral Vase")), wxICON_WARNING | wxYES | wxNO);
|
||||||
is_msg_dlg_already_exist = true;
|
// is_msg_dlg_already_exist = true;
|
||||||
DynamicPrintConfig new_conf = *m_config;
|
DynamicPrintConfig new_conf = *m_config;
|
||||||
if (dialog->ShowModal() == wxID_YES) {
|
if (dialog->ShowModal() == wxID_YES) {
|
||||||
new_conf.set_key_value("perimeters", new ConfigOptionInt(1));
|
new_conf.set_key_value("perimeters", new ConfigOptionInt(1));
|
||||||
|
@ -1184,7 +1190,7 @@ void TabPrint::update()
|
||||||
}
|
}
|
||||||
load_config(new_conf);
|
load_config(new_conf);
|
||||||
on_value_change("fill_density", fill_density);
|
on_value_change("fill_density", fill_density);
|
||||||
is_msg_dlg_already_exist = false;
|
// is_msg_dlg_already_exist = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_config->opt_bool("wipe_tower") && m_config->opt_bool("support_material") &&
|
if (m_config->opt_bool("wipe_tower") && m_config->opt_bool("support_material") &&
|
||||||
|
|
|
@ -203,6 +203,8 @@ protected:
|
||||||
|
|
||||||
void set_type();
|
void set_type();
|
||||||
|
|
||||||
|
std::set<std::string> m_dirty_options = {};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PresetBundle* m_preset_bundle;
|
PresetBundle* m_preset_bundle;
|
||||||
bool m_show_btn_incompatible_presets = false;
|
bool m_show_btn_incompatible_presets = false;
|
||||||
|
@ -281,6 +283,7 @@ protected:
|
||||||
void update_frequently_changed_parameters();
|
void update_frequently_changed_parameters();
|
||||||
void fill_icon_descriptions();
|
void fill_icon_descriptions();
|
||||||
void set_tooltips_text();
|
void set_tooltips_text();
|
||||||
|
bool update_completed() const { return m_dirty_options.empty(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class TabPrint : public Tab
|
class TabPrint : public Tab
|
||||||
|
|
Loading…
Reference in a new issue