FIX: Interactive UI for installing network plugins

jira: none

Change-Id: I2a99917cab90eda26335be38cccbf17cd2d5342b
This commit is contained in:
hang.xu 2024-09-03 17:59:44 +08:00 committed by Lane.Wei
parent f91bbc4f7c
commit a415ab0c71
4 changed files with 60 additions and 11 deletions

View File

@ -148,14 +148,25 @@ bool DownloadProgressDialog::Show(bool show)
m_upgrade_job->set_event_handle(this);
m_status_bar->set_progress(0);
Bind(EVT_UPGRADE_NETWORK_SUCCESS, [this](wxCommandEvent& evt) {
m_status_bar->change_button_label(_L("OK"));
on_finish();
m_status_bar->set_cancel_callback_fina(
[this]() {
this->Close();
wxGetApp().request_login();
}
);
if (wxGetApp().check_networking_version()) {
m_status_bar->change_button_label(_L("OK"));
on_finish();
m_status_bar->set_cancel_callback_fina(
[this]() {
this->Close();
wxGetApp().request_login();
}
);
}
else {
on_finish();
m_status_bar->change_button_label(_L("Close"));
m_status_bar->set_cancel_callback_fina(
[this]() {
this->Close();
}
);
}
});
//download failed

View File

@ -4233,8 +4233,29 @@ std::string GUI_App::handle_web_request(std::string cmd)
if (mainframe && mainframe->m_webview) { mainframe->m_webview->OpenOneMakerlab(strUrl); }
}
}
else if (command_str.compare("makerworld_model_open") == 0)
}
else if (command_str.compare("homepage_need_networkplugin") == 0){
if (mainframe){
if (mainframe->m_confirm_download_plugin_dlg == nullptr) {
mainframe->m_confirm_download_plugin_dlg = new SecondaryCheckDialog(mainframe, wxID_ANY, _L("Install network plug-in"), SecondaryCheckDialog::ButtonStyle::ONLY_CONFIRM);
mainframe->m_confirm_download_plugin_dlg->SetSize(wxSize(270, 158));
mainframe->m_confirm_download_plugin_dlg->update_text(_L("Please Install network plug-in before log in."));
mainframe->m_confirm_download_plugin_dlg->update_btn_label(_L("Install Network Plug-in"), _L(""));
mainframe->m_confirm_download_plugin_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this](wxCommandEvent& e) {
mainframe->m_confirm_download_plugin_dlg->Close();
ShowDownNetPluginDlg();
return;
});
}
auto dlg_width = mainframe->m_confirm_download_plugin_dlg->GetSize();
int xPos = mainframe->GetRect().GetX() + (mainframe->GetSize().x - dlg_width.x) / 2;
int yPos = mainframe->GetRect().GetY() + (mainframe->GetSize().y - dlg_width.y) / 2;
mainframe->m_confirm_download_plugin_dlg->SetPosition(wxPoint(xPos, yPos));
mainframe->m_confirm_download_plugin_dlg->on_show();
}
}
else if (command_str.compare("makerworld_model_open") == 0)
{
if (root.get_child_optional("model") != boost::none) {
pt::ptree data_node = root.get_child("model");

View File

@ -1045,6 +1045,9 @@ void MainFrame::init_tabpanel()
return;
});
}
int xPos = GetRect().GetX() + (GetSize().x - m_confirm_download_plugin_dlg->GetSize().x) / 2;
int yPos = GetRect().GetY() + (GetSize().y - m_confirm_download_plugin_dlg->GetSize().y) / 2;
m_confirm_download_plugin_dlg->SetPosition(wxPoint(xPos, yPos));
m_confirm_download_plugin_dlg->on_show();
}
}

View File

@ -4926,7 +4926,21 @@ void EditDevNameDialog::on_edit_name(wxCommandEvent &e)
void PinCodePanel::on_mouse_left_up(wxMouseEvent& evt)
{
if (m_type == 0) {
wxGetApp().popup_ping_bind_dialog();
if (wxGetApp().getAgent() && wxGetApp().getAgent()->is_user_login()){
wxGetApp().popup_ping_bind_dialog();
}
else{
auto m_confirm_login_dlg = new SecondaryCheckDialog(nullptr, wxID_ANY, _L("Bind with Pin Code"), SecondaryCheckDialog::ButtonStyle::ONLY_CONFIRM, wxDefaultPosition);
m_confirm_login_dlg->SetSize(wxSize(FromDIP(270), FromDIP(158)));
m_confirm_login_dlg->update_text(_L("Please log in before binding your device with a PIN code.\nAlternatively, you can use LAN mode to bind your device. Learn about LAN mode."));
m_confirm_login_dlg->update_btn_label(_L("Go to Login"), _L(""));
m_confirm_login_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this](wxCommandEvent& e) {
//m_confirm_login_dlg->on_hide();
wxGetApp().request_login();
return;
});
m_confirm_login_dlg->on_show();
}
}
else if (m_type == 1) {
InputIpAddressDialog dlgo;