FIX:disable the send button if not on same LAN

Change-Id: I730fc3b14ab048b4336c0164f775f870a9b171b8
This commit is contained in:
tao wang 2022-10-17 16:31:58 +08:00 committed by Lane.Wei
parent 4928ef31b8
commit 3992e25c93
2 changed files with 15 additions and 2 deletions

View file

@ -253,7 +253,8 @@ enum PrintDialogStatus {
PrintStatusSendingCanceled, PrintStatusSendingCanceled,
PrintStatusLanModeNoSdcard, PrintStatusLanModeNoSdcard,
PrintStatusNoSdcard, PrintStatusNoSdcard,
PrintStatusTimelapseNoSdcard PrintStatusTimelapseNoSdcard,
PrintStatusNotOnTheSameLAN
}; };
std::string get_print_status_info(PrintDialogStatus status); std::string get_print_status_info(PrintDialogStatus status);

View file

@ -655,7 +655,7 @@ void SendToPrinterDialog::on_timer(wxTimerEvent &event)
void SendToPrinterDialog::on_selection_changed(wxCommandEvent &event) void SendToPrinterDialog::on_selection_changed(wxCommandEvent &event)
{ {
/* reset timeout and reading printer info */ /* reset timeout and reading printer info */
m_status_bar->reset(); //m_status_bar->reset();
timeout_count = 0; timeout_count = 0;
auto selection = m_comboBox_printer->GetSelection(); auto selection = m_comboBox_printer->GetSelection();
@ -745,6 +745,12 @@ void SendToPrinterDialog::update_show_status()
return; return;
} }
if (obj_->dev_ip.empty()) {
show_status(PrintDialogStatus::PrintStatusNotOnTheSameLAN);
return;
}
show_status(PrintDialogStatus::PrintStatusReadingFinished); show_status(PrintDialogStatus::PrintStatusReadingFinished);
} }
@ -847,6 +853,12 @@ void SendToPrinterDialog::show_status(PrintDialogStatus status, std::vector<wxSt
Enable_Send_Button(false); Enable_Send_Button(false);
Enable_Refresh_Button(true); Enable_Refresh_Button(true);
} }
else if (status == PrintDialogStatus::PrintStatusNotOnTheSameLAN) {
wxString msg_text = _L("The printer is required to be in the same LAN as Bambu Studio.");
update_print_status_msg(msg_text, true, true);
Enable_Send_Button(false);
Enable_Refresh_Button(true);
}
else { else {
Enable_Send_Button(true); Enable_Send_Button(true);
Enable_Refresh_Button(true); Enable_Refresh_Button(true);