Merge branch 'main' into enh-update-wxwidgets

This commit is contained in:
Ocraftyone 2023-11-13 00:58:46 -05:00
commit 62d689b03e
No known key found for this signature in database
GPG key ID: 85836ED21AD4D125
163 changed files with 4674 additions and 2270 deletions

View file

@ -277,6 +277,7 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
sparse_infill_density == 0 &&
! config->opt_bool("enable_support") &&
config->opt_int("enforce_support_layers") == 0 &&
config->opt_bool("ensure_vertical_shell_thickness") &&
! config->opt_bool("detect_thin_wall") &&
! config->opt_bool("overhang_reverse") &&
config->opt_enum<TimelapseType>("timelapse_type") == TimelapseType::tlTraditional))
@ -304,6 +305,7 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
new_conf.set_key_value("sparse_infill_density", new ConfigOptionPercent(0));
new_conf.set_key_value("enable_support", new ConfigOptionBool(false));
new_conf.set_key_value("enforce_support_layers", new ConfigOptionInt(0));
new_conf.set_key_value("ensure_vertical_shell_thickness", new ConfigOptionBool(true));
new_conf.set_key_value("detect_thin_wall", new ConfigOptionBool(false));
new_conf.set_key_value("overhang_reverse", new ConfigOptionBool(false));
new_conf.set_key_value("timelapse_type", new ConfigOptionEnum<TimelapseType>(tlTraditional));
@ -524,7 +526,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
}
bool have_perimeters = config->opt_int("wall_loops") > 0;
for (auto el : { "extra_perimeters_on_overhangs", "detect_thin_wall", "detect_overhang_wall",
for (auto el : { "extra_perimeters_on_overhangs", "ensure_vertical_shell_thickness", "detect_thin_wall", "detect_overhang_wall",
"seam_position", "staggered_inner_seams", "wall_infill_order", "outer_wall_line_width",
"inner_wall_speed", "outer_wall_speed", "small_perimeter_speed", "small_perimeter_threshold" })
toggle_field(el, have_perimeters);

View file

@ -2122,16 +2122,15 @@ void GUI_App::init_app_config()
app_config = new AppConfig();
//app_config = new AppConfig(is_editor() ? AppConfig::EAppMode::Editor : AppConfig::EAppMode::GCodeViewer);
m_config_corrupted = false;
// load settings
m_app_conf_exists = app_config->exists();
if (m_app_conf_exists) {
std::string error = app_config->load();
if (!error.empty()) {
// Error while parsing config file. We'll customize the error message and rethrow to be displayed.
throw Slic3r::RuntimeError(
_u8L("OrcaSlicer configuration file may be corrupted and is not abled to be parsed."
"Please delete the file and try again.") +
"\n\n" + app_config->config_path() + "\n\n" + error);
// Orca: if the config file is corrupted, we will show a error dialog and create a default config file.
m_config_corrupted = true;
}
// Save orig_version here, so its empty if no app_config existed before this run.
m_last_config_version = app_config->orig_version();//parse_semver_from_ini(app_config->config_path());
@ -2477,7 +2476,6 @@ bool GUI_App::on_init_inner()
#endif // __WXMSW__
preset_updater = new PresetUpdater();
#if orca_todo
Bind(EVT_SLIC3R_VERSION_ONLINE, [this](const wxCommandEvent& evt) {
if (this->plater_ != nullptr) {
// this->plater_->get_notification_manager()->push_notification(NotificationType::NewAppAvailable);
@ -2566,7 +2564,6 @@ bool GUI_App::on_init_inner()
});
dlg.ShowModal();
});
#endif
}
else {
#ifdef __WXMSW__
@ -2750,6 +2747,7 @@ bool GUI_App::on_init_inner()
if (m_post_initialized && app_config->dirty())
app_config->save();
});
m_initialized = true;
@ -2757,6 +2755,13 @@ bool GUI_App::on_init_inner()
flush_logs();
BOOST_LOG_TRIVIAL(info) << "finished the gui app init";
if (m_config_corrupted) {
m_config_corrupted = false;
show_error(nullptr,
_u8L(
"The OrcaSlicer configuration file may be corrupted and cannot be parsed.\nOrcaSlicer has attempted to recreate the "
"configuration file.\nPlease note, application settings will be lost, but printer profiles will not be affected."));
}
//BBS: delete splash screen
delete scrn;
return true;
@ -4266,7 +4271,7 @@ void GUI_App::check_new_version_sf(bool show_tips, int by_user)
error);
})
.timeout_connect(1)
.on_complete([&](std::string body, unsigned http_status) {
.on_complete([this,by_user](std::string body, unsigned http_status) {
// Http response OK
if (http_status != 200)
return;
@ -4292,30 +4297,28 @@ void GUI_App::check_new_version_sf(bool show_tips, int by_user)
std::string best_release_content;
std::string best_pre_content;
const std::regex reg_num("([0-9]+)");
for (auto json_version : root) {
std::string tag = json_version.second.get<std::string>("tag_name");
if (tag[0] == 'v')
tag.erase(0, 1);
for (std::regex_iterator it = std::sregex_iterator(tag.begin(), tag.end(), reg_num);
it != std::sregex_iterator(); ++it) {
}
Semver tag_version = get_version(tag, matcher);
if (current_version == tag_version)
i_am_pre = json_version.second.get<bool>("prerelease");
if (json_version.second.get<bool>("prerelease")) {
if (best_pre < tag_version) {
best_pre = tag_version;
best_pre_url = json_version.second.get<std::string>("html_url");
best_pre_content = json_version.second.get<std::string>("body");
best_pre.set_prerelease("Preview");
}
} else {
if (best_release < tag_version) {
best_release = tag_version;
best_release_url = json_version.second.get<std::string>("html_url");
best_release_content = json_version.second.get<std::string>("body");
}
}
std::string tag = root.get<std::string>("tag_name");
if (tag[0] == 'v')
tag.erase(0, 1);
for (std::regex_iterator it = std::sregex_iterator(tag.begin(), tag.end(), reg_num);
it != std::sregex_iterator(); ++it) {
}
Semver tag_version = get_version(tag, matcher);
if (current_version == tag_version)
i_am_pre = root.get<bool>("prerelease");
if (root.get<bool>("prerelease")) {
if (best_pre < tag_version) {
best_pre = tag_version;
best_pre_url = root.get<std::string>("html_url");
best_pre_content = root.get<std::string>("body");
best_pre.set_prerelease("Preview");
}
} else {
if (best_release < tag_version) {
best_release = tag_version;
best_release_url = root.get<std::string>("html_url");
best_release_content = root.get<std::string>("body");
}
}
// if release is more recent than beta, use release anyway
@ -4325,8 +4328,11 @@ void GUI_App::check_new_version_sf(bool show_tips, int by_user)
best_pre_content = best_release_content;
}
// if we're the most recent, don't do anything
if ((i_am_pre ? best_pre : best_release) <= current_version)
if ((i_am_pre ? best_pre : best_release) <= current_version) {
if (by_user != 0)
this->no_new_version();
return;
}
// BOOST_LOG_TRIVIAL(info) << format("Got %1% online version: `%2%`. Sending to GUI thread...",
// SLIC3R_APP_NAME, i_am_pre ? best_pre.to_string(): best_release.to_string());

View file

@ -656,6 +656,7 @@ private:
bool m_datadir_redefined { false };
std::string m_older_data_dir_path;
boost::optional<Semver> m_last_config_version;
bool m_config_corrupted { false };
};
DECLARE_APP(GUI_App)

View file

@ -37,6 +37,8 @@ protected:
std::string get_action_snapshot_name() override { return "Paint-on seam editing"; }
static const constexpr float CursorRadiusMin = 0.05f; // cannot be zero
const float get_cursor_radius_min() const override { return CursorRadiusMin; }
private:
bool on_init() override;

View file

@ -147,6 +147,17 @@ bool GLGizmoText::on_init()
reset_text_info();
m_desc["font"] = _L("Font");
m_desc["size"] = _L("Size");
m_desc["thickness"] = _L("Thickness");
m_desc["text_gap"] = _L("Text Gap");
m_desc["angle"] = _L("Angle");
m_desc["embeded_depth"] = _L("Embeded\ndepth");
m_desc["input_text"] = _L("Input text");
m_desc["surface"] = _L("Surface");
m_desc["horizontal_text"] = _L("Horizontal text");
m_desc["rotate_text_caption"] = _L("Shift + Mouse move up or dowm");
m_desc["rotate_text"] = _L("Rotate text");
@ -669,13 +680,13 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
ImGui::PushStyleVar(ImGuiStyleVar_ScrollbarSize, 4.0f * currt_scale);
GizmoImguiBegin("Text", ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar);
float space_size = m_imgui->get_style_scaling() * 8;
float font_cap = m_imgui->calc_text_size(_L("Font")).x;
float size_cap = m_imgui->calc_text_size(_L("Size")).x;
float thickness_cap = m_imgui->calc_text_size(_L("Thickness")).x;
float input_cap = m_imgui->calc_text_size(_L("Input text")).x;
float depth_cap = m_imgui->calc_text_size(_L("Embeded")).x;
float caption_size = std::max(std::max(font_cap, size_cap), std::max(depth_cap, input_cap)) + space_size + ImGui::GetStyle().WindowPadding.x;
const float space_size = m_imgui->get_style_scaling() * 8;
const std::array<std::string, 7> cap_array = std::array<std::string, 7>{ "font", "size", "thickness", "text_gap", "angle", "embeded_depth", "input_text" };
float caption_size = 0.0f;
for (const auto &t : cap_array) {
caption_size = std::max(caption_size, m_imgui->calc_text_size(m_desc[t]).x);
}
caption_size += space_size + ImGui::GetStyle().WindowPadding.x;
float input_text_size = m_imgui->scaled(10.0f);
float button_size = ImGui::GetFrameHeight();
@ -702,7 +713,7 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
ImGui::AlignTextToFramePadding();
m_imgui->text(_L("Font"));
m_imgui->text(m_desc["font"]);
ImGui::SameLine(caption_size);
ImGui::PushItemWidth(list_width);
push_combo_style(currt_scale);
@ -742,7 +753,7 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
ImGui::PopStyleVar(2);
pop_combo_style();
ImGui::AlignTextToFramePadding();
m_imgui->text(_L("Size"));
m_imgui->text(m_desc["size"]);
ImGui::SameLine(caption_size);
ImGui::PushItemWidth(input_size);
if(ImGui::InputFloat("###font_size", &m_font_size, 0.0f, 0.0f, "%.2f"))
@ -769,7 +780,7 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
ImGui::PopStyleVar(3);
ImGui::AlignTextToFramePadding();
m_imgui->text(_L("Thickness"));
m_imgui->text(m_desc["thickness"]);
ImGui::SameLine(caption_size);
ImGui::PushItemWidth(list_width);
float old_value = m_thickness;
@ -784,7 +795,7 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
const float drag_left_width = caption_size + slider_width + space_size;
ImGui::AlignTextToFramePadding();
m_imgui->text(_L("Text Gap"));
m_imgui->text(m_desc["text_gap"]);
ImGui::SameLine(caption_size);
ImGui::PushItemWidth(slider_width);
if (m_imgui->bbl_slider_float_style("##text_gap", &m_text_gap, -100, 100, "%.2f", 1.0f, true))
@ -795,7 +806,7 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
m_need_update_text = true;
ImGui::AlignTextToFramePadding();
m_imgui->text(_L("Angle"));
m_imgui->text(m_desc["angle"]);
ImGui::SameLine(caption_size);
ImGui::PushItemWidth(slider_width);
if (m_imgui->bbl_slider_float_style("##angle", &m_rotate_angle, 0, 360, "%.2f", 1.0f, true))
@ -806,7 +817,7 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
m_need_update_text = true;
ImGui::AlignTextToFramePadding();
m_imgui->text(_L("Embeded\ndepth"));
m_imgui->text(m_desc["embeded_depth"]);
ImGui::SameLine(caption_size);
ImGui::PushItemWidth(list_width);
old_value = m_embeded_depth;
@ -817,7 +828,7 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
m_need_update_text = true;
ImGui::AlignTextToFramePadding();
m_imgui->text(_L("Input text"));
m_imgui->text(m_desc["input_text"]);
ImGui::SameLine(caption_size);
ImGui::PushItemWidth(list_width);
@ -835,12 +846,12 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
ImGui::SameLine(caption_size);
ImGui::AlignTextToFramePadding();
if (m_imgui->bbl_checkbox(_L("Surface"), m_is_surface_text))
if (m_imgui->bbl_checkbox(m_desc["surface"], m_is_surface_text))
m_need_update_text = true;
ImGui::SameLine();
ImGui::AlignTextToFramePadding();
if (m_imgui->bbl_checkbox(_L("Horizontal text"), m_keep_horizontal))
if (m_imgui->bbl_checkbox(m_desc["horizontal_text"], m_keep_horizontal))
m_need_update_text = true;
//ImGui::SameLine();

View file

@ -16,7 +16,7 @@ constexpr double miscalculation = scale_(scale_(1)); // equal to 1 mm2
static const float LEFT_MARGIN = 13.0f + 100.0f; // avoid thumbnail toolbar
static const float HORIZONTAL_SLIDER_WINDOW_HEIGHT = 64.0f;
static const float VERTICAL_SLIDER_WINDOW_WIDTH = 124.0f;
static const float VERTICAL_SLIDER_WINDOW_WIDTH = 160.0f;
static const float GROOVE_WIDTH = 12.0f;
static const ImVec2 ONE_LAYER_MARGIN = ImVec2(20.0f, 20.0f);
static const ImVec2 ONE_LAYER_BUTTON_SIZE = ImVec2(28.0f, 28.0f);

View file

@ -459,7 +459,7 @@ void PartPlate::calc_vertex_for_icons(int index, GeometryBuffer &buffer)
ExPolygon poly;
auto bed_ext = get_extents(m_shape);
Vec2d p = bed_ext[2];
if (m_plater->get_build_volume_type() == BuildVolume_Type::Circle)
if (m_plater && m_plater->get_build_volume_type() == BuildVolume_Type::Circle)
p[1] -= std::max(
0.0, (bed_ext.size()(1) - 5 * PARTPLATE_ICON_SIZE - 4 * PARTPLATE_ICON_GAP_Y - PARTPLATE_ICON_GAP_TOP) / 2);

View file

@ -1056,6 +1056,13 @@ void Sidebar::update_all_preset_comboboxes()
m_bed_type_list->SelectAndNotify((int)bed_type - 1);
}
m_bed_type_list->Enable();
auto str_bed_type = wxGetApp().app_config->get_printer_setting(wxGetApp().preset_bundle->printers.get_selected_preset_name(), "curr_bed_type");
if(!str_bed_type.empty()){
int bed_type_value = atoi(str_bed_type.c_str());
if(bed_type_value == 0)
bed_type_value = 1;
m_bed_type_list->SelectAndNotify(bed_type_value - 1);
}
} else {
connection_btn->Show();
ams_btn->Hide();

View file

@ -1941,6 +1941,8 @@ void TabPrint::build()
optgroup->append_single_option_line("bridge_angle");
optgroup->append_single_option_line("minimum_sparse_infill_area");
optgroup->append_single_option_line("infill_combination");
optgroup->append_single_option_line("detect_narrow_internal_solid_infill");
optgroup->append_single_option_line("ensure_vertical_shell_thickness");
page = add_options_page(L("Speed"), "empty");
optgroup = page->new_optgroup(L("Initial layer speed"), L"param_speed_first", 15);
@ -3229,6 +3231,17 @@ void TabPrinter::build_fff()
option.opt.height = gcode_field_height;//150;
optgroup->append_single_option_line(option);
optgroup = page->new_optgroup(L("Change extrusion role G-code"), L"param_gcode", 0);
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
validate_custom_gcode_cb(this, optgroup, opt_key, value);
};
option = optgroup->get_option("change_extrusion_role_gcode");
option.opt.full_width = true;
option.opt.is_code = true;
option.opt.height = gcode_field_height;//150;
optgroup->append_single_option_line(option);
optgroup = page->new_optgroup(L("Pause G-code"), L"param_gcode", 0);
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
validate_custom_gcode_cb(this, optgroup, opt_key, value);