FIX:The blank page appeared when clicking to log in

Change-Id: I0f6904c85da5f72fa9d4c0be0e8174acdf44cc8c
This commit is contained in:
Kunlong Ma
2023-08-09 11:50:57 +08:00
committed by Lane.Wei
parent 25f9cccf2a
commit 3f53791200

View File

@@ -57,7 +57,37 @@ ZUserLogin::ZUserLogin() : wxDialog((wxWindow *) (wxGetApp().mainframe), wxID_AN
// Url // Url
AppConfig * config = wxGetApp().app_config; AppConfig * config = wxGetApp().app_config;
NetworkAgent* agent = wxGetApp().getAgent(); NetworkAgent* agent = wxGetApp().getAgent();
if (!agent) return; if (!agent) {
std::string icon_path = (boost::format("%1%/images/BambuStudioTitle.ico") % resources_dir()).str();
SetIcon(wxIcon(encode_path(icon_path.c_str()), wxBITMAP_TYPE_ICO));
SetBackgroundColour(*wxWHITE);
wxBoxSizer* m_sizer_main = new wxBoxSizer(wxVERTICAL);
auto m_line_top = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1));
m_line_top->SetBackgroundColour(wxColour(166, 169, 170));
m_sizer_main->Add(m_line_top, 0, wxEXPAND, 0);
auto* m_message = new wxStaticText(this, wxID_ANY, _L("Bambu Network plug-in not detected."), wxDefaultPosition, wxDefaultSize, 0);
m_message->SetForegroundColour(*wxBLACK);
m_message->Wrap(FromDIP(360));
auto m_download_hyperlink = new wxHyperlinkCtrl(this, wxID_ANY, _L("Click here to download it."), wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
m_download_hyperlink->Bind(wxEVT_HYPERLINK, [this](wxCommandEvent& event) {
this->Close();
wxGetApp().ShowDownNetPluginDlg();
});
m_sizer_main->Add(m_message, 0, wxALIGN_CENTER | wxALL, FromDIP(15));
m_sizer_main->Add(m_download_hyperlink, 0, wxALIGN_CENTER | wxALL, FromDIP(10));
m_sizer_main->Add(0, 0, 1, wxBOTTOM, 10);
SetSizer(m_sizer_main);
m_sizer_main->SetSizeHints(this);
Layout();
Fit();
CentreOnParent();
}
else {
std::string host_url = agent->get_bambulab_host(); std::string host_url = agent->get_bambulab_host();
TargetUrl = host_url + "/sign-in"; TargetUrl = host_url + "/sign-in";
m_networkOk = false; m_networkOk = false;
@@ -104,7 +134,7 @@ ZUserLogin::ZUserLogin() : wxDialog((wxWindow *) (wxGetApp().mainframe), wxID_AN
// Bind(wxEVT_CLOSE_WINDOW, &ZUserLogin::OnClose, this); // Bind(wxEVT_CLOSE_WINDOW, &ZUserLogin::OnClose, this);
// UI // UI
SetTitle( _L("Login")); SetTitle(_L("Login"));
// Set a more sensible size for web browsing // Set a more sensible size for web browsing
wxSize pSize = FromDIP(wxSize(650, 840)); wxSize pSize = FromDIP(wxSize(650, 840));
SetSize(pSize); SetSize(pSize);
@@ -114,10 +144,7 @@ ZUserLogin::ZUserLogin() : wxDialog((wxWindow *) (wxGetApp().mainframe), wxID_AN
int MaxY = (screenheight - pSize.y) > 0 ? (screenheight - pSize.y) / 2 : 0; int MaxY = (screenheight - pSize.y) > 0 ? (screenheight - pSize.y) / 2 : 0;
wxPoint tmpPT((screenwidth - pSize.x) / 2, MaxY); wxPoint tmpPT((screenwidth - pSize.x) / 2, MaxY);
Move(tmpPT); Move(tmpPT);
}
//Param
m_AutotestToken = "";
wxGetApp().UpdateDlgDarkUI(this); wxGetApp().UpdateDlgDarkUI(this);
} }