fix some bug

This commit is contained in:
QIDI TECH
2025-09-22 15:42:42 +08:00
parent 5cdfef9f9e
commit 56232999f5
15 changed files with 66 additions and 23 deletions

View File

@@ -329,7 +329,7 @@ void AuFile::on_input_enter(wxCommandEvent &evt)
auto m_valid_type = Valid;
wxString info_line;
const char *unusable_symbols = "<>[]:/\\|?*\"";
const char *unusable_symbols = " #;\'<>:/\\|?*\"";
const std::string unusable_suffix = PresetCollection::get_suffix_modified(); //"(modified)";
for (size_t i = 0; i < std::strlen(unusable_symbols); i++) {

View File

@@ -736,9 +736,10 @@ void GCodeViewer::SequentialView::GCodeWindow::render(float top, float bottom, f
}
}
boost::trim(command);
boost::trim(parameters);
boost::trim(comment);
//y71
// boost::trim(command);
// boost::trim(parameters);
// boost::trim(comment);
ret.push_back({ command, parameters, comment });
}
return ret;

View File

@@ -296,7 +296,7 @@ void PrintJob::process()
try {
std::string mall_model_name = model_name->second;
std::replace(mall_model_name.begin(), mall_model_name.end(), ' ', '_');
const char *unusable_symbols = "<>[]:/\\|?*\" ";
const char *unusable_symbols = " #;\'<>:/\\|?*\"";
for (const char *symbol = unusable_symbols; *symbol != '\0'; ++symbol) { std::replace(mall_model_name.begin(), mall_model_name.end(), *symbol, '_'); }
std::regex pattern("_+");

View File

@@ -312,7 +312,7 @@ bool PhysicalPrinterDialog::update_preset_input() {
m_valid_type = Valid;
wxString info_line;
const char *unusable_symbols = "<>[]:/\\|?*\"";
const char *unusable_symbols = "#;\'<>:/\\|?*\"";
const std::string unusable_suffix = PresetCollection::get_suffix_modified(); //"(modified)";
for (size_t i = 0; i < std::strlen(unusable_symbols); i++) {

View File

@@ -341,7 +341,7 @@ void PhysicalPrinterDialog::update_preset_input() {
m_valid_type = Valid;
wxString info_line;
const char *unusable_symbols = "<>[]:/\\|?*\"";
const char *unusable_symbols = " #;\'<>:/\\|?*\"";
const std::string unusable_suffix = PresetCollection::get_suffix_modified(); //"(modified)";
for (size_t i = 0; i < std::strlen(unusable_symbols); i++) {

View File

@@ -233,7 +233,7 @@ bool Plater::has_illegal_filename_characters(const wxString& wxs_name)
bool Plater::has_illegal_filename_characters(const std::string& name)
{
const char* illegal_characters = "<>:/\\|?*\"";
const char* illegal_characters = " #;\'<>:/\\|?*\"";
for (size_t i = 0; i < std::strlen(illegal_characters); i++)
if (name.find_first_of(illegal_characters[i]) != std::string::npos)
return true;
@@ -248,7 +248,7 @@ bool Plater::has_illegal_filename_characters(const std::string& name)
void Plater::show_illegal_characters_warning(wxWindow* parent)
{
show_error(parent, _L("Invalid name, the following characters are not allowed:") + " <>:/\\|?*\"" +_L("(Including its escape characters)"));
show_error(parent, _L("Invalid name, the following characters are not allowed:") + " #;\'<>:/\\|?*\"" +_L("(Including its escape characters)"));
}
void Plater::mark_plate_toolbar_image_dirty()
@@ -5960,6 +5960,9 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
DynamicPrintConfig config;
Semver file_version;
En3mfType en_3mf_file_type = En3mfType::From_QDS;
//y71
std::string old_preset_name = wxGetApp().preset_bundle->printers.get_edited_preset().name;
{
DynamicPrintConfig config_loaded;
@@ -6220,6 +6223,15 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
}
}
//y71
bool has_different_settings_to_system = config.option("different_settings_to_system") ? true : false;
std::string qdt_diff_settings;
std::vector<std::string> qdt_different_keys;
if(has_different_settings_to_system){
std::string qdt_diff_settings = config.option<ConfigOptionStrings>("different_settings_to_system", true)->values[0];
Slic3r::unescape_strings_cstyle(qdt_diff_settings, qdt_different_keys);
}
if (load_config) {
if (!config.empty()) {
Preset::normalize(config);
@@ -6467,6 +6479,30 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
}
if (!silence) wxGetApp().app_config->update_config_dir(path.parent_path().string());
}
//y71
std::vector<std::string> qdt_nozzle_sizes = { "0.2 nozzle", "0.4 nozzle", "0.6 nozzle", "0.8 nozzle" };
std::string current_preset_name = wxGetApp().preset_bundle->printers.get_edited_preset().name;
std::string old_preset_nozzle_size, new_preset_nozzle_size;
for (std::string qdt_nozzle : qdt_nozzle_sizes) {
if (old_preset_name.find(qdt_nozzle) != std::string::npos)
old_preset_nozzle_size = qdt_nozzle;
if (current_preset_name.find(qdt_nozzle) != std::string::npos)
new_preset_nozzle_size = qdt_nozzle;
}
if (old_preset_nozzle_size != new_preset_nozzle_size) {
size_t nozzle_pos = old_preset_name.find(old_preset_nozzle_size);
size_t nozzle_len = old_preset_nozzle_size.size();
old_preset_name.replace(nozzle_pos, nozzle_len, new_preset_nozzle_size);
}
if (en_3mf_file_type != En3mfType::From_QDS) {
if(has_different_settings_to_system)
wxGetApp().get_tab(Preset::TYPE_PRINT)->cache_config_diff(qdt_different_keys);
wxGetApp().get_tab(Preset::TYPE_PRINTER)->select_preset(old_preset_name);
q->on_config_change(wxGetApp().preset_bundle->full_config());
}
} else {
// QDS: add plate data related logic
PlateDataPtrs plate_data;
@@ -10619,8 +10655,8 @@ wxString Plater::priv::get_export_gcode_filename(const wxString& extension, bool
std::string plate_name = partplate_list.get_curr_plate()->get_plate_name();
// remove unsupported characters in filename
curr_project_name = from_u8(filter_characters(curr_project_name.ToUTF8().data(), "<>[]:/\\|?*\""));
plate_name = filter_characters(plate_name, "<>[]:/\\|?*\"");
curr_project_name = from_u8(filter_characters(curr_project_name.ToUTF8().data(), " #;\'<>:/\\|?*\""));
plate_name = filter_characters(plate_name, " #;\'<>:/\\|?*\"");
if (!plate_name.empty())
plate_index_str = (boost::format("_%1%") % plate_name).str();
@@ -15427,7 +15463,7 @@ void Plater::export_gcode(bool prefer_removable)
output_path = into_path(dlg.GetPath());
while (has_illegal_filename_characters(output_path.filename().string())) {
show_error(this, _L("The provided file name is not valid.") + "\n" +
_L("The following characters are not allowed by a FAT file system:") + " <>:/\\|?*\"");
_L("The following characters are not allowed by a FAT file system:") + " #;\'<>:/\\|?*\"");
dlg.SetFilename(from_path(output_path.filename()));
if (dlg.ShowModal() == wxID_OK)
output_path = into_path(dlg.GetPath());

View File

@@ -185,7 +185,7 @@ void SavePresetDialog::Item::update()
m_valid_type = Valid;
wxString info_line;
const char *unusable_symbols = "<>[]:/\\|?*\"";
const char *unusable_symbols = " #;\'<>:/\\|?*\"";
const std::string unusable_suffix = PresetCollection::get_suffix_modified(); //"(modified)";
for (size_t i = 0; i < std::strlen(unusable_symbols); i++) {

View File

@@ -3437,7 +3437,7 @@ void SelectMachineDialog::on_rename_enter()
auto m_valid_type = Valid;
wxString info_line;
const char* unusable_symbols = "<>[]:/\\|?*\"";
const char* unusable_symbols = " #;\'<>:\\|?*\"";
const std::string unusable_suffix = PresetCollection::get_suffix_modified(); //"(modified)";
for (size_t i = 0; i < std::strlen(unusable_symbols); i++) {
@@ -4508,7 +4508,7 @@ void SelectMachineDialog::set_default()
m_current_project_name = m_current_project_name.substr(0, m_current_project_name.size() - 6);
//unsupported character filter
m_current_project_name = from_u8(filter_characters(m_current_project_name.ToUTF8().data(), "<>[]:/\\|?*\""));
m_current_project_name = from_u8(filter_characters(m_current_project_name.ToUTF8().data(), " #;\'<>:\\|?*\""));
m_rename_text->SetLabelText(m_current_project_name);
m_rename_normal_panel->Layout();

View File

@@ -930,7 +930,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++) {

View File

@@ -1710,7 +1710,7 @@ void SendMultiMachinePage::set_default()
//unsupported character filter
//y51
m_current_project_name = from_u8(filter_characters(m_current_project_name.ToUTF8().data(), "<>[]:\\|?*\""));
m_current_project_name = from_u8(filter_characters(m_current_project_name.ToUTF8().data(), " #;\'<>:\\|?*\""));
m_task_name->SetLabel(m_current_project_name);
@@ -1747,7 +1747,7 @@ void SendMultiMachinePage::on_rename_enter()
wxString info_line;
//y51
const char* unusable_symbols = "<>[]:\\|?*\"";
const char* unusable_symbols = " #;\'<>:\\|?*\"";
const std::string unusable_suffix = PresetCollection::get_suffix_modified(); //"(modified)";
for (size_t i = 0; i < std::strlen(unusable_symbols); i++) {

View File

@@ -132,7 +132,7 @@ void SendToPrinterDialog::on_rename_enter()
wxString info_line;
//y51
const char* unusable_symbols = "<>[]:\\|?*\"";
const char* unusable_symbols = " #;\'<>:\\|?*\"";
const std::string unusable_suffix = PresetCollection::get_suffix_modified(); //"(modified)";
for (size_t i = 0; i < std::strlen(unusable_symbols); i++) {
@@ -2151,7 +2151,7 @@ void SendToPrinterDialog::set_default()
//unsupported character filter
//y51
m_current_project_name = from_u8(filter_characters(m_current_project_name.ToUTF8().data(), "<>[]:\\|?*\""));
m_current_project_name = from_u8(filter_characters(m_current_project_name.ToUTF8().data(), " #;\'<>:\\|?*\""));
m_rename_text->SetLabelText(m_current_project_name);
m_rename_normal_panel->Layout();

View File

@@ -2562,7 +2562,7 @@ void SyncAmsInfoDialog::set_default(bool hide_some)
m_current_project_name = wxString::FromUTF8(file_name);
// unsupported character filter
m_current_project_name = from_u8(filter_characters(m_current_project_name.ToUTF8().data(), "<>[]:/\\|?*\""));
m_current_project_name = from_u8(filter_characters(m_current_project_name.ToUTF8().data(), " #;\'<>:/\\|?*\""));
// clear combobox
m_list.clear();

View File

@@ -2523,7 +2523,7 @@ void SyncBoxInfoDialog::set_default(bool hide_some)
m_current_project_name = wxString::FromUTF8(file_name);
// unsupported character filter
m_current_project_name = from_u8(filter_characters(m_current_project_name.ToUTF8().data(), "<>[]:/\\|?*\""));
m_current_project_name = from_u8(filter_characters(m_current_project_name.ToUTF8().data(), " #;\'<>:/\\|?*\""));
// clear combobox
m_list.clear();