Skip to content

Commit

Permalink
FIX: [5149 5142 5141 5140 5136] create printer and filament issue
Browse files Browse the repository at this point in the history
Jira: 5149 5142 5141 5140 5136
5149 process preset name can not show all
5142 improt configs combobox not update
5141 disable modify filament_vendor
5140 disable input Bambu and Generic vendor
5136 preset list window adjust

Change-Id: I111a23996146cc16cc7f533c8616d50223d34c40
Signed-off-by: maosheng.wei <maosheng.wei@bambulab.com>
  • Loading branch information
DanBao-Bambu authored and lanewei120 committed Nov 9, 2023
1 parent 939f64d commit 0ff1c20
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 28 deletions.
69 changes: 41 additions & 28 deletions src/slic3r/GUI/CreatePresetsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ static wxBoxSizer* create_checkbox(wxWindow* parent, Preset* preset, wxString& p
sizer->Add(checkbox, 0, 0, 0);
preset_checkbox.push_back(std::make_pair(checkbox, preset));
wxStaticText *preset_name_str = new wxStaticText(parent, wxID_ANY, preset_name);
wxToolTip * toolTip = new wxToolTip(preset_name);
preset_name_str->SetToolTip(toolTip);
sizer->Add(preset_name_str, 0, wxLEFT, 5);
return sizer;
}
Expand Down Expand Up @@ -892,6 +894,12 @@ wxBoxSizer *CreateFilamentPresetDialog::create_button_item()
return;
} else {
vendor_name = into_u8(m_filament_custom_vendor_input->GetTextCtrl()->GetValue());
if (vendor_name == "Bambu" || vendor_name == "Generic") {
MessageDialog dlg(this, _L("\"Bambu\" or \"Generic\" can not be used as a Vendor for custom filaments."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"),
wxYES | wxYES_DEFAULT | wxCENTRE);
dlg.ShowModal();
return;
}
}
}

Expand Down Expand Up @@ -2089,6 +2097,23 @@ void CreatePrinterPresetDialog::generate_process_presets_data(std::vector<Preset
}
}

void CreatePrinterPresetDialog::update_preset_list_size()
{
m_scrolled_preset_window->Freeze();
m_preset_template_panel->SetSizerAndFit(m_filament_sizer);
m_preset_template_panel->SetMinSize(wxSize(FromDIP(660), -1));
m_preset_template_panel->SetSize(wxSize(FromDIP(660), -1));
int whidth = m_preset_template_panel->GetSize().GetWidth();
int height = m_preset_template_panel->GetSize().GetHeight();
m_scrolled_preset_window->SetMinSize(wxSize(std::min(1500, whidth), std::min(600, height)));
m_scrolled_preset_window->SetMaxSize(wxSize(std::min(1500, whidth), std::min(600, height)));
m_scrolled_preset_window->SetSize(wxSize(std::min(1500, whidth), std::min(600, height)));
m_page2->SetSizerAndFit(m_page2_sizer);
Layout();
Fit();
m_scrolled_preset_window->Thaw();
}

wxBoxSizer *CreatePrinterPresetDialog::create_radio_item(wxString title, wxWindow *parent, wxString tooltip, std::vector<std::pair<RadioBox *, wxString>> &radiobox_list)
{
wxBoxSizer *horizontal_sizer = new wxBoxSizer(wxHORIZONTAL);
Expand Down Expand Up @@ -2174,13 +2199,7 @@ void CreatePrinterPresetDialog::select_curr_radiobox(std::vector<std::pair<Radio
}
}

if (this->GetSize().GetHeight() > 800) {
this->SetSize(-1, 800);
}

Layout();
Fit();
Refresh();
update_preset_list_size();
}

