GUI: Add filament notes to material selector tooltip (#10051)
Some checks failed
Build all / Build All (push) Waiting to run
Build all / Flatpak (push) Waiting to run
Publish docs to Wiki / Publish docs to Wiki (push) Has been cancelled

* GUI: Add filament notes to material selector tooltip

Enhances material selector tooltip to display filament notes from preset configuration.
Adds automatic truncation for notes longer than 200 characters with ellipsis.
Improves user experience by providing material context directly in tooltip.

Fixes #10037

* GUI: Add filament notes to material selector tooltip

Enhances material selector tooltip to display filament notes from preset configuration.
Adds automatic truncation for notes longer than 200 characters with ellipsis.
Improves user experience by providing material context directly in tooltip.

Fixes #10037

* GUI: Fix tooltip display for unsaved profile notes
This commit is contained in:
Jessy LANGE 2025-07-04 18:29:47 +02:00 committed by GitHub
parent 7f8f807500
commit e348923283
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -263,6 +263,28 @@ wxColor PresetComboBox::different_color(wxColor const &clr)
wxString PresetComboBox::get_tooltip(const Preset &preset)
{
wxString tooltip = from_u8(preset.name);
// Add filament notes if available for filament presets
if (m_type == Preset::TYPE_FILAMENT) {
const DynamicConfig* config = &preset.config;
Tab* tab = wxGetApp().get_tab(m_type);
if (tab && tab->current_preset_is_dirty() && tab->get_presets()->get_selected_preset().name == preset.name) {
config = tab->get_config();
}
if (config->has("filament_notes")) {
const ConfigOptionStrings* notes_opt = config->option<ConfigOptionStrings>("filament_notes");
if (notes_opt && !notes_opt->values.empty() && !notes_opt->values[0].empty()) {
std::string notes = notes_opt->values[0];
// Truncate if longer than 200 characters
if (notes.length() > 200) {
notes = notes.substr(0, 197) + "...";
}
tooltip += "\n" + from_u8(notes);
}
}
}
// BBS: FIXME
#if 0
if (m_type == Preset::TYPE_FILAMENT) {