SLA tilt profiles: Show/Hide tilt profiles in respect to the printer model.

Note: Tilt profiles are supported for SL1, SL1S and M1 only.
This commit is contained in:
YuSanka 2024-04-11 09:15:11 +02:00 committed by Lukas Matena
parent 755493531e
commit 2fac73b778
4 changed files with 63 additions and 9 deletions

View File

@ -1383,7 +1383,7 @@ bool GUI_App::on_init_inner()
mainframe->select_tab(size_t(0));
sidebar().obj_list()->init_objects(); // propagate model objects to object list
// update_mode(); // !!! do that later
update_mode(); // mode sizer doesn't exist anymore, so we came update mode here, before load_current_presets
SetTopWindow(mainframe);
plater_->init_notification_manager();

View File

@ -821,7 +821,7 @@ void ConfigOptionsGroup::Hide()
void ConfigOptionsGroup::Show(const bool show)
{
sizer->ShowItems(show);
if (sizer) sizer->ShowItems(show);
#if 0//#ifdef __WXGTK__
m_panel->Show(show);
m_grid_sizer->Show(show);

View File

@ -907,6 +907,7 @@ void Tab::update_mode()
m_mode = wxGetApp().get_mode();
update_visibility();
update_sla_prusa_specific_visibility();
update_changed_tree_ui();
}
@ -2931,15 +2932,15 @@ void TabPrinter::build_sla()
// FIXME: This should be on one line in the UI
optgroup->append_single_option_line("display_mirror_x");
optgroup->append_single_option_line("display_mirror_y");
/*
optgroup = page->new_optgroup(L("Tilt"));
line = { L("Tilt time"), "" };
line.append_option(optgroup->get_option("fast_tilt_time"));
line.append_option(optgroup->get_option("slow_tilt_time"));
line.append_option(optgroup->get_option("high_viscosity_tilt_time"));
optgroup->append_line(line);
optgroup->append_single_option_line("area_fill");
*/
// optgroup->append_single_option_line("area_fill");
optgroup = page->new_optgroup(L("Corrections"));
line = Line{ m_config->def()->get("relative_correction")->full_label, "" };
for (auto& axis : { "X", "Y", "Z" }) {
@ -3615,8 +3616,15 @@ void TabPrinter::update_fff()
toggle_options();
}
bool Tab::is_prusa_printer() const
{
std::string printer_model = m_preset_bundle->printers.get_edited_preset().config.opt_string("printer_model");
return printer_model == "SL1" || printer_model == "SL1S" || printer_model == "M1";
}
void TabPrinter::update_sla()
{ ; }
{
}
void Tab::update_ui_items_related_on_parent_preset(const Preset* selected_preset_parent)
{
@ -3704,6 +3712,7 @@ void Tab::load_current_preset()
m_opt_status_value = (m_presets->get_selected_preset_parent() ? osSystemValue : 0) | osInitValue;
init_options_list();
update_visibility();
update_sla_prusa_specific_visibility();
update_changed_ui();
}
#if 0
@ -4058,6 +4067,7 @@ void Tab::activate_selected_page(std::function<void()> throw_if_canceled)
this->compatible_widget_reload(m_compatible_prints);
}
update_sla_prusa_specific_visibility();
update_changed_ui();
update_description_lines();
toggle_options();
@ -4974,6 +4984,17 @@ bool TabPrinter::apply_extruder_cnt_from_cache()
return false;
}
void TabPrinter::update_sla_prusa_specific_visibility()
{
if (m_active_page && m_active_page->title() == "General") {
auto og_it = std::find_if(m_active_page->m_optgroups.begin(), m_active_page->m_optgroups.end(), [](const ConfigOptionsGroupShp og) { return og->title == "Tilt"; });
if (og_it != m_active_page->m_optgroups.end()) {
og_it->get()->Show(m_mode == comExpert && !is_prusa_printer());
Layout();
}
}
}
bool Tab::validate_custom_gcodes()
{
if (m_type != Preset::TYPE_FILAMENT &&
@ -5355,11 +5376,22 @@ void TabSLAMaterial::build()
build_preset_description_line(optgroup.get());
page = add_options_page(L("Material printing profile"), "note");
#if 1
optgroup = page->new_optgroup(L("Material printing profile"));
// option = optgroup->get_option("material_print_speed");
// optgroup->append_single_option_line(option);
optgroup->append_single_option_line("material_print_speed");
optgroup = page->new_optgroup(L("Tilt"));
optgroup->append_single_option_line("area_fill");
#else
optgroup = page->new_optgroup(L("Material printing profile"));
option = optgroup->get_option("material_print_speed");
optgroup->append_single_option_line(option);
optgroup->append_single_option_line("area_fill");
#endif
build_tilt_group(page);
}
@ -5505,6 +5537,25 @@ void TabSLAMaterial::sys_color_changed()
}
}
void TabSLAMaterial::update_sla_prusa_specific_visibility()
{
if (m_active_page && m_active_page->title() == "Material printing profile") {
for (auto& title : { "", "Tilt profiles" }) {
auto og_it = std::find_if(m_active_page->m_optgroups.begin(), m_active_page->m_optgroups.end(),
[title](const ConfigOptionsGroupShp og) { return og->title == title; });
if (og_it != m_active_page->m_optgroups.end())
og_it->get()->Show(m_mode == comExpert && is_prusa_printer());
}
auto og_it = std::find_if(m_active_page->m_optgroups.begin(), m_active_page->m_optgroups.end(),
[](const ConfigOptionsGroupShp og) { return og->title == "Material printing profile"; });
if (og_it != m_active_page->m_optgroups.end())
og_it->get()->Show(m_mode >= comAdvanced && !is_prusa_printer());
Layout();
}
}
static void add_options_into_line(ConfigOptionsGroupShp &optgroup,
const std::vector<SamePair<std::string>> &prefixes,
const std::string &optkey,

View File

@ -377,6 +377,7 @@ public:
void update_mode();
void update_mode_markers();
void update_visibility();
virtual void update_sla_prusa_specific_visibility() {}
virtual void msw_rescale();
virtual void sys_color_changed();
Field* get_field(const t_config_option_key& opt_key, int opt_index = -1) const;
@ -406,11 +407,11 @@ public:
static bool validate_custom_gcode(const wxString& title, const std::string& gcode);
bool validate_custom_gcodes();
bool validate_custom_gcodes_was_shown{ false };
bool is_prusa_printer() const;
void edit_custom_gcode(const t_config_option_key& opt_key);
virtual const std::string& get_custom_gcode(const t_config_option_key& opt_key);
virtual void set_custom_gcode(const t_config_option_key& opt_key, const std::string& value);
protected:
void create_line_with_widget(ConfigOptionsGroup* optgroup, const std::string& opt_key, const std::string& path, widget_t widget);
wxSizer* compatible_widget_create(wxWindow* parent, PresetDependencies &deps);
@ -559,6 +560,7 @@ public:
wxSizer* create_bed_shape_widget(wxWindow* parent);
void cache_extruder_cnt(const DynamicPrintConfig* config = nullptr);
bool apply_extruder_cnt_from_cache();
void update_sla_prusa_specific_visibility() override;
};
class TabSLAMaterial : public Tab
@ -582,6 +584,7 @@ public:
void msw_rescale() override;
void sys_color_changed() override;
bool supports_printer_technology(const PrinterTechnology tech) const override { return tech == ptSLA; }
void update_sla_prusa_specific_visibility() override;
};
class TabSLAPrint : public Tab