mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 00:16:04 +08:00
Merge branch 'ys_8055' into dev_250
This commit is contained in:
commit
388126b26e
@ -342,18 +342,26 @@ LayerRangeEditor::LayerRangeEditor( ObjectLayers* parent,
|
|||||||
this->Bind(wxEVT_TEXT_ENTER, [this, edit_fn](wxEvent&)
|
this->Bind(wxEVT_TEXT_ENTER, [this, edit_fn](wxEvent&)
|
||||||
{
|
{
|
||||||
m_enter_pressed = true;
|
m_enter_pressed = true;
|
||||||
// If LayersList wasn't updated/recreated, we can call wxEVT_KILL_FOCUS.Skip()
|
// Workaround! Under Linux we have to use CallAfter() to avoid crash after pressing ENTER key
|
||||||
if (m_type&etLayerHeight) {
|
// see #7531, #8055, #8408
|
||||||
if (!edit_fn(get_value(), true, false))
|
#ifdef __linux__
|
||||||
|
wxTheApp->CallAfter([this, edit_fn]() {
|
||||||
|
#endif
|
||||||
|
// If LayersList wasn't updated/recreated, we can call wxEVT_KILL_FOCUS.Skip()
|
||||||
|
if (m_type & etLayerHeight) {
|
||||||
|
if (!edit_fn(get_value(), true, false))
|
||||||
|
SetValue(m_valid_value);
|
||||||
|
else
|
||||||
|
m_valid_value = double_to_string(get_value());
|
||||||
|
m_call_kill_focus = true;
|
||||||
|
}
|
||||||
|
else if (!edit_fn(get_value(), true, false)) {
|
||||||
SetValue(m_valid_value);
|
SetValue(m_valid_value);
|
||||||
else
|
m_call_kill_focus = true;
|
||||||
m_valid_value = double_to_string(get_value());
|
}
|
||||||
m_call_kill_focus = true;
|
#ifdef __linux__
|
||||||
}
|
});
|
||||||
else if (!edit_fn(get_value(), true, false)) {
|
#endif
|
||||||
SetValue(m_valid_value);
|
|
||||||
m_call_kill_focus = true;
|
|
||||||
}
|
|
||||||
}, this->GetId());
|
}, this->GetId());
|
||||||
|
|
||||||
this->Bind(wxEVT_KILL_FOCUS, [this, edit_fn](wxFocusEvent& e)
|
this->Bind(wxEVT_KILL_FOCUS, [this, edit_fn](wxFocusEvent& e)
|
||||||
@ -419,16 +427,13 @@ coordf_t LayerRangeEditor::get_value()
|
|||||||
const char dec_sep = is_decimal_separator_point() ? '.' : ',';
|
const char dec_sep = is_decimal_separator_point() ? '.' : ',';
|
||||||
const char dec_sep_alt = dec_sep == '.' ? ',' : '.';
|
const char dec_sep_alt = dec_sep == '.' ? ',' : '.';
|
||||||
// Replace the first incorrect separator in decimal number.
|
// Replace the first incorrect separator in decimal number.
|
||||||
if (str.Replace(dec_sep_alt, dec_sep, false) != 0)
|
str.Replace(dec_sep_alt, dec_sep, false);
|
||||||
SetValue(str);
|
|
||||||
|
|
||||||
if (str == ".")
|
if (str == ".")
|
||||||
layer_height = 0.0;
|
layer_height = 0.0;
|
||||||
else {
|
else if (!str.ToDouble(&layer_height) || layer_height < 0.0f) {
|
||||||
if (!str.ToDouble(&layer_height) || layer_height < 0.0f) {
|
show_error(m_parent, _L("Invalid numeric input."));
|
||||||
show_error(m_parent, _L("Invalid numeric input."));
|
assert(m_valid_value.ToDouble(&layer_height));
|
||||||
SetValue(double_to_string(layer_height));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return layer_height;
|
return layer_height;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user