NEW: [STUDIO-4036 STUDIO-4073] create filament and printer dialog

Jira: 4036 4073

Change-Id: I073ee4a2af4c86332e6d052f5d7322c9f2784184
(cherry picked from commit f4ec32929e1e6ebecd87e2e709636a43be497265)
This commit is contained in:
maosheng.wei 2023-08-21 17:59:42 +08:00 committed by Lane.Wei
parent 131161f29b
commit 743f485fad
15 changed files with 3040 additions and 15 deletions

View file

@ -564,10 +564,45 @@ Sidebar::Sidebar(Plater *parent)
wxGetApp().run_wizard(ConfigWizard::RR_USER, ConfigWizard::SP_PRINTERS);
});
StateColor create_printer_bg_col(std::pair<wxColour, int>(wxColour(219, 253, 231), StateColor::Pressed), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Normal));
StateColor create_printer_fg_col(std::pair<wxColour, int>(wxColour(107, 107, 106), StateColor::Pressed),
std::pair<wxColour, int>(wxColour(107, 107, 106), StateColor::Hovered),
std::pair<wxColour, int>(wxColour(107, 107, 106), StateColor::Normal));
StateColor create_printer_bd_col(std::pair<wxColour, int>(wxColour(0, 174, 66), StateColor::Pressed), std::pair<wxColour, int>(wxColour(0, 174, 66), StateColor::Hovered),
std::pair<wxColour, int>(wxColour(172, 172, 172), StateColor::Normal));
auto create_printer_preset_btn = new Button(p->m_panel_printer_title, _L("Create Printer"));
create_printer_preset_btn->SetFont(Label::Body_10);
create_printer_preset_btn->SetPaddingSize(wxSize(FromDIP(8), FromDIP(3)));
create_printer_preset_btn->SetCornerRadius(FromDIP(8));
create_printer_preset_btn->SetBackgroundColor(create_printer_bg_col);
create_printer_preset_btn->SetBorderColor(create_printer_bd_col);
create_printer_preset_btn->SetTextColor(create_printer_fg_col);
create_printer_preset_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
//CreateFilamentPresetDialog dlg(p->m_panel_printer_title);
CreatePrinterPresetDialog dlg(p->m_panel_printer_title);
int res = dlg.ShowModal();
if (wxID_OK == res) {
wxGetApp().mainframe->update_side_preset_ui();
update_all_preset_comboboxes();
CreatePresetSuccessfulDialog success_dlg(p->m_panel_filament_title, SuccessType::PRINTER);
int res = success_dlg.ShowModal();
if (res == wxID_OK) {
p->editing_filament = -1;
if (p->combo_printer->switch_to_tab())
p->editing_filament = 0;
}
}
});
wxBoxSizer* h_sizer_title = new wxBoxSizer(wxHORIZONTAL);
h_sizer_title->Add(p->m_printer_icon, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, em);
h_sizer_title->Add(p->m_text_printer_settings, 0, wxALIGN_CENTER);
h_sizer_title->AddStretchSpacer();
h_sizer_title->Add(create_printer_preset_btn, 0, wxRIGHT | wxALIGN_CENTER, FromDIP(10));
h_sizer_title->Add(p->m_printer_setting, 0, wxALIGN_CENTER);
h_sizer_title->Add(15 * em / 10, 0, 0, 0, 0);
h_sizer_title->SetMinSize(-1, 3 * em);
@ -788,6 +823,31 @@ Sidebar::Sidebar(Plater *parent)
wxPostEvent(parent, SimpleEvent(EVT_SCHEDULE_BACKGROUND_PROCESS, parent));
}
}));
auto create_filament_preset_btn = new Button(p->m_panel_filament_title, _L("Create Filament"));
create_filament_preset_btn->SetFont(Label::Body_10);
create_filament_preset_btn->SetPaddingSize(wxSize(FromDIP(8), FromDIP(3)));
create_filament_preset_btn->SetCornerRadius(FromDIP(8));
create_filament_preset_btn->SetBackgroundColor(flush_bg_col);
create_filament_preset_btn->SetBorderColor(flush_bd_col);
create_filament_preset_btn->SetTextColor(flush_fg_col);
create_filament_preset_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
CreateFilamentPresetDialog dlg(p->m_panel_filament_title);
//CreatePrinterPresetDialog dlg(p->m_panel_filament_title);
int res = dlg.ShowModal();
if (wxID_OK == res) {
wxGetApp().mainframe->update_side_preset_ui();
update_ui_from_settings();
update_all_preset_comboboxes();
CreatePresetSuccessfulDialog success_dlg(p->m_panel_filament_title, SuccessType::FILAMENT);
int res = success_dlg.ShowModal();
/*if (res == wxID_OK) {
p->editing_filament = 0;
p->combos_filament[0]->switch_to_tab();
}*/
}
});
bSizer39->Add(create_filament_preset_btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(5));
bSizer39->Add(p->m_flushing_volume_btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(5));
bSizer39->Hide(p->m_flushing_volume_btn);
bSizer39->Add(FromDIP(10), 0, 0, 0, 0 );