fixed an bug that CN plate name was not working properly

This commit is contained in:
SoftFever 2023-08-04 20:36:32 +08:00
parent 580424701b
commit 14f248f8fa
4 changed files with 11 additions and 9 deletions

View file

@ -3654,7 +3654,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
}
else if(key == PLATER_NAME_ATTR)
{
m_curr_plater->plate_name = value;
m_curr_plater->plate_name = value.c_str();
}
else if (key == LOCK_ATTR)
{

View file

@ -36,6 +36,7 @@
#include "GUI_ObjectList.hpp"
#include "Tab.hpp"
#include "format.hpp"
#include "slic3r/GUI/GUI.hpp"
#include <imgui/imgui_internal.h>
using boost::optional;
@ -1571,7 +1572,7 @@ void PartPlate::generate_plate_name_texture()
{
// generate m_name_texture texture from m_name with generate_from_text_string
m_name_texture.reset();
auto text = m_name.empty()? _L("Untitled") : m_name;
auto text = m_name.empty()? _L("Untitled") : from_u8(m_name);
wxCoord w, h;
auto* font = &Label::Head_32;

View file

@ -27,6 +27,7 @@
#include <wx/filedlg.h>
#include <wx/dnd.h>
#include <wx/progdlg.h>
#include <wx/string.h>
#include <wx/wupdlock.h>
#include <wx/numdlg.h>
#include <wx/debug.h>
@ -6630,24 +6631,24 @@ wxString Plater::priv::get_export_gcode_filename(const wxString& extension, bool
auto full_filename = m_project_folder / std::string((m_project_name + extension).mb_str(wxConvUTF8));
return from_path(full_filename);
} else {
auto full_filename = m_project_folder / std::string((m_project_name + plate_index_str + extension).mb_str(wxConvUTF8));
auto full_filename = m_project_folder / std::string((m_project_name + from_u8(plate_index_str) + extension).mb_str(wxConvUTF8));
return from_path(full_filename);
}
} else {
if (export_all)
return m_project_name + wxString(plate_index_str) + extension;
return m_project_name + from_u8(plate_index_str) + extension;
else
return m_project_name + extension;
}
} else {
if (only_filename) {
if(m_project_name == _L("Untitled"))
return fs::path(model.objects.front()->name).replace_extension().c_str() + wxString(plate_index_str) + extension;
return wxString(fs::path(model.objects.front()->name).replace_extension().c_str()) + from_u8(plate_index_str) + extension;
if (export_all)
return m_project_name + extension;
else
return m_project_name + wxString(plate_index_str) + extension;
return m_project_name + from_u8(plate_index_str) + extension;
}
else
return "";
@ -11799,7 +11800,7 @@ int Plater::select_plate_by_hover_id(int hover_id, bool right_click)
else
dlg.sync_print_seq(0);
dlg.set_plate_name(curr_plate->get_plate_name());
dlg.set_plate_name(from_u8(curr_plate->get_plate_name()));
dlg.Bind(EVT_SET_BED_TYPE_CONFIRM, [this, plate_index, &dlg](wxCommandEvent& e) {
PartPlate *curr_plate = p->partplate_list.get_curr_plate();
@ -11825,7 +11826,7 @@ int Plater::select_plate_by_hover_id(int hover_id, bool right_click)
update();
});
dlg.ShowModal();
curr_plate->set_plate_name(dlg.get_plate_name().ToStdString());
curr_plate->set_plate_name(dlg.get_plate_name().ToUTF8().data());
this->schedule_background_process();
}

View file

@ -3069,7 +3069,7 @@ void SelectMachineDialog::set_default()
filename = m_plater->get_export_gcode_filename("", true);
}
fs::path filename_path(filename.ToStdWstring());
fs::path filename_path(filename.c_str());
m_current_project_name = wxString::FromUTF8(filename_path.filename().string());
m_rename_text->SetLabelText(m_current_project_name);
m_rename_normal_panel->Layout();