void CreatePrinterPresetDialog::create_printer_page2(wxWindow *parent)
Expand Down Expand Up @@ -2263,23 +2282,23 @@ wxBoxSizer *CreatePrinterPresetDialog::create_presets_template_item(wxWindow *pa
m_scrolled_preset_window = new wxScrolledWindow(parent);
m_scrolled_preset_window->SetScrollRate(5, 5);
m_scrolled_preset_window->SetBackgroundColour(*wxWHITE);
m_scrolled_preset_window->SetMinSize(wxSize(FromDIP(900), FromDIP(400)));
m_scrolled_preset_window->SetMaxSize(wxSize(FromDIP(900), FromDIP(500)));
m_scrolled_preset_window->SetSize(wxSize(FromDIP(900), FromDIP(300)));
//m_scrolled_preset_window->SetMinSize(wxSize(FromDIP(1500), FromDIP(-1)));
m_scrolled_preset_window->SetMaxSize(wxSize(FromDIP(1500), FromDIP(-1)));
m_scrolled_preset_window->SetSize(wxSize(FromDIP(1500), FromDIP(-1)));
m_scrooled_preset_sizer = new wxBoxSizer(wxHORIZONTAL);

m_preset_template_panel = new wxPanel(m_scrolled_preset_window);
m_preset_template_panel->SetSize(wxSize(-1, -1));
m_preset_template_panel->SetBackgroundColour(PRINTER_LIST_COLOUR);
m_preset_template_panel->SetMinSize(wxSize(FromDIP(580), -1));
wxBoxSizer * filament_sizer = new wxBoxSizer(wxVERTICAL);
m_preset_template_panel->SetMinSize(wxSize(FromDIP(660), -1));
m_filament_sizer = new wxBoxSizer(wxVERTICAL);
wxStaticText *static_filament_preset_text = new wxStaticText(m_preset_template_panel, wxID_ANY, _L("Filament preset template"), wxDefaultPosition, wxDefaultSize);
filament_sizer->Add(static_filament_preset_text, 0, wxEXPAND | wxALL, FromDIP(5));
m_filament_sizer->Add(static_filament_preset_text, 0, wxEXPAND | wxALL, FromDIP(5));
m_filament_preset_panel = new wxPanel(m_preset_template_panel);
m_filament_preset_template_sizer = new wxGridSizer(3, FromDIP(5), FromDIP(5));
m_filament_preset_panel->SetSize(PRESET_TEMPLATE_SIZE);
m_filament_preset_panel->SetSizer(m_filament_preset_template_sizer);
filament_sizer->Add(m_filament_preset_panel, 0, wxEXPAND | wxALL, FromDIP(5));
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);
Expand All @@ -2299,19 +2318,19 @@ wxBoxSizer *CreatePrinterPresetDialog::create_presets_template_item(wxWindow *pa
hori_filament_btn_sizer->Add(filament_sel_all_text, 0, wxEXPAND | wxALL, FromDIP(5));
hori_filament_btn_sizer->Add(filament_desel_all_text, 0, wxEXPAND | wxALL, FromDIP(5));
filament_btn_panel->SetSizer(hori_filament_btn_sizer);
filament_sizer->Add(filament_btn_panel, 0, wxEXPAND, 0);
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));
filament_sizer->Add(split_panel, 0, wxEXPAND, 0);
m_filament_sizer->Add(split_panel, 0, wxEXPAND, 0);

wxStaticText *static_process_preset_text = new wxStaticText(m_preset_template_panel, wxID_ANY, _L("Process preset template"), wxDefaultPosition, wxDefaultSize);
filament_sizer->Add(static_process_preset_text, 0, wxEXPAND | wxALL, FromDIP(5));
m_filament_sizer->Add(static_process_preset_text, 0, wxEXPAND | wxALL, FromDIP(5));
m_process_preset_panel = new wxPanel(m_preset_template_panel);
m_process_preset_panel->SetSize(PRESET_TEMPLATE_SIZE);
m_process_preset_template_sizer = new wxGridSizer(3, FromDIP(5), FromDIP(5));
m_process_preset_panel->SetSizer(m_process_preset_template_sizer);
filament_sizer->Add(m_process_preset_panel, 0, wxEXPAND | wxALL, FromDIP(5));
m_filament_sizer->Add(m_process_preset_panel, 0, wxEXPAND | wxALL, FromDIP(5));


