Merge branch 'main' into enh-update-wxwidgets

This commit is contained in:
Ocraftyone 2023-11-05 04:11:05 -05:00
commit 961629b766
No known key found for this signature in database
GPG key ID: 85836ED21AD4D125
67 changed files with 13231 additions and 5303 deletions

View file

@ -149,6 +149,9 @@ void AppConfig::set_defaults()
if (get("use_inches").empty())
set("use_inches", "0");
if (get("default_page").empty())
set("default_page", "0");
}
else {
#ifdef _WIN32
@ -231,6 +234,12 @@ void AppConfig::set_defaults()
if (get("stealth_mode").empty()) {
set_bool("stealth_mode", false);
}
// Orca
if(get("show_splash_screen").empty()) {
set_bool("show_splash_screen", true);
}
if (get("show_model_mesh").empty()) {
set_bool("show_model_mesh", false);
}
@ -303,9 +312,9 @@ void AppConfig::set_defaults()
set("max_recent_count", "18");
}
if (get("staff_pick_switch").empty()) {
set_bool("staff_pick_switch", true);
}
// if (get("staff_pick_switch").empty()) {
// set_bool("staff_pick_switch", false);
// }
if (get("sync_system_preset").empty()) {
set_bool("sync_system_preset", true);

View file

@ -1376,7 +1376,7 @@ std::tuple<std::vector<ExtrusionPaths>, Polygons> generate_extra_perimeters_over
void PerimeterGenerator::apply_extra_perimeters(ExPolygons &infill_area)
{
if (this->lower_slices != nullptr && this->config->detect_overhang_wall && this->config->extra_perimeters_on_overhangs &&
if (!m_spiral_vase && this->lower_slices != nullptr && this->config->detect_overhang_wall && this->config->extra_perimeters_on_overhangs &&
this->config->wall_loops > 0 && this->layer_id > this->object_config->raft_layers) {
// Generate extra perimeters on overhang areas, and cut them to these parts only, to save print time and material
auto [extra_perimeters, filled_area] = generate_extra_perimeters_over_overhangs(infill_area, this->lower_slices_polygons(),
@ -1641,7 +1641,7 @@ void PerimeterGenerator::process_classic()
//BBS: refer to superslicer
//store surface for top infill if only_one_wall_top
if (i == 0 && i!=loop_number && config->only_one_wall_top && this->upper_slices != NULL) {
if (i == 0 && i!=loop_number && config->only_one_wall_top && !surface.is_bridge() && this->upper_slices != NULL) {
this->split_top_surfaces(last, top_fills, last, fill_clip);
}
@ -1912,7 +1912,7 @@ void PerimeterGenerator::process_arachne()
std::vector<Arachne::VariableWidthLines> out_shell;
ExPolygons top_fills;
ExPolygons fill_clip;
if (loop_number > 0 && config->only_one_wall_top && this->upper_slices != nullptr) {
if (loop_number > 0 && config->only_one_wall_top && !surface.is_bridge() && this->upper_slices != nullptr) {
// Check if current layer has surfaces that are not covered by upper layer (i.e., top surfaces)
ExPolygons non_top_polygons;
this->split_top_surfaces(last, top_fills, non_top_polygons, fill_clip);

View file

@ -651,7 +651,7 @@ void PrintConfigDef::init_fff_params()
def->tooltip = L("Bed temperature of the initial layer. "
"Value 0 means the filament does not support to print on the Textured PEI Plate");
def->sidetext = L("°C");
def->max = 0;
def->min = 0;
def->max = 300;
def->set_default_value(new ConfigOptionInts{45});
@ -3043,21 +3043,6 @@ def = this->add("filament_loading_speed", coFloats);
def->mode = comSimple;
def->set_default_value(new ConfigOptionFloats { 0.4 });
def = this->add("retract_lift_above", coFloats);
def->label = L("Z hop lower boundary");
def->tooltip = L("Z hop will only come into effect when Z is above this value and is below the parameter: \"Z hop upper boundary\"");
def->sidetext = L("mm");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloats{0.});
def = this->add("retract_lift_below", coFloats);
def->label = L("Z hop upper boundary");
def->tooltip = L("If this value is positive, Z hop will only come into effect when Z is above the parameter: \"Z hop lower boundary\" and is below this value");
def->sidetext = L("mm");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloats{0.});
def = this->add("z_hop_types", coEnums);
def->label = L("Z hop type");
def->tooltip = L("Z hop type");

View file

@ -249,8 +249,12 @@ static std::vector<std::pair<TreeSupportSettings, std::vector<size_t>>> group_me
raw_overhangs = overhangs;
raw_overhangs_calculated = true;
}
if (! (enforced_layer || blockers_layers.empty() || blockers_layers[layer_id].empty()))
overhangs = diff(overhangs, blockers_layers[layer_id], ApplySafetyOffset::Yes);
if (! (enforced_layer || blockers_layers.empty() || blockers_layers[layer_id].empty())) {
Polygons &blocker = blockers_layers[layer_id];
// Arthur: union_ is a must because after mirroring, the blocker polygons are in left-hand coordinates, ie clockwise,
// which are not valid polygons, and will be removed by offset. union_ can make these polygons right.
overhangs = diff(overhangs, offset(union_(blocker), scale_(g_config_tree_support_collision_resolution)), ApplySafetyOffset::Yes);
}
if (config.bridge_no_support) {
for (const LayerRegion *layerm : current_layer.regions())
remove_bridges_from_contacts(print_config, lower_layer, *layerm,

View file

@ -1107,6 +1107,8 @@ void GUI_App::post_init()
//#endif
if (is_editor())
mainframe->select_tab(size_t(0));
if (app_config->get("default_page") == "1")
mainframe->select_tab(size_t(1));
mainframe->Thaw();
plater_->trigger_restore_project(1);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", end load_gl_resources";
@ -1734,9 +1736,9 @@ void GUI_App::restart_networking()
if (app_config->get("sync_user_preset") == "true") {
start_sync_user_preset();
}
if (mainframe && this->app_config->get("staff_pick_switch") == "true") {
if (mainframe->m_webview) { mainframe->m_webview->SendDesignStaffpick(has_model_mall()); }
}
// if (mainframe && this->app_config->get("staff_pick_switch") == "true") {
// if (mainframe->m_webview) { mainframe->m_webview->SendDesignStaffpick(has_model_mall()); }
// }
}
BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< boost::format(" exit, m_agent=%1%")%m_agent;
}
@ -2427,8 +2429,7 @@ bool GUI_App::on_init_inner()
}
BBLSplashScreen * scrn = nullptr;
const bool show_splash_screen = true;
if (show_splash_screen) {
if (app_config->get("show_splash_screen") == "true") {
// make a bitmap with dark grey banner on the left side
//BBS make BBL splash screen bitmap
wxBitmap bmp = BBLSplashScreen::MakeBitmap();
@ -2988,10 +2989,10 @@ void GUI_App::update_label_colours_from_appconfig()
void GUI_App::update_publish_status()
{
mainframe->show_publish_button(has_model_mall());
if (app_config->get("staff_pick_switch") == "true") {
mainframe->m_webview->SendDesignStaffpick(has_model_mall());
}
// mainframe->show_publish_button(has_model_mall());
// if (app_config->get("staff_pick_switch") == "true") {
// mainframe->m_webview->SendDesignStaffpick(has_model_mall());
// }
}
bool GUI_App::has_model_mall()
@ -3817,22 +3818,22 @@ std::string GUI_App::handle_web_request(std::string cmd)
}
}
}
else if (command_str.compare("modelmall_model_advise_get") == 0) {
if (mainframe && this->app_config->get("staff_pick_switch") == "true") {
if (mainframe->m_webview) {
mainframe->m_webview->SendDesignStaffpick(has_model_mall());
}
}
}
else if (command_str.compare("modelmall_model_open") == 0) {
if (root.get_child_optional("data") != boost::none) {
pt::ptree data_node = root.get_child("data");
boost::optional<std::string> id = data_node.get_optional<std::string>("id");
if (id.has_value() && mainframe->m_webview) {
mainframe->m_webview->OpenModelDetail(id.value(), m_agent);
}
}
}
// else if (command_str.compare("modelmall_model_advise_get") == 0) {
// if (mainframe && this->app_config->get("staff_pick_switch") == "true") {
// if (mainframe->m_webview) {
// mainframe->m_webview->SendDesignStaffpick(has_model_mall());
// }
// }
// }
// else if (command_str.compare("modelmall_model_open") == 0) {
// if (root.get_child_optional("data") != boost::none) {
// pt::ptree data_node = root.get_child("data");
// boost::optional<std::string> id = data_node.get_optional<std::string>("id");
// if (id.has_value() && mainframe->m_webview) {
// mainframe->m_webview->OpenModelDetail(id.value(), m_agent);
// }
// }
// }
else if (command_str.compare("homepage_open_recentfile") == 0) {
if (root.get_child_optional("data") != boost::none) {
pt::ptree data_node = root.get_child("data");

View file

@ -8290,7 +8290,7 @@ void Plater::calib_pa(const Calib_Params& params)
switch (params.mode) {
case CalibMode::Calib_PA_Line:
add_model(false, Slic3r::resources_dir() + "/calib/PressureAdvance/pressure_advance_test.stl");
add_model(false, Slic3r::resources_dir() + "/calib/pressure_advance/pressure_advance_test.stl");
break;
case CalibMode::Calib_PA_Pattern:
_calib_pa_pattern(params);
@ -8404,7 +8404,7 @@ void Plater::_calib_pa_pattern(const Calib_Params& params)
}
void Plater::_calib_pa_tower(const Calib_Params& params) {
add_model(false, Slic3r::resources_dir() + "/calib/PressureAdvance/tower_with_seam.stl");
add_model(false, Slic3r::resources_dir() + "/calib/pressure_advance/tower_with_seam.stl");
auto print_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config;
auto printer_config = &wxGetApp().preset_bundle->printers.get_edited_preset().config;

View file

@ -630,10 +630,10 @@ wxBoxSizer *PreferencesDialog::create_item_checkbox(wxString title, wxWindow *pa
app_config->set_bool(param, checkbox->GetValue());
app_config->save();
if (param == "staff_pick_switch") {
bool pbool = app_config->get("staff_pick_switch") == "true";
wxGetApp().switch_staff_pick(pbool);
}
// if (param == "staff_pick_switch") {
// bool pbool = app_config->get("staff_pick_switch") == "true";
// wxGetApp().switch_staff_pick(pbool);
// }
// backup
if (param == "backup_switch") {
@ -979,9 +979,13 @@ wxWindow* PreferencesDialog::create_general_page()
std::vector<wxString> Units = {_L("Metric") + " (mm, g)", _L("Imperial") + " (in, oz)"};
auto item_currency = create_item_combobox(_L("Units"), page, _L("Units"), "use_inches", Units);
std::vector<wxString> DefaultPage = {_L("Home"), _L("Prepare")};
auto item_default_page = create_item_combobox(_L("Default Page"), page, _L("Set the page opened on startup."), "default_page", DefaultPage);
auto item_mouse_zoom_settings = create_item_checkbox(_L("Zoom to mouse position"), page, _L("Zoom in towards the mouse pointer's position in the 3D view, rather than the 2D window center."), 50, "zoom_to_mouse");
auto item_use_free_camera_settings = create_item_checkbox(_L("Use free camera"), page, _L("If enabled, use free camera. If not enabled, use constrained camera."), 50, "use_free_camera");
auto item_show_splash_screen = create_item_checkbox(_L("Show splash screen"), page, _L("Show the splash screen during startup."), 50, "show_splash_screen");
auto item_hints = create_item_checkbox(_L("Show \"Tip of the day\" notification after start"), page, _L("If enabled, useful hints are displayed at startup."), 50, "show_hints");
auto item_gcode_window = create_item_checkbox(_L("Show g-code window"), page, _L("If enabled, g-code window will be displayed."), 50, "show_gcode_window");
@ -1004,9 +1008,9 @@ wxWindow* PreferencesDialog::create_general_page()
_L("If enabled, sets OrcaSlicer as default application to open .step files"), 50, "associate_step");
#endif // _WIN32
auto title_modelmall = create_item_title(_L("Online Models"), page, _L("Online Models"));
// auto title_modelmall = create_item_title(_L("Online Models"), page, _L("Online Models"));
// auto item_backup = create_item_switch(_L("Backup switch"), page, _L("Backup switch"), "units");
auto item_modelmall = create_item_checkbox(_L("Show online staff-picked models on the home page"), page, _L("Show online staff-picked models on the home page"), 50, "staff_pick_switch");
// auto item_modelmall = create_item_checkbox(_L("Show online staff-picked models on the home page"), page, _L("Show online staff-picked models on the home page"), 50, "staff_pick_switch");
auto title_project = create_item_title(_L("Project"), page, "");
auto item_max_recent_count = create_item_input(_L("Maximum recent projects"), "", page, _L("Maximum count of recent projects"), "max_recent_count", [](wxString value) {
@ -1039,8 +1043,10 @@ wxWindow* PreferencesDialog::create_general_page()
sizer_page->Add(item_language, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_region, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_currency, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_default_page, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_mouse_zoom_settings, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_use_free_camera_settings, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_show_splash_screen, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_hints, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_gcode_window, 0, wxTOP, FromDIP(3));
sizer_page->Add(title_presets, 0, wxTOP | wxEXPAND, FromDIP(20));
@ -1054,18 +1060,18 @@ wxWindow* PreferencesDialog::create_general_page()
sizer_page->Add(item_associate_stl, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_associate_step, 0, wxTOP, FromDIP(3));
#endif // _WIN32
auto item_title_modelmall = sizer_page->Add(title_modelmall, 0, wxTOP | wxEXPAND, FromDIP(20));
auto item_item_modelmall = sizer_page->Add(item_modelmall, 0, wxTOP, FromDIP(3));
auto update_modelmall = [this, item_title_modelmall, item_item_modelmall] (wxEvent & e) {
bool has_model_mall = wxGetApp().has_model_mall();
item_title_modelmall->Show(has_model_mall);
item_item_modelmall->Show(has_model_mall);
Layout();
Fit();
};
wxCommandEvent eee(wxEVT_COMBOBOX);
update_modelmall(eee);
item_region->GetItem(size_t(2))->GetWindow()->Bind(wxEVT_COMBOBOX, update_modelmall);
// auto item_title_modelmall = sizer_page->Add(title_modelmall, 0, wxTOP | wxEXPAND, FromDIP(20));
// auto item_item_modelmall = sizer_page->Add(item_modelmall, 0, wxTOP, FromDIP(3));
// auto update_modelmall = [this, item_title_modelmall, item_item_modelmall] (wxEvent & e) {
// bool has_model_mall = wxGetApp().has_model_mall();
// item_title_modelmall->Show(has_model_mall);
// item_item_modelmall->Show(has_model_mall);
// Layout();
// Fit();
// };
// wxCommandEvent eee(wxEVT_COMBOBOX);
// update_modelmall(eee);
// item_region->GetItem(size_t(2))->GetWindow()->Bind(wxEVT_COMBOBOX, update_modelmall);
sizer_page->Add(title_project, 0, wxTOP| wxEXPAND, FromDIP(20));
sizer_page->Add(item_max_recent_count, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_save_choise, 0, wxTOP, FromDIP(3));

View file

@ -430,23 +430,23 @@ void WebViewPanel::SendRecentList(int images)
void WebViewPanel::SendDesignStaffpick(bool on)
{
if (on) {
get_design_staffpick(0, 60, [this](std::string body) {
if (body.empty() || body.front() != '{') {
BOOST_LOG_TRIVIAL(warning) << "get_design_staffpick failed " + body;
return;
}
CallAfter([this, body] {
auto body2 = from_u8(body);
body2.insert(1, "\"command\": \"modelmall_model_advise_get\", ");
RunScript(wxString::Format("window.postMessage(%s)", body2));
});
});
} else {
std::string body2 = "{\"total\":0, \"hits\":[]}";
body2.insert(1, "\"command\": \"modelmall_model_advise_get\", ");
RunScript(wxString::Format("window.postMessage(%s)", body2));
}
// if (on) {
// get_design_staffpick(0, 60, [this](std::string body) {
// if (body.empty() || body.front() != '{') {
// BOOST_LOG_TRIVIAL(warning) << "get_design_staffpick failed " + body;
// return;
// }
// CallAfter([this, body] {
// auto body2 = from_u8(body);
// body2.insert(1, "\"command\": \"modelmall_model_advise_get\", ");
// RunScript(wxString::Format("window.postMessage(%s)", body2));
// });
// });
// } else {
// std::string body2 = "{\"total\":0, \"hits\":[]}";
// body2.insert(1, "\"command\": \"modelmall_model_advise_get\", ");
// RunScript(wxString::Format("window.postMessage(%s)", body2));
// }
}
void WebViewPanel::OpenModelDetail(std::string id, NetworkAgent *agent)
@ -488,17 +488,17 @@ void WebViewPanel::ShowNetpluginTip()
void WebViewPanel::get_design_staffpick(int offset, int limit, std::function<void(std::string)> callback)
{
auto host = wxGetApp().get_http_url(wxGetApp().app_config->get_country_code(), "v1/design-service/design/staffpick");
std::string url = (boost::format("%1%/?offset=%2%&limit=%3%") % host % offset % limit).str();
// auto host = wxGetApp().get_http_url(wxGetApp().app_config->get_country_code(), "v1/design-service/design/staffpick");
// std::string url = (boost::format("%1%/?offset=%2%&limit=%3%") % host % offset % limit).str();
Http http = Http::get(url);
http.header("accept", "application/json")
.header("Content-Type", "application/json")
.on_complete([this, callback](std::string body, unsigned status) { callback(body); })
.on_error([this, callback](std::string body, std::string error, unsigned status) {
callback(body);
})
.perform();
// Http http = Http::get(url);
// http.header("accept", "application/json")
// .header("Content-Type", "application/json")
// .on_complete([this, callback](std::string body, unsigned status) { callback(body); })
// .on_error([this, callback](std::string body, std::string error, unsigned status) {
// callback(body);
// })
// .perform();
}
int WebViewPanel::get_model_mall_detail_url(std::string *url, std::string id)

View file

@ -1,3 +1,7 @@
///|/ Copyright (c) Prusa Research 2018 - 2023 Oleksandra Iushchenko @YuSanka, Lukáš Matěna @lukasmatena, Pavel Mikuš @Godrak, Enrico Turri @enricoturri1966, Vojtěch Bubník @bubnikv
///|/
///|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
///|/
#ifdef HAS_WIN10SDK
#ifndef NOMINMAX
@ -323,9 +327,8 @@ public:
// fix_result containes a message if fixing failed
bool fix_model_by_win10_sdk_gui(ModelObject &model_object, int volume_idx, GUI::ProgressDialog& progress_dialog, const wxString& msg_header, std::string& fix_result)
{
std::mutex mutex;
std::condition_variable condition;
std::unique_lock<std::mutex> lock(mutex);
std::mutex mtx;
std::condition_variable condition;
struct Progress {
std::string message;
int percent = 0;
@ -344,8 +347,8 @@ bool fix_model_by_win10_sdk_gui(ModelObject &model_object, int volume_idx, GUI::
// (It seems like wxWidgets initialize the COM contex as single threaded and we need a multi-threaded context).
bool success = false;
size_t ivolume = 0;
auto on_progress = [&mutex, &condition, &ivolume, &volumes, &progress](const char *msg, unsigned prcnt) {
std::lock_guard<std::mutex> lk(mutex);
auto on_progress = [&mtx, &condition, &ivolume, &volumes, &progress](const char *msg, unsigned prcnt) {
std::unique_lock<std::mutex> lock(mtx);
progress.message = msg;
progress.percent = (int)floor((float(prcnt) + float(ivolume) * 100.f) / float(volumes.size()));
progress.updated = true;
@ -422,6 +425,7 @@ bool fix_model_by_win10_sdk_gui(ModelObject &model_object, int volume_idx, GUI::
}
});
while (! finished) {
std::unique_lock<std::mutex> lock(mtx);
condition.wait_for(lock, std::chrono::milliseconds(250), [&progress]{ return progress.updated; });
// decrease progress.percent value to avoid closing of the progress dialog
if (!progress_dialog.Update(progress.percent-1, msg_header + _(progress.message)))

View file

@ -402,8 +402,6 @@ bool OctoPrint::upload_inner_with_resolved_ip(PrintHostUpload upload_data, Progr
.on_complete([&](std::string body, unsigned status) {
BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: File uploaded: HTTP %2%: %3%") % name % status % body;
})
.timeout_connect(3600)
.timeout_max(7200)
.on_error([&](std::string body, std::string error, unsigned status) {
BOOST_LOG_TRIVIAL(error) << boost::format("%1%: Error uploading file to %2%: %3%, HTTP %4%, body: `%5%`") % name % url % error % status % body;
error_fn(format_error(body, error, status));
@ -411,7 +409,7 @@ bool OctoPrint::upload_inner_with_resolved_ip(PrintHostUpload upload_data, Progr
})
.on_progress([&](Http::Progress progress, bool& cancel) {
prorgess_fn(std::move(progress), cancel);
if (cancel) {
if (cancel) {
// Upload was canceled
BOOST_LOG_TRIVIAL(info) << name << ": Upload canceled";
result = false;
@ -486,8 +484,6 @@ bool OctoPrint::upload_inner_with_host(PrintHostUpload upload_data, ProgressFn p
#endif // _WIN32
set_auth(http);
http.form_add("print", upload_data.post_action == PrintHostPostUploadAction::StartPrint ? "true" : "false")
.timeout_connect(3600)
.timeout_max(7200)
.form_add("path", upload_parent_path.string()) // XXX: slashes on windows ???
.form_add_file("file", upload_data.source_path.string(), upload_filename.string())
.on_complete([&](std::string body, unsigned status) {