BulkExportDialog: Show not valid beds too

This commit is contained in:
YuSanka 2024-12-13 10:44:39 +01:00 committed by Lukas Matena
parent 0de63d0db8
commit 7cd7af5730
3 changed files with 24 additions and 13 deletions

View File

@ -58,21 +58,30 @@ void BulkExportDialog::Item::init_selection_ctrl(wxFlexGridSizer* row_sizer, int
BulkExportDialog::Item::Item( BulkExportDialog::Item::Item(
wxWindow *parent, wxWindow *parent,
wxFlexGridSizer*sizer, wxFlexGridSizer*sizer,
const fs::path &path, const std::optional<const boost::filesystem::path>& path_opt,
const int bed_index, const int bed_index,
Validator validator Validator validator
): ):
path(path),
bed_index(bed_index), bed_index(bed_index),
m_parent(parent), m_parent(parent),
m_valid_bmp(new wxStaticBitmap(m_parent, wxID_ANY, *get_bmp_bundle("tick_mark"))), m_valid_bmp(new wxStaticBitmap(m_parent, wxID_ANY, *get_bmp_bundle("tick_mark"))),
m_validator(std::move(validator)), m_validator(std::move(validator))
m_directory(path.parent_path())
{ {
if (path_opt) {
path = *path_opt;
m_directory = path.parent_path();
}
init_selection_ctrl(sizer, bed_index); init_selection_ctrl(sizer, bed_index);
init_input_name_ctrl(sizer, path.filename().string()); init_input_name_ctrl(sizer, path.filename().string());
sizer->Add(m_valid_bmp, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, BORDER_W); sizer->Add(m_valid_bmp, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, BORDER_W);
if (!path_opt) {
m_checkbox->Enable(false);
m_checkbox->SetValue(false);
selected = false;
}
m_valid_bmp->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& event) { event.Show(selected); }); m_valid_bmp->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& event) { event.Show(selected); });
update(); update();
} }
@ -191,7 +200,7 @@ void BulkExportDialog::Item::update_valid_bmp()
m_valid_bmp->SetBitmap(*get_bmp_bundle(get_bmp_name(m_status))); m_valid_bmp->SetBitmap(*get_bmp_bundle(get_bmp_name(m_status)));
} }
BulkExportDialog::BulkExportDialog(const std::vector<std::pair<int, fs::path>> &paths): BulkExportDialog::BulkExportDialog(const std::vector<std::pair<int, std::optional<fs::path>>> &paths):
DPIDialog( DPIDialog(
nullptr, nullptr,
wxID_ANY, wxID_ANY,
@ -235,7 +244,7 @@ BulkExportDialog::BulkExportDialog(const std::vector<std::pair<int, fs::path>> &
#endif #endif
} }
void BulkExportDialog::AddItem(const fs::path& path, int bed_index) void BulkExportDialog::AddItem(const std::optional<const boost::filesystem::path>& path, int bed_index)
{ {
m_items.push_back(std::make_unique<Item>(this, m_sizer, path, bed_index, PathValidator{m_items})); m_items.push_back(std::make_unique<Item>(this, m_sizer, path, bed_index, PathValidator{m_items}));
} }

View File

@ -41,7 +41,7 @@ public:
Item( Item(
wxWindow *parent, wxWindow *parent,
wxFlexGridSizer *sizer, wxFlexGridSizer *sizer,
const boost::filesystem::path &path, const std::optional<const boost::filesystem::path>& path,
const int bed_index, const int bed_index,
Validator validator Validator validator
); );
@ -82,7 +82,7 @@ private:
public: public:
BulkExportDialog(const std::vector<std::pair<int, boost::filesystem::path>> &paths); BulkExportDialog(const std::vector<std::pair<int, std::optional<boost::filesystem::path>>> &paths);
std::vector<std::pair<int, std::optional<boost::filesystem::path>>> get_paths() const; std::vector<std::pair<int, std::optional<boost::filesystem::path>>> get_paths() const;
bool has_warnings() const; bool has_warnings() const;
@ -91,7 +91,7 @@ protected:
void on_sys_color_changed() override {} void on_sys_color_changed() override {}
private: private:
void AddItem(const boost::filesystem::path &path, int bed_index); void AddItem(const std::optional<const boost::filesystem::path>& path, int bed_index);
void accept(); void accept();
bool enable_ok_btn() const; bool enable_ok_btn() const;
}; };

View File

@ -6060,11 +6060,12 @@ void Plater::export_all_gcodes(bool prefer_removable) {
std::map<int, PrintToExport> prints_to_export; std::map<int, PrintToExport> prints_to_export;
std::vector<std::pair<int, fs::path>> paths; std::vector<std::pair< int, std::optional<fs::path> >> paths;
for (int print_index{0}; print_index < this->get_fff_prints().size(); ++print_index) { for (int print_index{0}; print_index < s_multiple_beds.get_number_of_beds(); ++print_index) {
const std::unique_ptr<Print> &print{this->get_fff_prints()[print_index]}; const std::unique_ptr<Print> &print{this->get_fff_prints()[print_index]};
if (!print || !is_sliceable(s_print_statuses[print_index])) { if (!print || !is_sliceable(s_print_statuses[print_index])) {
paths.emplace_back(print_index, std::nullopt);
continue; continue;
} }
@ -6707,11 +6708,12 @@ void Plater::connect_gcode_all() {
} }
const PrusaConnectNew connect{*print_host_ptr}; const PrusaConnectNew connect{*print_host_ptr};
std::vector<std::pair<int, fs::path>> paths; std::vector<std::pair< int, std::optional<fs::path> >> paths;
for (std::size_t print_index{0}; print_index < this->get_fff_prints().size(); ++print_index) { for (std::size_t print_index{0}; print_index < s_multiple_beds.get_number_of_beds(); ++print_index) {
const std::unique_ptr<Print> &print{this->get_fff_prints()[print_index]}; const std::unique_ptr<Print> &print{this->get_fff_prints()[print_index]};
if (!print || !is_sliceable(s_print_statuses[print_index])) { if (!print || !is_sliceable(s_print_statuses[print_index])) {
paths.emplace_back(print_index, std::nullopt);
continue; continue;
} }