FIX:fixed the invisibility of the cancel button when sending fails

Change-Id: I32e9cf0c5846565a3bc9155c57289be9df148bde
This commit is contained in:
tao wang 2023-04-12 17:37:21 +08:00 committed by Lane.Wei
parent 40068156fe
commit d57931eacd
12 changed files with 46 additions and 22 deletions

View file

@ -35,9 +35,9 @@ void GUI::Job::update_percent_finish()
m_progress->clear_percent();
}
void GUI::Job::show_networking_test()
void GUI::Job::show_networking_test(wxString msg)
{
m_progress->show_networking_test();
m_progress->show_networking_test(msg);
}
GUI::Job::Job(std::shared_ptr<ProgressIndicator> pri)

View file

@ -47,7 +47,7 @@ protected:
void update_percent_finish();
void show_networking_test();
void show_networking_test(wxString msg);
bool was_canceled() const { return m_canceled.load(); }

View file

@ -10,7 +10,7 @@ void NotificationProgressIndicator::clear_percent()
}
void NotificationProgressIndicator::show_networking_test()
void NotificationProgressIndicator::show_networking_test(wxString msg)
{
}

View file

@ -15,7 +15,7 @@ public:
explicit NotificationProgressIndicator(NotificationManager *nm);
void clear_percent() override;
void show_networking_test() override;
void show_networking_test(wxString msg) override;
void set_range(int range) override;
void set_cancel_callback(CancelFn = CancelFn()) override;
void set_progress(int pr) override;

View file

@ -401,7 +401,6 @@ void PrintJob::process()
msg_text = timeout_to_upload_str;
} else if (result == BAMBU_NETWORK_ERR_INVALID_RESULT) {
msg_text = _L("Failed to send the print job. Please try again.");
this->show_networking_test();
} else if (result == BAMBU_NETWORK_ERR_FTP_UPLOAD_FAILED) {
msg_text = _L("Failed to send the print job. Please try again.");
} else {
@ -411,7 +410,15 @@ void PrintJob::process()
curr_percent = 0;
msg_text += wxString::Format("[%d][%s]", result, error_text);
}
update_status(curr_percent, msg_text);
if (result == BAMBU_NETWORK_ERR_INVALID_RESULT) {
this->show_networking_test(msg_text);
}
else {
update_status(curr_percent, msg_text);
}
BOOST_LOG_TRIVIAL(error) << "print_job: failed, result = " << result;
} else {
BOOST_LOG_TRIVIAL(error) << "print_job: send ok.";

View file

@ -18,7 +18,7 @@ public:
virtual ~ProgressIndicator() = default;
virtual void clear_percent() = 0;
virtual void show_networking_test() = 0;
virtual void show_networking_test(wxString msg) = 0;
virtual void set_range(int range) = 0;
virtual void set_cancel_callback(CancelFn = CancelFn()) = 0;
virtual void set_progress(int pr) = 0;