mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-21 13:47:59 -06:00
ConfigWizard: Fix default printer selection
This commit is contained in:
parent
8eb8a8b1f6
commit
3229574a39
2 changed files with 10 additions and 5 deletions
|
@ -113,11 +113,6 @@ PrinterPicker::PrinterPicker(wxWindow *parent, const VendorProfile &vendor, cons
|
||||||
sizer->Add(all_none_sizer, 0, wxEXPAND);
|
sizer->Add(all_none_sizer, 0, wxEXPAND);
|
||||||
|
|
||||||
SetSizer(sizer);
|
SetSizer(sizer);
|
||||||
|
|
||||||
if (cboxes.size() > 0) {
|
|
||||||
cboxes[0]->SetValue(true);
|
|
||||||
on_checkbox(cboxes[0], true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrinterPicker::select_all(bool select)
|
void PrinterPicker::select_all(bool select)
|
||||||
|
@ -130,6 +125,14 @@ void PrinterPicker::select_all(bool select)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PrinterPicker::select_one(size_t i, bool select)
|
||||||
|
{
|
||||||
|
if (i < cboxes.size() && cboxes[i]->GetValue() != select) {
|
||||||
|
cboxes[i]->SetValue(select);
|
||||||
|
on_checkbox(cboxes[i], select);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PrinterPicker::on_checkbox(const Checkbox *cbox, bool checked)
|
void PrinterPicker::on_checkbox(const Checkbox *cbox, bool checked)
|
||||||
{
|
{
|
||||||
variants_checked += checked ? 1 : -1;
|
variants_checked += checked ? 1 : -1;
|
||||||
|
@ -232,6 +235,7 @@ PageWelcome::PageWelcome(ConfigWizard *parent) :
|
||||||
AppConfig &appconfig_vendors = this->wizard_p()->appconfig_vendors;
|
AppConfig &appconfig_vendors = this->wizard_p()->appconfig_vendors;
|
||||||
|
|
||||||
printer_picker = new PrinterPicker(this, vendor_prusa->second, appconfig_vendors);
|
printer_picker = new PrinterPicker(this, vendor_prusa->second, appconfig_vendors);
|
||||||
|
printer_picker->select_one(0, true); // Select the default (first) model/variant on the Prusa vendor
|
||||||
printer_picker->Bind(EVT_PRINTER_PICK, [this, &appconfig_vendors](const PrinterPickerEvent &evt) {
|
printer_picker->Bind(EVT_PRINTER_PICK, [this, &appconfig_vendors](const PrinterPickerEvent &evt) {
|
||||||
appconfig_vendors.set_variant(evt.vendor_id, evt.model_id, evt.variant_name, evt.enable);
|
appconfig_vendors.set_variant(evt.vendor_id, evt.model_id, evt.variant_name, evt.enable);
|
||||||
this->on_variant_checked();
|
this->on_variant_checked();
|
||||||
|
|
|
@ -56,6 +56,7 @@ struct PrinterPicker: wxPanel
|
||||||
PrinterPicker(wxWindow *parent, const VendorProfile &vendor, const AppConfig &appconfig_vendors);
|
PrinterPicker(wxWindow *parent, const VendorProfile &vendor, const AppConfig &appconfig_vendors);
|
||||||
|
|
||||||
void select_all(bool select);
|
void select_all(bool select);
|
||||||
|
void select_one(size_t i, bool select);
|
||||||
void on_checkbox(const Checkbox *cbox, bool checked);
|
void on_checkbox(const Checkbox *cbox, bool checked);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue