mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-16 17:45:53 +08:00
Various small changes
This commit is contained in:
parent
44c8770df5
commit
23d056fc71
@ -750,13 +750,6 @@ void MainFrame::init_tabpanel()
|
|||||||
select_tab(size_t(0)); // select Plater
|
select_tab(size_t(0)); // select Plater
|
||||||
});
|
});
|
||||||
|
|
||||||
if (wxGetApp().is_editor()) {
|
|
||||||
|
|
||||||
//m_webview = new WebViewPanel(m_tabpanel);
|
|
||||||
//m_tabpanel->AddNewPage(m_webview, "web", "cog"/*, "tab_home_active"*/);
|
|
||||||
//m_param_panel = new ParamsPanel(m_tabpanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_plater = new Plater(this, this);
|
m_plater = new Plater(this, this);
|
||||||
m_plater->Hide();
|
m_plater->Hide();
|
||||||
|
|
||||||
@ -1183,7 +1176,7 @@ void MainFrame::on_sys_color_changed()
|
|||||||
wxGetApp().plater()->sys_color_changed();
|
wxGetApp().plater()->sys_color_changed();
|
||||||
|
|
||||||
// update Tabs
|
// update Tabs
|
||||||
for (auto tab : wxGetApp().tabs_list)
|
for (Tab* tab : wxGetApp().tabs_list)
|
||||||
tab->sys_color_changed();
|
tab->sys_color_changed();
|
||||||
|
|
||||||
if (m_connect_webview)
|
if (m_connect_webview)
|
||||||
|
@ -69,31 +69,21 @@ class FakeWebView : public wxWebView
|
|||||||
virtual void DoSetPage(const wxString& html, const wxString& baseUrl) override { }
|
virtual void DoSetPage(const wxString& html, const wxString& baseUrl) override { }
|
||||||
};
|
};
|
||||||
|
|
||||||
wxWebView* WebView::CreateWebView(wxWindow * parent, wxString const & url)
|
wxWebView* WebView::CreateWebView(wxWindow * parent, const wxString& url)
|
||||||
{
|
{
|
||||||
#if wxUSE_WEBVIEW_EDGE
|
#if wxUSE_WEBVIEW_EDGE
|
||||||
// WebView2Loader.dll in exe folder is enough?
|
bool backend_available = wxWebView::IsBackendAvailable(wxWebViewBackendEdge);
|
||||||
/*
|
#else
|
||||||
// Check if a fixed version of edge is present in
|
bool backend_available = wxWebView::IsBackendAvailable(wxWebViewBackendWebKit);
|
||||||
// $executable_path/edge_fixed and use it
|
|
||||||
wxFileName edgeFixedDir(wxStandardPaths::Get().GetExecutablePath());
|
|
||||||
edgeFixedDir.SetFullName("");
|
|
||||||
edgeFixedDir.AppendDir("edge_fixed");
|
|
||||||
if (edgeFixedDir.DirExists()) {
|
|
||||||
wxWebViewEdge::MSWSetBrowserExecutableDir(edgeFixedDir.GetFullPath());
|
|
||||||
wxLogMessage("Using fixed edge version");
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
#endif
|
#endif
|
||||||
wxString correct_url = url;
|
|
||||||
#ifdef __WIN32__
|
|
||||||
correct_url.Replace("\\", "/");
|
|
||||||
#endif
|
|
||||||
if (!correct_url.empty())
|
|
||||||
correct_url = wxURI(correct_url).BuildURI();
|
|
||||||
|
|
||||||
auto webView = wxWebView::New();
|
wxWebView* webView = nullptr;
|
||||||
|
if (backend_available)
|
||||||
|
webView = wxWebView::New();
|
||||||
|
|
||||||
if (webView) {
|
if (webView) {
|
||||||
|
wxString correct_url = url.empty() ? wxString("") : wxURI(url).BuildURI();
|
||||||
|
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
webView->SetUserAgent(wxString::Format("PrusaSlicer/v%s", SLIC3R_VERSION));
|
webView->SetUserAgent(wxString::Format("PrusaSlicer/v%s", SLIC3R_VERSION));
|
||||||
webView->Create(parent, wxID_ANY, correct_url, wxDefaultPosition, wxDefaultSize);
|
webView->Create(parent, wxID_ANY, correct_url, wxDefaultPosition, wxDefaultSize);
|
||||||
@ -113,7 +103,7 @@ wxWebView* WebView::CreateWebView(wxWindow * parent, wxString const & url)
|
|||||||
Slic3r::GUI::wxGetApp().CallAfter([webView] {
|
Slic3r::GUI::wxGetApp().CallAfter([webView] {
|
||||||
#endif
|
#endif
|
||||||
if (!webView->AddScriptMessageHandler("_prusaSlicer")) {
|
if (!webView->AddScriptMessageHandler("_prusaSlicer")) {
|
||||||
// TODO: dialog to user
|
// TODO: dialog to user !!!
|
||||||
//wxLogError("Could not add script message handler");
|
//wxLogError("Could not add script message handler");
|
||||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << "Could not add script message handler";
|
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << "Could not add script message handler";
|
||||||
}
|
}
|
||||||
@ -122,7 +112,7 @@ wxWebView* WebView::CreateWebView(wxWindow * parent, wxString const & url)
|
|||||||
#endif
|
#endif
|
||||||
webView->EnableContextMenu(false);
|
webView->EnableContextMenu(false);
|
||||||
} else {
|
} else {
|
||||||
// TODO: dialog to user
|
// TODO: dialog to user !!!
|
||||||
BOOST_LOG_TRIVIAL(error) << "Failed to create wxWebView object. Using Dummy object instead. Webview won't be working.";
|
BOOST_LOG_TRIVIAL(error) << "Failed to create wxWebView object. Using Dummy object instead. Webview won't be working.";
|
||||||
webView = new FakeWebView;
|
webView = new FakeWebView;
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ WebViewPanel::WebViewPanel(wxWindow *parent, const wxString& default_url)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Create the webview
|
// Create the webview
|
||||||
m_browser = WebView::CreateWebView(this, /*m_default_url*/ wxString::Format("file://%s/web/connection_failed.html", from_u8(resources_dir())));
|
m_browser = WebView::CreateWebView(this, /*m_default_url*/ GUI::format_wxstr("file://%1%/web/connection_failed.html", boost::filesystem::path(resources_dir()).generic_string()));
|
||||||
if (m_browser == nullptr) {
|
if (m_browser == nullptr) {
|
||||||
wxLogError("Could not init m_browser");
|
wxLogError("Could not init m_browser");
|
||||||
return;
|
return;
|
||||||
@ -170,7 +170,7 @@ void WebViewPanel::load_default_url_delayed()
|
|||||||
|
|
||||||
void WebViewPanel::load_error_page()
|
void WebViewPanel::load_error_page()
|
||||||
{
|
{
|
||||||
load_url(wxString::Format("file://%s/web/connection_failed.html", from_u8(resources_dir())));
|
load_url(GUI::format_wxstr("file://%1%/web/connection_failed.html", boost::filesystem::path(resources_dir()).generic_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebViewPanel::on_show(wxShowEvent& evt)
|
void WebViewPanel::on_show(wxShowEvent& evt)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user