mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-09-28 23:33:14 +08:00
FIX: error sync behavior for customize printer preset
jira: STUDIO-10331 Change-Id: I4d42ed089e515c2d74dfade1589f20f1c80ca4ca
This commit is contained in:
parent
6e8670ec6e
commit
ce963cede5
@ -33,11 +33,11 @@
|
||||
#define SELECT_ALL_OPTION_COLOUR wxColour("#00AE42")
|
||||
#define DEFAULT_PROMPT_TEXT_COLOUR wxColour("#ACACAC")
|
||||
|
||||
namespace Slic3r {
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
static const std::vector<std::string> filament_vendors = {"Polymaker", "OVERTURE", "Kexcelled", "HATCHBOX", "eSUN", "SUNLU", "Prusament", "Creality", "Protopasta",
|
||||
"Anycubic", "Basf", "ELEGOO", "INLAND", "FLASHFORGE", "FusRock", "AMOLEN", "MIKA3D", "3DXTECH",
|
||||
"Anycubic", "Basf", "ELEGOO", "INLAND", "FLASHFORGE", "FusRock", "AMOLEN", "MIKA3D", "3DXTECH",
|
||||
"Duramic", "Priline", "Eryone", "3Dgunius", "Novamaker", "Justmaker", "Giantarm", "iProspect", "LDO"};
|
||||
|
||||
static const std::vector<std::string> filament_types = {"PLA", "PLA+", "PLA Tough", "PETG", "ABS", "ASA", "FLEX", "HIPS", "PA", "PACF",
|
||||
@ -55,9 +55,9 @@ static const std::unordered_map<std::string, std::vector<std::string>> printer_m
|
||||
{"Artillery", {"sidewinder X1", "Genius", "Hornet"}},
|
||||
{"BIBO", {"BIBO2 Touch"}},
|
||||
{"BIQU", {"BX"}},
|
||||
{"Creality ENDER", {"Ender-3", "Ender-3 BLTouch", "Ender-3 Pro", "Ender-3 Neo",
|
||||
{"Creality ENDER", {"Ender-3", "Ender-3 BLTouch", "Ender-3 Pro", "Ender-3 Neo",
|
||||
"Ender-3 V2 Neo", "Ender-3 S1 Plus", "Ender-3 Max", "Ender-3 Max Neo",
|
||||
"Ender-4", "Ender-5 Pro", "Ender-5 Pro",
|
||||
"Ender-4", "Ender-5 Pro", "Ender-5 Pro",
|
||||
"Ender-7", "Ender-2", "Ender-2 Pro"}},
|
||||
{"Creality CR", {"CR-5 Pro", "CR-5 Pro H", "CR-10 SMART", "CR-10 SMART Pro", "CR-10 Mini",
|
||||
"CR-10", "CR-10 v3", "CR-10 S", "CR-10 v2", "CR-10 v2",
|
||||
@ -116,7 +116,7 @@ static bool str_is_all_digit(const std::string &str) {
|
||||
for (const char &c : str) {
|
||||
if (!std::isdigit(c)) return false;
|
||||
}
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool delete_filament_preset_by_name(std::string delete_preset_name, std::string &selected_preset_name)
|
||||
@ -194,7 +194,7 @@ static std::string get_curr_timestmp()
|
||||
}
|
||||
|
||||
static void get_filament_compatible_printer(Preset* preset, vector<std::string>& printers)
|
||||
{
|
||||
{
|
||||
auto compatible_printers = dynamic_cast<ConfigOptionStrings *>(preset->config.option("compatible_printers"));
|
||||
if (compatible_printers == nullptr) return;
|
||||
for (const std::string &printer_name : compatible_printers->values) {
|
||||
@ -313,7 +313,7 @@ static std::string get_vendor_name(const Preset *preset)
|
||||
auto vender = preset->config.option<ConfigOptionStrings>("filament_vendor");
|
||||
if (vender && vender->values.size()) return vender->values[0];
|
||||
}
|
||||
|
||||
|
||||
if (preset->type == Preset::Type::TYPE_PRINTER) {
|
||||
auto vender = preset->config.option<ConfigOptionStrings>("printer_model");
|
||||
if (vender && vender->values.size()) return vender->values[0];
|
||||
@ -359,7 +359,7 @@ static wxBoxSizer *create_select_filament_preset_checkbox(wxWindow *
|
||||
combobox_sizer->Add(combobox, 0, wxEXPAND | wxTOP, 5);
|
||||
|
||||
wxArrayString choices;
|
||||
for (Preset *preset : presets) {
|
||||
for (Preset *preset : presets) {
|
||||
choices.Add(wxString::FromUTF8(preset->name));
|
||||
}
|
||||
combobox->Set(choices);
|
||||
@ -555,7 +555,7 @@ static void adjust_dialog_in_screen(DPIDialog* dialog) {
|
||||
if (pos_x != dialog_x || pos_y != dialog_y) { dialog->SetPosition(wxPoint(dialog_x, dialog_y)); }
|
||||
}
|
||||
|
||||
CreateFilamentPresetDialog::CreateFilamentPresetDialog(wxWindow *parent)
|
||||
CreateFilamentPresetDialog::CreateFilamentPresetDialog(wxWindow *parent)
|
||||
: DPIDialog(parent ? parent : nullptr, wxID_ANY, _L("Create Filament"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX | wxCENTRE)
|
||||
{
|
||||
m_create_type.base_filament = _L("Create Based on Current Filament");
|
||||
@ -632,7 +632,7 @@ CreateFilamentPresetDialog::~CreateFilamentPresetDialog()
|
||||
}
|
||||
|
||||
void CreateFilamentPresetDialog::on_dpi_changed(const wxRect &suggested_rect) {
|
||||
|
||||
|
||||
m_button_create->SetMinSize(wxSize(FromDIP(58), FromDIP(24)));
|
||||
m_button_create->SetMaxSize(wxSize(FromDIP(58), FromDIP(24)));
|
||||
m_button_create->SetCornerRadius(FromDIP(12));
|
||||
@ -670,14 +670,14 @@ wxBoxSizer *CreateFilamentPresetDialog::create_item(FilamentOptionType option_ty
|
||||
}
|
||||
}
|
||||
wxBoxSizer *CreateFilamentPresetDialog::create_vendor_item()
|
||||
{
|
||||
wxBoxSizer *horizontal_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
{
|
||||
wxBoxSizer *horizontal_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
wxBoxSizer * optionSizer = new wxBoxSizer(wxVERTICAL);
|
||||
wxStaticText *static_vendor_text = new wxStaticText(this, wxID_ANY, _L("Vendor"), wxDefaultPosition, wxDefaultSize);
|
||||
optionSizer->Add(static_vendor_text, 0, wxEXPAND | wxALL, 0);
|
||||
optionSizer->SetMinSize(OPTION_SIZE);
|
||||
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
|
||||
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
|
||||
|
||||
wxArrayString choices;
|
||||
for (const wxString &vendor : filament_vendors) {
|
||||
@ -773,7 +773,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_type_item()
|
||||
comboBoxSizer->Add(m_filament_type_combobox, 0, wxEXPAND | wxALL, 0);
|
||||
horizontal_sizer->Add(comboBoxSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
|
||||
|
||||
m_filament_type_combobox->Bind(wxEVT_COMBOBOX, [this](wxCommandEvent &e) {
|
||||
m_filament_type_combobox->Bind(wxEVT_COMBOBOX, [this](wxCommandEvent &e) {
|
||||
m_filament_type_combobox->SetLabelColor(*wxBLACK);
|
||||
const wxString &curr_create_type = curr_create_filament_type();
|
||||
clear_filament_preset_map();
|
||||
@ -782,7 +782,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_type_item()
|
||||
m_filament_preset_combobox->Set(filament_preset_choice);
|
||||
m_filament_preset_combobox->SetLabel(_L("Select Filament Preset"));
|
||||
m_filament_preset_combobox->SetLabelColor(DEFAULT_PROMPT_TEXT_COLOUR);
|
||||
|
||||
|
||||
} else if (curr_create_type == m_create_type.base_filament_preset) {
|
||||
get_filament_presets_by_machine();
|
||||
}
|
||||
@ -839,17 +839,17 @@ wxBoxSizer *CreateFilamentPresetDialog::create_filament_preset_item()
|
||||
|
||||
wxBoxSizer * comboBoxSizer = new wxBoxSizer(wxVERTICAL);
|
||||
comboBoxSizer->Add(create_radio_item(m_create_type.base_filament, this, wxEmptyString, m_create_type_btns), 0, wxEXPAND | wxALL, 0);
|
||||
|
||||
|
||||
m_filament_preset_combobox = new ComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, FILAMENT_PRESET_COMBOBOX_SIZE, 0, nullptr, wxCB_READONLY);
|
||||
m_filament_preset_combobox->SetLabel(_L("Select Filament Preset"));
|
||||
m_filament_preset_combobox->SetLabelColor(DEFAULT_PROMPT_TEXT_COLOUR);
|
||||
|
||||
|
||||
|
||||
m_filament_preset_combobox->Bind(wxEVT_COMBOBOX, [this](wxCommandEvent &e) {
|
||||
m_filament_preset_combobox->SetLabelColor(*wxBLACK);
|
||||
wxString filament_type = m_filament_preset_combobox->GetStringSelection();
|
||||
std::unordered_map<std::string, std::vector<Preset *>>::iterator iter = m_filament_choice_map.find(m_public_name_to_filament_id_map[filament_type]);
|
||||
|
||||
|
||||
m_scrolled_preset_panel->Freeze();
|
||||
m_filament_presets_sizer->Clear(true);
|
||||
m_filament_preset.clear();
|
||||
@ -895,7 +895,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_filament_preset_item()
|
||||
comboBoxSizer->Add(m_filament_preset_combobox, 0, wxEXPAND | wxTOP, FromDIP(5));
|
||||
|
||||
comboBoxSizer->Add(create_radio_item(m_create_type.base_filament_preset, this, wxEmptyString, m_create_type_btns), 0, wxEXPAND | wxTOP, FromDIP(10));
|
||||
|
||||
|
||||
horizontal_sizer->Add(comboBoxSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
|
||||
|
||||
horizontal_sizer->Add(0, 0, 0, wxLEFT, FromDIP(30));
|
||||
@ -935,7 +935,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_button_item()
|
||||
m_button_create->SetCornerRadius(FromDIP(12));
|
||||
bSizer_button->Add(m_button_create, 0, wxRIGHT, FromDIP(10));
|
||||
|
||||
m_button_create->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
||||
m_button_create->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
||||
//get vendor name
|
||||
wxString vendor_str = m_filament_vendor_combobox->GetLabel();
|
||||
std::string vendor_name;
|
||||
@ -989,7 +989,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_button_item()
|
||||
}
|
||||
vendor_name = remove_special_key(vendor_name);
|
||||
serial_name = remove_special_key(serial_name);
|
||||
|
||||
|
||||
if (vendor_name.empty() || serial_name.empty()) {
|
||||
MessageDialog dlg(this, _L("There may be escape characters in the vendor or serial input of filament. Please delete and re-enter."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"),
|
||||
wxYES | wxYES_DEFAULT | wxCENTRE);
|
||||
@ -1032,11 +1032,11 @@ wxBoxSizer *CreateFilamentPresetDialog::create_button_item()
|
||||
std::string user_filament_id = get_filament_id(filament_preset_name);
|
||||
|
||||
const wxString &curr_create_type = curr_create_filament_type();
|
||||
|
||||
|
||||
if (curr_create_type == m_create_type.base_filament) {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":clone filament create type filament ";
|
||||
for (const std::pair<::CheckBox *, std::pair<std::string, Preset *>> &checkbox_preset : m_filament_preset) {
|
||||
if (checkbox_preset.first->GetValue()) {
|
||||
if (checkbox_preset.first->GetValue()) {
|
||||
std::string compatible_printer_name = checkbox_preset.second.first;
|
||||
std::vector<std::string> failures;
|
||||
Preset const *const checked_preset = checkbox_preset.second.second;
|
||||
@ -1090,7 +1090,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_button_item()
|
||||
}
|
||||
}
|
||||
preset_bundle->update_compatible(PresetSelectCompatibleType::Always);
|
||||
EndModal(wxID_OK);
|
||||
EndModal(wxID_OK);
|
||||
});
|
||||
|
||||
StateColor btn_bg_white(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Pressed), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
|
||||
@ -1105,15 +1105,15 @@ wxBoxSizer *CreateFilamentPresetDialog::create_button_item()
|
||||
m_button_cancel->SetCornerRadius(FromDIP(12));
|
||||
bSizer_button->Add(m_button_cancel, 0, wxRIGHT, FromDIP(10));
|
||||
|
||||
m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
||||
EndModal(wxID_CANCEL);
|
||||
m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
||||
EndModal(wxID_CANCEL);
|
||||
});
|
||||
|
||||
return bSizer_button;
|
||||
}
|
||||
|
||||
wxArrayString CreateFilamentPresetDialog::get_filament_preset_choices()
|
||||
{
|
||||
{
|
||||
wxArrayString choices;
|
||||
// get fialment type name
|
||||
wxString type_str = m_filament_type_combobox->GetLabel();
|
||||
@ -1138,12 +1138,12 @@ wxArrayString CreateFilamentPresetDialog::get_filament_preset_choices()
|
||||
m_filament_choice_map[preset->filament_id].push_back(preset);
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " base user preset is:" << preset->name;
|
||||
}
|
||||
|
||||
|
||||
int suffix = 0;
|
||||
for (const pair<std::string, std::vector<Preset *>> &preset : m_filament_choice_map) {
|
||||
for (const pair<std::string, std::vector<Preset *>> &preset : m_filament_choice_map) {
|
||||
if (preset.second.empty()) continue;
|
||||
std::set<wxString> preset_name_set;
|
||||
for (Preset* filament_preset : preset.second) {
|
||||
for (Preset* filament_preset : preset.second) {
|
||||
std::string preset_name = filament_preset->name;
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " filament_id: " << filament_preset->filament_id << " preset name: " << filament_preset->name;
|
||||
size_t index_at = preset_name.find(" @");
|
||||
@ -1154,7 +1154,7 @@ wxArrayString CreateFilamentPresetDialog::get_filament_preset_choices()
|
||||
}
|
||||
assert(1 == preset_name_set.size());
|
||||
if (preset_name_set.size() > 1) {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " the same filament has different filament(vendor type serial)";
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " the same filament has different filament(vendor type serial)";
|
||||
}
|
||||
for (const wxString& public_name : preset_name_set) {
|
||||
if (m_public_name_to_filament_id_map.find(public_name) != m_public_name_to_filament_id_map.end()) {
|
||||
@ -1214,10 +1214,10 @@ void CreateFilamentPresetDialog::select_curr_radiobox(std::vector<std::pair<Radi
|
||||
m_filament_preset_text->SetLabel(_L("We would rename the presets as \"Vendor Type Serial @printer you selected\". \nTo add preset for more prinetrs, Please go to printer selection"));
|
||||
m_filament_preset_combobox->Hide();
|
||||
if (_L("Select Type") != m_filament_type_combobox->GetLabel()) {
|
||||
|
||||
|
||||
clear_filament_preset_map();
|
||||
get_filament_presets_by_machine();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
m_scrolled_preset_panel->SetSizerAndFit(m_scrolled_sizer);
|
||||
@ -1253,7 +1253,7 @@ void CreateFilamentPresetDialog::get_filament_presets_by_machine()
|
||||
} else {
|
||||
type_name = into_u8(type_str);
|
||||
}
|
||||
|
||||
|
||||
std::unordered_map<std::string, float> nozzle_diameter = nozzle_diameter_map;
|
||||
std::unordered_map<std::string, std::vector<Preset *>> machine_name_to_presets;
|
||||
PresetBundle * preset_bundle = wxGetApp().preset_bundle;
|
||||
@ -1423,7 +1423,7 @@ void CreateFilamentPresetDialog::clear_filament_preset_map()
|
||||
m_filament_preset_panel->Thaw();
|
||||
}
|
||||
|
||||
CreatePrinterPresetDialog::CreatePrinterPresetDialog(wxWindow *parent)
|
||||
CreatePrinterPresetDialog::CreatePrinterPresetDialog(wxWindow *parent)
|
||||
: DPIDialog(parent ? parent : nullptr, wxID_ANY, _L("Create Printer/Nozzle"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX | wxCENTER)
|
||||
{
|
||||
m_create_type.create_printer = _L("Create Printer");
|
||||
@ -1506,8 +1506,8 @@ void CreatePrinterPresetDialog::on_dpi_changed(const wxRect &suggested_rect) {
|
||||
}
|
||||
|
||||
wxBoxSizer *CreatePrinterPresetDialog::create_step_switch_item()
|
||||
{
|
||||
wxBoxSizer *step_switch_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
{
|
||||
wxBoxSizer *step_switch_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
std::string wiki_url = "https://wiki.bambulab.com/en/software/bambu-studio/3rd-party-printer-profile";
|
||||
wxHyperlinkCtrl *m_download_hyperlink = new wxHyperlinkCtrl(this, wxID_ANY, _L("wiki"), wiki_url, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
|
||||
@ -1538,15 +1538,15 @@ wxBoxSizer *CreatePrinterPresetDialog::create_step_switch_item()
|
||||
line_top->SetBackgroundColour(PRINTER_LIST_COLOUR);
|
||||
|
||||
step_switch_sizer->Add(line_top, 0, wxEXPAND | wxALL, FromDIP(10));
|
||||
|
||||
|
||||
return step_switch_sizer;
|
||||
}
|
||||
|
||||
void CreatePrinterPresetDialog::create_printer_page1(wxWindow *parent)
|
||||
{
|
||||
{
|
||||
this->SetBackgroundColour(*wxWHITE);
|
||||
|
||||
m_page1_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
m_page1_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
m_page1_sizer->Add(create_type_item(parent), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
|
||||
m_page1_sizer->Add(create_printer_item(parent), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
|
||||
@ -1581,7 +1581,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_type_item(wxWindow *parent)
|
||||
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
|
||||
|
||||
wxBoxSizer *radioBoxSizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
|
||||
radioBoxSizer->Add(create_radio_item(m_create_type.create_printer, parent, wxEmptyString, m_create_type_btns), 0, wxEXPAND | wxALL, 0);
|
||||
radioBoxSizer->Add(create_radio_item(m_create_type.create_nozzle, parent, wxEmptyString, m_create_type_btns), 0, wxEXPAND | wxTOP, FromDIP(10));
|
||||
horizontal_sizer->Add(radioBoxSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
|
||||
@ -1605,11 +1605,11 @@ wxBoxSizer *CreatePrinterPresetDialog::create_printer_item(wxWindow *parent)
|
||||
m_select_vendor->SetValue(_L("Select Vendor"));
|
||||
m_select_vendor->SetLabelColor(DEFAULT_PROMPT_TEXT_COLOUR);
|
||||
wxArrayString printer_vendor;
|
||||
for (const std::string &vendor : printer_vendors) {
|
||||
printer_vendor.Add(vendor);
|
||||
for (const std::string &vendor : printer_vendors) {
|
||||
printer_vendor.Add(vendor);
|
||||
}
|
||||
m_select_vendor->Set(printer_vendor);
|
||||
m_select_vendor->Bind(wxEVT_COMBOBOX, [this](wxCommandEvent e) {
|
||||
m_select_vendor->Bind(wxEVT_COMBOBOX, [this](wxCommandEvent e) {
|
||||
m_select_vendor->SetLabelColor(*wxBLACK);
|
||||
std::string curr_selected_vendor = into_u8(m_select_vendor->GetStringSelection());
|
||||
std::unordered_map<std::string,std::vector<std::string>>::const_iterator iter = printer_model_map.find(curr_selected_vendor);
|
||||
@ -1617,11 +1617,11 @@ wxBoxSizer *CreatePrinterPresetDialog::create_printer_item(wxWindow *parent)
|
||||
{
|
||||
std::vector<std::string> vendor_model = iter->second;
|
||||
wxArrayString model_choice;
|
||||
for (const std::string &model : vendor_model) {
|
||||
for (const std::string &model : vendor_model) {
|
||||
model_choice.Add(model);
|
||||
}
|
||||
m_select_model->Set(model_choice);
|
||||
if (!model_choice.empty()) {
|
||||
if (!model_choice.empty()) {
|
||||
m_select_model->SetSelection(0);
|
||||
m_select_model->SetLabelColor(*wxBLACK);
|
||||
}
|
||||
@ -1631,7 +1631,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_printer_item(wxWindow *parent)
|
||||
}
|
||||
e.Skip();
|
||||
});
|
||||
|
||||
|
||||
comboBoxSizer->Add(m_select_vendor, 0, wxEXPAND | wxALL, 0);
|
||||
|
||||
m_select_model = new ComboBox(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, NAME_OPTION_COMBOBOX_SIZE, 0, nullptr, wxCB_READONLY);
|
||||
@ -1738,7 +1738,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_nozzle_diameter_item(wxWindow *par
|
||||
wxBoxSizer *comboBoxSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_nozzle_diameter = new ComboBox(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, OPTION_SIZE, 0, nullptr, wxCB_READONLY);
|
||||
wxArrayString nozzle_diameters;
|
||||
for (const std::string nozzle : nozzle_diameter_vec) {
|
||||
for (const std::string nozzle : nozzle_diameter_vec) {
|
||||
nozzle_diameters.Add(nozzle + " mm");
|
||||
}
|
||||
m_nozzle_diameter->Set(nozzle_diameters);
|
||||
@ -1930,7 +1930,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_hot_bed_stl_item(wxWindow *parent)
|
||||
}
|
||||
|
||||
wxBoxSizer *CreatePrinterPresetDialog::create_hot_bed_svg_item(wxWindow *parent)
|
||||
{
|
||||
{
|
||||
wxBoxSizer *horizontal_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
wxBoxSizer * optionSizer = new wxBoxSizer(wxVERTICAL);
|
||||
@ -2230,7 +2230,7 @@ void CreatePrinterPresetDialog::generate_process_presets_data(std::vector<Preset
|
||||
initial_layer_print_height->value = nozzle_dia / 2;
|
||||
else
|
||||
BOOST_LOG_TRIVIAL(info) << "process template has no initial_layer_print_height";
|
||||
|
||||
|
||||
auto line_width = dynamic_cast<ConfigOptionFloat *>(const_cast<Preset *>(preset)->config.option("line_width", true));
|
||||
if (line_width)
|
||||
line_width->value = nozzle_dia;
|
||||
@ -2454,7 +2454,7 @@ void CreatePrinterPresetDialog::select_curr_radiobox(std::vector<std::pair<Radio
|
||||
m_can_not_find_vendor_combox->Show();
|
||||
m_can_not_find_vendor_text->Show();
|
||||
m_printer_info_panel->Show();
|
||||
if (m_can_not_find_vendor_combox->GetValue()) {
|
||||
if (m_can_not_find_vendor_combox->GetValue()) {
|
||||
m_custom_vendor_text_ctrl->Show();
|
||||
m_custom_model_text_ctrl->Show();
|
||||
m_select_vendor->Hide();
|
||||
@ -2481,7 +2481,7 @@ void CreatePrinterPresetDialog::select_curr_radiobox(std::vector<std::pair<Radio
|
||||
radiobox_list[i].first->SetValue(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
update_preset_list_size();
|
||||
}
|
||||
|
||||
@ -2582,14 +2582,14 @@ wxBoxSizer *CreatePrinterPresetDialog::create_presets_template_item(wxWindow *pa
|
||||
m_filament_preset_panel->SetSize(PRESET_TEMPLATE_SIZE);
|
||||
m_filament_preset_panel->SetSizer(m_filament_preset_template_sizer);
|
||||
m_filament_sizer->Add(m_filament_preset_panel, 0, wxEXPAND | wxALL, FromDIP(5));
|
||||
|
||||
|
||||
wxBoxSizer *hori_filament_btn_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxPanel * filament_btn_panel = new wxPanel(m_preset_template_panel);
|
||||
filament_btn_panel->SetBackgroundColour(FILAMENT_OPTION_COLOUR);
|
||||
wxStaticText *filament_sel_all_text = new wxStaticText(filament_btn_panel, wxID_ANY, _L("Select All"), wxDefaultPosition, wxDefaultSize);
|
||||
filament_sel_all_text->SetForegroundColour(SELECT_ALL_OPTION_COLOUR);
|
||||
filament_sel_all_text->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
||||
select_all_preset_template(m_filament_preset);
|
||||
filament_sel_all_text->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
||||
select_all_preset_template(m_filament_preset);
|
||||
e.Skip();
|
||||
});
|
||||
wxStaticText *filament_desel_all_text = new wxStaticText(filament_btn_panel, wxID_ANY, _L("Deselect All"), wxDefaultPosition, wxDefaultSize);
|
||||
@ -2602,7 +2602,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_presets_template_item(wxWindow *pa
|
||||
hori_filament_btn_sizer->Add(filament_desel_all_text, 0, wxEXPAND | wxALL, FromDIP(5));
|
||||
filament_btn_panel->SetSizer(hori_filament_btn_sizer);
|
||||
m_filament_sizer->Add(filament_btn_panel, 0, wxEXPAND, 0);
|
||||
|
||||
|
||||
wxPanel *split_panel = new wxPanel(m_preset_template_panel, wxID_ANY, wxDefaultPosition, wxSize(-1, FromDIP(10)));
|
||||
split_panel->SetBackgroundColour(wxColour(*wxWHITE));
|
||||
m_filament_sizer->Add(split_panel, 0, wxEXPAND, 0);
|
||||
@ -2614,7 +2614,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_presets_template_item(wxWindow *pa
|
||||
m_process_preset_template_sizer = new wxGridSizer(3, FromDIP(5), FromDIP(5));
|
||||
m_process_preset_panel->SetSizer(m_process_preset_template_sizer);
|
||||
m_filament_sizer->Add(m_process_preset_panel, 0, wxEXPAND | wxALL, FromDIP(5));
|
||||
|
||||
|
||||
|
||||
wxBoxSizer *hori_process_btn_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxPanel * process_btn_panel = new wxPanel(m_preset_template_panel);
|
||||
@ -2844,7 +2844,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page2_btns_item(wxWindow *parent)
|
||||
successful_preset_names.push_back(sucessful_preset->name.substr(0, sucessful_preset->name.find(" @")) + " @" + printer_preset_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************** clone printer preset ********************************/
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":creater printer ";
|
||||
try {
|
||||
@ -2856,13 +2856,13 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page2_btns_item(wxWindow *parent)
|
||||
if (printer_variant)
|
||||
printer_variant->value = printer_nozzle_name;
|
||||
|
||||
auto nozzle_diameter = dynamic_cast<ConfigOptionFloats *>(m_printer_preset->config.option("nozzle_diameter", true));
|
||||
auto nozzle_diameter = dynamic_cast<ConfigOptionFloatsNullable *>(m_printer_preset->config.option("nozzle_diameter", true));
|
||||
if (nozzle_diameter) {
|
||||
std::unordered_map<std::string, float>::const_iterator iter = nozzle_diameter_map.find(printer_nozzle_name);
|
||||
if (nozzle_diameter_map.end() != iter) {
|
||||
nozzle_diameter->values = {iter->second};
|
||||
std::fill(nozzle_diameter->values.begin(), nozzle_diameter->values.end(), iter->second);
|
||||
} else {
|
||||
nozzle_diameter->values = {std::stof(get_nozzle_diameter())};
|
||||
std::fill(nozzle_diameter->values.begin(), nozzle_diameter->values.end(), std::stof(get_nozzle_diameter()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2872,7 +2872,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page2_btns_item(wxWindow *parent)
|
||||
preset_bundle->printers.save_current_preset(printer_preset_name, true, false, m_printer_preset);
|
||||
preset_bundle->update_compatible(PresetSelectCompatibleType::Always);
|
||||
EndModal(wxID_OK);
|
||||
|
||||
|
||||
});
|
||||
|
||||
m_button_page2_cancel = new Button(parent, _L("Cancel"));
|
||||
@ -2912,7 +2912,7 @@ void CreatePrinterPresetDialog::show_page2()
|
||||
}
|
||||
|
||||
bool CreatePrinterPresetDialog::data_init()
|
||||
{
|
||||
{
|
||||
std::string nozzle_type = into_u8(m_nozzle_diameter->GetStringSelection());
|
||||
size_t index_mm = nozzle_type.find(" mm");
|
||||
if (std::string::npos != index_mm) {
|
||||
@ -2926,7 +2926,7 @@ bool CreatePrinterPresetDialog::data_init()
|
||||
m_printer_vendor->Set(exist_vendor_choice);
|
||||
|
||||
m_printer_model->Bind(wxEVT_COMBOBOX, &CreatePrinterPresetDialog::on_preset_model_value_change, this);
|
||||
|
||||
|
||||
m_printer_vendor->Bind(wxEVT_COMBOBOX, [this, vendors, nozzle](wxCommandEvent e) {
|
||||
m_printer_vendor->SetLabelColor(*wxBLACK);
|
||||
|
||||
@ -2939,7 +2939,7 @@ bool CreatePrinterPresetDialog::data_init()
|
||||
dlg.ShowModal();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
wxArrayString printer_preset_model = printer_preset_sort_with_nozzle_diameter(m_printer_preset_vendor_selected, nozzle);
|
||||
if (printer_preset_model.size() == 0) {
|
||||
MessageDialog dlg(this, _L("Current vendor has no models, please reselect."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE);
|
||||
@ -2947,7 +2947,7 @@ bool CreatePrinterPresetDialog::data_init()
|
||||
return;
|
||||
}
|
||||
m_printer_model->Set(printer_preset_model);
|
||||
if (!printer_preset_model.empty()) {
|
||||
if (!printer_preset_model.empty()) {
|
||||
m_printer_model->SetSelection(0);
|
||||
wxCommandEvent e;
|
||||
on_preset_model_value_change(e);
|
||||
@ -2955,7 +2955,7 @@ bool CreatePrinterPresetDialog::data_init()
|
||||
}
|
||||
rewritten = false;
|
||||
e.Skip();
|
||||
|
||||
|
||||
});
|
||||
return true;
|
||||
|
||||
@ -2965,7 +2965,7 @@ void CreatePrinterPresetDialog::set_current_visible_printer()
|
||||
{
|
||||
//The entire process of creating a custom printer only needs to be done once
|
||||
if (m_printer_name_to_preset.size() > 0) return;
|
||||
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
|
||||
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
|
||||
const std::deque<Preset> &printer_presets = preset_bundle->printers.get_presets();
|
||||
wxArrayString printer_choice;
|
||||
m_printer_name_to_preset.clear();
|
||||
@ -3005,9 +3005,9 @@ wxArrayString CreatePrinterPresetDialog::printer_preset_sort_with_nozzle_diamete
|
||||
|
||||
int index_nearest_nozzle = -1;
|
||||
float nozzle_diameter_diff = 1;
|
||||
for (int i = 0; i < preset_sort.size(); ++i) {
|
||||
for (int i = 0; i < preset_sort.size(); ++i) {
|
||||
float curr_nozzle_diameter_diff = std::abs(nozzle_diameter - preset_sort[i].first);
|
||||
if (curr_nozzle_diameter_diff < nozzle_diameter_diff) {
|
||||
if (curr_nozzle_diameter_diff < nozzle_diameter_diff) {
|
||||
index_nearest_nozzle = i;
|
||||
nozzle_diameter_diff = curr_nozzle_diameter_diff;
|
||||
if (curr_nozzle_diameter_diff == 0) break;
|
||||
@ -3015,7 +3015,7 @@ wxArrayString CreatePrinterPresetDialog::printer_preset_sort_with_nozzle_diamete
|
||||
}
|
||||
wxArrayString printer_preset_model_selection;
|
||||
int right_index = index_nearest_nozzle + 1;
|
||||
while (index_nearest_nozzle >= 0 || right_index < preset_sort.size()) {
|
||||
while (index_nearest_nozzle >= 0 || right_index < preset_sort.size()) {
|
||||
if (index_nearest_nozzle >= 0 && right_index < preset_sort.size()) {
|
||||
float left_nozzle_diff = std::abs(nozzle_diameter - preset_sort[index_nearest_nozzle].first);
|
||||
float right_nozzle_diff = std::abs(nozzle_diameter - preset_sort[right_index].first);
|
||||
@ -3033,22 +3033,22 @@ wxArrayString CreatePrinterPresetDialog::printer_preset_sort_with_nozzle_diamete
|
||||
} else if (right_index < preset_sort.size()) {
|
||||
printer_preset_model_selection.Add(from_u8(preset_sort[right_index].second));
|
||||
right_index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return printer_preset_model_selection;
|
||||
}
|
||||
|
||||
void CreatePrinterPresetDialog::select_all_preset_template(std::vector<std::pair<::CheckBox *, Preset *>> &preset_templates)
|
||||
{
|
||||
for (std::pair<::CheckBox *, Preset const *> filament_preset : preset_templates) {
|
||||
for (std::pair<::CheckBox *, Preset const *> filament_preset : preset_templates) {
|
||||
filament_preset.first->SetValue(true);
|
||||
}
|
||||
}
|
||||
|
||||
void CreatePrinterPresetDialog::deselect_all_preset_template(std::vector<std::pair<::CheckBox *, Preset *>> &preset_templates)
|
||||
{
|
||||
for (std::pair<::CheckBox *, Preset const *> filament_preset : preset_templates) {
|
||||
filament_preset.first->SetValue(false);
|
||||
for (std::pair<::CheckBox *, Preset const *> filament_preset : preset_templates) {
|
||||
filament_preset.first->SetValue(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3076,7 +3076,7 @@ void CreatePrinterPresetDialog::update_presets_list(bool just_template)
|
||||
}
|
||||
|
||||
for (const Preset &process_preset : process_presets) {
|
||||
if (process_preset.is_compatible) {
|
||||
if (process_preset.is_compatible) {
|
||||
if (process_preset.is_default) continue;
|
||||
|
||||
Preset *temp_process = new Preset(process_preset);
|
||||
@ -3089,9 +3089,9 @@ void CreatePrinterPresetDialog::update_presets_list(bool just_template)
|
||||
}
|
||||
|
||||
void CreatePrinterPresetDialog::clear_preset_combobox()
|
||||
{
|
||||
{
|
||||
for (std::pair<::CheckBox *, Preset *> preset : m_filament_preset) {
|
||||
if (preset.second) {
|
||||
if (preset.second) {
|
||||
delete preset.second;
|
||||
preset.second = nullptr;
|
||||
}
|
||||
@ -3285,8 +3285,8 @@ wxString CreatePrinterPresetDialog::curr_create_preset_type() const
|
||||
{
|
||||
wxString curr_selected_preset_type;
|
||||
for (const std::pair<RadioBox *, wxString> &presets_radio : m_create_presets_btns) {
|
||||
if (presets_radio.first->GetValue()) {
|
||||
curr_selected_preset_type = presets_radio.second;
|
||||
if (presets_radio.first->GetValue()) {
|
||||
curr_selected_preset_type = presets_radio.second;
|
||||
}
|
||||
}
|
||||
return curr_selected_preset_type;
|
||||
@ -3329,17 +3329,17 @@ CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(wxWindow *parent, con
|
||||
wxStaticText *next_step_text;
|
||||
bool sync_user_preset_need_enabled = wxGetApp().getAgent() && wxGetApp().app_config->get("sync_user_preset") == "false";
|
||||
switch (create_success_type) {
|
||||
case PRINTER:
|
||||
success_text = new wxStaticText(this, wxID_ANY, _L("Printer Created"));
|
||||
next_step_text = new wxStaticText(this, wxID_ANY, _L("Please go to printer settings to edit your presets"));
|
||||
case PRINTER:
|
||||
success_text = new wxStaticText(this, wxID_ANY, _L("Printer Created"));
|
||||
next_step_text = new wxStaticText(this, wxID_ANY, _L("Please go to printer settings to edit your presets"));
|
||||
break;
|
||||
case FILAMENT:
|
||||
success_text = new wxStaticText(this, wxID_ANY, _L("Filament Created"));
|
||||
case FILAMENT:
|
||||
success_text = new wxStaticText(this, wxID_ANY, _L("Filament Created"));
|
||||
wxString prompt_text = _L("Please go to filament setting to edit your presets if you need.\nPlease note that nozzle temperature, hot bed temperature, and maximum "
|
||||
"volumetric speed has a significant impact on printing quality. Please set them carefully.");
|
||||
wxString sync_text = sync_user_preset_need_enabled ? _L("Studio has detected that your user presets synchronization function is not enabled, which may result in unsuccessful Filament settings on "
|
||||
"the Device page. \nClick \"Sync user presets\" to enable the synchronization function.") : "";
|
||||
next_step_text = new wxStaticText(this, wxID_ANY, prompt_text + "\n\n" + sync_text);
|
||||
next_step_text = new wxStaticText(this, wxID_ANY, prompt_text + "\n\n" + sync_text);
|
||||
break;
|
||||
}
|
||||
success_text->SetFont(Label::Head_18);
|
||||
@ -3353,7 +3353,7 @@ CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(wxWindow *parent, con
|
||||
wxBoxSizer *btn_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
btn_sizer->Add(0, 0, 1, wxEXPAND, 0);
|
||||
switch (create_success_type) {
|
||||
case PRINTER:
|
||||
case PRINTER:
|
||||
m_button_ok = new Button(this, _L("Printer Setting"));
|
||||
break;
|
||||
case FILAMENT: m_button_ok = sync_user_preset_need_enabled ? new Button(this, _L("Sync user presets")) : new Button(this, _L("OK"));
|
||||
@ -3380,7 +3380,7 @@ CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(wxWindow *parent, con
|
||||
}
|
||||
EndModal(wxID_OK);
|
||||
});
|
||||
|
||||
|
||||
if (PRINTER == create_success_type || sync_user_preset_need_enabled) {
|
||||
m_button_cancel = new Button(this, _L("Cancel"));
|
||||
m_button_cancel->SetBackgroundColor(btn_bg_white);
|
||||
@ -3525,7 +3525,7 @@ void ExportConfigsDialog::show_export_result(const ExportCase &export_case)
|
||||
msg_dlg = new MessageDialog(this, _L("Export successful"), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (msg_dlg) {
|
||||
msg_dlg->ShowModal();
|
||||
delete msg_dlg;
|
||||
@ -3559,9 +3559,9 @@ bool ExportConfigsDialog::preset_is_not_compatible_bbl_printer(Preset *preset)
|
||||
}
|
||||
|
||||
bool ExportConfigsDialog::earse_preset_fields_for_safe(Preset *preset)
|
||||
{
|
||||
{
|
||||
if (preset->type != Preset::Type::TYPE_PRINTER) return true;
|
||||
|
||||
|
||||
boost::filesystem::path file_path(data_dir() + "/" + PRESET_USER_DIR + "/" + "Temp" + "/" + (preset->name + ".json"));
|
||||
preset->file = file_path.make_preferred().string();
|
||||
|
||||
@ -3575,7 +3575,7 @@ bool ExportConfigsDialog::earse_preset_fields_for_safe(Preset *preset)
|
||||
config.erase("printhost_port");
|
||||
|
||||
preset->save(nullptr);
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string ExportConfigsDialog::initial_file_path(const wxString &path, const std::string &sub_file_path)
|
||||
@ -3868,7 +3868,7 @@ void ExportConfigsDialog::select_curr_radiobox(std::vector<std::pair<RadioBox *,
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
m_serial_text->SetLabel(_L("Only printer names with changed process presets will be displayed, \nand all user process presets in each printer name you select will be exported as a zip."));
|
||||
}
|
||||
@ -3897,7 +3897,7 @@ ExportConfigsDialog::ExportCase ExportConfigsDialog::archive_preset_bundle_to_fi
|
||||
std::string export_path = initial_file_path(path, "Printer config bundle");
|
||||
if (export_path.empty() || "initial_failed" == export_path) return ExportCase::EXPORT_CANCEL;
|
||||
BOOST_LOG_TRIVIAL(info) << "Export printer preset bundle";
|
||||
|
||||
|
||||
for (std::pair<::CheckBox *, Preset *> checkbox_preset : m_preset) {
|
||||
if (checkbox_preset.first->GetValue()) {
|
||||
Preset *printer_preset = checkbox_preset.second;
|
||||
@ -3925,7 +3925,7 @@ ExportConfigsDialog::ExportCase ExportConfigsDialog::archive_preset_bundle_to_fi
|
||||
BOOST_LOG_TRIVIAL(info) << "Failed to initialize ZIP archive";
|
||||
return ExportCase::INITIALIZE_FAIL;
|
||||
}
|
||||
|
||||
|
||||
boost::filesystem::path pronter_file_path = boost::filesystem::path(printer_preset->file);
|
||||
std::string preset_path = pronter_file_path.make_preferred().string();
|
||||
if (preset_path.empty()) {
|
||||
@ -4080,7 +4080,7 @@ ExportConfigsDialog::ExportCase ExportConfigsDialog::archive_filament_bundle_to_
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(info) << "Filament preset json add successful: " << filament_preset->name;
|
||||
}
|
||||
|
||||
|
||||
for (const std::pair<std::string, json>& vendor_name_to_json : vendor_structure) {
|
||||
json j;
|
||||
std::string filament_vendor = vendor_name_to_json.first;
|
||||
@ -4207,7 +4207,7 @@ ExportConfigsDialog::ExportCase ExportConfigsDialog::archive_process_preset_to_f
|
||||
BOOST_LOG_TRIVIAL(info) << "Export process preset: " << process_preset->name << " skip because of the preset file path is empty.";
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
std::string preset_name = process_preset->name + ".json";
|
||||
config_paths.push_back(std::make_pair(preset_name, preset_path));
|
||||
}
|
||||
@ -4274,7 +4274,7 @@ wxBoxSizer *ExportConfigsDialog::create_button_item(wxWindow* parent)
|
||||
}
|
||||
show_export_result(export_case);
|
||||
if (ExportCase::EXPORT_SUCCESS != export_case) return;
|
||||
|
||||
|
||||
EndModal(wxID_OK);
|
||||
});
|
||||
|
||||
@ -4358,7 +4358,7 @@ void ExportConfigsDialog::data_init()
|
||||
|
||||
const std::deque<Preset> & printer_presets = preset_bundle.printers.get_presets();
|
||||
for (const Preset &printer_preset : printer_presets) {
|
||||
|
||||
|
||||
std::string preset_name = printer_preset.name;
|
||||
if (!printer_preset.is_visible || printer_preset.is_default || printer_preset.is_project_embedded) continue;
|
||||
if (preset_bundle.printers.select_preset_by_name(preset_name, true)) {
|
||||
@ -4381,7 +4381,7 @@ void ExportConfigsDialog::data_init()
|
||||
m_process_presets[preset_name].push_back(new_prpcess_preset);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Preset *new_printer_preset = new Preset(printer_preset);
|
||||
earse_preset_fields_for_safe(new_printer_preset);
|
||||
m_printer_presets[preset_name] = new_printer_preset;
|
||||
@ -4422,9 +4422,9 @@ EditFilamentPresetDialog::EditFilamentPresetDialog(wxWindow *parent, FilamentInf
|
||||
m_main_sizer->Add(m_line_top, 0, wxEXPAND, 0);
|
||||
m_main_sizer->Add(0, 0, 0, wxTOP, FromDIP(5));
|
||||
|
||||
wxStaticText* basic_infomation = new wxStaticText(this, wxID_ANY, _L("Basic Information"));
|
||||
wxStaticText* basic_infomation = new wxStaticText(this, wxID_ANY, _L("Basic Information"));
|
||||
basic_infomation->SetFont(Label::Head_16);
|
||||
|
||||
|
||||
m_main_sizer->Add(basic_infomation, 0, wxALL, FromDIP(10));
|
||||
m_filament_id = filament_info->filament_id;
|
||||
//std::string filament_name = filament_info->filament_name;
|
||||
@ -4491,7 +4491,7 @@ void EditFilamentPresetDialog::on_dpi_changed(const wxRect &suggested_rect) {
|
||||
m_del_filament_btn->SetCornerRadius(FromDIP(12));
|
||||
m_ok_btn->SetMinSize(wxSize(FromDIP(58), FromDIP(24)));
|
||||
m_ok_btn->SetMaxSize(wxSize(FromDIP(58), FromDIP(24)));
|
||||
m_ok_btn->SetCornerRadius(FromDIP(12));*/
|
||||
m_ok_btn->SetCornerRadius(FromDIP(12));*/
|
||||
Layout();
|
||||
}
|
||||
|
||||
@ -4499,7 +4499,7 @@ bool EditFilamentPresetDialog::get_same_filament_id_presets(std::string filament
|
||||
{
|
||||
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
|
||||
const std::deque<Preset> &filament_presets = preset_bundle->filaments.get_presets();
|
||||
|
||||
|
||||
m_printer_compatible_presets.clear();
|
||||
for (Preset const &preset : filament_presets) {
|
||||
if (preset.is_system || preset.filament_id != filament_id) continue;
|
||||
@ -4546,7 +4546,7 @@ void EditFilamentPresetDialog::update_preset_tree()
|
||||
m_preset_tree_window->SetMaxSize(wxSize(std::min(1000, width + width_extend), std::min(400, height + height_extend)));
|
||||
m_preset_tree_window->SetSize(wxSize(std::min(1000, width + width_extend), std::min(400, height + height_extend)));
|
||||
this->SetSizerAndFit(m_main_sizer);
|
||||
|
||||
|
||||
this->Layout();
|
||||
this->Fit();
|
||||
this->Refresh();
|
||||
@ -4841,14 +4841,14 @@ wxBoxSizer *EditFilamentPresetDialog::create_button_sizer()
|
||||
}
|
||||
m_printer_compatible_presets.clear();
|
||||
wxGetApp().preset_bundle->filaments.select_preset_by_name(next_selected_preset_name,true);
|
||||
|
||||
|
||||
for (size_t i = 0; i < wxGetApp().preset_bundle->filament_presets.size(); ++i) {
|
||||
auto preset = wxGetApp().preset_bundle->filaments.find_preset(wxGetApp().preset_bundle->filament_presets[i]);
|
||||
if (preset == nullptr) wxGetApp().preset_bundle->filament_presets[i] = wxGetApp().preset_bundle->filaments.get_selected_preset_name();
|
||||
}
|
||||
EndModal(wxID_OK);
|
||||
}
|
||||
e.Skip();
|
||||
e.Skip();
|
||||
}));
|
||||
|
||||
m_ok_btn->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_OK); });
|
||||
@ -4924,7 +4924,7 @@ void CreatePresetForPrinterDialog::get_visible_printer_and_compatible_filament_p
|
||||
} else {
|
||||
filament_types = dynamic_cast<ConfigOptionStrings *>(const_cast<Preset *>(filament_preset_base)->config.option("filament_type"));
|
||||
}
|
||||
|
||||
|
||||
if (filament_types && filament_types->values.empty()) continue;
|
||||
const std::string filament_type = filament_types->values[0];
|
||||
std::string filament_type_ = m_filament_type == "PLA Aero" ? "PLA-AERO" : m_filament_type;
|
||||
@ -4944,7 +4944,7 @@ wxBoxSizer *CreatePresetForPrinterDialog::create_selected_printer_preset_sizer()
|
||||
select_preseter_preset_sizer->Add(printer_text, 0, wxEXPAND | wxALL, 0);
|
||||
m_selected_printer = new ComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, PRINTER_PRESET_MODEL_SIZE, 0, nullptr, wxCB_READONLY);
|
||||
select_preseter_preset_sizer->Add(m_selected_printer, 0, wxEXPAND | wxTOP, FromDIP(5));
|
||||
|
||||
|
||||
wxArrayString printer_choices;
|
||||
for (std::pair<std::string, std::vector<std::shared_ptr<Preset>>> printer_to_filament_presets : m_printer_compatible_filament_presets) {
|
||||
auto compatible_printer_name = printer_to_filament_presets.first;
|
||||
@ -5065,7 +5065,7 @@ wxBoxSizer *CreatePresetForPrinterDialog::create_button_sizer()
|
||||
EndModal(wxID_OK);
|
||||
});
|
||||
m_cancel_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { EndModal(wxID_CANCEL); });
|
||||
|
||||
|
||||
return bSizer_button;
|
||||
}
|
||||
|
||||
@ -5174,7 +5174,7 @@ wxPanel *PresetTree::get_child_item(wxPanel *parent, std::shared_ptr<Preset> pre
|
||||
del_preset_btn->SetBorderColor(flush_bd_col);
|
||||
del_preset_btn->SetTextColor(flush_fg_col);
|
||||
}
|
||||
|
||||
|
||||
//del_preset_btn->Hide();
|
||||
sizer->Add(del_preset_btn, 0, wxALL | wxALIGN_CENTER_VERTICAL, 0);
|
||||
|
||||
|
@ -194,16 +194,11 @@ wxDEFINE_EVENT(EVT_ADD_FILAMENT, SimpleEvent);
|
||||
wxDEFINE_EVENT(EVT_DEL_FILAMENT, SimpleEvent);
|
||||
wxDEFINE_EVENT(EVT_ADD_CUSTOM_FILAMENT, ColorEvent);
|
||||
wxDEFINE_EVENT(EVT_NOTICE_CHILDE_SIZE_CHANGED, SimpleEvent);
|
||||
static int get_diameter_index(float diameter)
|
||||
static string get_diameter_string(float diameter)
|
||||
{
|
||||
float eps = 1e-3;
|
||||
std::vector<float> diameters = {0.2, 0.4, 0.6, 0.8};
|
||||
for (int index = 0; index < diameters.size(); ++index) {
|
||||
if (abs(diameters[index] - diameter) < eps) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
std::ostringstream stream;
|
||||
stream << std::fixed << std::setprecision(1) << diameter;
|
||||
return stream.str();
|
||||
}
|
||||
|
||||
bool Plater::has_illegal_filename_characters(const wxString& wxs_name)
|
||||
@ -1229,8 +1224,11 @@ bool Sidebar::priv::sync_extruder_list(bool &only_external_material)
|
||||
int main_index = obj->is_main_extruder_on_left() ? 0 : 1;
|
||||
int deputy_index = obj->is_main_extruder_on_left() ? 1 : 0;
|
||||
|
||||
left_extruder->combo_diameter->SetSelection(get_diameter_index(nozzle_diameters[0]));
|
||||
right_extruder->combo_diameter->SetSelection(get_diameter_index(nozzle_diameters[1]));
|
||||
int left_index = left_extruder->combo_diameter->FindString(get_diameter_string(nozzle_diameters[0]));
|
||||
int right_index = left_extruder->combo_diameter->FindString(get_diameter_string(nozzle_diameters[1]));
|
||||
assert(left_extruder != -1 && right_extruder != -1);
|
||||
left_extruder->combo_diameter->SetSelection(left_index);
|
||||
right_extruder->combo_diameter->SetSelection(right_index);
|
||||
is_switching_diameter = true;
|
||||
switch_diameter(false);
|
||||
is_switching_diameter = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user