ENH:filter characters not supported by windows system
Change-Id: I0dcbf9535df7bdc4b19e095aa0c23223efa5087b
This commit is contained in:
parent
fa49bdebd3
commit
d8349610f7
|
@ -220,8 +220,6 @@ void PrintJob::process()
|
|||
|
||||
params.dev_id = m_dev_id;
|
||||
params.ftp_folder = m_ftp_folder;
|
||||
|
||||
|
||||
params.filename = job_data._3mf_path.string();
|
||||
params.config_filename = job_data._3mf_config_path.string();
|
||||
params.plate_index = curr_plate_idx;
|
||||
|
|
|
@ -3365,6 +3365,19 @@ void SelectMachineDialog::set_flow_calibration_state(bool state)
|
|||
}
|
||||
}
|
||||
|
||||
std::string SelectMachineDialog::filter_characters(const std::string& str, const std::string& filterChars)
|
||||
{
|
||||
std::string filteredStr = str;
|
||||
|
||||
auto removeFunc = [&filterChars](char ch) {
|
||||
return filterChars.find(ch) != std::string::npos;
|
||||
};
|
||||
|
||||
filteredStr.erase(std::remove_if(filteredStr.begin(), filteredStr.end(), removeFunc), filteredStr.end());
|
||||
|
||||
return filteredStr;
|
||||
}
|
||||
|
||||
void SelectMachineDialog::set_default()
|
||||
{
|
||||
if (m_print_type == PrintFromType::FROM_NORMAL) {
|
||||
|
@ -3397,6 +3410,10 @@ void SelectMachineDialog::set_default()
|
|||
|
||||
fs::path filename_path(filename.c_str());
|
||||
m_current_project_name = wxString::FromUTF8(filename_path.filename().string());
|
||||
|
||||
//unsupported character filter
|
||||
m_current_project_name = filter_characters(m_current_project_name.ToStdString(), "<>[]:/\\|?*\"");
|
||||
|
||||
m_rename_text->SetLabelText(m_current_project_name);
|
||||
m_rename_normal_panel->Layout();
|
||||
|
||||
|
@ -4008,7 +4025,7 @@ void EditDevNameDialog::on_edit_name(wxCommandEvent &e)
|
|||
wxString info_line;
|
||||
auto new_dev_name = m_textCtr->GetTextCtrl()->GetValue();
|
||||
|
||||
const char * unusable_symbols = "@~.<>[]:/\\|?*\"";
|
||||
const char * unusable_symbols = "<>[]:/\\|?*\"";
|
||||
const std::string unusable_suffix = PresetCollection::get_suffix_modified();
|
||||
|
||||
for (size_t i = 0; i < std::strlen(unusable_symbols); i++) {
|
||||
|
|
|
@ -455,6 +455,7 @@ public:
|
|||
wxWindow* create_item_checkbox(wxString title, wxWindow* parent, wxString tooltip, std::string param);
|
||||
wxImage * LoadImageFromBlob(const unsigned char *data, int size);
|
||||
PrintDialogStatus get_status() { return m_print_status; }
|
||||
std::string filter_characters(const std::string& str, const std::string& filterChars);
|
||||
std::vector<std::string> sort_string(std::vector<std::string> strArray);
|
||||
};
|
||||
|
||||
|
|
|
@ -1211,6 +1211,19 @@ void SendToPrinterDialog::on_dpi_changed(const wxRect &suggested_rect)
|
|||
Refresh();
|
||||
}
|
||||
|
||||
std::string SendToPrinterDialog::filter_characters(const std::string& str, const std::string& filterChars)
|
||||
{
|
||||
std::string filteredStr = str;
|
||||
|
||||
auto removeFunc = [&filterChars](char ch) {
|
||||
return filterChars.find(ch) != std::string::npos;
|
||||
};
|
||||
|
||||
filteredStr.erase(std::remove_if(filteredStr.begin(), filteredStr.end(), removeFunc), filteredStr.end());
|
||||
|
||||
return filteredStr;
|
||||
}
|
||||
|
||||
void SendToPrinterDialog::set_default()
|
||||
{
|
||||
//project name
|
||||
|
@ -1229,6 +1242,10 @@ void SendToPrinterDialog::set_default()
|
|||
|
||||
fs::path filename_path(filename.c_str());
|
||||
m_current_project_name = wxString::FromUTF8(filename_path.filename().string());
|
||||
|
||||
//unsupported character filter
|
||||
m_current_project_name = filter_characters(m_current_project_name.ToStdString(), "<>[]:/\\|?*\"");
|
||||
|
||||
m_rename_text->SetLabelText(m_current_project_name);
|
||||
m_rename_normal_panel->Layout();
|
||||
|
||||
|
|
|
@ -153,6 +153,7 @@ public:
|
|||
void show_print_failed_info(bool show, int code = 0, wxString description = wxEmptyString, wxString extra = wxEmptyString);
|
||||
void update_print_error_info(int code, std::string msg, std::string extra);
|
||||
wxString format_text(wxString& m_msg);
|
||||
std::string filter_characters(const std::string& str, const std::string& filterChars);
|
||||
std::vector<std::string> sort_string(std::vector<std::string> strArray);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue