mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-13 20:46:01 +08:00
Custom set of unused characters in Bulk export.
This commit is contained in:
parent
4bd0c15c1b
commit
1a7cc64b94
@ -94,6 +94,7 @@ constexpr int max_path_length = 255;
|
||||
|
||||
struct PathValidator {
|
||||
std::reference_wrapper<std::vector<std::unique_ptr<BulkExportDialog::Item>>> items;
|
||||
std::string unusable_symbols;
|
||||
using ItemStatus = BulkExportDialog::ItemStatus;
|
||||
|
||||
bool is_duplicate(const fs::path &path) {
|
||||
@ -112,8 +113,7 @@ struct PathValidator {
|
||||
const fs::path &path,
|
||||
const std::string &filename
|
||||
) {
|
||||
const char* unusable_symbols = "<>[]:/\\|?*\"";
|
||||
for (size_t i = 0; i < std::strlen(unusable_symbols); i++) {
|
||||
for (size_t i = 0; i < std::strlen(unusable_symbols.c_str()); i++) {
|
||||
if (filename.find_first_of(unusable_symbols[i]) != std::string::npos) {
|
||||
return {
|
||||
ItemStatus::NoValid,
|
||||
@ -200,7 +200,7 @@ void BulkExportDialog::Item::update_valid_bmp()
|
||||
m_valid_bmp->SetBitmap(*get_bmp_bundle(get_bmp_name(m_status)));
|
||||
}
|
||||
|
||||
BulkExportDialog::BulkExportDialog(const std::vector<std::pair<int, std::optional<fs::path>>> &paths, const wxString& title):
|
||||
BulkExportDialog::BulkExportDialog(const std::vector<std::pair<int, std::optional<fs::path>>> &paths, const wxString& title, const std::string& unusable_symbols):
|
||||
DPIDialog(
|
||||
nullptr,
|
||||
wxID_ANY,
|
||||
@ -210,6 +210,7 @@ BulkExportDialog::BulkExportDialog(const std::vector<std::pair<int, std::optiona
|
||||
wxDEFAULT_DIALOG_STYLE | wxICON_WARNING
|
||||
)
|
||||
, m_title(title)
|
||||
, m_unusable_symbols(unusable_symbols)
|
||||
{
|
||||
this->SetFont(wxGetApp().normal_font());
|
||||
|
||||
@ -247,7 +248,7 @@ BulkExportDialog::BulkExportDialog(const std::vector<std::pair<int, std::optiona
|
||||
|
||||
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, m_unusable_symbols}));
|
||||
}
|
||||
|
||||
void BulkExportDialog::accept()
|
||||
|
@ -80,9 +80,10 @@ private:
|
||||
std::vector<std::unique_ptr<Item>> m_items;
|
||||
wxFlexGridSizer*m_sizer{nullptr};
|
||||
wxString m_title;
|
||||
std::string m_unusable_symbols;
|
||||
public:
|
||||
|
||||
BulkExportDialog(const std::vector<std::pair<int, std::optional<boost::filesystem::path>>> &paths, const wxString& title);
|
||||
BulkExportDialog(const std::vector<std::pair<int, std::optional<boost::filesystem::path>>> &paths, const wxString& title, const std::string& unusable_symbols);
|
||||
std::vector<std::pair<int, std::optional<boost::filesystem::path>>> get_paths() const;
|
||||
bool has_warnings() const;
|
||||
|
||||
|
@ -5954,7 +5954,7 @@ void Plater::export_all_gcodes(bool prefer_removable) {
|
||||
paths.emplace_back(print_index, output_file);
|
||||
}
|
||||
|
||||
BulkExportDialog dialog{paths, _L("Export beds")};
|
||||
BulkExportDialog dialog{paths, _L("Export beds"), "<>[]:/\\|?*\""};
|
||||
if (dialog.ShowModal() != wxID_OK) {
|
||||
return;
|
||||
}
|
||||
@ -6602,7 +6602,7 @@ void Plater::connect_gcode_all() {
|
||||
paths.emplace_back(print_index, filename_fixed);
|
||||
}
|
||||
|
||||
BulkExportDialog dialog{paths, _L("Send all to Connect")};
|
||||
BulkExportDialog dialog{paths, _L("Send all to Connect"), connect.get_unusable_symbols()};
|
||||
if (dialog.ShowModal() != wxID_OK) {
|
||||
return;
|
||||
}
|
||||
|
@ -118,6 +118,7 @@ public:
|
||||
PrintHostPostUploadActions get_post_upload_actions() const override { return PrintHostPostUploadAction::StartPrint | PrintHostPostUploadAction::QueuePrint; }
|
||||
const char* get_name() const override { return "PrusaConnect"; }
|
||||
bool get_storage(wxArrayString& storage_path, wxArrayString& storage_name) const override { return false; }
|
||||
std::string get_unusable_symbols() const override { return "\\/:*?\"%<>¯°#ˇ|[]"; }
|
||||
protected:
|
||||
void set_http_post_header_args(Http& http, PrintHostPostUploadAction post_action) const override;
|
||||
};
|
||||
|
@ -75,6 +75,7 @@ public:
|
||||
// Support for PrusaLink uploading to different storage. Not supported by other print hosts.
|
||||
// Returns false if not supported or fail.
|
||||
virtual bool get_storage(wxArrayString& /*storage_path*/, wxArrayString& /*storage_name*/) const { return false; }
|
||||
virtual std::string get_unusable_symbols() const { return {}; }
|
||||
|
||||
static PrintHost* get_print_host(DynamicPrintConfig *config);
|
||||
|
||||
|
@ -38,6 +38,7 @@ public:
|
||||
bool get_storage(wxArrayString& storage_path, wxArrayString& storage_name) const override;
|
||||
//const std::string& get_apikey() const { return m_apikey; }
|
||||
//const std::string& get_cafile() const { return m_cafile; }
|
||||
std::string get_unusable_symbols() const override { return "\\/:*?\"%<>¯°#ˇ|[]"; }
|
||||
|
||||
private:
|
||||
std::string m_uuid;
|
||||
|
Loading…
x
Reference in New Issue
Block a user