mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-14 18:27:58 -06:00
Improve UI of profile dependencies tab (#9553)
* init * Update Tab.cpp * update labels * Update Tab.hpp * Fix checkbox label * Update Tab.cpp --------- Co-authored-by: Noisyfox <timemanager.rick@gmail.com>
This commit is contained in:
parent
cc525608e9
commit
41ff632d28
6 changed files with 33 additions and 14 deletions
1
resources/images/param_dependencies_presets.svg
Normal file
1
resources/images/param_dependencies_presets.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?><svg id="a" xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18"><path d="M15.94,5.06c-.75-.75-1.97-.75-2.72,0l-2.04,2.04c-.75.75-.75,1.97,0,2.72s1.97.75,2.72,0l2.04-2.04c.75-.75.75-1.97,0-2.72Z" style="fill:none; stroke:#009688; stroke-linecap:round; stroke-linejoin:round;"/><path d="M9.82,11.18c-.75-.75-1.97-.75-2.72,0l-2.04,2.04c-.75.75-.75,1.97,0,2.72s1.97.75,2.72,0l2.04-2.04c.75-.75.75-1.97,0-2.72Z" style="fill:none; stroke:#009688; stroke-linecap:round; stroke-linejoin:round;"/><line x1="8" y1="13" x2="13" y2="8" style="fill:none; stroke:#009688; stroke-linecap:round; stroke-linejoin:round;"/><line x1=".5" y1="2.5" x2="1.5" y2="2.5" style="fill:none; stroke:#949494; stroke-linecap:square; stroke-linejoin:round;"/><line x1="3.5" y1="2.5" x2="8.5" y2="2.5" style="fill:none; stroke:#949494; stroke-linecap:square; stroke-linejoin:round;"/><rect x="1.5" y=".5" width="2" height="4" rx=".67" ry=".67" style="fill:none; stroke:#949494; stroke-linecap:square; stroke-linejoin:round;"/><line x1="8.5" y1="6.5" x2="7.5" y2="6.5" style="fill:none; stroke:#949494; stroke-linecap:square; stroke-linejoin:round;"/><line x1="5.5" y1="6.5" x2=".5" y2="6.5" style="fill:none; stroke:#949494; stroke-linecap:square; stroke-linejoin:round;"/><rect x="5.5" y="4.5" width="2" height="4" rx=".67" ry=".67" transform="translate(13 13) rotate(180)" style="fill:none; stroke:#949494; stroke-linecap:square; stroke-linejoin:round;"/></svg>
|
After Width: | Height: | Size: 1.5 KiB |
1
resources/images/param_dependencies_printers.svg
Normal file
1
resources/images/param_dependencies_printers.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?><svg id="a" xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18"><line x1="2.5" y1="2.5" x2="6.5" y2="2.5" style="fill:none; stroke:#949494; stroke-linecap:square; stroke-linejoin:round;"/><line x1="2.5" y1="6.5" x2="6.5" y2="6.5" style="fill:none; stroke:#949494; stroke-linecap:square; stroke-linejoin:round;"/><rect x=".5" y=".5" width="8" height="8" rx="1.89" ry="1.89" style="fill:none; stroke:#949494; stroke-linecap:square; stroke-linejoin:round;"/><line x1="4.5" y1="3.5" x2="4.5" y2="2.5" style="fill:none; stroke:#949494; stroke-linecap:square; stroke-linejoin:round;"/><path d="M15.94,5.06c-.75-.75-1.97-.75-2.72,0l-2.04,2.04c-.75.75-.75,1.97,0,2.72s1.97.75,2.72,0l2.04-2.04c.75-.75.75-1.97,0-2.72Z" style="fill:none; stroke:#009688; stroke-linecap:round; stroke-linejoin:round;"/><path d="M9.82,11.18c-.75-.75-1.97-.75-2.72,0l-2.04,2.04c-.75.75-.75,1.97,0,2.72s1.97.75,2.72,0l2.04-2.04c.75-.75.75-1.97,0-2.72Z" style="fill:none; stroke:#009688; stroke-linecap:round; stroke-linejoin:round;"/><line x1="8" y1="13" x2="13" y2="8" style="fill:none; stroke:#009688; stroke-linecap:round; stroke-linejoin:round;"/></svg>
|
After Width: | Height: | Size: 1.2 KiB |
|
@ -1 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?><svg id="a" xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18"><path d="M15.75,1.25c-1-1-2.63-1-3.63,0l-2.72,2.72c-1,1-1,2.63,0,3.63,1,1,2.63,1,3.63,0l2.72-2.72c1-1,1-2.63,0-3.63Z" style="fill:none; stroke:#009688; stroke-linecap:round; stroke-linejoin:round;"/><path d="M7.59,9.41c-1-1-2.63-1-3.63,0l-2.72,2.72c-1,1-1,2.63,0,3.63s2.63,1,3.63,0l2.72-2.72c1-1,1-2.63,0-3.63Z" style="fill:none; stroke:#009688; stroke-linecap:round; stroke-linejoin:round;"/><line x1=".5" y1="2.5" x2="1.5" y2="2.5" style="fill:none; stroke:#949494; stroke-linecap:square; stroke-linejoin:round;"/><polygon points="8 3 4 3 4 2 9 2 8 3" style="fill:#949494;"/><rect x="1.5" y=".5" width="3" height="4" rx=".82" ry=".82" style="fill:none; stroke:#949494; stroke-linecap:square; stroke-linejoin:round;"/><polygon points="13 15 8 15 9 14 13 14 13 15" style="fill:#949494;"/><line x1="4.5" y1="12.5" x2="12.5" y2="4.5" style="fill:none; stroke:#009688; stroke-linecap:round; stroke-linejoin:round;"/><line x1="15.5" y1="14.5" x2="16.5" y2="14.5" style="fill:none; stroke:#949494; stroke-linecap:square; stroke-linejoin:round;"/><rect x="12.5" y="12.5" width="3" height="4" rx=".82" ry=".82" style="fill:none; stroke:#949494; stroke-linecap:square; stroke-linejoin:round;"/></svg>
|
|
Before Width: | Height: | Size: 1.3 KiB |
|
@ -1318,7 +1318,7 @@ void PrintConfigDef::init_fff_params()
|
||||||
def->set_default_value(new ConfigOptionFloat(1));
|
def->set_default_value(new ConfigOptionFloat(1));
|
||||||
|
|
||||||
def = this->add("compatible_printers", coStrings);
|
def = this->add("compatible_printers", coStrings);
|
||||||
def->label = L("Compatible machine");
|
def->label = L("Select printers");
|
||||||
def->mode = comAdvanced;
|
def->mode = comAdvanced;
|
||||||
def->set_default_value(new ConfigOptionStrings());
|
def->set_default_value(new ConfigOptionStrings());
|
||||||
def->cli = ConfigOptionDef::nocli;
|
def->cli = ConfigOptionDef::nocli;
|
||||||
|
@ -1331,7 +1331,7 @@ void PrintConfigDef::init_fff_params()
|
||||||
def->cli = ConfigOptionDef::nocli;
|
def->cli = ConfigOptionDef::nocli;
|
||||||
|
|
||||||
def = this->add("compatible_printers_condition", coString);
|
def = this->add("compatible_printers_condition", coString);
|
||||||
def->label = L("Compatible machine condition");
|
def->label = L("Condition");
|
||||||
def->tooltip = L("A boolean expression using the configuration values of an active printer profile. "
|
def->tooltip = L("A boolean expression using the configuration values of an active printer profile. "
|
||||||
"If this expression evaluates to true, this profile is considered compatible "
|
"If this expression evaluates to true, this profile is considered compatible "
|
||||||
"with the active printer profile.");
|
"with the active printer profile.");
|
||||||
|
@ -1340,13 +1340,13 @@ void PrintConfigDef::init_fff_params()
|
||||||
def->cli = ConfigOptionDef::nocli;
|
def->cli = ConfigOptionDef::nocli;
|
||||||
|
|
||||||
def = this->add("compatible_prints", coStrings);
|
def = this->add("compatible_prints", coStrings);
|
||||||
def->label = L("Compatible process profiles");
|
def->label = L("Select profiles");
|
||||||
def->mode = comAdvanced;
|
def->mode = comAdvanced;
|
||||||
def->set_default_value(new ConfigOptionStrings());
|
def->set_default_value(new ConfigOptionStrings());
|
||||||
def->cli = ConfigOptionDef::nocli;
|
def->cli = ConfigOptionDef::nocli;
|
||||||
|
|
||||||
def = this->add("compatible_prints_condition", coString);
|
def = this->add("compatible_prints_condition", coString);
|
||||||
def->label = L("Compatible process profiles condition");
|
def->label = L("Condition");
|
||||||
def->tooltip = L("A boolean expression using the configuration values of an active print profile. "
|
def->tooltip = L("A boolean expression using the configuration values of an active print profile. "
|
||||||
"If this expression evaluates to true, this profile is considered compatible "
|
"If this expression evaluates to true, this profile is considered compatible "
|
||||||
"with the active print profile.");
|
"with the active print profile.");
|
||||||
|
|
|
@ -3585,7 +3585,7 @@ void TabFilament::build()
|
||||||
optgroup->append_single_option_line("filament_multitool_ramming_flow");
|
optgroup->append_single_option_line("filament_multitool_ramming_flow");
|
||||||
|
|
||||||
page = add_options_page(L("Dependencies"), "advanced");
|
page = add_options_page(L("Dependencies"), "advanced");
|
||||||
optgroup = page->new_optgroup(L("Profile dependencies"), "param_profile_dependencies");
|
optgroup = page->new_optgroup(L("Compatible printers"), "param_dependencies_printers");
|
||||||
create_line_with_widget(optgroup.get(), "compatible_printers", "", [this](wxWindow* parent) {
|
create_line_with_widget(optgroup.get(), "compatible_printers", "", [this](wxWindow* parent) {
|
||||||
return compatible_widget_create(parent, m_compatible_printers);
|
return compatible_widget_create(parent, m_compatible_printers);
|
||||||
});
|
});
|
||||||
|
@ -3594,6 +3594,7 @@ void TabFilament::build()
|
||||||
option.opt.full_width = true;
|
option.opt.full_width = true;
|
||||||
optgroup->append_single_option_line(option);
|
optgroup->append_single_option_line(option);
|
||||||
|
|
||||||
|
optgroup = page->new_optgroup(L("Compatible process profiles"), "param_dependencies_presets");
|
||||||
create_line_with_widget(optgroup.get(), "compatible_prints", "", [this](wxWindow* parent) {
|
create_line_with_widget(optgroup.get(), "compatible_prints", "", [this](wxWindow* parent) {
|
||||||
return compatible_widget_create(parent, m_compatible_prints);
|
return compatible_widget_create(parent, m_compatible_prints);
|
||||||
});
|
});
|
||||||
|
@ -5921,8 +5922,14 @@ void Tab::create_line_with_widget(ConfigOptionsGroup* optgroup, const std::strin
|
||||||
// Return a callback to create a Tab widget to mark the preferences as compatible / incompatible to the current printer.
|
// Return a callback to create a Tab widget to mark the preferences as compatible / incompatible to the current printer.
|
||||||
wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &deps)
|
wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &deps)
|
||||||
{
|
{
|
||||||
deps.checkbox = new wxCheckBox(parent, wxID_ANY, _(L("All")));
|
auto cb_text = _L("All");
|
||||||
deps.checkbox->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
deps.checkbox = new ::CheckBox(parent, wxID_ANY);
|
||||||
|
deps.checkbox->SetLabel(cb_text);
|
||||||
|
deps.checkbox->SetFont(Label::Body_14);
|
||||||
|
auto cb_size = wxSize(deps.checkbox->GetTextExtent(cb_text).x + deps.checkbox->GetBitmap().GetWidth() + FromDIP(6), -1);
|
||||||
|
deps.checkbox->SetSize( cb_size);
|
||||||
|
deps.checkbox->SetMinSize(cb_size);
|
||||||
|
deps.checkbox->SetForegroundColour(wxColour("#363636"));
|
||||||
wxGetApp().UpdateDarkUI(deps.checkbox, false, true);
|
wxGetApp().UpdateDarkUI(deps.checkbox, false, true);
|
||||||
|
|
||||||
// ORCA modernize button style
|
// ORCA modernize button style
|
||||||
|
@ -5948,18 +5955,28 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep
|
||||||
|
|
||||||
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
sizer->Add((deps.checkbox), 0, wxALIGN_CENTER_VERTICAL);
|
sizer->Add((deps.checkbox), 0, wxALIGN_CENTER_VERTICAL);
|
||||||
|
sizer->Add(new wxStaticText(parent, wxID_ANY, " ")); // weirdly didnt apply AddSpacer or wxRIGHT border
|
||||||
sizer->Add((deps.btn), 0, wxALIGN_CENTER_VERTICAL);
|
sizer->Add((deps.btn), 0, wxALIGN_CENTER_VERTICAL);
|
||||||
|
|
||||||
deps.checkbox->Bind(wxEVT_CHECKBOX, ([this, &deps](wxCommandEvent e)
|
deps.checkbox->Bind(wxEVT_TOGGLEBUTTON, ([this, &deps](wxCommandEvent e)
|
||||||
{
|
{
|
||||||
deps.btn->Enable(! deps.checkbox->GetValue());
|
deps.checkbox->SetValue(e.IsChecked());
|
||||||
|
deps.btn->Enable(!e.IsChecked());
|
||||||
// All printers have been made compatible with this preset.
|
// All printers have been made compatible with this preset.
|
||||||
if (deps.checkbox->GetValue())
|
if (e.IsChecked())
|
||||||
this->load_key_value(deps.key_list, std::vector<std::string> {});
|
this->load_key_value(deps.key_list, std::vector<std::string> {});
|
||||||
this->get_field(deps.key_condition)->toggle(deps.checkbox->GetValue());
|
this->get_field(deps.key_condition)->toggle(e.IsChecked());
|
||||||
this->update_changed_ui();
|
this->update_changed_ui();
|
||||||
}) );
|
e.Skip();
|
||||||
|
}), deps.checkbox->GetId());
|
||||||
|
|
||||||
|
if (deps.checkbox){
|
||||||
|
bool is_empty = m_config->option<ConfigOptionStrings>(deps.key_list)->values.empty();
|
||||||
|
deps.checkbox->SetValue(is_empty);
|
||||||
|
deps.btn->Enable(!is_empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if (m_compatible_printers.checkbox) {
|
if (m_compatible_printers.checkbox) {
|
||||||
bool is_empty = m_config->option<ConfigOptionStrings>("compatible_printers")->values.empty();
|
bool is_empty = m_config->option<ConfigOptionStrings>("compatible_printers")->values.empty();
|
||||||
m_compatible_printers.checkbox->SetValue(is_empty);
|
m_compatible_printers.checkbox->SetValue(is_empty);
|
||||||
|
@ -5971,6 +5988,7 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep
|
||||||
m_compatible_prints.checkbox->SetValue(is_empty);
|
m_compatible_prints.checkbox->SetValue(is_empty);
|
||||||
is_empty ? m_compatible_prints.btn->Disable() : m_compatible_prints.btn->Enable();
|
is_empty ? m_compatible_prints.btn->Disable() : m_compatible_prints.btn->Enable();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
deps.btn->Bind(wxEVT_BUTTON, ([this, parent, &deps](wxCommandEvent e)
|
deps.btn->Bind(wxEVT_BUTTON, ([this, parent, &deps](wxCommandEvent e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -164,7 +164,7 @@ protected:
|
||||||
|
|
||||||
struct PresetDependencies {
|
struct PresetDependencies {
|
||||||
Preset::Type type = Preset::TYPE_INVALID;
|
Preset::Type type = Preset::TYPE_INVALID;
|
||||||
wxCheckBox *checkbox = nullptr;
|
::CheckBox* checkbox = nullptr;
|
||||||
Button *btn = nullptr;
|
Button *btn = nullptr;
|
||||||
std::string key_list; // "compatible_printers"
|
std::string key_list; // "compatible_printers"
|
||||||
std::string key_condition;
|
std::string key_condition;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue