mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 08:47:52 -06:00
fix a small UI glitch caused by printer viewer
This commit is contained in:
parent
47225a83a2
commit
1a371a9417
3 changed files with 6 additions and 52 deletions
|
@ -941,6 +941,7 @@ void MainFrame::init_tabpanel()
|
|||
//select_tab(MainFrame::tpMonitor);
|
||||
m_printer_view->load_url(url);
|
||||
});
|
||||
m_printer_view->Hide();
|
||||
|
||||
m_auxiliary = new AuxiliaryPanel(m_tabpanel, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||
m_tabpanel->AddPage(m_auxiliary, _L("Project"), std::string("tab_auxiliary_avtice"), std::string("tab_auxiliary_avtice"));
|
||||
|
@ -979,6 +980,7 @@ void MainFrame::show_device(bool bBBLPrinter) {
|
|||
m_tabpanel->InsertPage(3, m_printer_view, _L("Device"),
|
||||
std::string("tab_monitor_active"),
|
||||
std::string("tab_monitor_active"));
|
||||
m_printer_view->Show();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,17 +23,7 @@ PrinterWebView::PrinterWebView(wxWindow *parent)
|
|||
|
||||
wxBoxSizer* topsizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
// Create the button
|
||||
bSizer_toolbar = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
//m_button_reload = new wxButton(this, wxID_ANY, wxT("Reload"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
//bSizer_toolbar->Add(m_button_reload, 0, wxALL, 5);
|
||||
|
||||
m_url = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER);
|
||||
bSizer_toolbar->Add(m_url, 1, wxALL | wxEXPAND, 5);
|
||||
|
||||
|
||||
// Create the webview
|
||||
// Create the webview
|
||||
m_browser = WebView::CreateWebView(this, "");
|
||||
if (m_browser == nullptr) {
|
||||
wxLogError("Could not init m_browser");
|
||||
|
@ -55,9 +45,6 @@ PrinterWebView::PrinterWebView(wxWindow *parent)
|
|||
//Zoom
|
||||
m_zoomFactor = 100;
|
||||
|
||||
// Connect the button events
|
||||
//Bind(wxEVT_BUTTON, &PrinterWebView::OnReload, this, m_button_reload->GetId());
|
||||
Bind(wxEVT_TEXT_ENTER, &PrinterWebView::OnUrl, this, m_url->GetId());
|
||||
//Connect the idle events
|
||||
Bind(wxEVT_CLOSE_WINDOW, &PrinterWebView::OnClose, this);
|
||||
|
||||
|
@ -74,12 +61,9 @@ PrinterWebView::~PrinterWebView()
|
|||
|
||||
void PrinterWebView::load_url(wxString& url)
|
||||
{
|
||||
//this->Show();
|
||||
//this->Raise();
|
||||
m_url->SetLabelText(url);
|
||||
// this->Show();
|
||||
// this->Raise();
|
||||
|
||||
if (wxGetApp().get_mode() == comDevelop)
|
||||
wxLogMessage(m_url->GetValue());
|
||||
m_browser->LoadURL(url);
|
||||
//m_browser->SetFocus();
|
||||
UpdateState();
|
||||
|
@ -90,28 +74,7 @@ void PrinterWebView::load_url(wxString& url)
|
|||
*/
|
||||
void PrinterWebView::UpdateState() {
|
||||
// SetTitle(m_browser->GetCurrentTitle());
|
||||
m_url->SetValue(m_browser->GetCurrentURL());
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback invoked when user entered an URL and pressed enter
|
||||
*/
|
||||
void PrinterWebView::OnUrl(wxCommandEvent& WXUNUSED(evt))
|
||||
{
|
||||
if (wxGetApp().get_mode() == comDevelop)
|
||||
wxLogMessage(m_url->GetValue());
|
||||
m_browser->LoadURL(m_url->GetValue());
|
||||
m_browser->SetFocus();
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback invoked when user pressed the "reload" button
|
||||
*/
|
||||
void PrinterWebView::OnReload(wxCommandEvent& WXUNUSED(evt))
|
||||
{
|
||||
m_browser->Reload();
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
void PrinterWebView::OnClose(wxCloseEvent& evt)
|
||||
|
|
|
@ -36,25 +36,14 @@ public:
|
|||
virtual ~PrinterWebView();
|
||||
|
||||
void load_url(wxString& url);
|
||||
|
||||
void UpdateState();
|
||||
void OnUrl(wxCommandEvent& evt);
|
||||
void OnReload(wxCommandEvent& evt);
|
||||
void OnClose(wxCloseEvent& evt);
|
||||
void OnClose(wxCloseEvent& evt);
|
||||
|
||||
private:
|
||||
|
||||
wxWebView* m_browser;
|
||||
wxBoxSizer *bSizer_toolbar;
|
||||
wxButton * m_button_reload;
|
||||
wxTextCtrl *m_url;
|
||||
|
||||
long m_zoomFactor;
|
||||
|
||||
// Last executed JavaScript snippet, for convenience.
|
||||
// wxString m_javascript;
|
||||
// wxString m_response_js;
|
||||
|
||||
// DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue