mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-12-11 16:00:17 -07:00
Merge branch 'main' into enh-update-wxwidgets
This commit is contained in:
commit
961629b766
67 changed files with 13231 additions and 5303 deletions
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue