mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-14 04:27:36 +00:00
Show alias instead of full name in publish dialog
This commit is contained in:
@@ -93,8 +93,12 @@ wxString material_title(size_t slot, const PresetBundle* bundle, const DynamicPr
|
|||||||
{
|
{
|
||||||
if (slot < bundle->filament_presets.size()) {
|
if (slot < bundle->filament_presets.size()) {
|
||||||
const Preset* preset = bundle->filaments.find_preset(bundle->filament_presets[slot]);
|
const Preset* preset = bundle->filaments.find_preset(bundle->filament_presets[slot]);
|
||||||
if (preset != nullptr && !preset->name.empty())
|
if (preset != nullptr && !preset->name.empty()) {
|
||||||
return from_u8(material_display_name(preset->name));
|
// Display the name the sidebar does: the alias (already bare-name + variant-tail
|
||||||
|
// stripped for root filament presets).
|
||||||
|
const std::string& display = preset->alias.empty() ? get_preset_bare_name(preset->name) : preset->alias;
|
||||||
|
return from_u8(material_display_name(display));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const PublishMaterialIdentity identity = material_identity(slot, full);
|
const PublishMaterialIdentity identity = material_identity(slot, full);
|
||||||
if (!identity.type.empty())
|
if (!identity.type.empty())
|
||||||
@@ -357,7 +361,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto* reason = new wxStaticText(this, wxID_ANY,
|
auto* reason = new wxStaticText(this, wxID_ANY,
|
||||||
issue.reason == MixedDependencyIssue::Reason::Disabled ? _L("not enabled") : _L("material not published"));
|
issue.reason == MixedDependencyIssue::Reason::Disabled ? _L("not enabled") :
|
||||||
|
_L("material not published"));
|
||||||
reason->SetFont(Label::Body_12);
|
reason->SetFont(Label::Body_12);
|
||||||
reason->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#989898")));
|
reason->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#989898")));
|
||||||
row->Add(reason, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(8));
|
row->Add(reason, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(8));
|
||||||
@@ -366,7 +371,8 @@ public:
|
|||||||
content->AddSpacer(FromDIP(6));
|
content->AddSpacer(FromDIP(6));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* hint = new wxStaticText(this, wxID_ANY,
|
auto* hint = new wxStaticText(
|
||||||
|
this, wxID_ANY,
|
||||||
_L("To publish a mixed filament, enable every filament it uses and choose Full Publish or check its Type requirement."));
|
_L("To publish a mixed filament, enable every filament it uses and choose Full Publish or check its Type requirement."));
|
||||||
hint->SetFont(Label::Body_12);
|
hint->SetFont(Label::Body_12);
|
||||||
hint->Wrap(FromDIP(380));
|
hint->Wrap(FromDIP(380));
|
||||||
@@ -1191,8 +1197,7 @@ void PublishSettingsDialog::add_mixed_visual(size_t category_index, const MixedV
|
|||||||
|
|
||||||
if (spec.tri_weights.size() == 3 && n == 3 && !spec.is_gradient) {
|
if (spec.tri_weights.size() == 3 && n == 3 && !spec.is_gradient) {
|
||||||
// Ternary mix: read-only miniature of the MixedFilamentDialog's triangle picker.
|
// Ternary mix: read-only miniature of the MixedFilamentDialog's triangle picker.
|
||||||
const MixedTriangleTheme tri_theme{StateColor::darkModeColorFor(*wxWHITE),
|
const MixedTriangleTheme tri_theme{StateColor::darkModeColorFor(*wxWHITE), StateColor::darkModeColorFor(wxColour("#CECECE")),
|
||||||
StateColor::darkModeColorFor(wxColour("#CECECE")),
|
|
||||||
StateColor::darkModeColorFor(wxColour("#262E30")),
|
StateColor::darkModeColorFor(wxColour("#262E30")),
|
||||||
StateColor::darkModeColorFor(wxColour(107, 107, 107))};
|
StateColor::darkModeColorFor(wxColour(107, 107, 107))};
|
||||||
draw_mixed_triangle_picker(pdc, rc.GetSize(), {spec.component_colours[0], spec.component_colours[1], spec.component_colours[2]},
|
draw_mixed_triangle_picker(pdc, rc.GetSize(), {spec.component_colours[0], spec.component_colours[1], spec.component_colours[2]},
|
||||||
@@ -1204,8 +1209,8 @@ void PublishSettingsDialog::add_mixed_visual(size_t category_index, const MixedV
|
|||||||
// solid segment per component.
|
// solid segment per component.
|
||||||
if (n == 2) {
|
if (n == 2) {
|
||||||
const int bar_h = FromDIP(27);
|
const int bar_h = FromDIP(27);
|
||||||
draw_mixed_ratio_blend_bar(pdc, wxRect(rc.x, rc.y, rc.width, bar_h), spec.component_colours[0],
|
draw_mixed_ratio_blend_bar(pdc, wxRect(rc.x, rc.y, rc.width, bar_h), spec.component_colours[0], spec.component_colours[1],
|
||||||
spec.component_colours[1], spec.ratios[1]);
|
spec.ratios[1]);
|
||||||
// Read-only twin of the dialog's left/right percentage labels.
|
// Read-only twin of the dialog's left/right percentage labels.
|
||||||
pdc.SetFont(::Label::Body_12);
|
pdc.SetFont(::Label::Body_12);
|
||||||
pdc.SetTextForeground(StateColor::darkModeColorFor(wxColour(107, 107, 107)));
|
pdc.SetTextForeground(StateColor::darkModeColorFor(wxColour(107, 107, 107)));
|
||||||
@@ -1228,9 +1233,9 @@ void PublishSettingsDialog::add_mixed_visual(size_t category_index, const MixedV
|
|||||||
pdc.SetFont(::Label::Body_12);
|
pdc.SetFont(::Label::Body_12);
|
||||||
int x0 = rc.x;
|
int x0 = rc.x;
|
||||||
for (size_t i = 0; i < n; ++i) {
|
for (size_t i = 0; i < n; ++i) {
|
||||||
const int x1 = (i + 1 < n)
|
const int x1 = (i + 1 < n) ? rc.x + int(std::lround(std::accumulate(shares.begin(), shares.begin() + i + 1, 0.0) /
|
||||||
? rc.x + int(std::lround(std::accumulate(shares.begin(), shares.begin() + i + 1, 0.0) / total * double(rc.width)))
|
total * double(rc.width))) :
|
||||||
: rc.x + rc.width;
|
rc.x + rc.width;
|
||||||
const int w = std::max(1, x1 - x0);
|
const int w = std::max(1, x1 - x0);
|
||||||
const wxString text = wxString::Format("%d%%", int(std::lround(shares[i] / total * 100.0)));
|
const wxString text = wxString::Format("%d%%", int(std::lround(shares[i] / total * 100.0)));
|
||||||
const wxSize tsz = pdc.GetTextExtent(text);
|
const wxSize tsz = pdc.GetTextExtent(text);
|
||||||
|
|||||||
Reference in New Issue
Block a user