Fix for #8261 - view mode gets reset when exiting the configuration wizard early
ConfigWizard::PageMode:: Code for initialization of values is moved to constructor from on_activate(). On Linux wxRadioButton values have to be set otherwise first value in group will be selected by default.
This commit is contained in:
parent
33b2478b69
commit
1bf4d61e36
2 changed files with 9 additions and 18 deletions
|
@ -1281,17 +1281,6 @@ PageMode::PageMode(ConfigWizard *parent)
|
|||
radio_advanced = new wxRadioButton(this, wxID_ANY, _L("Advanced mode"));
|
||||
radio_expert = new wxRadioButton(this, wxID_ANY, _L("Expert mode"));
|
||||
|
||||
append(radio_simple);
|
||||
append(radio_advanced);
|
||||
append(radio_expert);
|
||||
|
||||
append_text("\n" + _L("The size of the object can be specified in inches"));
|
||||
check_inch = new wxCheckBox(this, wxID_ANY, _L("Use inches"));
|
||||
append(check_inch);
|
||||
}
|
||||
|
||||
void PageMode::on_activate()
|
||||
{
|
||||
std::string mode { "simple" };
|
||||
wxGetApp().app_config->get("", "view_mode", mode);
|
||||
|
||||
|
@ -1299,7 +1288,16 @@ void PageMode::on_activate()
|
|||
else if (mode == "expert") { radio_expert->SetValue(true); }
|
||||
else { radio_simple->SetValue(true); }
|
||||
|
||||
append(radio_simple);
|
||||
append(radio_advanced);
|
||||
append(radio_expert);
|
||||
|
||||
append_text("\n" + _L("The size of the object can be specified in inches"));
|
||||
check_inch = new wxCheckBox(this, wxID_ANY, _L("Use inches"));
|
||||
check_inch->SetValue(wxGetApp().app_config->get("use_inches") == "1");
|
||||
append(check_inch);
|
||||
|
||||
on_activate();
|
||||
}
|
||||
|
||||
void PageMode::serialize_mode(AppConfig *app_config) const
|
||||
|
@ -1310,11 +1308,6 @@ void PageMode::serialize_mode(AppConfig *app_config) const
|
|||
if (radio_advanced->GetValue()) { mode = "advanced"; }
|
||||
if (radio_expert->GetValue()) { mode = "expert"; }
|
||||
|
||||
// If "Mode" page wasn't selected (no one radiobutton is checked),
|
||||
// we shouldn't to update a view_mode value in app_config
|
||||
if (mode.empty())
|
||||
return;
|
||||
|
||||
app_config->set("view_mode", mode);
|
||||
app_config->set("use_inches", check_inch->GetValue() ? "1" : "0");
|
||||
}
|
||||
|
|
|
@ -426,8 +426,6 @@ struct PageMode: ConfigWizardPage
|
|||
PageMode(ConfigWizard *parent);
|
||||
|
||||
void serialize_mode(AppConfig *app_config) const;
|
||||
|
||||
virtual void on_activate();
|
||||
};
|
||||
|
||||
struct PageVendors: ConfigWizardPage
|
||||
|
|
Loading…
Reference in a new issue