Add parameter description

Original Commit: prusa3d/PrusaSlicer@d652f15

Co-authored-by: YuSanka <yusanka@gmail.com>
This commit is contained in:
Ocraftyone 2023-12-26 06:00:37 -05:00
parent 58cd50cc23
commit 6539dc4efa
No known key found for this signature in database
GPG key ID: 85836ED21AD4D125
2 changed files with 10 additions and 0 deletions

View file

@ -169,6 +169,8 @@ EditGCodeDialog::EditGCodeDialog(wxWindow* parent, const std::string& key, const
m_param_label = new wxStaticText(this, wxID_ANY, _L("Select placeholder"));
m_param_label->SetFont(wxGetApp().bold_font());
m_param_description = new wxStaticText(this, wxID_ANY, wxEmptyString);
//Orca: use custom buttons
auto btn_sizer = create_btn_sizer(wxOK | wxCANCEL);
for(auto btn : m_button_list)
@ -179,6 +181,7 @@ EditGCodeDialog::EditGCodeDialog(wxWindow* parent, const std::string& key, const
topSizer->Add(label_top , 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, border);
topSizer->Add(grid_sizer , 1, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, border);
topSizer->Add(m_param_label , 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, border);
topSizer->Add(m_param_description , 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, border);
topSizer->Add(btn_sizer , 0, wxEXPAND | wxALL, border);
SetSizer(topSizer);
@ -398,6 +401,7 @@ void EditGCodeDialog::bind_list_and_button()
{
m_params_list->Bind(wxEVT_DATAVIEW_SELECTION_CHANGED, [this](wxDataViewEvent& evt) {
wxString label;
wxString description;
const std::string opt_key = m_params_list->GetSelectedParamKey();
if (!opt_key.empty()) {
@ -435,12 +439,17 @@ void EditGCodeDialog::bind_list_and_button()
(!cod->full_label.empty() && !cod->label.empty() ) ?
format_wxstr("%1% > %2%\n(%3%)", _(cod->full_label), _(cod->label), type_str) :
format_wxstr("%1%\n(%2%)", cod->label.empty() ? _(cod->full_label) : _(cod->label), type_str);
if (cod)
description = _(cod->tooltip);
}
else
label = "Undef optptr";
}
m_param_label->SetLabel(label);
m_param_description->SetLabel(description);
Layout();
});