FIX: MediaPlayCtrl auto stop when not printing

Change-Id: I657c5fe85e9192d76cf846ae8243e36a6463623a
Jira: STUDIO-10337
This commit is contained in:
chunmao.guo 2025-02-13 15:22:35 +08:00 committed by lane.wei
parent b50bde834d
commit 5ad7576ce7
2 changed files with 6 additions and 4 deletions

View File

@ -311,8 +311,10 @@ void MediaFilePanel::SetMachineObject(MachineObject* obj)
int err = fs->GetLastError(); int err = fs->GetLastError();
if (!e.GetString().IsEmpty()) if (!e.GetString().IsEmpty())
msg = e.GetString(); msg = e.GetString();
if (err != 0) if (err != 0) {
msg += " [%d]"; msg += " [%d]";
msg += wxDateTime::Now().Format(_T(" <%m-%d %H:%M>"));
}
if (fs->GetCount() == 0 && !msg.empty()) if (fs->GetCount() == 0 && !msg.empty())
m_image_grid->SetStatus(icon, msg); m_image_grid->SetStatus(icon, msg);
if (e.GetInt() == PrinterFileSystem::Initializing) if (e.GetInt() == PrinterFileSystem::Initializing)

View File

@ -93,7 +93,7 @@ MediaPlayCtrl::MediaPlayCtrl(wxWindow *parent, wxMediaCtrl3 *media_ctrl, const w
m_button_play->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this](auto &e) { TogglePlay(); }); m_button_play->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this](auto &e) { TogglePlay(); });
m_button_play->Bind(wxEVT_RIGHT_UP, [this](auto & e) { m_media_ctrl->Play(); }); m_button_play->Bind(wxEVT_RIGHT_UP, [this](auto & e) { m_media_ctrl->Play(); });
m_label_status->Bind(wxEVT_LEFT_UP, [this](auto &e) { m_label_status->Bind(wxEVT_LEFT_UP, [this](auto &e) {
auto url = wxString::Format(L"https://wiki.bambulab.com/%s/software/bambu-studio/faq/live-view", L"en"); auto url = wxString::Format(L"https://wiki.bambulab.com/%s/software/bambu-studio/faq/live-view", wxGetApp().current_language_code_safe() == "zh_CN" ? "zh" : "en");
wxLaunchDefaultBrowser(url); wxLaunchDefaultBrowser(url);
}); });
@ -182,15 +182,15 @@ void MediaPlayCtrl::SetMachineObject(MachineObject* obj)
if (m_play_timer <= now) { if (m_play_timer <= now) {
m_play_timer = now + 1min; m_play_timer = now + 1min;
#if BBL_RELEASE_TO_PUBLIC #if BBL_RELEASE_TO_PUBLIC
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl playing..., idle: " << SecondsSinceLastInput() << "printIdle: " << m_print_idle;
if (SecondsSinceLastInput() >= 900) { // 15 min if (SecondsSinceLastInput() >= 900) { // 15 min
auto close = wxGetApp().app_config->get("liveview", "auto_stop_liveview") == "true"; auto close = wxGetApp().app_config->get("liveview", "auto_stop_liveview") == "true";
if (close) { if (close || obj == nullptr || !obj->is_in_printing()) {
m_next_retry = wxDateTime(); m_next_retry = wxDateTime();
Stop(_L("Temporarily closed because there is no operating for a long time.")); Stop(_L("Temporarily closed because there is no operating for a long time."));
return; return;
} }
} }
auto obj = wxGetApp().getDeviceManager()->get_selected_machine();
if (obj && obj->is_in_printing()) { if (obj && obj->is_in_printing()) {
m_print_idle = 0; m_print_idle = 0;
} else if (++m_print_idle >= 5) { } else if (++m_print_idle >= 5) {