mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-09-16 15:23:16 +08:00
ConnectWebViewPanel: disable error reporting via dialog (only reporting to console), disable dev tools
This commit is contained in:
parent
07dbc5d7f0
commit
6255d57e5e
@ -27,12 +27,37 @@ namespace Slic3r {
|
|||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
|
|
||||||
|
WebViewPanel::~WebViewPanel()
|
||||||
|
{
|
||||||
|
SetEvtHandlerEnabled(false);
|
||||||
|
#ifdef DEBUG_URL_PANEL
|
||||||
|
delete m_tools_menu;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebViewPanel::load_url(const wxString& url)
|
||||||
|
{
|
||||||
|
if (!m_browser)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this->on_page_will_load();
|
||||||
|
|
||||||
|
this->Show();
|
||||||
|
this->Raise();
|
||||||
|
#ifdef DEBUG_URL_PANEL
|
||||||
|
m_url->SetLabelText(url);
|
||||||
|
#endif
|
||||||
|
m_browser->LoadURL(url);
|
||||||
|
m_browser->SetFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
WebViewPanel::WebViewPanel(wxWindow *parent, const wxString& default_url, const std::vector<std::string>& message_handler_names, const std::string& loading_html/* = "loading"*/)
|
WebViewPanel::WebViewPanel(wxWindow *parent, const wxString& default_url, const std::vector<std::string>& message_handler_names, const std::string& loading_html/* = "loading"*/)
|
||||||
: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize)
|
: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize)
|
||||||
, m_default_url (default_url)
|
, m_default_url (default_url)
|
||||||
, m_loading_html(loading_html)
|
, m_loading_html(loading_html)
|
||||||
, m_script_message_hadler_names(message_handler_names)
|
, m_script_message_hadler_names(message_handler_names)
|
||||||
{
|
{
|
||||||
wxBoxSizer* topsizer = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* topsizer = new wxBoxSizer(wxVERTICAL);
|
||||||
#ifdef DEBUG_URL_PANEL
|
#ifdef DEBUG_URL_PANEL
|
||||||
// Create the button
|
// Create the button
|
||||||
@ -91,7 +116,7 @@ WebViewPanel::WebViewPanel(wxWindow *parent, const wxString& default_url, const
|
|||||||
m_tools_menu->AppendSeparator();
|
m_tools_menu->AppendSeparator();
|
||||||
|
|
||||||
wxMenu* script_menu = new wxMenu;
|
wxMenu* script_menu = new wxMenu;
|
||||||
|
|
||||||
m_script_custom = script_menu->Append(wxID_ANY, "Custom script");
|
m_script_custom = script_menu->Append(wxID_ANY, "Custom script");
|
||||||
m_tools_menu->AppendSubMenu(script_menu, "Run Script");
|
m_tools_menu->AppendSubMenu(script_menu, "Run Script");
|
||||||
wxMenuItem* addUserScript = m_tools_menu->Append(wxID_ANY, "Add user script");
|
wxMenuItem* addUserScript = m_tools_menu->Append(wxID_ANY, "Add user script");
|
||||||
@ -129,34 +154,6 @@ WebViewPanel::WebViewPanel(wxWindow *parent, const wxString& default_url, const
|
|||||||
#endif
|
#endif
|
||||||
//Connect the idle events
|
//Connect the idle events
|
||||||
Bind(wxEVT_IDLE, &WebViewPanel::on_idle, this);
|
Bind(wxEVT_IDLE, &WebViewPanel::on_idle, this);
|
||||||
|
|
||||||
m_browser->EnableContextMenu(true);
|
|
||||||
m_browser->EnableAccessToDevTools(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
WebViewPanel::~WebViewPanel()
|
|
||||||
{
|
|
||||||
SetEvtHandlerEnabled(false);
|
|
||||||
#ifdef DEBUG_URL_PANEL
|
|
||||||
delete m_tools_menu;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void WebViewPanel::load_url(const wxString& url)
|
|
||||||
{
|
|
||||||
if (!m_browser)
|
|
||||||
return;
|
|
||||||
|
|
||||||
this->on_page_will_load();
|
|
||||||
|
|
||||||
this->Show();
|
|
||||||
this->Raise();
|
|
||||||
#ifdef DEBUG_URL_PANEL
|
|
||||||
m_url->SetLabelText(url);
|
|
||||||
#endif
|
|
||||||
m_browser->LoadURL(url);
|
|
||||||
m_browser->SetFocus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebViewPanel::load_default_url_delayed()
|
void WebViewPanel::load_default_url_delayed()
|
||||||
@ -696,13 +693,14 @@ void ConnectWebViewPanel::on_navigation_request(wxWebViewEvent &evt)
|
|||||||
void ConnectWebViewPanel::on_connect_action_error(const std::string &message_data)
|
void ConnectWebViewPanel::on_connect_action_error(const std::string &message_data)
|
||||||
{
|
{
|
||||||
ConnectRequestHandler::on_connect_action_error(message_data);
|
ConnectRequestHandler::on_connect_action_error(message_data);
|
||||||
MessageDialog dialog(
|
// TODO: make this more user friendly (and make sure only once opened if multiple errors happen)
|
||||||
this,
|
// MessageDialog dialog(
|
||||||
GUI::format_wxstr(_L("WebKit Runtime Error encountered:\n\n%s"), message_data),
|
// this,
|
||||||
"WebKit Runtime Error",
|
// GUI::format_wxstr(_L("WebKit Runtime Error encountered:\n\n%s"), message_data),
|
||||||
wxOK
|
// "WebKit Runtime Error",
|
||||||
);
|
// wxOK
|
||||||
dialog.ShowModal();
|
// );
|
||||||
|
// dialog.ShowModal();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user