NEW: remember use options when printing

JIRA: STUDIO-2396

Change-Id: I21e6f91e3da53adf8dc28d9be223e03a4a275fca
Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
Stone Li 2023-03-08 11:20:32 +08:00 committed by Lane.Wei
parent 55f3e51bf4
commit 65db26a27d
2 changed files with 49 additions and 5 deletions

View File

@ -307,6 +307,16 @@ void AppConfig::set_defaults()
}
#endif
if (get("print", "bed_leveling").empty()) {
set_str("print", "bed_leveling", "1");
}
if (get("print", "flow_cali").empty()) {
set_str("print", "flow_cali", "1");
}
if (get("print", "timelapse").empty()) {
set_str("print", "timelapse", "1");
}
// Remove legacy window positions/sizes
erase("app", "main_frame_maximized");
erase("app", "main_frame_pos");

View File

@ -1420,7 +1420,28 @@ wxWindow *SelectMachineDialog::create_item_checkbox(wxString title, wxWindow *pa
checkbox->SetToolTip(tooltip);
text->SetToolTip(tooltip);
text->Bind(wxEVT_LEFT_DOWN, [this, check](wxMouseEvent &) { check->SetValue(check->GetValue() ? false : true); });
check->Bind(wxEVT_LEFT_DOWN, [this, check, param](wxMouseEvent &e) {
AppConfig* config = wxGetApp().app_config;
if (config) {
if (check->GetValue())
config->set_str("print", param, "0");
else
config->set_str("print", param, "1");
}
e.Skip();
});
text->Bind(wxEVT_LEFT_DOWN, [this, check, param](wxMouseEvent &) {
check->SetValue(check->GetValue() ? false : true);
AppConfig* config = wxGetApp().app_config;
if (config) {
if (check->GetValue())
config->set_str("print", param, "1");
else
config->set_str("print", param, "0");
}
});
m_checkbox_list[param] = check;
return checkbox;
}
@ -2958,10 +2979,23 @@ void SelectMachineDialog::set_default()
select_bed->Show();
select_flow->Show();
// checkbox default values
m_checkbox_list["bed_leveling"]->SetValue(true);
m_checkbox_list["flow_cali"]->SetValue(true);
m_checkbox_list["timelapse"]->SetValue(true);
// load checkbox values from app config
AppConfig* config = wxGetApp().app_config;
if (config && config->get("print", "bed_leveling") == "0") {
m_checkbox_list["bed_leveling"]->SetValue(false);
} else {
m_checkbox_list["bed_leveling"]->SetValue(true);
}
if (config && config->get("print", "flow_cali") == "0") {
m_checkbox_list["flow_cali"]->SetValue(false);
} else {
m_checkbox_list["flow_cali"]->SetValue(true);
}
if (config && config->get("print", "timelapse") == "0") {
m_checkbox_list["timelapse"]->SetValue(false);
} else {
m_checkbox_list["timelapse"]->SetValue(true);
}
ams_check->SetValue(true);
// thumbmail