mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-20 11:53:48 +00:00
Compare commits
4 Commits
feature/ht
...
fix/linux-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f67a53d97b | ||
|
|
6829e3cb14 | ||
|
|
4fd599ae20 | ||
|
|
d73bcc661b |
8
.idea/.gitignore
generated
vendored
Normal file
8
.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
2
.idea/OrcaSlicer.iml
generated
Normal file
2
.idea/OrcaSlicer.iml
generated
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module classpath="CMake" type="CPP_MODULE" version="4" />
|
||||||
7
.idea/codeStyles/Project.xml
generated
Normal file
7
.idea/codeStyles/Project.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<code_scheme name="Project" version="173">
|
||||||
|
<clangFormatSettings>
|
||||||
|
<option name="ENABLED" value="true" />
|
||||||
|
</clangFormatSettings>
|
||||||
|
</code_scheme>
|
||||||
|
</component>
|
||||||
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||||
|
</state>
|
||||||
|
</component>
|
||||||
4
.idea/misc.xml
generated
Normal file
4
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
||||||
|
</project>
|
||||||
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/OrcaSlicer.iml" filepath="$PROJECT_DIR$/.idea/OrcaSlicer.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -11,7 +11,6 @@
|
|||||||
#include "Downloader.hpp"
|
#include "Downloader.hpp"
|
||||||
#include <boost/chrono/duration.hpp>
|
#include <boost/chrono/duration.hpp>
|
||||||
#include <boost/log/detail/native_typeof.hpp>
|
#include <boost/log/detail/native_typeof.hpp>
|
||||||
#include <libslic3r/Config.hpp>
|
|
||||||
#include <wx/event.h>
|
#include <wx/event.h>
|
||||||
|
|
||||||
// Localization headers: include libslic3r version first so everything in this file
|
// Localization headers: include libslic3r version first so everything in this file
|
||||||
@@ -4836,12 +4835,12 @@ void GUI_App::on_http_error(wxCommandEvent &evt)
|
|||||||
BOOST_LOG_TRIVIAL(warning) << "logout: http error 401.";
|
BOOST_LOG_TRIVIAL(warning) << "logout: http error 401.";
|
||||||
this->request_user_logout(provider);
|
this->request_user_logout(provider);
|
||||||
|
|
||||||
if (!m_show_http_error_msgdlg) {
|
if (!m_show_http_errpr_msgdlg) {
|
||||||
MessageDialog msg_dlg(nullptr, _L("Login information expired. Please login again."), "", wxAPPLY | wxOK);
|
MessageDialog msg_dlg(nullptr, _L("Login information expired. Please login again."), "", wxAPPLY | wxOK);
|
||||||
m_show_http_error_msgdlg = true;
|
m_show_http_errpr_msgdlg = true;
|
||||||
auto modal_result = msg_dlg.ShowModal();
|
auto modal_result = msg_dlg.ShowModal();
|
||||||
if (modal_result == wxOK || modal_result == wxCLOSE) {
|
if (modal_result == wxOK || modal_result == wxCLOSE) {
|
||||||
m_show_http_error_msgdlg = false;
|
m_show_http_errpr_msgdlg = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4849,40 +4848,6 @@ void GUI_App::on_http_error(wxCommandEvent &evt)
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// No need to show dialog for 410: 410 means resource has been deleted from the server.
|
|
||||||
if (status == 410) {
|
|
||||||
BOOST_LOG_TRIVIAL(info) << "Http error 410.";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool m_is_error_shown = false;
|
|
||||||
// Show general error notification for Orca Cloud API failures (not Bambu)
|
|
||||||
if (provider == ORCA_CLOUD_PROVIDER && status >= 400 && code != HttpErrorVersionLimited) {
|
|
||||||
wxString msg;
|
|
||||||
if (!error.empty()) {
|
|
||||||
msg = wxString::Format(_L("API error (HTTP %u): %s"), status, wxString::FromUTF8(error));
|
|
||||||
} else {
|
|
||||||
msg = wxString::Format(_L("API error (HTTP %u)"), status);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (app_config->get_bool("developer_mode")) {
|
|
||||||
// Use notification manager if ImGui is ready; fall back to wxMessageBox on Linux
|
|
||||||
// where ImGui may not be initialized until the user switches to the Prepare tab.
|
|
||||||
if (wxGetApp().plater() != nullptr && wxGetApp().imgui()->display_initialized()) {
|
|
||||||
wxGetApp()
|
|
||||||
.plater()
|
|
||||||
->get_notification_manager()
|
|
||||||
->push_notification(NotificationType::PlaterError, NotificationManager::NotificationLevel::WarningNotificationLevel,
|
|
||||||
msg.ToUTF8().data());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!m_is_error_shown) {
|
|
||||||
m_is_error_shown = true;
|
|
||||||
wxMessageBox(msg, _L("Orca Cloud API Error"), wxOK | wxICON_ERROR, wxGetApp().mainframe);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI_App::enable_user_preset_folder(bool enable)
|
void GUI_App::enable_user_preset_folder(bool enable)
|
||||||
|
|||||||
@@ -324,7 +324,7 @@ private:
|
|||||||
bool m_is_dark_mode{ false };
|
bool m_is_dark_mode{ false };
|
||||||
bool m_adding_script_handler { false };
|
bool m_adding_script_handler { false };
|
||||||
bool m_side_popup_status{false};
|
bool m_side_popup_status{false};
|
||||||
bool m_show_http_error_msgdlg{false};
|
bool m_show_http_errpr_msgdlg{false};
|
||||||
bool m_show_error_msgdlg{false};
|
bool m_show_error_msgdlg{false};
|
||||||
wxString m_info_dialog_content;
|
wxString m_info_dialog_content;
|
||||||
HttpServer m_http_server;
|
HttpServer m_http_server;
|
||||||
|
|||||||
@@ -373,13 +373,12 @@ public:
|
|||||||
//BBS
|
//BBS
|
||||||
static int TOOLBAR_WINDOW_FLAGS;
|
static int TOOLBAR_WINDOW_FLAGS;
|
||||||
|
|
||||||
bool display_initialized() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init_font(bool compress);
|
void init_font(bool compress);
|
||||||
void init_input();
|
void init_input();
|
||||||
void init_style();
|
void init_style();
|
||||||
void render_draw_data(ImDrawData *draw_data);
|
void render_draw_data(ImDrawData *draw_data);
|
||||||
|
bool display_initialized() const;
|
||||||
void destroy_font();
|
void destroy_font();
|
||||||
std::vector<unsigned char> load_svg(const std::string& bitmap_name, unsigned target_width, unsigned target_height, unsigned *outwidth, unsigned *outheight);
|
std::vector<unsigned char> load_svg(const std::string& bitmap_name, unsigned target_width, unsigned target_height, unsigned *outwidth, unsigned *outheight);
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,81 @@
|
|||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
// Workaround for #7210: WebKitGTK crashes on vue-resize's hidden <object> probe used by
|
||||||
|
// older Fluidd/Mainsail pages. Swap that <object> for a <div> shim at appendChild time
|
||||||
|
// and bridge resize events through a fake contentDocument.defaultView so vue-resize keeps
|
||||||
|
// working. Workaround proposed by @VittC.
|
||||||
|
static void inject_vue_resize_workaround(wxWebView *webView)
|
||||||
|
{
|
||||||
|
webView->AddUserScript(
|
||||||
|
"(function() {"
|
||||||
|
" 'use strict';"
|
||||||
|
" function isVueResizeObject(el) {"
|
||||||
|
" return el && el.tagName === 'OBJECT'"
|
||||||
|
" && el.type === 'text/html'"
|
||||||
|
" && el.getAttribute('aria-hidden') === 'true'"
|
||||||
|
" && el.getAttribute('tabindex') === '-1';"
|
||||||
|
" }"
|
||||||
|
" function isResizeObserverParent(p) {"
|
||||||
|
" return p && p.classList && p.classList.contains('resize-observer');"
|
||||||
|
" }"
|
||||||
|
" function makeShim(orig, parentForRO) {"
|
||||||
|
" var shim = document.createElement('div');"
|
||||||
|
" shim.setAttribute('aria-hidden', 'true');"
|
||||||
|
" shim.setAttribute('tabindex', '-1');"
|
||||||
|
" shim.style.display = 'none';"
|
||||||
|
" var fakeWin = document.createElement('div');"
|
||||||
|
" var ro = null;"
|
||||||
|
" var origRemoveEL = fakeWin.removeEventListener.bind(fakeWin);"
|
||||||
|
" fakeWin.removeEventListener = function(type, fn, opts) {"
|
||||||
|
" origRemoveEL(type, fn, opts);"
|
||||||
|
" if (type === 'resize' && ro) { ro.disconnect(); ro = null; }"
|
||||||
|
" };"
|
||||||
|
" Object.defineProperty(shim, 'contentDocument', {"
|
||||||
|
" configurable: true,"
|
||||||
|
" get: function() { return { defaultView: fakeWin }; }"
|
||||||
|
" });"
|
||||||
|
" Object.defineProperty(shim, 'contentWindow', {"
|
||||||
|
" configurable: true,"
|
||||||
|
" get: function() { return fakeWin; }"
|
||||||
|
" });"
|
||||||
|
" if (typeof orig.onload === 'function') { shim.onload = orig.onload; }"
|
||||||
|
" queueMicrotask(function() {"
|
||||||
|
" if (parentForRO && typeof ResizeObserver !== 'undefined') {"
|
||||||
|
" ro = new ResizeObserver(function() {"
|
||||||
|
" fakeWin.dispatchEvent(new Event('resize'));"
|
||||||
|
" });"
|
||||||
|
" ro.observe(parentForRO);"
|
||||||
|
" }"
|
||||||
|
" if (typeof shim.onload === 'function') {"
|
||||||
|
" try { shim.onload(new Event('load')); } catch (e) {}"
|
||||||
|
" }"
|
||||||
|
" shim.dispatchEvent(new Event('load'));"
|
||||||
|
" });"
|
||||||
|
" return shim;"
|
||||||
|
" }"
|
||||||
|
" var origAppend = Node.prototype.appendChild;"
|
||||||
|
" Node.prototype.appendChild = function(child) {"
|
||||||
|
" if (isResizeObserverParent(this) && isVueResizeObject(child)) {"
|
||||||
|
" return origAppend.call(this, makeShim(child, this));"
|
||||||
|
" }"
|
||||||
|
" return origAppend.call(this, child);"
|
||||||
|
" };"
|
||||||
|
" var origInsertBefore = Node.prototype.insertBefore;"
|
||||||
|
" Node.prototype.insertBefore = function(child, ref) {"
|
||||||
|
" if (isResizeObserverParent(this) && isVueResizeObject(child)) {"
|
||||||
|
" return origInsertBefore.call(this, makeShim(child, this), ref);"
|
||||||
|
" }"
|
||||||
|
" return origInsertBefore.call(this, child, ref);"
|
||||||
|
" };"
|
||||||
|
" console.log('[vr-fix] vue-resize WebKitGTK patch active');"
|
||||||
|
"})();",
|
||||||
|
wxWEBVIEW_INJECT_AT_DOCUMENT_START
|
||||||
|
);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
PrinterWebView::PrinterWebView(wxWindow *parent)
|
PrinterWebView::PrinterWebView(wxWindow *parent)
|
||||||
: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize)
|
: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize)
|
||||||
, m_browser(nullptr)
|
, m_browser(nullptr)
|
||||||
@@ -43,6 +118,8 @@ PrinterWebView::PrinterWebView(wxWindow *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
inject_vue_resize_workaround(m_browser);
|
||||||
|
|
||||||
auto cookiesPath = boost::filesystem::path(data_dir() + "/cache/cookies.db");
|
auto cookiesPath = boost::filesystem::path(data_dir() + "/cache/cookies.db");
|
||||||
auto wv = static_cast<WebKitWebView*>(m_browser->GetNativeBackend());
|
auto wv = static_cast<WebKitWebView*>(m_browser->GetNativeBackend());
|
||||||
auto wv_ctx = webkit_web_view_get_context(wv);
|
auto wv_ctx = webkit_web_view_get_context(wv);
|
||||||
@@ -165,6 +242,10 @@ void PrinterWebView::SendAPIKey()
|
|||||||
)",
|
)",
|
||||||
m_apikey);
|
m_apikey);
|
||||||
m_browser->RemoveAllUserScripts();
|
m_browser->RemoveAllUserScripts();
|
||||||
|
#ifdef __linux__
|
||||||
|
// Re-inject the vue-resize/WebKitGTK workaround that RemoveAllUserScripts just cleared.
|
||||||
|
inject_vue_resize_workaround(m_browser);
|
||||||
|
#endif
|
||||||
|
|
||||||
m_browser->AddUserScript(script);
|
m_browser->AddUserScript(script);
|
||||||
m_browser->Reload();
|
m_browser->Reload();
|
||||||
|
|||||||
Reference in New Issue
Block a user