From 7aa857bf0f54d3447389f2912d5d950229153859 Mon Sep 17 00:00:00 2001 From: "maosheng.wei" Date: Mon, 23 Oct 2023 21:06:09 +0800 Subject: [PATCH] FIX: create printer preset dialog issue Jira: 4890 4886 4880 Change-Id: If3bc20cf8f8c80d49cf6baf70ed9892710fc0c0c Signed-off-by: maosheng.wei --- src/libslic3r/Preset.cpp | 2 +- src/slic3r/GUI/CreatePresetsDialog.cpp | 38 +++++++++++++++++--------- src/slic3r/GUI/GUI_App.cpp | 1 + 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 4a98a9b87..59a3e5ef5 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -1564,7 +1564,7 @@ bool PresetCollection::load_user_preset(std::string name, std::map presets_loaded; int count = 0; - BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(" enter, name %1% , total value counts %2%")%name %preset_values.size(); + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" enter, name %1% , total value counts %2%")%name %preset_values.size(); //if the version is not matching, skip it if (preset_values.find(BBL_JSON_KEY_VERSION) == preset_values.end()) { diff --git a/src/slic3r/GUI/CreatePresetsDialog.cpp b/src/slic3r/GUI/CreatePresetsDialog.cpp index 8250727e2..1e1a69675 100644 --- a/src/slic3r/GUI/CreatePresetsDialog.cpp +++ b/src/slic3r/GUI/CreatePresetsDialog.cpp @@ -461,7 +461,7 @@ static bool delete_filament_preset_by_name(std::string delete_preset_name, std:: } CreateFilamentPresetDialog::CreateFilamentPresetDialog(wxWindow *parent) - : DPIDialog(parent ? parent : nullptr, wxID_ANY, _L("Creat Filament"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX) + : DPIDialog(parent ? parent : nullptr, wxID_ANY, _L("Creat Filament"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX | wxCENTRE) { m_create_type.base_filament = _L("Create based on current filamet"); @@ -1064,7 +1064,7 @@ void CreateFilamentPresetDialog::clear_filament_preset_map() } CreatePrinterPresetDialog::CreatePrinterPresetDialog(wxWindow *parent) -: DPIDialog(parent ? parent : nullptr, wxID_ANY, _L("Create Printer/Nozzle"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX) +: DPIDialog(parent ? parent : nullptr, wxID_ANY, _L("Create Printer/Nozzle"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX | wxCENTER) { m_create_type.create_printer = _L("Create Printer"); m_create_type.create_nozzle = _L("Create Nozzle for existing printer"); @@ -1109,7 +1109,12 @@ CreatePrinterPresetDialog::CreatePrinterPresetDialog(wxWindow *parent) Layout(); Fit(); - + + wxSize screen_size = wxGetDisplaySize(); + int dialogX = (screen_size.GetWidth() - GetSize().GetWidth()) / 2; + int dialogY = (screen_size.GetHeight() - GetSize().GetHeight()) / 2; + SetPosition(wxPoint(dialogX, dialogY)); + wxGetApp().UpdateDlgDarkUI(this); } @@ -1133,19 +1138,25 @@ wxBoxSizer *CreatePrinterPresetDialog::create_step_switch_item() step_switch_sizer->Add(m_download_hyperlink, 0, wxRIGHT | wxALIGN_RIGHT, FromDIP(5)); wxBoxSizer *horizontal_sizer = new wxBoxSizer(wxHORIZONTAL); - m_step_1 = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap("step_1", nullptr, FromDIP(20)), wxDefaultPosition, wxDefaultSize); - horizontal_sizer->Add(m_step_1, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(3)); - wxStaticText *static_create_printer_text = new wxStaticText(this, wxID_ANY, _L("Create Printer"), wxDefaultPosition, wxDefaultSize); - horizontal_sizer->Add(static_create_printer_text, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(3)); - auto divider_line = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(50), 1)); + wxPanel * step_switch_panel = new wxPanel(this); + step_switch_panel->SetBackgroundColour(*wxWHITE); + horizontal_sizer->Add(0, 0, 1, wxEXPAND,0); + m_step_1 = new wxStaticBitmap(step_switch_panel, wxID_ANY, create_scaled_bitmap("step_1", nullptr, FromDIP(20)), wxDefaultPosition, wxDefaultSize); + horizontal_sizer->Add(m_step_1, 0, wxEXPAND | wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(3)); + wxStaticText *static_create_printer_text = new wxStaticText(step_switch_panel, wxID_ANY, _L("Create Printer"), wxDefaultPosition, wxDefaultSize); + horizontal_sizer->Add(static_create_printer_text, 0, wxEXPAND | wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(3)); + auto divider_line = new wxPanel(step_switch_panel, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(50), 1)); divider_line->SetBackgroundColour(PRINTER_LIST_COLOUR); horizontal_sizer->Add(divider_line, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(3)); - m_step_2 = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap("step_2_ready", nullptr, FromDIP(20)), wxDefaultPosition, wxDefaultSize); - horizontal_sizer->Add(m_step_2, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(3)); - wxStaticText *static_improt_presets_text = new wxStaticText(this, wxID_ANY, _L("Improt Presets"), wxDefaultPosition, wxDefaultSize); - horizontal_sizer->Add(static_improt_presets_text, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(3)); + m_step_2 = new wxStaticBitmap(step_switch_panel, wxID_ANY, create_scaled_bitmap("step_2_ready", nullptr, FromDIP(20)), wxDefaultPosition, wxDefaultSize); + horizontal_sizer->Add(m_step_2, 0, wxEXPAND | wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(3)); + wxStaticText *static_improt_presets_text = new wxStaticText(step_switch_panel, wxID_ANY, _L("Improt Presets"), wxDefaultPosition, wxDefaultSize); + horizontal_sizer->Add(static_improt_presets_text, 0, wxEXPAND | wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(3)); + horizontal_sizer->Add(0, 0, 1, wxEXPAND, 0); - step_switch_sizer->Add(horizontal_sizer, 0, wxBOTTOM | wxALIGN_CENTER_HORIZONTAL, FromDIP(10)); + step_switch_panel->SetSizer(horizontal_sizer); + + step_switch_sizer->Add(step_switch_panel, 0, wxBOTTOM | wxALIGN_CENTER_HORIZONTAL, FromDIP(10)); auto line_top = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL); line_top->SetBackgroundColour(PRINTER_LIST_COLOUR); @@ -1165,6 +1176,7 @@ void CreatePrinterPresetDialog::create_printer_page1(wxWindow *parent) m_page1_sizer->Add(create_printer_item(parent), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5)); m_page1_sizer->Add(create_nozzle_diameter_item(parent), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5)); m_printer_info_panel = new wxPanel(parent); + m_printer_info_panel->SetBackgroundColour(*wxWHITE); m_printer_info_sizer = new wxBoxSizer(wxVERTICAL); m_printer_info_sizer->Add(create_bed_shape_item(m_printer_info_panel), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5)); m_printer_info_sizer->Add(create_bed_size_item(m_printer_info_panel), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5)); diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index f41ac3fe8..b6177a539 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -4450,6 +4450,7 @@ void GUI_App::reload_settings() if (preset_bundle && m_agent) { std::map> user_presets; m_agent->get_user_presets(&user_presets); + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " cloud user preset number is: " << user_presets.size(); preset_bundle->load_user_presets(*app_config, user_presets, ForwardCompatibilitySubstitutionRule::Enable); preset_bundle->save_user_presets(*app_config, get_delete_cache_presets()); mainframe->update_side_preset_ui();