ENH: Add a Select All button to the timelapse and model file lists of the printer storage (#16716)

* Add a Select All button to the printer's timelapse and model file lists

While files are being selected for batch download or deletion, one click now
selects every file of the list that is shown.

Ported from BambuStudio 2.5.0.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GYra1zfuVBUu8unsTTXHVN

* Keep Select All visible and let it start the selection like BambuStudio

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GYra1zfuVBUu8unsTTXHVN

* Let the Select All button clear the selection once every file is selected

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GYra1zfuVBUu8unsTTXHVN

* Revert the Select All toggle: Cancel already clears the selection

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GYra1zfuVBUu8unsTTXHVN

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
EldenrootandClaude Sonnet 5.5 authored and GitHub committed 2026-10-26 23:34:37 +03:00
1 parent e52c735d1a
commit 63048e3858
2 files changed
+22 -1

No files matched your search

+21 -1
View File
@@ -132,11 +132,13 @@ MediaFilePanel::MediaFilePanel(wxWindow * parent)
m_button_delete->SetToolTip(_L("Delete selected files from printer."));
m_button_download = new ::Button(m_manage_panel, _L("Download"));
m_button_download->SetToolTip(_L("Download selected files from printer."));
m_button_select_all = new ::Button(m_manage_panel, _L("Select All"));
m_button_select_all->SetToolTip(_L("Select all files in the list for batch management."));
m_button_management = new ::Button(m_manage_panel, _L("Select"));
m_button_management->SetToolTip(_L("Batch manage files."));
m_button_refresh = new ::Button(m_manage_panel, _L("Refresh"));
m_button_refresh->SetToolTip(_L("Reload file list from printer."));
for (auto b : {m_button_delete, m_button_download, m_button_refresh, m_button_management}) {
for (auto b : {m_button_delete, m_button_download, m_button_refresh, m_button_management, m_button_select_all}) {
b->SetFont(Label::Body_12);
b->SetCornerRadius(12);
b->SetPaddingSize({10, 6});
@@ -144,6 +146,10 @@ MediaFilePanel::MediaFilePanel(wxWindow * parent)
}
m_button_delete->SetBorderColorNormal(wxColor("#FF6F00"));
m_button_delete->SetTextColorNormal(wxColor("#FF6F00"));
m_button_select_all->SetBorderWidth(0);
m_button_select_all->SetBackgroundColorNormal(wxColor("#009688"));
m_button_select_all->SetTextColorNormal(*wxWHITE);
m_button_select_all->Enable(false);
m_button_management->SetBorderWidth(0);
m_button_management->SetBackgroundColorNormal(wxColor("#009688"));
m_button_management->SetTextColorNormal(*wxWHITE);
@@ -155,6 +161,7 @@ MediaFilePanel::MediaFilePanel(wxWindow * parent)
wxBoxSizer *manage_sizer = new wxBoxSizer(wxHORIZONTAL);
manage_sizer->AddStretchSpacer(1);
manage_sizer->Add(m_button_select_all, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 24);
manage_sizer->Add(m_button_download, 0, wxALIGN_CENTER_VERTICAL)->Show(false);
manage_sizer->Add(m_button_delete, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 24)->Show(false);
manage_sizer->Add(m_button_refresh, 0, wxALIGN_CENTER_VERTICAL);
@@ -208,6 +215,16 @@ MediaFilePanel::MediaFilePanel(wxWindow * parent)
e.Skip();
SetSelecting(!m_image_grid->IsSelecting());
});
m_button_select_all->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this](auto &e) {
e.Skip();
if (auto fs = m_image_grid->GetFileSystem()) {
// Entering the selecting mode clears the selection, so do it first
if (!m_image_grid->IsSelecting())
SetSelecting(true);
fs->SelectAll(true);
m_image_grid->Refresh();
}
});
m_button_refresh->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this](auto &e) {
e.Skip();
if (auto fs = m_image_grid->GetFileSystem())
@@ -294,6 +311,7 @@ void MediaFilePanel::UpdateByObj(MachineObject* obj)
}
m_button_refresh->Enable(false);
m_button_management->Enable(false);
m_button_select_all->Enable(false);
SetSelecting(false);
if (m_machine.empty()) {
m_image_grid->SetStatus(m_bmp_failed, _L("Please confirm if the printer is connected."));
@@ -311,6 +329,7 @@ void MediaFilePanel::UpdateByObj(MachineObject* obj)
//m_manage_panel->Show(fs->GetFileType() < PrinterFileSystem::F_MODEL);
m_button_refresh->Enable(fs->GetStatus() == PrinterFileSystem::ListReady);
m_button_management->Enable(fs->GetCount() > 0);
m_button_select_all->Enable(fs->GetCount() > 0);
bool download_support = fs->GetFileType() < PrinterFileSystem::F_MODEL || m_model_download_support;
m_image_grid->ShowDownload(download_support);
if (fs->GetCount() == 0)
@@ -432,6 +451,7 @@ void MediaFilePanel::Rescale()
m_button_delete->Rescale();
m_button_refresh->Rescale();
m_button_management->Rescale();
m_button_select_all->Rescale();
m_image_grid->Rescale();
}