完成配置下拉框刷新。按钮颜色修改尝试。测试更多参数样式修改

This commit is contained in:
cjw 2025-02-23 17:03:57 +08:00
parent ff1370ae7c
commit b2b9264d18
9 changed files with 70 additions and 32 deletions

View File

@ -391,6 +391,9 @@ std::vector<Preset*> PresetBundle::get_current_project_embedded_presets()
auto printer_presets = this->printers.get_project_embedded_presets(); auto printer_presets = this->printers.get_project_embedded_presets();
if (!printer_presets.empty()) if (!printer_presets.empty())
std::copy(printer_presets.begin(), printer_presets.end(), std::back_inserter(project_presets)); std::copy(printer_presets.begin(), printer_presets.end(), std::back_inserter(project_presets));
auto config_presets = this->configs.get_project_embedded_presets();
if (!config_presets.empty())
std::copy(config_presets.begin(), config_presets.end(), std::back_inserter(project_presets));
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(" finished, returned project_presets count %1%")%project_presets.size(); BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(" finished, returned project_presets count %1%")%project_presets.size();
return project_presets; return project_presets;
@ -409,6 +412,7 @@ void PresetBundle::reset_project_embedded_presets()
bool printer_reselect = this->printers.reset_project_embedded_presets(); bool printer_reselect = this->printers.reset_project_embedded_presets();
bool filament_reselect = this->filaments.reset_project_embedded_presets(); bool filament_reselect = this->filaments.reset_project_embedded_presets();
bool print_reselect = this->prints.reset_project_embedded_presets(); bool print_reselect = this->prints.reset_project_embedded_presets();
bool config_reselect = this->configs.reset_project_embedded_presets();
if (printer_reselect) { if (printer_reselect) {
if (!prefer_printer.empty()) if (!prefer_printer.empty())
@ -419,7 +423,7 @@ void PresetBundle::reset_project_embedded_presets()
//this->update_multi_material_filament_presets(); //this->update_multi_material_filament_presets();
this->update_compatible(PresetSelectCompatibleType::Never); this->update_compatible(PresetSelectCompatibleType::Never);
} }
else if (filament_reselect || print_reselect) { else if (filament_reselect || print_reselect || config_reselect) {
//Preset& current_printer = this->printers.get_selected_preset(); //Preset& current_printer = this->printers.get_selected_preset();
/*if (filament_reselect) { /*if (filament_reselect) {
const std::vector<std::string> &prefered_filament_profiles = current_printer.config.option<ConfigOptionStrings>("default_filament_profile")->values; const std::vector<std::string> &prefered_filament_profiles = current_printer.config.option<ConfigOptionStrings>("default_filament_profile")->values;
@ -1418,12 +1422,13 @@ void PresetBundle::update_system_maps()
this->sla_materials.update_map_system_profile_renamed(); this->sla_materials.update_map_system_profile_renamed();
this->printers .update_map_system_profile_renamed(); this->printers .update_map_system_profile_renamed();
//xiamian+ //xiamian+
//this->configs .update_map_system_profile_renamed(); this->configs .update_map_system_profile_renamed();
this->prints .update_map_alias_to_profile_name(); this->prints .update_map_alias_to_profile_name();
this->sla_prints .update_map_alias_to_profile_name(); this->sla_prints .update_map_alias_to_profile_name();
this->filaments .update_map_alias_to_profile_name(); this->filaments .update_map_alias_to_profile_name();
this->sla_materials.update_map_alias_to_profile_name(); this->sla_materials.update_map_alias_to_profile_name();
this->configs .update_map_alias_to_profile_name();
} }
static inline std::string remove_ini_suffix(const std::string &name) static inline std::string remove_ini_suffix(const std::string &name)
@ -1443,6 +1448,12 @@ void PresetBundle::load_installed_printers(const AppConfig &config)
for (auto &preset : printers) for (auto &preset : printers)
preset.set_visible_from_appconfig(config); preset.set_visible_from_appconfig(config);
} }
void PresetBundle::load_installed_configs(const AppConfig& config)
{
this->update_system_maps();
for (auto& preset : configs)
preset.set_visible_from_appconfig(config);
}
const std::string& PresetBundle::get_preset_name_by_alias( const Preset::Type& preset_type, const std::string& alias) const const std::string& PresetBundle::get_preset_name_by_alias( const Preset::Type& preset_type, const std::string& alias) const
{ {
@ -1453,6 +1464,7 @@ const std::string& PresetBundle::get_preset_name_by_alias( const Preset::Type& p
const PresetCollection& presets = preset_type == Preset::TYPE_PRINT ? prints : const PresetCollection& presets = preset_type == Preset::TYPE_PRINT ? prints :
preset_type == Preset::TYPE_SLA_PRINT ? sla_prints : preset_type == Preset::TYPE_SLA_PRINT ? sla_prints :
preset_type == Preset::TYPE_FILAMENT ? filaments : preset_type == Preset::TYPE_FILAMENT ? filaments :
preset_type == Preset::TYPE_CONFIG ? configs :
sla_materials; sla_materials;
return presets.get_preset_name_by_alias(alias); return presets.get_preset_name_by_alias(alias);
@ -1484,12 +1496,13 @@ const int PresetBundle::get_required_hrc_by_filament_type(const std::string& fil
void PresetBundle::save_changes_for_preset(const std::string& new_name, Preset::Type type, void PresetBundle::save_changes_for_preset(const std::string& new_name, Preset::Type type,
const std::vector<std::string>& unselected_options, bool save_to_project) const std::vector<std::string>& unselected_options, bool save_to_project)
{ {
PresetCollection& presets = type == Preset::TYPE_PRINT ? prints : PresetCollection& presets = type == Preset::TYPE_PRINT ? prints :
type == Preset::TYPE_SLA_PRINT ? sla_prints : type == Preset::TYPE_SLA_PRINT ? sla_prints :
type == Preset::TYPE_FILAMENT ? filaments : type == Preset::TYPE_FILAMENT ? filaments :
type == Preset::TYPE_SLA_MATERIAL ? sla_materials : type == Preset::TYPE_SLA_MATERIAL ? sla_materials :
type == Preset::TYPE_PRINTER ?printers : type == Preset::TYPE_CONFIG ? configs :
configs; printers;
// if we want to save just some from selected options // if we want to save just some from selected options
if (!unselected_options.empty()) { if (!unselected_options.empty()) {
@ -1595,6 +1608,7 @@ void PresetBundle::load_selections(AppConfig &config, const PresetPreferences& p
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(": enter, preferred printer_model_id %1%")%preferred_selection.printer_model_id; BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(": enter, preferred printer_model_id %1%")%preferred_selection.printer_model_id;
// Update visibility of presets based on application vendor / model / variant configuration. // Update visibility of presets based on application vendor / model / variant configuration.
this->load_installed_printers(config); this->load_installed_printers(config);
this->load_installed_configs(config);
// Update visibility of filament and sla material presets // Update visibility of filament and sla material presets
this->load_installed_filaments(config); this->load_installed_filaments(config);
@ -1637,6 +1651,7 @@ void PresetBundle::load_selections(AppConfig &config, const PresetPreferences& p
filaments.select_preset_by_name_strict(initial_filament_profile_name); filaments.select_preset_by_name_strict(initial_filament_profile_name);
sla_prints.select_preset_by_name_strict(initial_sla_print_profile_name); sla_prints.select_preset_by_name_strict(initial_sla_print_profile_name);
sla_materials.select_preset_by_name_strict(initial_sla_material_profile_name); sla_materials.select_preset_by_name_strict(initial_sla_material_profile_name);
configs.select_preset_by_name_strict(initial_config_profile_name);
// Load the names of the other filament profiles selected for a multi-material printer. // Load the names of the other filament profiles selected for a multi-material printer.
// Load it even if the current printer technology is SLA. // Load it even if the current printer technology is SLA.
@ -4049,6 +4064,7 @@ void PresetBundle::set_default_suppressed(bool default_suppressed)
sla_prints.set_default_suppressed(default_suppressed); sla_prints.set_default_suppressed(default_suppressed);
sla_materials.set_default_suppressed(default_suppressed); sla_materials.set_default_suppressed(default_suppressed);
printers.set_default_suppressed(default_suppressed); printers.set_default_suppressed(default_suppressed);
configs.set_default_suppressed(default_suppressed);
} }
} // namespace Slic3r } // namespace Slic3r

View File

@ -227,6 +227,7 @@ public:
// based on the user configuration. // based on the user configuration.
// If the "vendor" section is missing, enable all models and variants of the particular vendor. // If the "vendor" section is missing, enable all models and variants of the particular vendor.
void load_installed_printers(const AppConfig &config); void load_installed_printers(const AppConfig &config);
void load_installed_configs(const AppConfig &config);
const std::string& get_preset_name_by_alias(const Preset::Type& preset_type, const std::string& alias) const; const std::string& get_preset_name_by_alias(const Preset::Type& preset_type, const std::string& alias) const;

View File

@ -30,7 +30,8 @@
#define STATIC_TEXT_COLOUR wxColour("#363636") #define STATIC_TEXT_COLOUR wxColour("#363636")
#define PRINTER_LIST_COLOUR wxColour("#EEEEEE") #define PRINTER_LIST_COLOUR wxColour("#EEEEEE")
#define FILAMENT_OPTION_COLOUR wxColour("#D9D9D9") #define FILAMENT_OPTION_COLOUR wxColour("#D9D9D9")
#define SELECT_ALL_OPTION_COLOUR wxColour("#00AE42") //#define SELECT_ALL_OPTION_COLOUR wxColour("#00AE42")
#define SELECT_ALL_OPTION_COLOUR wxColour("#009FF3")
#define DEFAULT_PROMPT_TEXT_COLOUR wxColour("#ACACAC") #define DEFAULT_PROMPT_TEXT_COLOUR wxColour("#ACACAC")
namespace Slic3r { namespace Slic3r {

View File

@ -5911,6 +5911,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
imgui.text(total_str + ":"); imgui.text(total_str + ":");
ImGui::SameLine(max_len); ImGui::SameLine(max_len);
imgui.text(short_time(get_time_dhms(time_mode.time))); imgui.text(short_time(get_time_dhms(time_mode.time)));
//imgui.text(get_time_dhms(time_mode.time));
//xiamian+ //xiamian+
ImGui::Dummy({ window_padding, window_padding }); ImGui::Dummy({ window_padding, window_padding });
ImGui::SameLine(); ImGui::SameLine();
@ -5933,6 +5934,10 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
//oss << std::put_time(new_local_tm, "%Y-%m-%d %H:%M:%S"); //oss << std::put_time(new_local_tm, "%Y-%m-%d %H:%M:%S");
oss << std::put_time(new_local_tm, "%Y-%m-%d %H:%M"); oss << std::put_time(new_local_tm, "%Y-%m-%d %H:%M");
imgui.text(oss.str()); imgui.text(oss.str());
ImGui::SameLine(max_len);
std::string abc = " ";
imgui.text(abc);
//ImGui::Spacing();
//shangmian+ //shangmian+
auto show_mode_button = [this, &imgui, can_show_mode_button](const wxString& label, PrintEstimatedStatistics::ETimeMode mode) { auto show_mode_button = [this, &imgui, can_show_mode_button](const wxString& label, PrintEstimatedStatistics::ETimeMode mode) {
if (can_show_mode_button(mode)) { if (can_show_mode_button(mode)) {

View File

@ -486,6 +486,7 @@ void ParamsPanel::refresh_tabs()
break; break;
case Preset::TYPE_CONFIG: case Preset::TYPE_CONFIG:
m_tab_config = tab; m_tab_config = tab;
//m_tab_config = NULL;
break; break;
default: default:
break; break;

View File

@ -1382,6 +1382,17 @@ void Sidebar::update_presets(Preset::Type preset_type)
} }
break; break;
} }
case Preset::TYPE_CONFIG:
//wxGetApp().mainframe->m_param_panel;
//p->combo_print->update();
{
/* Tab* config_tab = wxGetApp().get_tab(Preset::TYPE_CONFIG);
if (config_tab) {
config_tab->get_combo_box()->update();
}*/
p->combo_config->update();
break;
}
case Preset::TYPE_SLA_PRINT: case Preset::TYPE_SLA_PRINT:
;// p->combo_sla_print->update(); ;// p->combo_sla_print->update();
break; break;
@ -1538,6 +1549,7 @@ void Sidebar::msw_rescale()
// //p->combo_printer // //p->combo_printer
// } ) // } )
// combo->msw_rescale(); // combo->msw_rescale();
p->combo_config->msw_rescale();
p->combo_printer->msw_rescale(); p->combo_printer->msw_rescale();
for (PlaterPresetComboBox* combo : p->combos_filament) for (PlaterPresetComboBox* combo : p->combos_filament)
combo->msw_rescale(); combo->msw_rescale();

View File

@ -4253,9 +4253,8 @@ void TabPrinter::update_sla()
void TabConfig::build() { void TabConfig::build() {
m_presets = &m_preset_bundle->configs; m_presets = &m_preset_bundle->configs;
load_initial_data(); load_initial_data();
auto page = add_options_page(L("Quality"), "spool");
auto page = add_options_page(L("Quality"), "spool"); auto optgroup = page->new_optgroup("", L"param_layer_height");
auto optgroup = page->new_optgroup("", L"param_layer_height");
optgroup->append_single_option_line("initial_layer_print_height", "layer-height"); optgroup->append_single_option_line("initial_layer_print_height", "layer-height");
optgroup->append_single_option_line("initial_layer_line_width"); optgroup->append_single_option_line("initial_layer_line_width");
@ -4306,7 +4305,7 @@ void TabConfig::build() {
//optgroup->append_single_option_line("support_interface_spacing", "support#base-pattern"); //optgroup->append_single_option_line("support_interface_spacing", "support#base-pattern");
page = add_options_page(L("Strength"), "empty"); page = add_options_page(L("Strength"), "empty");
optgroup = page->new_optgroup("", L"param_wall"); optgroup = page->new_optgroup("", L"param_wall");
optgroup->append_single_option_line("top_surface_pattern", "fill-patterns#Infill of the top surface and bottom surface"); optgroup->append_single_option_line("top_surface_pattern", "fill-patterns#Infill of the top surface and bottom surface");
optgroup->append_single_option_line("bottom_surface_pattern", "fill-patterns#Infill of the top surface and bottom surface"); optgroup->append_single_option_line("bottom_surface_pattern", "fill-patterns#Infill of the top surface and bottom surface");
@ -4318,7 +4317,7 @@ void TabConfig::build() {
optgroup->append_single_option_line("minimum_sparse_infill_area", "parameter/strength-advance-settings"); optgroup->append_single_option_line("minimum_sparse_infill_area", "parameter/strength-advance-settings");
optgroup->append_single_option_line("infill_combination", "parameter/strength-advance-settings"); optgroup->append_single_option_line("infill_combination", "parameter/strength-advance-settings");
page = add_options_page(L("Speed"), "empty"); page = add_options_page(L("Speed"), "empty");
optgroup = page->new_optgroup("", L"param_speed_first", 15); optgroup = page->new_optgroup("", L"param_speed_first", 15);
optgroup->append_single_option_line("default_print_speed"); optgroup->append_single_option_line("default_print_speed");
optgroup->append_single_option_line("initial_layer_speed"); optgroup->append_single_option_line("initial_layer_speed");
@ -4340,15 +4339,15 @@ void TabConfig::build() {
optgroup->append_single_option_line("accel_to_decel_enable"); optgroup->append_single_option_line("accel_to_decel_enable");
optgroup->append_single_option_line("accel_to_decel_factor"); optgroup->append_single_option_line("accel_to_decel_factor");
/* optgroup->append_single_option_line("default_jerk"); /* optgroup->append_single_option_line("default_jerk");
optgroup->append_single_option_line("outer_wall_jerk"); optgroup->append_single_option_line("outer_wall_jerk");
optgroup->append_single_option_line("inner_wall_jerk"); optgroup->append_single_option_line("inner_wall_jerk");
optgroup->append_single_option_line("infill_jerk"); optgroup->append_single_option_line("infill_jerk");
optgroup->append_single_option_line("top_surface_jerk"); optgroup->append_single_option_line("top_surface_jerk");
optgroup->append_single_option_line("initial_layer_jerk"); optgroup->append_single_option_line("initial_layer_jerk");
optgroup->append_single_option_line("travel_jerk");*/ optgroup->append_single_option_line("travel_jerk");*/
page = add_options_page(L("Support"), "support"); page = add_options_page(L("Support"), "support");
optgroup = page->new_optgroup("", L"param_support"); optgroup = page->new_optgroup("", L"param_support");
optgroup->append_single_option_line("support_type", "support#support-types"); optgroup->append_single_option_line("support_type", "support#support-types");
optgroup->append_single_option_line("support_style", "support#support-styles"); optgroup->append_single_option_line("support_style", "support#support-styles");
@ -4379,7 +4378,7 @@ void TabConfig::build() {
optgroup->append_single_option_line("tree_support_branch_diameter", "support#tree-support-only-options"); optgroup->append_single_option_line("tree_support_branch_diameter", "support#tree-support-only-options");
optgroup->append_single_option_line("tree_support_branch_angle", "support#tree-support-only-options"); optgroup->append_single_option_line("tree_support_branch_angle", "support#tree-support-only-options");
page = add_options_page(L("Others"), "advanced"); page = add_options_page(L("Others"), "advanced");
optgroup = page->new_optgroup("", L"param_adhension"); optgroup = page->new_optgroup("", L"param_adhension");
optgroup->append_single_option_line("slicing_mode"); optgroup->append_single_option_line("slicing_mode");
optgroup->append_single_option_line("fibre_feed_rate"); optgroup->append_single_option_line("fibre_feed_rate");
@ -4392,6 +4391,7 @@ void TabConfig::build() {
optgroup->append_single_option_line("fuzzy_skin", "parameter/fuzzy-skin"); optgroup->append_single_option_line("fuzzy_skin", "parameter/fuzzy-skin");
optgroup->append_single_option_line("fuzzy_skin_point_distance"); optgroup->append_single_option_line("fuzzy_skin_point_distance");
optgroup->append_single_option_line("fuzzy_skin_thickness"); optgroup->append_single_option_line("fuzzy_skin_thickness");
} }
@ -4420,10 +4420,11 @@ void TabConfig::toggle_options() {
bool is_BBL_printer = false; bool is_BBL_printer = false;
if (m_preset_bundle) { if (m_preset_bundle) {
is_BBL_printer = is_BBL_printer = m_preset_bundle->configs.get_edited_preset().is_bbl_vendor_preset(m_preset_bundle);
m_preset_bundle->configs.get_edited_preset().is_bbl_vendor_preset(
m_preset_bundle);
} }
/* const Preset& preset = m_preset_bundle->configs.get_edited_preset();
bool is_BBL = preset.is_system;*/
//if (m_active_page->title() == "Quality") { //if (m_active_page->title() == "Quality") {
//toggle_line("printable_area", !is_configed_by_BBL);//all printer can entry and view data //toggle_line("printable_area", !is_configed_by_BBL);//all printer can entry and view data
//toggle_option("single_extruder_multi_material", have_multiple_extruders); //toggle_option("single_extruder_multi_material", have_multiple_extruders);
@ -4444,10 +4445,10 @@ void TabConfig::toggle_options() {
// toggle_option(el, !is_BBL_printer); // toggle_option(el, !is_BBL_printer);
//} //}
//if (m_active_page->title() == "Strength") { /* if (m_active_page->title() == "Strength") {
//toggle_line("time_lapse_gcode", m_preset_bundle->configs.get_edited_preset().config.opt_enum<PrinterStructure>("printer_structure") == PrinterStructure::psI3); toggle_line("time_lapse_gcode", m_preset_bundle->configs.get_edited_preset().config.opt_enum<PrinterStructure>("printer_structure") == PrinterStructure::psI3);
//toggle_option("thumbnail_size", !is_BBL_printer); toggle_option("thumbnail_size", !is_BBL_printer);
//} }*/
} }
void TabConfig::update() { void TabConfig::update() {

View File

@ -30,6 +30,7 @@ Button::Button()
std::make_pair(0xF0F0F1, (int) StateColor::Disabled), std::make_pair(0xF0F0F1, (int) StateColor::Disabled),
std::make_pair(0x37EE7C, (int) StateColor::Hovered | StateColor::Checked), std::make_pair(0x37EE7C, (int) StateColor::Hovered | StateColor::Checked),
std::make_pair(0x00AE42, (int) StateColor::Checked), std::make_pair(0x00AE42, (int) StateColor::Checked),
//std::make_pair(0x009FF3, (int) StateColor::Checked),
std::make_pair(*wxLIGHT_GREY, (int) StateColor::Hovered), std::make_pair(*wxLIGHT_GREY, (int) StateColor::Hovered),
std::make_pair(*wxWHITE, (int) StateColor::Normal)); std::make_pair(*wxWHITE, (int) StateColor::Normal));
text_color = StateColor( text_color = StateColor(

View File

@ -15,7 +15,7 @@ SwitchButton::SwitchButton(wxWindow* parent, wxWindowID id)
, m_off(this, "toggle_off", 16) , m_off(this, "toggle_off", 16)
, text_color(std::pair{0xfffffe, (int) StateColor::Checked}, std::pair{0x6B6B6B, (int) StateColor::Normal}) , text_color(std::pair{0xfffffe, (int) StateColor::Checked}, std::pair{0x6B6B6B, (int) StateColor::Normal})
, track_color(0xD9D9D9) , track_color(0xD9D9D9)
, thumb_color(std::pair{0x00AE42, (int) StateColor::Checked}, std::pair{0xD9D9D9, (int) StateColor::Normal}) , thumb_color(std::pair{0x009FF3, (int) StateColor::Checked}, std::pair{0xD9D9D9, (int) StateColor::Normal})
{ {
SetBackgroundColour(StaticBox::GetParentBackgroundColor(parent)); SetBackgroundColour(StaticBox::GetParentBackgroundColor(parent));
Bind(wxEVT_TOGGLEBUTTON, [this](auto& e) { update(); e.Skip(); }); Bind(wxEVT_TOGGLEBUTTON, [this](auto& e) { update(); e.Skip(); });