Display filament labels in "change filament" context menus (#4921)
* ENH: display filament labels in "change filament" context menus
This commit is contained in:
parent
eef66022a0
commit
ec8d91e14f
1 changed files with 31 additions and 7 deletions
|
@ -897,8 +897,20 @@ void MenuFactory::append_menu_item_change_extruder(wxMenu* menu)
|
|||
bool is_active_extruder = i == initial_extruder;
|
||||
int icon_idx = i == 0 ? 0 : i - 1;
|
||||
|
||||
const wxString& item_name = (i == 0 ? _L("Default") : wxString::Format(_L("Filament %d"), i)) +
|
||||
(is_active_extruder ? " (" + _L("active") + ")" : "");
|
||||
wxString item_name = _L("Default");
|
||||
|
||||
if (i > 0) {
|
||||
auto preset = wxGetApp().preset_bundle->filaments.find_preset(wxGetApp().preset_bundle->filament_presets[i - 1]);
|
||||
if (preset == nullptr) {
|
||||
item_name = wxString::Format(_L("Filament %d"), i);
|
||||
} else {
|
||||
item_name = from_u8(preset->label(false));
|
||||
}
|
||||
}
|
||||
|
||||
if (is_active_extruder) {
|
||||
item_name << " (" + _L("current") + ")";
|
||||
}
|
||||
|
||||
if (icon_idx >= 0 && icon_idx < icons.size()) {
|
||||
append_menu_item(
|
||||
|
@ -1881,8 +1893,20 @@ void MenuFactory::append_menu_item_change_filament(wxMenu* menu)
|
|||
//bool is_active_extruder = i == initial_extruder;
|
||||
bool is_active_extruder = false;
|
||||
|
||||
const wxString& item_name = (i == 0 ? _L("Default") : wxString::Format(_L("Filament %d"), i)) +
|
||||
(is_active_extruder ? " (" + _L("current") + ")" : "");
|
||||
wxString item_name = _L("Default");
|
||||
|
||||
if (i > 0) {
|
||||
auto preset = wxGetApp().preset_bundle->filaments.find_preset(wxGetApp().preset_bundle->filament_presets[i - 1]);
|
||||
if (preset == nullptr) {
|
||||
item_name = wxString::Format(_L("Filament %d"), i);
|
||||
} else {
|
||||
item_name = from_u8(preset->label(false));
|
||||
}
|
||||
}
|
||||
|
||||
if (is_active_extruder) {
|
||||
item_name << " (" + _L("current") + ")";
|
||||
}
|
||||
|
||||
append_menu_item(extruder_selection_menu, wxID_ANY, item_name, "",
|
||||
[i](wxCommandEvent&) { obj_list()->set_extruder_for_selected_items(i); }, i == 0 ? wxNullBitmap : *icons[i - 1], menu,
|
||||
|
|
Loading…
Reference in a new issue