wxBoxSizer *hori_process_btn_sizer = new wxBoxSizer(wxHORIZONTAL);
Expand All @@ -2332,9 +2351,9 @@ wxBoxSizer *CreatePrinterPresetDialog::create_presets_template_item(wxWindow *pa
hori_process_btn_sizer->Add(process_sel_all_text, 0, wxEXPAND | wxALL, FromDIP(5));
hori_process_btn_sizer->Add(process_desel_all_text, 0, wxEXPAND | wxALL, FromDIP(5));
process_btn_panel->SetSizer(hori_process_btn_sizer);
filament_sizer->Add(process_btn_panel, 0, wxEXPAND, 0);
m_filament_sizer->Add(process_btn_panel, 0, wxEXPAND, 0);

m_preset_template_panel->SetSizer(filament_sizer);
m_preset_template_panel->SetSizer(m_filament_sizer);
m_scrooled_preset_sizer->Add(m_preset_template_panel, 0, wxEXPAND | wxALL, 0);
m_scrolled_preset_window->SetSizerAndFit(m_scrooled_preset_sizer);
vertical_sizer->Add(m_scrolled_preset_window, 0, wxEXPAND | wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(10));
Expand Down Expand Up @@ -2683,6 +2702,7 @@ bool CreatePrinterPresetDialog::data_init()
m_printer_model->SetSelection(0);
wxCommandEvent e;
on_preset_model_value_change(e);
update_preset_list_size();
}
rewritten = false;
e.Skip();
Expand Down Expand Up @@ -2958,14 +2978,7 @@ void CreatePrinterPresetDialog::on_preset_model_value_change(wxCommandEvent &e)
}
rewritten = false;

m_page2->SetSizerAndFit(m_page2_sizer);

if (this->GetSize().GetHeight() > 800) {
this->SetSize(-1, 800);
}

Layout();
Fit();
update_preset_list_size();

e.Skip();
}
Expand Down
2 changes: 2 additions & 0 deletions src/slic3r/GUI/CreatePresetsDialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ class CreatePrinterPresetDialog : public DPIDialog
void load_model_stl();
bool load_system_and_user_presets_with_curr_model(PresetBundle &temp_preset_bundle, bool just_template = false);
void generate_process_presets_data(std::vector<Preset const *> presets, std::string nozzle);
void update_preset_list_size();
wxArrayString printer_preset_sort_with_nozzle_diameter(const VendorProfile &vendor_profile, float nozzle_diameter);

wxBoxSizer *create_radio_item(wxString title, wxWindow *parent, wxString tooltip, std::vector<std::pair<RadioBox *, wxString>> &radiobox_list);
Expand Down Expand Up @@ -202,6 +203,7 @@ class CreatePrinterPresetDialog : public DPIDialog
wxPanel * m_filament_preset_panel = nullptr;
wxPanel * m_process_preset_panel = nullptr;
wxPanel * m_preset_template_panel = nullptr;
wxBoxSizer * m_filament_sizer = nullptr;
wxPanel * m_printer_info_panel = nullptr;
wxBoxSizer * m_page1_sizer = nullptr;
wxBoxSizer * m_printer_info_sizer = nullptr;
Expand Down
1 change: 1 addition & 0 deletions src/slic3r/GUI/MainFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3205,6 +3205,7 @@ void MainFrame::load_config_file()
}
}
wxGetApp().preset_bundle->update_compatible(PresetSelectCompatibleType::Always);
update_side_preset_ui();
MessageDialog dlg2(this, wxString::Format(_L_PLURAL("There is %d config imported. (Only non-system and compatible configs)",
"There are %d configs imported. (Only non-system and compatible configs)", cfiles.size()), cfiles.size()),
_L("Import result"), wxOK);
Expand Down
1 change: 1 addition & 0 deletions src/slic3r/GUI/Tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3108,6 +3108,7 @@ void TabFilament::toggle_options()
if (m_active_page->title() == "Filament")
{
toggle_option("filament_type", false);
toggle_option("filament_vendor", false);
//BBS: hide these useless option for bambu printer
toggle_line("enable_pressure_advance", !is_BBL_printer);
if (is_BBL_printer)
Expand Down

0 comments on commit 0ff1c20

Please sign in to comment.