mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-27 02:31:10 -06:00
Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_3dconnexion
This commit is contained in:
commit
7007d81519
16 changed files with 328 additions and 102 deletions
|
|
@ -35,9 +35,14 @@ static wxString generate_html_row(const Config::Snapshot &snapshot, bool row_eve
|
|||
text += snapshot_active ? "#B3FFCB" : (row_even ? "#FFFFFF" : "#D5D5D5");
|
||||
text += "\">";
|
||||
text += "<td>";
|
||||
|
||||
static const constexpr char *LOCALE_TIME_FMT = "%x %X";
|
||||
wxString datetime = wxDateTime(snapshot.time_captured).Format(LOCALE_TIME_FMT);
|
||||
|
||||
// Format the row header.
|
||||
text += wxString("<font size=\"5\"><b>") + (snapshot_active ? _(L("Active")) + ": " : "") +
|
||||
Utils::format_local_date_time(snapshot.time_captured) + ": " + format_reason(snapshot.reason);
|
||||
text += wxString("<font size=\"5\"><b>") + (snapshot_active ? _(L("Active")) + ": " : "") +
|
||||
datetime + ": " + format_reason(snapshot.reason);
|
||||
|
||||
if (! snapshot.comment.empty())
|
||||
text += " (" + wxString::FromUTF8(snapshot.comment.data()) + ")";
|
||||
text += "</b></font><br>";
|
||||
|
|
|
|||
|
|
@ -819,6 +819,21 @@ bool PresetCollection::delete_current_preset()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool PresetCollection::delete_preset(const std::string& name)
|
||||
{
|
||||
auto it = this->find_preset_internal(name);
|
||||
|
||||
const Preset& preset = *it;
|
||||
if (preset.is_default)
|
||||
return false;
|
||||
if (!preset.is_external && !preset.is_system) {
|
||||
// Erase the preset file.
|
||||
boost::nowide::remove(preset.file.c_str());
|
||||
}
|
||||
m_presets.erase(it);
|
||||
return true;
|
||||
}
|
||||
|
||||
void PresetCollection::load_bitmap_default(wxWindow *window, const std::string &file_name)
|
||||
{
|
||||
// XXX: See note in PresetBundle::load_compatible_bitmaps()
|
||||
|
|
|
|||
|
|
@ -276,6 +276,9 @@ public:
|
|||
// Delete the current preset, activate the first visible preset.
|
||||
// returns true if the preset was deleted successfully.
|
||||
bool delete_current_preset();
|
||||
// Delete the current preset, activate the first visible preset.
|
||||
// returns true if the preset was deleted successfully.
|
||||
bool delete_preset(const std::string& name);
|
||||
|
||||
// Load default bitmap to be placed at the wxBitmapComboBox of a MainFrame.
|
||||
void load_bitmap_default(wxWindow *window, const std::string &file_name);
|
||||
|
|
|
|||
|
|
@ -3019,6 +3019,18 @@ void Tab::save_preset(std::string name /*= ""*/)
|
|||
show_error(this, _(L("Cannot overwrite an external profile.")));
|
||||
return;
|
||||
}
|
||||
if (existing && name != preset.name)
|
||||
{
|
||||
wxString msg_text = GUI::from_u8((boost::format(_utf8(L("Preset with name \"%1%\" already exist."))) % name).str());
|
||||
msg_text += "\n" + _(L("Replace?"));
|
||||
wxMessageDialog dialog(nullptr, msg_text, _(L("Warning")), wxICON_WARNING | wxYES | wxNO);
|
||||
|
||||
if (dialog.ShowModal() == wxID_NO)
|
||||
return;
|
||||
|
||||
// Remove the preset from the list.
|
||||
m_presets->delete_preset(name);
|
||||
}
|
||||
}
|
||||
|
||||
// Save the preset into Slic3r::data_dir / presets / section_name / preset_name.ini
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue