mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-24 15:13:58 -06:00
ENH: remove create filament entry to guide
Jira: 4036 Change-Id: I86aa3423761956120e9bf42dcb8eca76dd44202b Signed-off-by: maosheng.wei <maosheng.wei@bambulab.com>
This commit is contained in:
parent
ffcfb4f6bd
commit
735ef3dc8a
24 changed files with 3398 additions and 329 deletions
|
@ -27,6 +27,7 @@
|
|||
#include <slic3r/Utils/Http.hpp>
|
||||
#include <libslic3r/miniz_extension.hpp>
|
||||
#include <libslic3r/Utils.hpp>
|
||||
#include "CreatePresetsDialog.hpp"
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
|
@ -34,6 +35,34 @@ namespace Slic3r { namespace GUI {
|
|||
|
||||
json m_ProfileJson;
|
||||
|
||||
static wxString update_custom_filaments()
|
||||
{
|
||||
json m_Res = json::object();
|
||||
m_Res["command"] = "update_custom_filaments";
|
||||
m_Res["sequence_id"] = "2000";
|
||||
json m_CustomFilaments = json::array();
|
||||
PresetBundle * preset_bundle = wxGetApp().preset_bundle;
|
||||
std::map<std::string, std::vector<Preset const *>> temp_filament_id_to_presets = preset_bundle->filaments.get_filament_presets();
|
||||
json temp_j;
|
||||
for (std::pair<std::string, std::vector<Preset const *>> filament_id_to_presets : temp_filament_id_to_presets) {
|
||||
std::string filament_id = filament_id_to_presets.first;
|
||||
if (filament_id.empty()) continue;
|
||||
for (const Preset *preset : filament_id_to_presets.second) {
|
||||
if (preset->is_system || filament_id.empty() || "null" == filament_id || filament_id.size() != 8 || filament_id[0] != 'P') break;
|
||||
temp_j["id"] = preset->filament_id;
|
||||
std::string preset_name = preset->name;
|
||||
size_t index_at = preset_name.find_last_of('@');
|
||||
if (std::string::npos != index_at) { preset_name = preset_name.substr(0, index_at - 1); }
|
||||
temp_j["name"] = preset_name;
|
||||
m_CustomFilaments.push_back(temp_j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_Res["data"] = m_CustomFilaments;
|
||||
wxString strJS = wxString::Format("HandleStudio(%s)", wxString::FromUTF8(m_Res.dump(-1, ' ', false, json::error_handler_t::ignore)));
|
||||
return strJS;
|
||||
}
|
||||
|
||||
GuideFrame::GuideFrame(GUI_App *pGUI, long style)
|
||||
: DPIDialog((wxWindow *) (pGUI->mainframe), wxID_ANY, "BambuStudio", wxDefaultPosition, wxDefaultSize, style),
|
||||
m_appconfig_new()
|
||||
|
@ -322,6 +351,20 @@ void GuideFrame::OnScriptMessage(wxWebViewEvent &evt)
|
|||
|
||||
wxGetApp().CallAfter([this,strJS] { RunScript(strJS); });
|
||||
}
|
||||
else if (strCmd == "request_custom_filaments") {
|
||||
wxString strJS = update_custom_filaments();
|
||||
wxGetApp().CallAfter([this, strJS] { RunScript(strJS); });
|
||||
}
|
||||
else if (strCmd == "create_custom_filament") {
|
||||
this->EndModal(wxID_OK);
|
||||
wxQueueEvent(wxGetApp().plater(), new SimpleEvent(EVT_CREATE_FILAMENT));
|
||||
} else if (strCmd == "modify_custom_filament") {
|
||||
this->EndModal(wxID_OK);
|
||||
FilamentInfomation *filament_info = new FilamentInfomation();
|
||||
filament_info->filament_id = j["id"];
|
||||
//filament_info->filament_name = j["name"];
|
||||
wxQueueEvent(wxGetApp().plater(), new SimpleEvent(EVT_MODIFY_FILAMENT, filament_info));
|
||||
}
|
||||
else if (strCmd == "save_userguide_models")
|
||||
{
|
||||
json MSelected = j["data"];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue