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

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();
if (!printer_presets.empty())
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();
return project_presets;
@ -409,6 +412,7 @@ void PresetBundle::reset_project_embedded_presets()
bool printer_reselect = this->printers.reset_project_embedded_presets();
bool filament_reselect = this->filaments.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 (!prefer_printer.empty())
@ -419,7 +423,7 @@ void PresetBundle::reset_project_embedded_presets()
//this->update_multi_material_filament_presets();
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();
/*if (filament_reselect) {
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->printers .update_map_system_profile_renamed();
//xiamian+
//this->configs .update_map_system_profile_renamed();
this->configs .update_map_system_profile_renamed();
this->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->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)
@ -1443,6 +1448,12 @@ void PresetBundle::load_installed_printers(const AppConfig &config)
for (auto &preset : printers)
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
{
@ -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 :
preset_type == Preset::TYPE_SLA_PRINT ? sla_prints :
preset_type == Preset::TYPE_FILAMENT ? filaments :
preset_type == Preset::TYPE_CONFIG ? configs :
sla_materials;
return presets.get_preset_name_by_alias(alias);
@ -1488,8 +1500,9 @@ void PresetBundle::save_changes_for_preset(const std::string& new_name, Preset::
type == Preset::TYPE_SLA_PRINT ? sla_prints :
type == Preset::TYPE_FILAMENT ? filaments :
type == Preset::TYPE_SLA_MATERIAL ? sla_materials :
type == Preset::TYPE_PRINTER ?printers :
configs;
type == Preset::TYPE_CONFIG ? configs :
printers;
// if we want to save just some from selected options
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;
// Update visibility of presets based on application vendor / model / variant configuration.
this->load_installed_printers(config);
this->load_installed_configs(config);
// Update visibility of filament and sla material presets
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);
sla_prints.select_preset_by_name_strict(initial_sla_print_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 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_materials.set_default_suppressed(default_suppressed);
printers.set_default_suppressed(default_suppressed);
configs.set_default_suppressed(default_suppressed);
}
} // namespace Slic3r

View File

@ -227,6 +227,7 @@ public:
// based on the user configuration.
// 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_configs(const AppConfig &config);
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 PRINTER_LIST_COLOUR wxColour("#EEEEEE")
#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")
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::SameLine(max_len);
imgui.text(short_time(get_time_dhms(time_mode.time)));
//imgui.text(get_time_dhms(time_mode.time));
//xiamian+
ImGui::Dummy({ window_padding, window_padding });
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");
imgui.text(oss.str());
ImGui::SameLine(max_len);
std::string abc = " ";
imgui.text(abc);
//ImGui::Spacing();
//shangmian+
auto show_mode_button = [this, &imgui, can_show_mode_button](const wxString& label, PrintEstimatedStatistics::ETimeMode mode) {
if (can_show_mode_button(mode)) {

View File

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

View File

@ -1382,6 +1382,17 @@ void Sidebar::update_presets(Preset::Type preset_type)
}
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:
;// p->combo_sla_print->update();
break;
@ -1538,6 +1549,7 @@ void Sidebar::msw_rescale()
// //p->combo_printer
// } )
// combo->msw_rescale();
p->combo_config->msw_rescale();
p->combo_printer->msw_rescale();
for (PlaterPresetComboBox* combo : p->combos_filament)
combo->msw_rescale();

View File

@ -4253,7 +4253,6 @@ void TabPrinter::update_sla()
void TabConfig::build() {
m_presets = &m_preset_bundle->configs;
load_initial_data();
auto page = add_options_page(L("Quality"), "spool");
auto optgroup = page->new_optgroup("", L"param_layer_height");
optgroup->append_single_option_line("initial_layer_print_height", "layer-height");
@ -4392,6 +4391,7 @@ void TabConfig::build() {
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_thickness");
}
@ -4420,10 +4420,11 @@ void TabConfig::toggle_options() {
bool is_BBL_printer = false;
if (m_preset_bundle) {
is_BBL_printer =
m_preset_bundle->configs.get_edited_preset().is_bbl_vendor_preset(
m_preset_bundle);
is_BBL_printer = 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") {
//toggle_line("printable_area", !is_configed_by_BBL);//all printer can entry and view data
//toggle_option("single_extruder_multi_material", have_multiple_extruders);
@ -4444,10 +4445,10 @@ void TabConfig::toggle_options() {
// toggle_option(el, !is_BBL_printer);
//}
//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_option("thumbnail_size", !is_BBL_printer);
//}
/* 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_option("thumbnail_size", !is_BBL_printer);
}*/
}
void TabConfig::update() {

View File

@ -30,6 +30,7 @@ Button::Button()
std::make_pair(0xF0F0F1, (int) StateColor::Disabled),
std::make_pair(0x37EE7C, (int) StateColor::Hovered | 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(*wxWHITE, (int) StateColor::Normal));
text_color = StateColor(

View File

@ -15,7 +15,7 @@ SwitchButton::SwitchButton(wxWindow* parent, wxWindowID id)
, m_off(this, "toggle_off", 16)
, text_color(std::pair{0xfffffe, (int) StateColor::Checked}, std::pair{0x6B6B6B, (int) StateColor::Normal})
, 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));
Bind(wxEVT_TOGGLEBUTTON, [this](auto& e) { update(); e.Skip(); });