Merge BS 1.7.7.89

# Conflicts:
#	bbl/i18n/ko/BambuStudio_ko.po
#	localization/i18n/OrcaSlicer.pot
#	localization/i18n/de/OrcaSlicer_de.po
#	localization/i18n/en/OrcaSlicer_en.po
#	localization/i18n/es/OrcaSlicer_es.po
#	localization/i18n/fr/OrcaSlicer_fr.po
#	localization/i18n/hu/OrcaSlicer_hu.po
#	localization/i18n/it/OrcaSlicer_it.po
#	localization/i18n/ja/OrcaSlicer_ja.po
#	localization/i18n/nl/OrcaSlicer_nl.po
#	localization/i18n/sv/OrcaSlicer_sv.po
#	localization/i18n/zh_cn/OrcaSlicer_zh_CN.po
#	resources/i18n/de/BambuStudio.mo
#	resources/i18n/en/BambuStudio.mo
#	resources/i18n/es/BambuStudio.mo
#	resources/i18n/fr/BambuStudio.mo
#	resources/i18n/hu/BambuStudio.mo
#	resources/i18n/it/BambuStudio.mo
#	resources/i18n/ja/BambuStudio.mo
#	resources/i18n/ko/BambuStudio.mo
#	resources/i18n/nl/BambuStudio.mo
#	resources/i18n/sv/BambuStudio.mo
#	resources/i18n/zh_cn/BambuStudio.mo
#	resources/profiles/Anycubic/machine/Anycubic Kobra Max 0.4 nozzle.json
#	src/OrcaSlicer.cpp
#	src/libnest2d/include/libnest2d/selections/firstfit.hpp
#	src/libslic3r/GCode/GCodeProcessor.cpp
#	src/libslic3r/Print.cpp
#	src/libslic3r/Print.hpp
#	src/libslic3r/PrintConfig.cpp
#	src/slic3r/GUI/CalibrationWizardPresetPage.cpp
#	src/slic3r/GUI/GLCanvas3D.cpp
#	src/slic3r/GUI/PartPlate.cpp
#	src/slic3r/GUI/PartPlate.hpp
#	src/slic3r/GUI/ReleaseNote.cpp
#	src/slic3r/GUI/Tab.cpp
#	version.inc
This commit is contained in:
SoftFever 2023-10-21 19:41:49 +08:00
commit a7729ca83f
213 changed files with 2090 additions and 649 deletions

View file

@ -34,11 +34,13 @@ void Bed_2D::repaint(const std::vector<Vec2d>& shape)
// On MacOS the background is erased, on Windows the background is not erased
// and on Linux / GTK the background is erased to gray color.
// Fill DC with the background on Windows & Linux / GTK.
#ifdef _WIN32
auto color = wxGetApp().get_highlight_default_clr();
#else
auto color = wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT); //GetSystemColour
#endif
wxColour color;
if (wxGetApp().dark_mode()) {// SetBackgroundColour
color = wxColour(45, 45, 49);
}
else {
color = *wxWHITE;
}
dc.SetPen(*new wxPen(color, 1, wxPENSTYLE_SOLID));
dc.SetBrush(*new wxBrush(color, wxBRUSHSTYLE_SOLID));
auto rect = GetUpdateRegion().GetBox();

View file

@ -1163,6 +1163,7 @@ void MappingContainer::doRender(wxDC& dc)
AmsReplaceMaterialDialog::AmsReplaceMaterialDialog(wxWindow* parent)
: DPIDialog(parent, wxID_ANY, _L("Auto Refill"), wxDefaultPosition, wxDefaultSize, wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX)
{
#ifdef __WINDOWS__
SetDoubleBuffered(true);
#endif //__WINDOWS__
@ -1331,8 +1332,19 @@ void AmsReplaceMaterialDialog::update_machine_obj(MachineObject* obj)
m_scrollview_groups->SetMinSize(wxSize(FromDIP(400), height));
m_scrollview_groups->SetMaxSize(wxSize(FromDIP(400), height));
} else {
if (label_txt)
label_txt->SetLabelText(_L("There are currently no identical spare consumables available, and automatic replenishment is currently not possible. \n(Currently supporting automatic supply of consumables with the same brand, material type, and color)"));
if (!obj->is_function_supported(PrinterFunction::FUNC_FILAMENT_BACKUP)) {
label_txt->SetLabel(_L("The printer does not currently support auto refill."));
}
else if (!obj->ams_auto_switch_filament_flag) {
label_txt->SetLabelText(_L("AMS filament backup is not enabled, please enable it in the AMS settings."));
}
else {
label_txt->SetLabelText(_L("If there are two identical filaments in AMS, AMS filament backup will be enabled. \n(Currently supporting automatic supply of consumables with the same brand, material type, and color)"));
}
label_txt->SetMinSize(wxSize(FromDIP(380), -1));
label_txt->SetMaxSize(wxSize(FromDIP(380), -1));
label_txt->Wrap(FromDIP(380));
}
m_scrollview_groups->Layout();

View file

@ -132,6 +132,7 @@ void BedShapeDialog::build_dialog(const ConfigOptionPoints& default_pt, const Co
{
SetFont(wxGetApp().normal_font());
SetBackgroundColour(*wxWHITE);
m_panel = new BedShapePanel(this);
m_panel->build_panel(default_pt, custom_texture, custom_model);
@ -246,6 +247,7 @@ void BedShapePanel::build_panel(const ConfigOptionPoints& default_pt, const std:
ConfigOptionsGroupShp BedShapePanel::init_shape_options_page(const wxString& title)
{
wxPanel* panel = new wxPanel(m_shape_options_book);
panel->SetBackgroundColour(*wxWHITE);
ConfigOptionsGroupShp optgroup = std::make_shared<ConfigOptionsGroup>(panel, _L("Settings"));
optgroup->label_width = 10;
@ -343,6 +345,8 @@ wxPanel* BedShapePanel::init_texture_panel()
remove_btn->Bind(wxEVT_UPDATE_UI, ([this](wxUpdateUIEvent& e) { e.Enable(m_custom_texture != NONE); }));
parent->SetBackgroundColour(*wxWHITE);
return sizer;
};
optgroup->append_line(line);
@ -431,6 +435,8 @@ wxPanel* BedShapePanel::init_model_panel()
remove_btn->Bind(wxEVT_UPDATE_UI, ([this](wxUpdateUIEvent& e) { e.Enable(m_custom_model != NONE); }));
parent->SetBackgroundColour(*wxWHITE);
return sizer;
};
optgroup->append_line(line);

View file

@ -93,7 +93,7 @@ class BedShapeDialog : public DPIDialog
BedShapePanel* m_panel;
public:
BedShapeDialog(wxWindow* parent) : DPIDialog(parent, wxID_ANY, _(L("Bed Shape")),
wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {}
wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE) {}
void build_dialog(const ConfigOptionPoints& default_pt, const ConfigOptionString& custom_texture, const ConfigOptionString& custom_model);

View file

@ -124,16 +124,16 @@ void HistoryWindow::sync_history_result(MachineObject* obj)
if (obj)
m_calib_results_history = obj->pa_calib_tab;
sync_history_data();
if (m_calib_results_history.empty()) {
m_tips->SetLabel(_L("No History Result"));
return;
}
else {
m_tips->SetLabel(_L("Success to get history result"));
}
m_tips->Refresh();
sync_history_data();
}
void HistoryWindow::on_device_connected(MachineObject* obj)
@ -191,8 +191,10 @@ void HistoryWindow::on_select_nozzle(wxCommandEvent& evt)
void HistoryWindow::reqeust_history_result(MachineObject* obj)
{
if (curr_obj) {
// reset
curr_obj->reset_pa_cali_history_result();
sync_history_result(curr_obj);
m_calib_results_history.clear();
sync_history_data();
float nozzle_value = get_nozzle_value();
if (nozzle_value > 0) {

View file

@ -1139,6 +1139,9 @@ void CalibrationPresetPage::update_combobox_filaments(MachineObject* obj)
{
if (!obj) return;
if (!obj->is_info_ready())
return;
//step 1: update combobox filament list
float nozzle_value = get_nozzle_value();
obj->cali_selected_nozzle_dia = nozzle_value;

View file

@ -1292,7 +1292,7 @@ void CalibrationFlowCoarseSavePage::set_curr_flow_ratio(const float value) {
bool CalibrationFlowCoarseSavePage::get_result(float* out_value, wxString* out_name) {
// Check if the value is valid
if (m_coarse_flow_ratio <= 0.0 || m_coarse_flow_ratio >= 2.0) {
if (m_optimal_block_coarse->GetSelection() == -1 || m_coarse_flow_ratio <= 0.0 || m_coarse_flow_ratio >= 2.0) {
MessageDialog msg_dlg(nullptr, _L("Please choose a block with smoothest top surface"), wxEmptyString, wxICON_WARNING | wxOK);
msg_dlg.ShowModal();
return false;
@ -1424,7 +1424,7 @@ void CalibrationFlowFineSavePage::set_curr_flow_ratio(const float value) {
bool CalibrationFlowFineSavePage::get_result(float* out_value, wxString* out_name) {
// Check if the value is valid
if (m_fine_flow_ratio <= 0.0 || m_fine_flow_ratio >= 2.0) {
if (m_optimal_block_fine->GetSelection() == -1 || m_fine_flow_ratio <= 0.0 || m_fine_flow_ratio >= 2.0) {
MessageDialog msg_dlg(nullptr, _L("Please choose a block with smoothest top surface."), wxEmptyString, wxICON_WARNING | wxOK);
msg_dlg.ShowModal();
return false;

View file

@ -16,11 +16,18 @@
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
#include "fast_float/fast_float.h"
#define CALI_DEBUG
namespace pt = boost::property_tree;
float string_to_float(const std::string& str_value) {
float value = 0.0;
fast_float::from_chars(str_value.c_str(), str_value.c_str() + str_value.size(), value);
return value;
}
const int PRINTING_STAGE_COUNT = 32;
std::string PRINTING_STAGE_STR[PRINTING_STAGE_COUNT] = {
"printing",
@ -474,6 +481,18 @@ PrinterArch MachineObject::get_printer_arch() const
return DeviceManager::get_printer_arch(printer_type);
}
//BBS: check if machine is enclosed
bool MachineObject::is_printer_enclosed() const
{
std::unordered_set<std::string>enclosed_printers = {
"C12",
"BL-P002",
"BL-P001",
"C13"
};
return enclosed_printers.find(printer_type) != enclosed_printers.end();
}
MachineObject::MachineObject(NetworkAgent* agent, std::string name, std::string id, std::string ip)
:dev_name(name),
dev_id(id),
@ -1414,6 +1433,15 @@ int MachineObject::get_bed_temperature_limit()
return BED_TEMP_LIMIT;
}
bool MachineObject::is_makeworld_subtask()
{
if (model_task && model_task->design_id > 0) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " model task id: " << model_task->task_id << " is makeworld model";
return true;
}
return false;
}
bool MachineObject::is_sdcard_printing()
{
if (can_abort()
@ -2474,6 +2502,7 @@ bool MachineObject::is_in_printing_status(std::string status)
return false;
}
bool MachineObject::is_in_printing()
{
/* use print_status if print_status is valid */
@ -2806,6 +2835,31 @@ int MachineObject::local_publish_json(std::string json_str, int qos)
return result;
}
std::string MachineObject::setting_id_to_type(std::string setting_id, std::string tray_type)
{
std::string type;
PresetBundle* preset_bundle = GUI::wxGetApp().preset_bundle;
if (preset_bundle) {
for (auto it = preset_bundle->filaments.begin(); it != preset_bundle->filaments.end(); it++) {
if (it->filament_id.compare(setting_id) == 0) {
std::string display_filament_type;
it->config.get_filament_type(display_filament_type);
type = display_filament_type;
break;
}
}
}
if (tray_type != type || type.empty()) {
if (type.empty()) {type = tray_type;}
BOOST_LOG_TRIVIAL(info) << "The values of tray_info_idx and tray_type do not match tray_info_idx " << setting_id << " tray_type " << tray_type;
}
return type;
}
int MachineObject::parse_json(std::string payload)
{
CNumericLocalesSetter locales_setter;
@ -3269,7 +3323,7 @@ int MachineObject::parse_json(std::string payload)
if (jj["nozzle_diameter"].is_number_float()) {
nozzle_diameter = jj["nozzle_diameter"].get<float>();
} else if (jj["nozzle_diameter"].is_string()) {
nozzle_diameter = stof(jj["nozzle_diameter"].get<std::string>().c_str());
nozzle_diameter = string_to_float(jj["nozzle_diameter"].get<std::string>());
}
}
}
@ -3666,7 +3720,8 @@ int MachineObject::parse_json(std::string payload)
curr_tray->tag_uid = "0";
if (tray_it->contains("tray_info_idx") && tray_it->contains("tray_type")) {
curr_tray->setting_id = (*tray_it)["tray_info_idx"].get<std::string>();
std::string type = (*tray_it)["tray_type"].get<std::string>();
//std::string type = (*tray_it)["tray_type"].get<std::string>();
std::string type = setting_id_to_type(curr_tray->setting_id, (*tray_it)["tray_type"].get<std::string>());
if (curr_tray->setting_id == "GFS00") {
curr_tray->type = "PLA-S";
}
@ -3827,7 +3882,8 @@ int MachineObject::parse_json(std::string payload)
vt_tray.tag_uid = "0";
if (jj["vt_tray"].contains("tray_info_idx") && jj["vt_tray"].contains("tray_type")) {
vt_tray.setting_id = jj["vt_tray"]["tray_info_idx"].get<std::string>();
std::string type = jj["vt_tray"]["tray_type"].get<std::string>();
//std::string type = jj["vt_tray"]["tray_type"].get<std::string>();
std::string type = setting_id_to_type(vt_tray.setting_id, jj["vt_tray"]["tray_type"].get<std::string>());
if (vt_tray.setting_id == "GFS00") {
vt_tray.type = "PLA-S";
}
@ -3959,9 +4015,10 @@ int MachineObject::parse_json(std::string payload)
BOOST_LOG_TRIVIAL(trace) << "ams_filament_setting, parse tray info";
vt_tray.nozzle_temp_max = std::to_string(jj["nozzle_temp_max"].get<int>());
vt_tray.nozzle_temp_min = std::to_string(jj["nozzle_temp_min"].get<int>());
vt_tray.type = jj["tray_type"].get<std::string>();
vt_tray.color = jj["tray_color"].get<std::string>();
vt_tray.setting_id = jj["tray_info_idx"].get<std::string>();
//vt_tray.type = jj["tray_type"].get<std::string>();
vt_tray.type = setting_id_to_type(vt_tray.setting_id, jj["tray_info_idx"].get<std::string>());
// delay update
vt_tray.set_hold_count();
} else {
@ -3973,7 +4030,7 @@ int MachineObject::parse_json(std::string payload)
BOOST_LOG_TRIVIAL(trace) << "ams_filament_setting, parse tray info";
tray_it->second->nozzle_temp_max = std::to_string(jj["nozzle_temp_max"].get<int>());
tray_it->second->nozzle_temp_min = std::to_string(jj["nozzle_temp_min"].get<int>());
tray_it->second->type = jj["tray_type"].get<std::string>();
//tray_it->second->type = jj["tray_type"].get<std::string>();
tray_it->second->color = jj["tray_color"].get<std::string>();
/*tray_it->second->cols.clear();
@ -3986,6 +4043,7 @@ int MachineObject::parse_json(std::string payload)
}*/
tray_it->second->setting_id = jj["tray_info_idx"].get<std::string>();
tray_it->second->type = setting_id_to_type(tray_it->second->setting_id, jj["tray_type"].get<std::string>());
// delay update
tray_it->second->set_hold_count();
} else {
@ -4058,8 +4116,17 @@ int MachineObject::parse_json(std::string payload)
std::string reason = jj["reason"].get<std::string>();
GUI::wxGetApp().CallAfter([cali_mode, reason] {
wxString info = "";
if (reason == "invalid nozzle_diameter") {
info = _L("Invalid nozzle diameter");
if (reason == "invalid nozzle_diameter" || reason == "nozzle_diameter is not supported") {
info = _L("This calibration does not support the currently selected nozzle diameter");
}
else if (reason == "invalid handle_flowrate_cali param") {
info = _L("Current flowrate cali param is invalid");
}
else if (reason == "nozzle_diameter is not matched") {
info = _L("Selected diameter and machine diameter do not match");
}
else if (reason == "generate auto filament cali gcode failure") {
info = _L("Failed to generate cali gcode");
}
else {
info = reason;
@ -4164,7 +4231,7 @@ int MachineObject::parse_json(std::string payload)
pa_calib_tab_nozzle_dia = jj["nozzle_diameter"].get<float>();
}
else if (jj["nozzle_diameter"].is_string()) {
pa_calib_tab_nozzle_dia = stof(jj["nozzle_diameter"].get<std::string>().c_str());
pa_calib_tab_nozzle_dia = string_to_float(jj["nozzle_diameter"].get<std::string>());
}
else {
assert(false);
@ -4191,18 +4258,18 @@ int MachineObject::parse_json(std::string payload)
if (jj["nozzle_diameter"].is_number_float()) {
pa_calib_result.nozzle_diameter = jj["nozzle_diameter"].get<float>();
} else if (jj["nozzle_diameter"].is_string()) {
pa_calib_result.nozzle_diameter = stof(jj["nozzle_diameter"].get<std::string>().c_str());
pa_calib_result.nozzle_diameter = string_to_float(jj["nozzle_diameter"].get<std::string>());
}
if ((*it)["k_value"].is_number_float())
pa_calib_result.k_value = (*it)["k_value"].get<float>();
else if ((*it)["k_value"].is_string())
pa_calib_result.k_value = stof((*it)["k_value"].get<std::string>().c_str());
pa_calib_result.k_value = string_to_float((*it)["k_value"].get<std::string>());
if ((*it)["n_coef"].is_number_float())
pa_calib_result.n_coef = (*it)["n_coef"].get<float>();
else if ((*it)["n_coef"].is_string())
pa_calib_result.n_coef = stof((*it)["n_coef"].get<std::string>().c_str());
pa_calib_result.n_coef = string_to_float((*it)["n_coef"].get<std::string>());
if (check_pa_result_validation(pa_calib_result))
pa_calib_tab.push_back(pa_calib_result);
@ -4238,18 +4305,18 @@ int MachineObject::parse_json(std::string payload)
if (jj["nozzle_diameter"].is_number_float()) {
pa_calib_result.nozzle_diameter = jj["nozzle_diameter"].get<float>();
} else if (jj["nozzle_diameter"].is_string()) {
pa_calib_result.nozzle_diameter = stof(jj["nozzle_diameter"].get<std::string>().c_str());
pa_calib_result.nozzle_diameter = string_to_float(jj["nozzle_diameter"].get<std::string>());
}
if ((*it)["k_value"].is_number_float())
pa_calib_result.k_value = (*it)["k_value"].get<float>();
else if ((*it)["k_value"].is_string())
pa_calib_result.k_value = stof((*it)["k_value"].get<std::string>().c_str());
pa_calib_result.k_value = string_to_float((*it)["k_value"].get<std::string>());
if ((*it)["n_coef"].is_number_float())
pa_calib_result.n_coef = (*it)["n_coef"].get<float>();
else if ((*it)["n_coef"].is_string())
pa_calib_result.n_coef = stof((*it)["n_coef"].get<std::string>().c_str());
pa_calib_result.n_coef = string_to_float((*it)["n_coef"].get<std::string>());
if (it->contains("confidence")) {
pa_calib_result.confidence = (*it)["confidence"].get<int>();
@ -4285,8 +4352,8 @@ int MachineObject::parse_json(std::string payload)
flow_ratio_calib_result.tray_id = (*it)["tray_id"].get<int>();
flow_ratio_calib_result.filament_id = (*it)["filament_id"].get<std::string>();
flow_ratio_calib_result.setting_id = (*it)["setting_id"].get<std::string>();
flow_ratio_calib_result.nozzle_diameter = stof(jj["nozzle_diameter"].get<std::string>().c_str());
flow_ratio_calib_result.flow_ratio = stof((*it)["flow_ratio"].get<std::string>().c_str());
flow_ratio_calib_result.nozzle_diameter = string_to_float(jj["nozzle_diameter"].get<std::string>());
flow_ratio_calib_result.flow_ratio = string_to_float((*it)["flow_ratio"].get<std::string>());
if (it->contains("confidence")) {
flow_ratio_calib_result.confidence = (*it)["confidence"].get<int>();
} else {
@ -4443,6 +4510,93 @@ void MachineObject::set_modeltask(BBLModelTask* task)
model_task = task;
}
void MachineObject::update_model_task()
{
if (request_model_result > 10) return;
if (!m_agent) return;
if (!model_task) return;
if (!subtask_) return;
if (model_task->task_id != subtask_->task_id) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " times: " << request_model_result << " model_task_id !=subtask_id";
return;
}
if (model_task->instance_id <= 0) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " times: " << request_model_result << " instance_id <= 0";
return;
}
if ((!subtask_id_.empty() && last_subtask_id_ != subtask_id_) || get_model_mall_result_need_retry) {
if (!subtask_id_.empty() && last_subtask_id_ != subtask_id_) {
BOOST_LOG_TRIVIAL(info) << "update_model_task: last=" << last_subtask_id_ << ", curr=" << subtask_id_;
last_subtask_id_ = subtask_id_;
request_model_result = 0;
}
if (get_model_mall_result_need_retry) {
BOOST_LOG_TRIVIAL(info) << "need retry";
get_model_mall_result_need_retry = false;
}
} else {
BOOST_LOG_TRIVIAL(info) << "subtask_id_ no change and do not need retry";
return;
}
int curr_instance_id = model_task->instance_id;
if (rating_info) {
delete rating_info;
rating_info = nullptr;
}
get_model_task_thread = new boost::thread([this, curr_instance_id]{
try {
std::string rating_result;
unsigned int http_code = 404;
std::string http_error;
int res = -1;
res = m_agent->get_model_mall_rating_result(curr_instance_id, rating_result, http_code, http_error);
request_model_result++;
BOOST_LOG_TRIVIAL(info) << "request times: " << request_model_result << " http code: " << http_code;
rating_info = new RatingInfo();
rating_info->http_code = http_code;
if (0 == res && 200 == http_code) {
try {
json rating_json = json::parse(rating_result);
if (rating_json.contains("id")) {
rating_info->rating_id = rating_json["id"].get<unsigned int>();
//rating id is necessary info, so rating id must have
request_model_result = 0;
rating_info->request_successful = true;
BOOST_LOG_TRIVIAL(info) << "get rating id";
} else {
rating_info->request_successful = false;
BOOST_LOG_TRIVIAL(info) << "can not get rating id";
return;
}
if (rating_json.contains("score")) {
rating_info->start_count = rating_json["score"].get<int>();
}
if (rating_json.contains("content"))
rating_info->content = rating_json["content"].get<std::string>();
if (rating_json.contains("successPrinted"))
rating_info->success_printed = rating_json["successPrinted"].get<bool>();
if (rating_json.contains("images")) {
rating_info->image_url_paths = rating_json["images"].get<std::vector<std::string>>();
}
} catch (...) {
BOOST_LOG_TRIVIAL(info) << "parse model mall result json failed";
}
}
else {
rating_info->request_successful = false;
BOOST_LOG_TRIVIAL(info) << "model mall result request failed, request time: " << request_model_result << " http_code: " << http_code
<< " error msg: " << http_error;
return;
}
}
catch (...) {
BOOST_LOG_TRIVIAL(info) << "get mall model rating id failed and hide scoring page";
}
});
}
void MachineObject::update_slice_info(std::string project_id, std::string profile_id, std::string subtask_id, int plate_idx)
{
if (!m_agent) return;
@ -4478,22 +4632,26 @@ void MachineObject::update_slice_info(std::string project_id, std::string profil
std::string http_body;
if (m_agent->get_subtask_info(subtask_id, &subtask_json, &http_code, &http_body) == 0) {
try {
json task_j = json::parse(subtask_json);
if (task_j.contains("content")) {
std::string content_str = task_j["content"].get<std::string>();
json content_j = json::parse(content_str);
plate_index = content_j["info"]["plate_idx"].get<int>();
}
if (!subtask_json.empty()){
if (task_j.contains("context") && task_j["context"].contains("plates")) {
for (int i = 0; i < task_j["context"]["plates"].size(); i++) {
if (task_j["context"]["plates"][i].contains("index") && task_j["context"]["plates"][i]["index"].get<int>() == plate_index) {
slice_info->thumbnail_url = task_j["context"]["plates"][i]["thumbnail"]["url"].get<std::string>();
BOOST_LOG_TRIVIAL(trace) << "task_info: thumbnail url=" << slice_info->thumbnail_url;
json task_j = json::parse(subtask_json);
if (task_j.contains("content")) {
std::string content_str = task_j["content"].get<std::string>();
json content_j = json::parse(content_str);
plate_index = content_j["info"]["plate_idx"].get<int>();
}
if (task_j.contains("context") && task_j["context"].contains("plates")) {
for (int i = 0; i < task_j["context"]["plates"].size(); i++) {
if (task_j["context"]["plates"][i].contains("index") && task_j["context"]["plates"][i]["index"].get<int>() == plate_index) {
slice_info->thumbnail_url = task_j["context"]["plates"][i]["thumbnail"]["url"].get<std::string>();
BOOST_LOG_TRIVIAL(trace) << "task_info: thumbnail url=" << slice_info->thumbnail_url;
}
}
}
} else {
BOOST_LOG_TRIVIAL(error) << "task_info: no context or plates";
else {
BOOST_LOG_TRIVIAL(error) << "task_info: no context or plates";
}
}
}
catch(...) {
@ -4523,8 +4681,8 @@ void MachineObject::update_slice_info(std::string project_id, std::string profil
FilamentInfo f;
f.color = filament["color"].get<std::string>();
f.type = filament["type"].get<std::string>();
f.used_g = stof(filament["used_g"].get<std::string>());
f.used_m = stof(filament["used_m"].get<std::string>());
f.used_g = string_to_float(filament["used_g"].get<std::string>());
f.used_m = string_to_float(filament["used_m"].get<std::string>());
slice_info->filaments_info.push_back(f);
}
}

View file

@ -179,6 +179,16 @@ enum ManualPaCaliMethod {
PA_PATTERN,
};
struct RatingInfo {
bool request_successful;
int http_code;
int rating_id;
int start_count;
bool success_printed;
std::string content;
std::vector<std::string> image_url_paths;
};
class AmsTray {
public:
AmsTray(std::string tray_id) {
@ -461,6 +471,7 @@ public:
std::string printer_type; /* model_id */
PrinterSeries get_printer_series() const;
PrinterArch get_printer_arch() const;
bool is_printer_enclosed() const;
std::string printer_thumbnail_img;
std::string monitor_upgrade_printer_img;
@ -761,15 +772,23 @@ public:
std::string profile_id_;
std::string task_id_;
std::string subtask_id_;
std::string last_subtask_id_;
BBLSliceInfo* slice_info {nullptr};
boost::thread* get_slice_info_thread { nullptr };
boost::thread* get_model_task_thread { nullptr };
bool is_makeworld_subtask();
int plate_index { -1 };
std::string m_gcode_file;
int gcode_file_prepare_percent = 0;
BBLSubTask* subtask_;
BBLModelTask* model_task;
BBLModelTask *model_task { nullptr };
RatingInfo* rating_info { nullptr };
int request_model_result = 0;
bool get_model_mall_result_need_retry = false;
std::string obj_subtask_id; // subtask_id == 0 for sdcard
std::string subtask_name;
bool is_sdcard_printing();
@ -906,9 +925,11 @@ public:
int parse_json(std::string payload);
int publish_gcode(std::string gcode_str);
std::string setting_id_to_type(std::string setting_id, std::string tray_type);
BBLSubTask* get_subtask();
BBLModelTask* get_modeltask();
void set_modeltask(BBLModelTask* task);
void update_model_task();
void update_slice_info(std::string project_id, std::string profile_id, std::string subtask_id, int plate_idx);
bool m_firmware_valid { false };

View file

@ -1767,8 +1767,11 @@ Points GLCanvas3D::estimate_wipe_tower_points(int plate_index, bool global) cons
float y = dynamic_cast<const ConfigOptionFloats *>(proj_cfg.option("wipe_tower_y"))->get_at(plate_index);
if (plate_index >= plate_count) { plate_index = 0; }
float w = dynamic_cast<const ConfigOptionFloat *>(m_config->option("prime_tower_width"))->value;
float v = dynamic_cast<const ConfigOptionFloat *>(m_config->option("prime_volume"))->value;
Vec3d wipe_tower_size = ppl.get_plate(plate_index)->estimate_wipe_tower_size(w, v);
auto part_plate = ppl.get_plate(plate_index);
const auto &wipe_tower_data = print.wipe_tower_data(part_plate->get_extruders(true).size());
// float v = dynamic_cast<const ConfigOptionFloat *>(m_config->option("prime_volume"))->value;
const DynamicPrintConfig &print_cfg = wxGetApp().preset_bundle->prints.get_edited_preset().config;
Vec3d wipe_tower_size = part_plate->estimate_wipe_tower_size(print_cfg, w, wipe_tower_data.depth);
if (wipe_tower_size(1) == 0) {
// when depth is unavailable (no items on this plate), we have to estimate the depth using the extruder number of all plates
@ -2656,7 +2659,8 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
const Print* print = m_process->fff_print();
const auto& wipe_tower_data = print->wipe_tower_data(filaments_count);
float brim_width = wipe_tower_data.brim_width;
Vec3d wipe_tower_size = ppl.get_plate(plate_id)->estimate_wipe_tower_size(w, wipe_tower_data.depth);
const DynamicPrintConfig &print_cfg = wxGetApp().preset_bundle->prints.get_edited_preset().config;
Vec3d wipe_tower_size = ppl.get_plate(plate_id)->estimate_wipe_tower_size(print_cfg, w, wipe_tower_data.depth);
const float margin = 15.f;
BoundingBoxf3 plate_bbox = wxGetApp().plater()->get_partplate_list().get_plate(plate_id)->get_bounding_box();

View file

@ -480,8 +480,6 @@ public:
bool avoid_extrusion_cali_region = true;
//BBS: add more arrangeSettings
bool is_seq_print = false;
float bed_shrink_x = 0.f;
float bed_shrink_y = 0.f;
bool align_to_y_axis = false;
};

View file

@ -2339,6 +2339,7 @@ bool GUI_App::on_init_inner()
}
#endif
BOOST_LOG_TRIVIAL(info) << boost::format("gui mode, Current BambuStudio Version %1%")%SLIC3R_VERSION;
// Enable this to get the default Win32 COMCTRL32 behavior of static boxes.
// wxSystemOptions::SetOption("msw.staticbox.optimized-paint", 0);
// Enable this to disable Windows Vista themes for all wxNotebooks. The themes seem to lead to terrible

View file

@ -92,8 +92,12 @@ void Slic3r::GUI::ImageGrid::SetFileType(int type, std::string const &storage)
void Slic3r::GUI::ImageGrid::SetGroupMode(int mode)
{
if (!m_file_sys || m_file_sys->GetCount() == 0)
if (!m_file_sys)
return;
if (m_file_sys->GetCount() == 0) {
m_file_sys->SetGroupMode((PrinterFileSystem::GroupMode) mode);
return;
}
wxSize size = GetClientSize();
int index = (m_row_offset + 1 < m_row_count || m_row_count == 0)
? m_row_offset / 4 * m_col_count
@ -220,6 +224,7 @@ void ImageGrid::UpdateLayout()
void Slic3r::GUI::ImageGrid::UpdateFocusRange()
{
if (!m_file_sys) return;
wxSize size = GetClientSize();
wxPoint off;
int index = firstItem(size, off);

View file

@ -491,10 +491,7 @@ void ArrangeJob::on_exception(const std::exception_ptr &eptr)
void ArrangeJob::process()
{
const GLCanvas3D::ArrangeSettings &settings =
static_cast<const GLCanvas3D*>(m_plater->canvas3D())->get_arrange_settings();
auto & partplate_list = m_plater->get_partplate_list();
auto& print = wxGetApp().plater()->get_partplate_list().get_current_fff_print();
const Slic3r::DynamicPrintConfig& global_config = wxGetApp().preset_bundle->full_config();
PresetBundle* preset_bundle = wxGetApp().preset_bundle;
@ -502,14 +499,14 @@ void ArrangeJob::process()
if (is_bbl && params.avoid_extrusion_cali_region && global_config.opt_bool("scan_first_layer"))
partplate_list.preprocess_nonprefered_areas(m_unselected, MAX_NUM_PLATES);
update_arrange_params(params, *m_plater, m_selected);
update_arrange_params(params, m_plater->config(), m_selected);
update_selected_items_inflation(m_selected, m_plater->config(), params);
update_unselected_items_inflation(m_unselected, m_plater->config(), params);
update_selected_items_axis_align(m_selected, m_plater->config(), params);
Points bedpts = get_shrink_bedpts(m_plater->config(),params);
double scaled_exclusion_gap = scale_(1);
partplate_list.preprocess_exclude_areas(params.excluded_regions, 1, scaled_exclusion_gap);
partplate_list.preprocess_exclude_areas(params.excluded_regions, 1, scale_(1));
BOOST_LOG_TRIVIAL(debug) << "arrange bedpts:" << bedpts[0].transpose() << ", " << bedpts[1].transpose() << ", " << bedpts[2].transpose() << ", " << bedpts[3].transpose();
@ -520,11 +517,11 @@ void ArrangeJob::process()
};
{
BOOST_LOG_TRIVIAL(debug)<< "Arrange full params: "<< params.to_json();
BOOST_LOG_TRIVIAL(debug) << "items selected before arrange: ";
for (auto selected : m_selected)
BOOST_LOG_TRIVIAL(debug) << selected.name << ", extruder: " << selected.extrude_ids.back() << ", bed: " << selected.bed_idx
<< ", bed_temp: " << selected.first_bed_temp << ", print_temp: " << selected.print_temp;
BOOST_LOG_TRIVIAL(warning)<< "Arrange full params: "<< params.to_json();
BOOST_LOG_TRIVIAL(info) << boost::format("arrange: items selected before arranging: %1%") % m_selected.size();
for (auto selected : m_selected) {
BOOST_LOG_TRIVIAL(debug) << selected.name << ", extruder: " << selected.extrude_ids.back() << ", bed: " << selected.bed_idx<<", filemant_type:" << selected.filament_temp_type;
}
BOOST_LOG_TRIVIAL(debug) << "items unselected before arrange: ";
for (auto item : m_unselected)
BOOST_LOG_TRIVIAL(debug) << item.name << ", bed: " << item.bed_idx << ", trans: " << item.translation.transpose();
@ -535,7 +532,7 @@ void ArrangeJob::process()
// sort by item id
std::sort(m_selected.begin(), m_selected.end(), [](auto a, auto b) {return a.itemid < b.itemid; });
{
BOOST_LOG_TRIVIAL(debug) << "items selected after arrange: ";
BOOST_LOG_TRIVIAL(info) << boost::format("arrange: items unselected before arranging: %1%") % m_unselected.size();
for (auto selected : m_selected)
BOOST_LOG_TRIVIAL(debug) << selected.name << ", extruder: " << selected.extrude_ids.back() << ", bed: " << selected.bed_idx
<< ", bed_temp: " << selected.first_bed_temp << ", print_temp: " << selected.print_temp
@ -709,23 +706,6 @@ double bed_stride_y(const Plater* plater) {
return (1. + LOGICAL_BED_GAP) * beddepth;
}
arrangement::ArrangeParams get_arrange_params(Plater *p)
{
const GLCanvas3D::ArrangeSettings &settings =
static_cast<const GLCanvas3D*>(p->canvas3D())->get_arrange_settings();
arrangement::ArrangeParams params;
params.allow_rotations = settings.enable_rotation;
params.min_obj_distance = scaled(settings.distance);
//BBS: add specific params
params.is_seq_print = settings.is_seq_print;
params.bed_shrink_x = settings.bed_shrink_x;
params.bed_shrink_y = settings.bed_shrink_y;
return params;
}
// call before get selected and unselected
arrangement::ArrangeParams init_arrange_params(Plater *p)
{
@ -745,8 +725,6 @@ arrangement::ArrangeParams init_arrange_params(Plater *p)
params.avoid_extrusion_cali_region = settings.avoid_extrusion_cali_region;
params.is_seq_print = settings.is_seq_print;
params.min_obj_distance = scaled(settings.distance);
params.bed_shrink_x = settings.bed_shrink_x;
params.bed_shrink_y = settings.bed_shrink_y;
params.align_to_y_axis = settings.align_to_y_axis;
int state = p->get_prepare_state();
@ -756,28 +734,12 @@ arrangement::ArrangeParams init_arrange_params(Plater *p)
params.is_seq_print = plate->get_real_print_seq() == PrintSequence::ByObject;
}
if (params.is_seq_print)
if (params.is_seq_print) {
params.min_obj_distance = std::max(params.min_obj_distance, scaled(params.cleareance_radius + 0.001)); // +0.001mm to avoid clearance check fail due to rounding error
params.bed_shrink_x = BED_SHRINK_SEQ_PRINT;
params.bed_shrink_y = BED_SHRINK_SEQ_PRINT;
}
return params;
}
//after get selected call this to update bed_shrink
void update_arrange_params(arrangement::ArrangeParams &params, const Plater &p, const arrangement::ArrangePolygons &selected)
{
const GLCanvas3D::ArrangeSettings &settings = static_cast<const GLCanvas3D *>(p.canvas3D())->get_arrange_settings();
auto & print = wxGetApp().plater()->get_partplate_list().get_current_fff_print();
double skirt_distance = print.has_skirt() ? print.config().skirt_distance.value : 0;
// Note: skirt_distance is now defined between outermost brim and skirt, not the object and skirt.
// So we can't do max but do adding instead.
params.brim_skirt_distance = skirt_distance;
params.bed_shrink_x = settings.bed_shrink_x + params.brim_skirt_distance;
params.bed_shrink_y = settings.bed_shrink_y + params.brim_skirt_distance;
// for sequential print, we need to inflate the bed because cleareance_radius is so large
if (params.is_seq_print) {
float shift_dist = params.cleareance_radius / 2 - 5;
params.bed_shrink_x -= shift_dist;
params.bed_shrink_y -= shift_dist;
}
}
}} // namespace Slic3r::GUI

View file

@ -75,13 +75,8 @@ static const constexpr double LOGICAL_BED_GAP = 1. / 5.;
double bed_stride_x(const Plater* plater);
double bed_stride_y(const Plater* plater);
arrangement::ArrangeParams get_arrange_params(Plater *p);
arrangement::ArrangeParams init_arrange_params(Plater *p);
void update_arrange_params(arrangement::ArrangeParams &params, const Plater &p, const arrangement::ArrangePolygons &selected);
}} // namespace Slic3r::GUI
#endif // ARRANGEJOB_HPP

View file

@ -202,10 +202,7 @@ void FillBedJob::process()
{
if (m_object_idx == -1 || m_selected.empty()) return;
const GLCanvas3D::ArrangeSettings &settings =
static_cast<const GLCanvas3D*>(m_plater->canvas3D())->get_arrange_settings();
update_arrange_params(params, *m_plater, m_selected);
update_arrange_params(params, m_plater->config(), m_selected);
m_bedpts = get_shrink_bedpts(m_plater->config(), params);
auto &partplate_list = m_plater->get_partplate_list();

View file

@ -274,7 +274,6 @@ void MonitorPanel::on_update_all(wxMouseEvent &event)
return;
set_default();
m_status_info_panel->set_print_finish_status(false);
update_all();
MachineObject *obj_ = dev->get_selected_machine();

View file

@ -302,10 +302,15 @@ static void add_msg_content(wxWindow* parent, wxBoxSizer* content_sizer, wxStrin
page_size = wxSize(68 * em, page_height);
}
else {
Label* wrapped_text = new Label(html, msg);
wrapped_text->Wrap(68 * em);
msg = wrapped_text->GetLabel();
wrapped_text->Destroy();
wxClientDC dc(parent);
wxSize msg_sz = dc.GetMultiLineTextExtent(msg);
page_size = wxSize(std::min(msg_sz.GetX() + 2 * em, 68 * em),
std::min(msg_sz.GetY() + 2 * em, 68 * em));
page_size = wxSize(std::min(msg_sz.GetX(), 68 * em),
std::min(msg_sz.GetY(), 68 * em));
}
html->SetMinSize(page_size);

View file

@ -1576,21 +1576,26 @@ std::vector<int> PartPlate::get_used_extruders()
return used_extruders;
}
Vec3d PartPlate::estimate_wipe_tower_size(const double w, const double d) const
Vec3d PartPlate::estimate_wipe_tower_size(const DynamicPrintConfig & config, const double w, const double d, int plate_extruder_size) const
{
Vec3d wipe_tower_size;
std::vector<int> plate_extruders = get_extruders(true);
double layer_height = 0.08f; // hard code layer height
double max_height = 0.f;
wipe_tower_size.setZero();
wipe_tower_size(0) = w;
ConfigOption* layer_height_opt = wxGetApp().preset_bundle->prints.get_edited_preset().config.option("layer_height");
const ConfigOption* layer_height_opt = config.option("layer_height");
if (layer_height_opt)
layer_height = layer_height_opt->getFloat();
// empty plate
if (plate_extruders.empty())
if (plate_extruder_size == 0)
{
std::vector<int> plate_extruders = get_extruders(true);
plate_extruder_size = plate_extruders.size();
}
if (plate_extruder_size == 0)
return wipe_tower_size;
for (int obj_idx = 0; obj_idx < m_model->objects.size(); obj_idx++) {
@ -1602,11 +1607,11 @@ Vec3d PartPlate::estimate_wipe_tower_size(const double w, const double d) const
}
wipe_tower_size(2) = max_height;
const DynamicPrintConfig &dconfig = wxGetApp().preset_bundle->prints.get_edited_preset().config;
auto timelapse_type = dconfig.option<ConfigOptionEnum<TimelapseType>>("timelapse_type");
//const DynamicPrintConfig &dconfig = wxGetApp().preset_bundle->prints.get_edited_preset().config;
auto timelapse_type = config.option<ConfigOptionEnum<TimelapseType>>("timelapse_type");
bool timelapse_enabled = timelapse_type ? (timelapse_type->value == TimelapseType::tlSmooth) : false;
double depth = plate_extruders.size() == 1 ? 0 : d;
double depth = plate_extruder_size == 1 ? 0 : d;
if (timelapse_enabled || depth > EPSILON) {
float min_wipe_tower_depth = 0.f;
auto iter = WipeTower::min_depth_per_height.begin();
@ -5108,6 +5113,22 @@ void PartPlateList::BedTextureInfo::TexturePart::update_buffer()
}
}
void PartPlateList::BedTextureInfo::TexturePart::reset()
{
if (texture) {
texture->reset();
delete texture;
}
if (buffer)
delete buffer;
}
void PartPlateList::BedTextureInfo::reset()
{
for (size_t i = 0; i < parts.size(); i++)
parts[i].reset();
}
void PartPlateList::init_bed_type_info()
{
BedTextureInfo::TexturePart pc_part1(10, 130, 10, 110, "bbl_bed_pc_left.svg");
@ -5119,6 +5140,7 @@ void PartPlateList::init_bed_type_info()
BedTextureInfo::TexturePart pte_part1(10, 80, 10, 160, "bbl_bed_pte_left.svg");
BedTextureInfo::TexturePart pte_part2(74, -10, 148, 12, "bbl_bed_pte_bottom.svg");
for (size_t i = 0; i < btCount; i++) {
bed_texture_info[i].reset();
bed_texture_info[i].parts.clear();
}
bed_texture_info[btPC].parts.push_back(pc_part1);

View file

@ -290,7 +290,7 @@ public:
ModelInstance* get_instance(int obj_id, int instance_id);
Vec3d get_origin() { return m_origin; }
Vec3d estimate_wipe_tower_size(const double w, const double d) const;
Vec3d estimate_wipe_tower_size(const DynamicPrintConfig & config, const double w, const double d, int plate_extruder_size = 0) const;
std::vector<int> get_extruders(bool conside_custom_gcode = false) const;
std::vector<int> get_extruders_under_cli(bool conside_custom_gcode, DynamicPrintConfig& full_config) const;
std::vector<int> get_extruders_without_support(bool conside_custom_gcode = false) const;
@ -597,8 +597,10 @@ public:
}
void update_buffer();
void reset();
};
std::vector<TexturePart> parts;
void reset();
};
static const unsigned int MAX_PLATES_COUNT = MAX_PLATE_COUNT;

View file

@ -2842,7 +2842,7 @@ wxColour Plater::get_next_color_for_filament()
wxString Plater::get_slice_warning_string(GCodeProcessorResult::SliceWarning& warning)
{
if (warning.msg == BED_TEMP_TOO_HIGH_THAN_FILAMENT) {
return _L("The bed temperature exceeds filament's vitrification temperature. Please open the front door of printer before printing to avoid nozzle clog.");
return _L("The current hot bed temperature is relatively high. The nozzle may be clogged when printing this filament in a closed enclosure. Please open the front door and/or remove the upper glass.");
} else if (warning.msg == NOZZLE_HRC_CHECKER) {
return _L("The nozzle hardness required by the filament is higher than the default nozzle hardness of the printer. Please replace the hardened nozzle or filament, otherwise, the nozzle will be attrited or damaged.");
} else if (warning.msg == NOT_SUPPORT_TRADITIONAL_TIMELAPSE) {
@ -3969,7 +3969,7 @@ wxString Plater::priv::get_export_file(GUI::FileType file_type)
{
// XXX: Problem on OS X with double extension?
output_file.replace_extension("zip.amf");
dlg_title = _devL("Export AMF file:");
dlg_title = _L("Export AMF file:");
break;
}
case FT_3MF:
@ -3981,7 +3981,7 @@ wxString Plater::priv::get_export_file(GUI::FileType file_type)
case FT_OBJ:
{
output_file.replace_extension("obj");
dlg_title = _devL("Export OBJ file:");
dlg_title = _L("Export OBJ file:");
break;
}
default: break;
@ -4248,7 +4248,7 @@ void Plater::priv::mirror(Axis axis)
void Plater::find_new_position(const ModelInstancePtrs &instances)
{
arrangement::ArrangePolygons movable, fixed;
arrangement::ArrangeParams arr_params = get_arrange_params(this);
arrangement::ArrangeParams arr_params = init_arrange_params(this);
for (const ModelObject *mo : p->model.objects)
for (ModelInstance *inst : mo->instances) {
@ -4770,7 +4770,7 @@ bool Plater::priv::replace_volume_with_stl(int object_idx, int volume_idx, const
{
const std::string path = new_path.string();
wxBusyCursor wait;
wxBusyInfo info(_devL("Replace from:") + " " + from_u8(path), q->get_current_canvas3D()->get_wxglcanvas());
wxBusyInfo info(_L("Replace from:") + " " + from_u8(path), q->get_current_canvas3D()->get_wxglcanvas());
Model new_model;
try {
@ -4786,7 +4786,7 @@ bool Plater::priv::replace_volume_with_stl(int object_idx, int volume_idx, const
}
if (new_model.objects.size() > 1 || new_model.objects.front()->volumes.size() > 1) {
MessageDialog dlg(q, _devL("Unable to replace with more than one volume"), _devL("Error during replace"), wxOK | wxOK_DEFAULT | wxICON_WARNING);
MessageDialog dlg(q, _L("Unable to replace with more than one volume"), _L("Error during replace"), wxOK | wxOK_DEFAULT | wxICON_WARNING);
dlg.ShowModal();
return false;
}
@ -5051,8 +5051,8 @@ void Plater::priv::reload_from_disk()
}
}
else {
wxString message = _devL("Do you want to replace it") + " ?";
MessageDialog dlg(q, message, wxMessageBoxCaptionStr, wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION);
wxString message = _L("Do you want to replace it") + " ?";
MessageDialog dlg(q, message, _L("Message"), wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION);
if (dlg.ShowModal() == wxID_YES)
#if ENABLE_RELOAD_FROM_DISK_REWORK
replace_paths.emplace_back(search, sel_filename_path);
@ -5080,7 +5080,7 @@ void Plater::priv::reload_from_disk()
const auto& path = input_paths[i].string();
wxBusyCursor wait;
wxBusyInfo info(_devL("Reload from:") + " " + from_u8(path), q->get_current_canvas3D()->get_wxglcanvas());
wxBusyInfo info(_L("Reload from:") + " " + from_u8(path), q->get_current_canvas3D()->get_wxglcanvas());
Model new_model;
try
@ -5291,11 +5291,11 @@ void Plater::priv::reload_from_disk()
#endif // ENABLE_RELOAD_FROM_DISK_REWORK
if (!fail_list.empty()) {
wxString message = _devL("Unable to reload:") + "\n";
wxString message = _L("Unable to reload:") + "\n";
for (const wxString& s : fail_list) {
message += s + "\n";
}
MessageDialog dlg(q, message, _devL("Error during reload"), wxOK | wxOK_DEFAULT | wxICON_WARNING);
MessageDialog dlg(q, message, _L("Error during reload"), wxOK | wxOK_DEFAULT | wxICON_WARNING);
dlg.ShowModal();
}
@ -6311,6 +6311,7 @@ void Plater::priv::on_action_print_all(SimpleEvent&)
//BBS
if (!m_select_machine_dlg) m_select_machine_dlg = new SelectMachineDialog(q);
m_select_machine_dlg->set_print_type(PrintFromType::FROM_NORMAL);
m_select_machine_dlg->prepare(PLATE_ALL_IDX);
m_select_machine_dlg->ShowModal();
record_start_print_preset("print_all");
@ -8116,7 +8117,7 @@ void Plater::import_model_id(wxString download_info)
body,
http_status,
error);
if (retry_count == max_retries) {
msg = _L("Importing to Bambu Studio failed. Please download the file and manually import it.");
cont = false;
@ -9990,7 +9991,7 @@ void Plater::export_gcode(bool prefer_removable)
fs::path output_path;
{
std::string ext = default_output_file.extension().string();
wxFileDialog dlg(this, (printer_technology() == ptFFF) ? _L("Save G-code file as:") : _devL("Save SLA file as:"),
wxFileDialog dlg(this, (printer_technology() == ptFFF) ? _L("Save G-code file as:") : _L("Save SLA file as:"),
start_dir,
from_path(default_output_file.filename()),
GUI::file_wildcards((printer_technology() == ptFFF) ? FT_GCODE : FT_SL1, ext),
@ -9999,8 +10000,8 @@ void Plater::export_gcode(bool prefer_removable)
if (dlg.ShowModal() == wxID_OK) {
output_path = into_path(dlg.GetPath());
while (has_illegal_filename_characters(output_path.filename().string())) {
show_error(this, _devL("The provided file name is not valid.") + "\n" +
_devL("The following characters are not allowed by a FAT file system:") + " <>:/\\|?*\"");
show_error(this, _L("The provided file name is not valid.") + "\n" +
_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

@ -91,6 +91,7 @@ void PrinterFileSystem::SetFileType(FileType type, std::string const &storage)
m_file_list.swap(m_file_list_cache[{m_file_type, m_file_storage}]);
m_lock_start = m_lock_end = 0;
BuildGroups();
UpdateGroupSelect();
SendChangedEvent(EVT_FILE_CHANGED);
if (type == F_INVALID_TYPE)
return;
@ -515,10 +516,10 @@ void PrinterFileSystem::Stop(bool quit)
void PrinterFileSystem::BuildGroups()
{
if (m_file_list.empty())
return;
m_group_year.clear();
m_group_month.clear();
if (m_file_list.empty())
return;
wxDateTime t = wxDateTime((time_t) m_file_list.front().time);
m_group_year.push_back(0);
m_group_month.push_back(0);

View file

@ -41,12 +41,14 @@ PrinterWebView::PrinterWebView(wxWindow *parent)
topsizer->Add(m_browser, wxSizerFlags().Expand().Proportion(1));
// Log backend information
/* m_browser->GetUserAgent() may lead crash
if (wxGetApp().get_mode() == comDevelop) {
wxLogMessage(wxWebView::GetBackendVersionInfo().ToString());
wxLogMessage("Backend: %s Version: %s", m_browser->GetClassInfo()->GetClassName(),
wxWebView::GetBackendVersionInfo().ToString());
wxLogMessage("User Agent: %s", m_browser->GetUserAgent());
}
*/
//Zoom
m_zoomFactor = 100;

View file

@ -26,7 +26,7 @@ namespace Slic3r { namespace GUI {
wxDEFINE_EVENT(EVT_SECONDARY_CHECK_CONFIRM, wxCommandEvent);
wxDEFINE_EVENT(EVT_SECONDARY_CHECK_CANCEL, wxCommandEvent);
wxDEFINE_EVENT(EVT_SECONDARY_CHECK_FUNC, wxCommandEvent);
wxDEFINE_EVENT(EVT_SECONDARY_CHECK_DONE, wxCommandEvent);
wxDEFINE_EVENT(EVT_CHECKBOX_CHANGE, wxCommandEvent);
wxDEFINE_EVENT(EVT_ENTER_IP_ADDRESS, wxCommandEvent);
wxDEFINE_EVENT(EVT_CLOSE_IPADDRESS_DLG, wxCommandEvent);
@ -531,10 +531,10 @@ SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, cons
auto bottom_sizer = new wxBoxSizer(wxVERTICAL);
auto sizer_button = new wxBoxSizer(wxHORIZONTAL);
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(0, 137, 123), StateColor::Pressed), std::pair<wxColour, int>(wxColour(38, 166, 154), StateColor::Hovered),
btn_bg_green = StateColor(std::pair<wxColour, int>(wxColour(0, 137, 123), StateColor::Pressed), std::pair<wxColour, int>(wxColour(38, 166, 154), StateColor::Hovered),
std::pair<wxColour, int>(AMS_CONTROL_BRAND_COLOUR, StateColor::Normal));
StateColor btn_bg_white(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Pressed), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
btn_bg_white = StateColor(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Pressed), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
std::pair<wxColour, int>(*wxWHITE, StateColor::Normal));
@ -609,7 +609,7 @@ SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, cons
m_button_fn->SetCornerRadius(FromDIP(12));
m_button_fn->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& e) {
post_event(wxCommandEvent(EVT_SECONDARY_CHECK_FUNC));
post_event(wxCommandEvent(EVT_SECONDARY_CHECK_DONE));
e.Skip();
});
@ -617,14 +617,20 @@ SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, cons
m_button_cancel->Show();
m_button_fn->Hide();
m_button_retry->Hide();
} else if (btn_style == CONFIRM_AND_FUNC) {
} else if (btn_style == CONFIRM_AND_DONE) {
m_button_cancel->Hide();
m_button_fn->Show();
m_button_retry->Hide();
} else if (btn_style == CONFIRM_AND_RETRY) {
m_button_retry->Show();
m_button_cancel->Hide();
} else {
m_button_fn->Hide();
} else if (style == DONE_AND_RETRY) {
m_button_retry->Show();
m_button_fn->Show();
m_button_cancel->Hide();
}
else {
m_button_retry->Hide();
m_button_cancel->Hide();
m_button_fn->Hide();
@ -734,7 +740,7 @@ void SecondaryCheckDialog::update_title_style(wxString title, SecondaryCheckDial
m_button_fn->Hide();
m_button_retry->Hide();
}
else if (style == CONFIRM_AND_FUNC) {
else if (style == CONFIRM_AND_DONE) {
m_button_cancel->Hide();
m_button_fn->Show();
m_button_retry->Hide();
@ -742,6 +748,12 @@ void SecondaryCheckDialog::update_title_style(wxString title, SecondaryCheckDial
else if (style == CONFIRM_AND_RETRY) {
m_button_retry->Show();
m_button_cancel->Hide();
m_button_fn->Hide();
}
else if (style == DONE_AND_RETRY) {
m_button_retry->Show();
m_button_fn->Show();
m_button_cancel->Hide();
}
else {
m_button_retry->Hide();
@ -753,12 +765,6 @@ void SecondaryCheckDialog::update_title_style(wxString title, SecondaryCheckDial
Layout();
}
void SecondaryCheckDialog::update_func_btn(wxString func_btn_text)
{
m_button_fn->SetLabel(func_btn_text);
rescale();
}
void SecondaryCheckDialog::update_btn_label(wxString ok_btn_text, wxString cancel_btn_text)
{
m_button_ok->SetLabel(ok_btn_text);

View file

@ -40,7 +40,7 @@ namespace Slic3r { namespace GUI {
wxDECLARE_EVENT(EVT_SECONDARY_CHECK_CONFIRM, wxCommandEvent);
wxDECLARE_EVENT(EVT_SECONDARY_CHECK_CANCEL, wxCommandEvent);
wxDECLARE_EVENT(EVT_SECONDARY_CHECK_FUNC, wxCommandEvent);
wxDECLARE_EVENT(EVT_SECONDARY_CHECK_DONE, wxCommandEvent);
wxDECLARE_EVENT(EVT_SECONDARY_CHECK_RETRY, wxCommandEvent);
class ReleaseNoteDialog : public DPIDialog
@ -107,9 +107,10 @@ public:
enum ButtonStyle {
ONLY_CONFIRM = 0,
CONFIRM_AND_CANCEL = 1,
CONFIRM_AND_FUNC = 2,
CONFIRM_AND_DONE = 2,
CONFIRM_AND_RETRY = 3,
MAX_STYLE_NUM = 4
DONE_AND_RETRY = 4,
MAX_STYLE_NUM = 5
};
SecondaryCheckDialog(
wxWindow* parent,
@ -126,13 +127,15 @@ public:
void on_hide();
void update_btn_label(wxString ok_btn_text, wxString cancel_btn_text);
void update_title_style(wxString title, SecondaryCheckDialog::ButtonStyle style, wxWindow* parent = nullptr);
void update_func_btn(wxString func_btn_text);
void post_event(wxCommandEvent&& event);
void rescale();
~SecondaryCheckDialog();
void on_dpi_changed(const wxRect& suggested_rect);
void msw_rescale();
StateColor btn_bg_green;
StateColor btn_bg_white;
Label* m_staticText_release_note {nullptr};
wxBoxSizer* m_sizer_main;
wxScrolledWindow *m_vebview_release_note {nullptr};

View file

@ -1918,10 +1918,10 @@ void SelectMachineDialog::update_ams_status_msg(wxString msg, bool is_warning)
} else {
msg = format_text(msg);
auto str_new = msg.ToStdString();
auto str_new = msg.utf8_string();
stripWhiteSpace(str_new);
auto str_old = m_statictext_ams_msg->GetLabel().ToStdString();
auto str_old = m_statictext_ams_msg->GetLabel().utf8_string();
stripWhiteSpace(str_old);
if (str_new != str_old) {
@ -1953,10 +1953,10 @@ void SelectMachineDialog::update_priner_status_msg(wxString msg, bool is_warning
} else {
msg = format_text(msg);
auto str_new = msg.ToStdString();
auto str_new = msg.utf8_string();
stripWhiteSpace(str_new);
auto str_old = m_statictext_printer_msg->GetLabel().ToStdString();
auto str_old = m_statictext_printer_msg->GetLabel().utf8_string();
stripWhiteSpace(str_old);
if (str_new != str_old) {
@ -2286,9 +2286,9 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
for (auto warning : plate->get_slice_result()->warnings) {
if (warning.msg == BED_TEMP_TOO_HIGH_THAN_FILAMENT) {
if ((obj_->get_printer_series() == PrinterSeries::SERIES_X1)) {
confirm_text.push_back(Plater::get_slice_warning_string(warning) + "\n");
has_slice_warnings = true;
if (obj_->is_printer_enclosed()) {
//confirm_text.push_back(Plater::get_slice_warning_string(warning) + "\n");
//has_slice_warnings = true;
}
}
else if (warning.msg == NOT_SUPPORT_TRADITIONAL_TIMELAPSE) {
@ -3046,6 +3046,8 @@ void SelectMachineDialog::on_selection_changed(wxCommandEvent &event)
//reset print status
update_flow_cali_check(obj);
show_status(PrintDialogStatus::PrintStatusInit);
reset_ams_material();
@ -3053,6 +3055,21 @@ void SelectMachineDialog::on_selection_changed(wxCommandEvent &event)
update_show_status();
}
void SelectMachineDialog::update_flow_cali_check(MachineObject* obj)
{
auto bed_type = m_plater->get_partplate_list().get_curr_plate()->get_bed_type(true);
auto show_cali_tips = true;
if (obj && obj->printer_type == "N1") { show_cali_tips = false; }
if (bed_type == BedType::btPTE) {
set_flow_calibration_state(false, show_cali_tips);
}
else {
set_flow_calibration_state(true, show_cali_tips);
}
}
void SelectMachineDialog::update_ams_check(MachineObject* obj)
{
if (obj && obj->is_function_supported(FUNC_USE_AMS)
@ -3442,18 +3459,17 @@ wxImage *SelectMachineDialog::LoadImageFromBlob(const unsigned char *data, int s
return NULL;
}
void SelectMachineDialog::set_flow_calibration_state(bool state)
void SelectMachineDialog::set_flow_calibration_state(bool state, bool show_tips)
{
if (!state) {
m_checkbox_list["flow_cali"]->SetValue(state);
auto tool_tip = _L("Caution to use! Flow calibration on Textured PEI Plate may fail due to the scattered surface.");
m_checkbox_list["flow_cali"]->SetToolTip(tool_tip);
m_checkbox_list["flow_cali"]->Enable();
//m_checkbox_state_list["flow_cali"] = state;
for (auto win : select_flow->GetWindowChildren()) {
win->SetToolTip(tool_tip);
}
select_flow->SetToolTip(tool_tip);
//select_flow->SetToolTip(tool_tip);
}
else {
@ -3466,11 +3482,16 @@ void SelectMachineDialog::set_flow_calibration_state(bool state)
}
m_checkbox_list["flow_cali"]->Enable();
//m_checkbox_state_list["flow_cali"] = state;
for (auto win : select_flow->GetWindowChildren()) {
win->SetToolTip( _L("Automatic flow calibration using Micro Lidar"));
}
}
if (!show_tips) {
for (auto win : select_flow->GetWindowChildren()) {
win->SetToolTip(wxEmptyString);
}
}
}
void SelectMachineDialog::set_default()
@ -3648,6 +3669,11 @@ void SelectMachineDialog::set_default_normal()
item->Bind(wxEVT_LEFT_UP, [this, item, materials, extruder](wxMouseEvent& e) {});
item->Bind(wxEVT_LEFT_DOWN, [this, item, materials, extruder](wxMouseEvent& e) {
DeviceManager* dev_manager = Slic3r::GUI::wxGetApp().getDeviceManager();
if (!dev_manager) return;
MachineObject* curr_obj = dev_manager->get_selected_machine();
MaterialHash::iterator iter = m_materialList.begin();
while (iter != m_materialList.end()) {
int id = iter->first;
@ -3664,29 +3690,25 @@ void SelectMachineDialog::set_default_normal()
auto mouse_pos = ClientToScreen(e.GetPosition());
wxPoint rect = item->ClientToScreen(wxPoint(0, 0));
// update ams data
DeviceManager* dev_manager = Slic3r::GUI::wxGetApp().getDeviceManager();
if (!dev_manager) return;
MachineObject* obj_ = dev_manager->get_selected_machine();
if (obj_ && obj_->is_support_ams_mapping()) {
if (curr_obj && curr_obj->is_support_ams_mapping()) {
if (m_mapping_popup.IsShown()) return;
wxPoint pos = item->ClientToScreen(wxPoint(0, 0));
pos.y += item->GetRect().height;
m_mapping_popup.Move(pos);
if (obj_ &&
obj_->has_ams() &&
if (curr_obj->has_ams() &&
m_checkbox_list["use_ams"]->GetValue() &&
obj_->dev_id == m_printer_last_select)
curr_obj->dev_id == m_printer_last_select)
{
m_mapping_popup.set_parent_item(item);
m_mapping_popup.set_current_filament_id(extruder);
m_mapping_popup.set_tag_texture(materials[extruder]);
m_mapping_popup.update_ams_data(obj_->amsList);
m_mapping_popup.update_ams_data(curr_obj->amsList);
m_mapping_popup.Popup();
}
}
});
});
Material* material_item = new Material();
material_item->id = extruder;
@ -3719,13 +3741,10 @@ void SelectMachineDialog::set_default_normal()
m_scrollable_view->SetMaxSize(m_scrollable_region->GetSize());
//disable pei bed
auto bed_type = m_plater->get_partplate_list().get_curr_plate()->get_bed_type(true);
if (bed_type == BedType::btPTE) {
set_flow_calibration_state(false);
}
else {
set_flow_calibration_state(true);
}
DeviceManager* dev_manager = Slic3r::GUI::wxGetApp().getDeviceManager();
if (!dev_manager) return;
MachineObject* obj_ = dev_manager->get_selected_machine();
update_flow_cali_check(obj_);
wxSize screenSize = wxGetDisplaySize();
auto dialogSize = this->GetSize();

View file

@ -432,6 +432,7 @@ public:
void update_page_turn_state(bool show);
void on_timer(wxTimerEvent& event);
void on_selection_changed(wxCommandEvent& event);
void update_flow_cali_check(MachineObject* obj);
void Enable_Refresh_Button(bool en);
void Enable_Send_Button(bool en);
void on_dpi_changed(const wxRect& suggested_rect) override;
@ -442,7 +443,7 @@ public:
void update_priner_status_msg(wxString msg, bool is_warning = false);
void update_print_status_msg(wxString msg, bool is_warning = false, bool is_printer = true);
void update_print_error_info(int code, std::string msg, std::string extra);
void set_flow_calibration_state(bool state);
void set_flow_calibration_state(bool state, bool show_tips = true);
bool is_show_timelapse();
bool has_timelapse_warning();
void update_timelapse_enable_status();

View file

@ -447,6 +447,30 @@ void PrintingTaskPanel::create_panel(wxWindow* parent)
m_score_staticline->Hide();
sizer->Add(0, 0, 0, wxTOP, FromDIP(15));
sizer->Add(m_score_staticline, 0, wxEXPAND | wxALL, FromDIP(10));
m_request_failed_panel = new wxPanel(parent, wxID_ANY);
m_request_failed_panel->SetBackgroundColour(*wxWHITE);
wxBoxSizer *static_request_failed_panel_sizer = new wxBoxSizer(wxHORIZONTAL);
m_request_failed_info = new wxStaticText(m_request_failed_panel, wxID_ANY, _L("You have completed printing the mall model, \nbut the synchronization of rating information has failed."), wxDefaultPosition, wxDefaultSize, 0);
m_request_failed_info->Wrap(-1);
m_request_failed_info->SetForegroundColour(*wxRED);
m_request_failed_info->SetFont(::Label::Body_10);
static_request_failed_panel_sizer->Add(m_request_failed_info, 0, wxEXPAND | wxALL, FromDIP(10));
StateColor btn_bg_green(std::pair<wxColour, int>(AMS_CONTROL_DISABLE_COLOUR, StateColor::Disabled), std::pair<wxColour, int>(wxColour(27, 136, 68), StateColor::Pressed),
std::pair<wxColour, int>(wxColour(61, 203, 115), StateColor::Hovered), std::pair<wxColour, int>(AMS_CONTROL_BRAND_COLOUR, StateColor::Normal));
StateColor btn_bd_green(std::pair<wxColour, int>(AMS_CONTROL_WHITE_COLOUR, StateColor::Disabled), std::pair<wxColour, int>(AMS_CONTROL_BRAND_COLOUR, StateColor::Enabled));
m_button_market_retry = new Button(m_request_failed_panel, _L("Retry"));
m_button_market_retry->SetBackgroundColor(btn_bg_green);
m_button_market_retry->SetBorderColor(btn_bd_green);
m_button_market_retry->SetTextColor(wxColour("#FFFFFE"));
m_button_market_retry->SetSize(wxSize(FromDIP(128), FromDIP(26)));
m_button_market_retry->SetMinSize(wxSize(-1, FromDIP(26)));
m_button_market_retry->SetCornerRadius(FromDIP(13));
static_request_failed_panel_sizer->Add(0, 0, 1, wxEXPAND, 0);
static_request_failed_panel_sizer->Add(m_button_market_retry, 0, wxEXPAND | wxALL, FromDIP(10));
m_request_failed_panel->SetSizer(static_request_failed_panel_sizer);
m_request_failed_panel->Hide();
sizer->Add(m_request_failed_panel, 0, wxEXPAND | wxALL, FromDIP(10));
m_score_subtask_info = new wxPanel(parent, wxID_ANY);
m_score_subtask_info->SetBackgroundColour(*wxWHITE);
@ -486,10 +510,6 @@ void PrintingTaskPanel::create_panel(wxWindow* parent)
static_score_star_sizer->Add(m_score_star[i], 0, wxEXPAND | wxLEFT, FromDIP(10));
}
StateColor btn_bg_green(std::pair<wxColour, int>(AMS_CONTROL_DISABLE_COLOUR, StateColor::Disabled), std::pair<wxColour, int>(wxColour(27, 136, 68), StateColor::Pressed),
std::pair<wxColour, int>(wxColour(61, 203, 115), StateColor::Hovered), std::pair<wxColour, int>(AMS_CONTROL_BRAND_COLOUR, StateColor::Normal));
StateColor btn_bd_green(std::pair<wxColour, int>(AMS_CONTROL_WHITE_COLOUR, StateColor::Disabled), std::pair<wxColour, int>(AMS_CONTROL_BRAND_COLOUR, StateColor::Enabled));
m_button_market_scoring = new Button(m_score_subtask_info, _L("Rate"));
m_button_market_scoring->SetBackgroundColor(btn_bg_green);
m_button_market_scoring->SetBorderColor(btn_bd_green);
@ -1625,6 +1645,7 @@ StatusPanel::StatusPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, co
m_project_task_panel->get_pause_resume_button()->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_subtask_pause_resume), NULL, this);
m_project_task_panel->get_abort_button()->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_subtask_abort), NULL, this);
m_project_task_panel->get_market_scoring_button()->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_market_scoring), NULL, this);
m_project_task_panel->get_market_retry_buttom()->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_market_retry), NULL, this);
m_project_task_panel->get_clean_button()->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_print_error_clean), NULL, this);
m_setting_button->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(StatusPanel::on_camera_enter), NULL, this);
@ -1659,7 +1680,7 @@ StatusPanel::StatusPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, co
Bind(EVT_AMS_GUIDE_WIKI, &StatusPanel::on_ams_guide, this);
Bind(EVT_AMS_RETRY, &StatusPanel::on_ams_retry, this);
Bind(EVT_FAN_CHANGED, &StatusPanel::on_fan_changed, this);
Bind(EVT_SECONDARY_CHECK_FUNC, &StatusPanel::on_print_error_func, this);
Bind(EVT_SECONDARY_CHECK_DONE, &StatusPanel::on_print_error_done, this);
m_switch_speed->Connect(wxEVT_LEFT_DOWN, wxCommandEventHandler(StatusPanel::on_switch_speed), NULL, this);
m_calibration_btn->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_start_calibration), NULL, this);
@ -1673,6 +1694,7 @@ StatusPanel::~StatusPanel()
m_project_task_panel->get_pause_resume_button()->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_subtask_pause_resume), NULL, this);
m_project_task_panel->get_abort_button()->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_subtask_abort), NULL, this);
m_project_task_panel->get_market_scoring_button()->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_market_scoring), NULL, this);
m_project_task_panel->get_market_retry_buttom()->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_market_retry), NULL, this);
m_project_task_panel->get_clean_button()->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_print_error_clean), NULL, this);
m_setting_button->Disconnect(wxEVT_LEFT_DOWN, wxMouseEventHandler(StatusPanel::on_camera_enter), NULL, this);
@ -1735,16 +1757,19 @@ void StatusPanel::init_scaled_buttons()
}
void StatusPanel::on_market_scoring(wxCommandEvent &event) {
if (obj && obj->get_modeltask() && obj->get_modeltask()->design_id > 0 && m_rating_result.contains("id")) { // model is mall model and has rating_id
if (m_score_data && m_score_data->rating_id == m_rating_result["id"].get<unsigned int>()) { // current score data for model is same as mall model
if (obj && obj->is_makeworld_subtask() && obj->rating_info && obj->rating_info->request_successful) { // model is mall model and has rating_id
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": on_market_scoring" ;
if (m_score_data && m_score_data->rating_id == obj->rating_info->rating_id) { // current score data for model is same as mall model
if (m_score_data->star_count != m_project_task_panel->get_star_count()) m_score_data->star_count = m_project_task_panel->get_star_count();
ScoreDialog m_score_dlg(this, m_score_data);
int ret = m_score_dlg.ShowModal();
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": old data";
if (ret == wxID_OK) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": old data is upload";
m_score_data->rating_id = -1;
m_project_task_panel->set_star_count_dirty(false);
m_print_finish = false;
if (obj) obj->get_model_mall_result_need_retry = true;
return;
}
if (m_score_data != nullptr) {
@ -1754,35 +1779,26 @@ void StatusPanel::on_market_scoring(wxCommandEvent &event) {
m_score_data = new ScoreData(m_score_dlg.get_score_data()); // when user do not submit score, store the data for next opening the score dialog
m_project_task_panel->set_star_count(m_score_data->star_count);
} else {
//to do: if user has rated the model, show the comment on the dialog
int star_count = 0;
if (m_rating_result.contains("content"))
star_count = m_project_task_panel->get_star_count_dirty() ? m_project_task_panel->get_star_count() : m_rating_result["score"].get<int>();
bool success_print = true;
if (m_rating_result.contains("successPrinted"))
success_print = m_rating_result["successPrinted"].get<bool>();
ScoreDialog m_score_dlg(this, obj->get_modeltask()->design_id, obj->get_modeltask()->model_id, obj->get_modeltask()->profile_id,
m_rating_result["id"].get<unsigned int>(), success_print, star_count);
int star_count = m_project_task_panel->get_star_count_dirty() ? m_project_task_panel->get_star_count() : obj->rating_info->start_count;
bool success_print = obj->rating_info->success_printed;
ScoreDialog m_score_dlg(this, obj->get_modeltask()->design_id, obj->get_modeltask()->model_id, obj->get_modeltask()->profile_id, obj->rating_info->rating_id,
success_print, star_count);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": new data";
std::string comment = obj->rating_info->content;
if (!comment.empty()) { m_score_dlg.set_comment(comment); }
if (m_rating_result.contains("content")) {
std::string comment = m_rating_result["content"].get<std::string>();
if (!comment.empty()) {
m_score_dlg.set_comment(comment);
}
}
if (m_rating_result.contains("images")) {
std::vector<std::string> images_json_array;
images_json_array = m_rating_result["images"].get<std::vector<std::string>>();
m_score_dlg.set_cloud_bitmap(images_json_array);
}
std::vector<std::string> images_json_array;
images_json_array = obj->rating_info->image_url_paths;
if (!images_json_array.empty()) m_score_dlg.set_cloud_bitmap(images_json_array);
int ret = m_score_dlg.ShowModal();
if (ret == wxID_OK) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": new data is upload";
m_score_data->rating_id = -1;
m_project_task_panel->set_star_count_dirty(false);
m_print_finish = false;
if (obj) obj->get_model_mall_result_need_retry = true;
return;
}
if (m_score_data != nullptr) {
@ -1792,8 +1808,15 @@ void StatusPanel::on_market_scoring(wxCommandEvent &event) {
m_score_data = new ScoreData(m_score_dlg.get_score_data());
m_project_task_panel->set_star_count(m_score_data->star_count);
}
}
}
void StatusPanel::on_market_retry(wxCommandEvent &event)
{
if (obj) {
obj->get_model_mall_result_need_retry = true;
} else {
BOOST_LOG_TRIVIAL(info)<< __FUNCTION__ << "retury failed";
}
}
@ -1898,6 +1921,7 @@ bool StatusPanel::is_task_changed(MachineObject* obj)
last_profile_id = obj->profile_id_;
last_task_id = obj->task_id_;
request_model_info_flag = false;
m_project_task_panel->set_star_count_dirty(false);
return true;
}
return false;
@ -2026,9 +2050,12 @@ void StatusPanel::show_error_message(MachineObject* obj, wxString msg, std::stri
if (m_print_error_dlg == nullptr) {
m_print_error_dlg = new SecondaryCheckDialog(this->GetParent(), wxID_ANY, _L("Warning"), SecondaryCheckDialog::ButtonStyle::ONLY_CONFIRM);
}
if (it_done != message_containing_done.end()) {
m_print_error_dlg->update_func_btn(_L("Done"));
m_print_error_dlg->update_title_style(_L("Warning"), SecondaryCheckDialog::ButtonStyle::CONFIRM_AND_FUNC, this);
if (it_done != message_containing_done.end() && it_retry != message_containing_retry.end()) {
m_print_error_dlg->update_title_style(_L("Warning"), SecondaryCheckDialog::ButtonStyle::DONE_AND_RETRY, this);
}
else if (it_done != message_containing_done.end()) {
m_print_error_dlg->update_title_style(_L("Warning"), SecondaryCheckDialog::ButtonStyle::CONFIRM_AND_DONE, this);
}
else if (it_retry != message_containing_retry.end()) {
m_print_error_dlg->update_title_style(_L("Warning"), SecondaryCheckDialog::ButtonStyle::CONFIRM_AND_RETRY, this);
@ -2411,13 +2438,7 @@ void StatusPanel::update_ams(MachineObject *obj)
m_ams_control->SetAmsModel(ams_mode, ams_mode);
show_ams_group(true);
if (!is_support_filament_backup || !obj->ams_support_auto_switch_filament_flag) {
m_ams_control->show_auto_refill(false);
}
else {
m_ams_control->show_auto_refill(true);
}
m_ams_control->show_auto_refill(true);
}
@ -2732,7 +2753,6 @@ void StatusPanel::update_model_info()
if (wxGetApp().getAgent() && obj) {
BBLSubTask* curr_task = obj->get_subtask();
if (curr_task) {
BBLModelTask* curr_model_task = obj->get_modeltask();
@ -2767,6 +2787,7 @@ void StatusPanel::update_subtask(MachineObject *obj)
} else if (obj->is_in_printing() || obj->print_status == "FINISH") {
if (obj->is_in_prepare() || obj->print_status == "SLICING") {
m_project_task_panel->market_scoring_hide();
m_project_task_panel->get_request_failed_panel()->Hide();
m_project_task_panel->enable_abort_button(false);
m_project_task_panel->enable_pause_resume_button(false, "pause_disable");
wxString prepare_text;
@ -2801,78 +2822,56 @@ void StatusPanel::update_subtask(MachineObject *obj)
else {
m_project_task_panel->show_profile_info(false);
}
update_basic_print_data(false);
} else {
if (obj->can_resume()) {
m_project_task_panel->enable_pause_resume_button(true, "resume");
} else {
m_project_task_panel->enable_pause_resume_button(true, "pause");
}
if (obj->print_status == "FINISH") {
if (obj->is_printing_finished()) {
obj->update_model_task();
m_project_task_panel->enable_abort_button(false);
m_project_task_panel->enable_pause_resume_button(false, "resume_disable");
if (wxGetApp().has_model_mall()) {
//determine whether the model is mall model
bool is_market_task = obj->get_modeltask() && obj->get_modeltask()->design_id > 0;
if (is_market_task) {
NetworkAgent *agent = wxGetApp().getAgent();
if (agent && IsShownOnScreen() && !m_print_finish) {
int job_id = obj->get_modeltask()->job_id;
boost::thread([this, agent, job_id] {
try {
std::string rating_result;
unsigned int http_code = 0;
std::string http_error;
int rating_id = -1;
int res = agent->get_model_mall_rating_result(job_id, rating_result, http_code, http_error);
if (0 == res) {
m_rating_result = json::parse(rating_result);
if (m_rating_result.contains("id")) {
rating_id = m_rating_result["id"].get<unsigned int>();
m_project_task_panel->market_scoring_show();
BOOST_LOG_TRIVIAL(info) << "show scoring page";
bool is_update = model_score_is_update();
// this mall model has score, user do not click star, Initialize scores only once per print startup program
if (is_update ||
(!m_project_task_panel->get_star_count_dirty() && !m_print_finish && IsShownOnScreen() && m_rating_result.contains("score"))) {
int star_count = m_rating_result["score"].get<int>();
m_project_task_panel->set_star_count(star_count);
BOOST_LOG_TRIVIAL(info) << "Initialize scores";
m_project_task_panel->set_star_count_dirty(true);
m_print_finish = true;
if (0 != star_count) {
m_project_task_panel->get_market_scoring_button()->Enable(true);
m_project_task_panel->set_has_reted_text(true);
} else {
m_project_task_panel->set_has_reted_text(false);
}
}
}
}
} catch (...) {
m_project_task_panel->market_scoring_hide();
BOOST_LOG_TRIVIAL(info) << "get mall model rating id failed and hide scoring page";
}
});
// is makeworld subtask
if (wxGetApp().has_model_mall() && obj->is_makeworld_subtask()) {
// has model mall rating result
if (obj && obj->rating_info && obj->rating_info->request_successful) {
m_project_task_panel->get_request_failed_panel()->Hide();
BOOST_LOG_TRIVIAL(info) << "model mall result request successful";
// has start count
if (!m_project_task_panel->get_star_count_dirty()) {
if (obj->rating_info->start_count > 0) {
m_project_task_panel->set_star_count(obj->rating_info->start_count);
m_project_task_panel->set_star_count_dirty(true);
BOOST_LOG_TRIVIAL(info) << "Initialize scores";
m_project_task_panel->get_market_scoring_button()->Enable(true);
m_project_task_panel->set_has_reted_text(true);
} else {
m_project_task_panel->set_star_count(0);
m_project_task_panel->set_star_count_dirty(false);
m_project_task_panel->get_market_scoring_button()->Enable(false);
m_project_task_panel->set_has_reted_text(false);
}
}
m_project_task_panel->market_scoring_show();
} else if (obj && obj->rating_info && !obj->rating_info->request_successful) {
BOOST_LOG_TRIVIAL(info) << "model mall result request failed";
if (403 != obj->rating_info->http_code) {
BOOST_LOG_TRIVIAL(info) << "Request need retry";
m_project_task_panel->get_market_retry_buttom()->Enable(!obj->get_model_mall_result_need_retry);
m_project_task_panel->get_request_failed_panel()->Show();
} else {
BOOST_LOG_TRIVIAL(info) << "Request rejected";
}
BOOST_LOG_TRIVIAL(info) << "SHOW_SCORE_BTU: design_id [" << obj->get_modeltask()->design_id << "] print_finish [" << m_print_finish << "]";
} else { // model is not mall model. hide scoring page
m_project_task_panel->market_scoring_hide();
}
} else { // have no model mall, hide scoring page
} else {
m_project_task_panel->market_scoring_hide();
}
} else { // model printing is not finished, hide scoring page
m_project_task_panel->enable_abort_button(true);
m_project_task_panel->market_scoring_hide();
if (m_print_finish) {
m_print_finish = false;
}
m_project_task_panel->get_request_failed_panel()->Hide();
}
// update printing stage
@ -2913,21 +2912,6 @@ void StatusPanel::update_subtask(MachineObject *obj)
this->Layout();
}
bool StatusPanel::model_score_is_update()
{
try {
if (m_last_result["id"] != m_rating_result["id"] || m_last_result["content"] != m_rating_result["content"] || m_last_result["images"] != m_rating_result["images"]) {
m_last_result = m_rating_result;
return true;
}
} catch (...) {
BOOST_LOG_TRIVIAL(info) << "m_last_result first initial";
m_last_result = m_rating_result;
}
return false;
}
void StatusPanel::update_cloud_subtask(MachineObject *obj)
{
if (!obj) return;
@ -2990,6 +2974,7 @@ void StatusPanel::reset_printing_values()
m_project_task_panel->market_scoring_hide();
m_project_task_panel->get_request_failed_panel()->Hide();
update_basic_print_data(false);
m_project_task_panel->update_left_time(NA_STR);
m_project_task_panel->update_layers_num(true, wxString::Format(_L("Layer: %s"), NA_STR));
@ -3558,9 +3543,9 @@ void StatusPanel::on_ams_retry(wxCommandEvent& event)
}
}
void StatusPanel::on_print_error_func(wxCommandEvent& event)
void StatusPanel::on_print_error_done(wxCommandEvent& event)
{
BOOST_LOG_TRIVIAL(info) << "on_print_error_func";
BOOST_LOG_TRIVIAL(info) << "on_print_error_done";
if (obj) {
obj->command_ams_control("done");
if (m_print_error_dlg) {
@ -3928,10 +3913,6 @@ void StatusPanel::show_status(int status)
}
}
void StatusPanel::set_print_finish_status(bool is_finish) {
m_print_finish = is_finish;
}
void StatusPanel::set_hold_count(int& count)
{
if (obj) {
@ -4172,7 +4153,7 @@ std::pair<wxStaticBitmap *, ScoreDialog::ImageMsg> ScoreDialog::create_local_thu
bitmap_to_image_msg.first = imageCtrl;
bitmap_to_image_msg.second = cur_image_msg;
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": local picture is download";
return bitmap_to_image_msg;
}
@ -4215,7 +4196,7 @@ std::pair<wxStaticBitmap *, ScoreDialog::ImageMsg> ScoreDialog::create_oss_thumb
bitmap_to_image_msg.first = imageCtrl;
bitmap_to_image_msg.second = cur_image_msg;
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": oss picture is download";
return bitmap_to_image_msg;
}
@ -4386,7 +4367,7 @@ wxBoxSizer *ScoreDialog::get_photo_btn_sizer() {
m_add_photo->Bind(wxEVT_LEFT_DOWN, [this](auto &e) {
// add photo logic
wxFileDialog openFileDialog(this, "Select Images", "", "", "Image files (*.png;*.jpg)|*.png;*.jpg", wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE);
wxFileDialog openFileDialog(this, "Select Images", "", "", "Image files (*.png;*.jpg;*jpeg)|*.png;*.jpg;*.jpeg", wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE);
if (openFileDialog.ShowModal() == wxID_CANCEL) return;
@ -4471,6 +4452,7 @@ wxBoxSizer *ScoreDialog::get_button_sizer()
}
std::set<std::pair<wxStaticBitmap *, wxString>> need_upload_images = add_need_upload_imgs();
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": get need upload picture count: " << need_upload_images.size();
std::string comment = into_u8(m_comment_text->GetValue());
unsigned int http_code;
@ -4482,6 +4464,7 @@ wxBoxSizer *ScoreDialog::get_button_sizer()
int ret = wxGetApp().getAgent()->get_oss_config(config, wxGetApp().app_config->get_country_code(), http_code, http_error);
if (ret == -1) {
error_info += into_u8(_L("Get oss config failed.")) + "\n\thttp code: " + std::to_string(http_code) + "\n\thttp error: " + http_error;
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": get oss config filed and http_error: " << http_error;
m_upload_status_code = StatusCode::UPLOAD_EXIST_ISSUE;
}
if (m_upload_status_code == StatusCode::UPLOAD_PROGRESS) {
@ -4569,6 +4552,7 @@ wxBoxSizer *ScoreDialog::get_button_sizer()
_L("Your comment result cannot be uploaded due to some reasons. As follows:\n\n error code: ") + std::to_string(http_code) +
"\n " + _L("error message: ") + http_error + _L("\n\nWould you like to redirect to the webpage for rating?"),
wxString(_L("info")), wxOK | wxNO | wxCENTER);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": upload rating picture failed and http error" << http_error;
if (dlg_info->ShowModal() == wxID_OK) {
market_model_scoring_page(m_design_id);
EndModal(wxID_OK);
@ -4579,6 +4563,7 @@ wxBoxSizer *ScoreDialog::get_button_sizer()
} else if (m_upload_status_code == StatusCode::UPLOAD_IMG_FAILED) {
MessageDialog *dlg_info = new MessageDialog(this, _L("Some of your images failed to upload. Would you like to redirect to the webpage for rating?"),
wxString(_L("info")), wxOK | wxNO | wxCENTER);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": upload rating picture failed or get oss config failed";
if (dlg_info->ShowModal() == wxID_OK) {
market_model_scoring_page(m_design_id);
EndModal(wxID_OK);

View file

@ -182,6 +182,7 @@ private:
wxStaticText * m_staticText_progress_end;
wxStaticText* m_staticText_layers;
wxStaticText * m_has_rated_prompt;
wxStaticText * m_request_failed_info;
wxStaticBitmap* m_bitmap_thumbnail;
wxStaticBitmap* m_bitmap_static_use_time;
wxStaticBitmap* m_bitmap_static_use_weight;
@ -189,8 +190,10 @@ private:
ScalableButton* m_button_abort;
Button* m_button_market_scoring;
Button* m_button_clean;
Button * m_button_market_retry;
wxPanel * m_score_subtask_info;
wxPanel * m_score_staticline;
wxPanel * m_request_failed_panel;
// score page
int m_star_count;
std::vector<ScalableButton *> m_score_star;
@ -226,8 +229,10 @@ public:
ScalableButton* get_abort_button() {return m_button_abort;};
ScalableButton* get_pause_resume_button() {return m_button_pause_resume;};
Button* get_market_scoring_button() {return m_button_market_scoring;};
Button * get_market_retry_buttom() { return m_button_market_retry; };
Button* get_clean_button() {return m_button_clean;};
wxStaticBitmap* get_bitmap_thumbnail() {return m_bitmap_thumbnail;};
wxPanel * get_request_failed_panel() { return m_request_failed_panel; }
int get_star_count() { return m_star_count; }
void set_star_count(int star_count);
std::vector<ScalableButton *> &get_score_star() { return m_score_star; }
@ -465,10 +470,9 @@ protected:
int m_last_timelapse = -1;
int m_last_extrusion = -1;
int m_last_vcamera = -1;
int m_model_mall_request_count = 0;
bool m_is_load_with_temp = false;
bool m_print_finish = false;
json m_rating_result;
json m_last_result;
wxWebRequest web_request;
bool bed_temp_input = false;
@ -492,6 +496,7 @@ protected:
void update_tasklist_info();
void on_market_scoring(wxCommandEvent &event);
void on_market_retry(wxCommandEvent &event);
void on_subtask_pause_resume(wxCommandEvent &event);
void on_subtask_abort(wxCommandEvent &event);
void on_print_error_clean(wxCommandEvent &event);
@ -534,7 +539,7 @@ protected:
void on_ams_selected(wxCommandEvent &event);
void on_ams_guide(wxCommandEvent &event);
void on_ams_retry(wxCommandEvent &event);
void on_print_error_func(wxCommandEvent& event);
void on_print_error_done(wxCommandEvent& event);
void on_fan_changed(wxCommandEvent& event);
void on_cham_temp_kill_focus(wxFocusEvent& event);
@ -579,9 +584,6 @@ protected:
void on_webrequest_state(wxWebRequestEvent &evt);
bool is_task_changed(MachineObject* obj);
/* model mall score */
bool model_score_is_update();
/* camera */
void update_camera_state(MachineObject* obj);
bool show_vcamera = false;
@ -625,7 +627,6 @@ public:
void set_default();
void show_status(int status);
void set_print_finish_status(bool is_finish);
void set_hold_count(int& count);
void rescale_camera_icons();

View file

@ -2098,7 +2098,7 @@ void TabPrint::build()
optgroup = page->new_optgroup(L("Special mode"), L"param_special");
optgroup->append_single_option_line("slicing_mode");
optgroup->append_single_option_line("print_sequence");
optgroup->append_single_option_line("print_sequence", "sequent-print");
optgroup->append_single_option_line("spiral_mode", "spiral-vase");
optgroup->append_single_option_line("timelapse_type", "Timelapse");
@ -2726,7 +2726,7 @@ void TabFilament::build()
optgroup = page->new_optgroup(L("Print temperature"), L"param_temperature");
optgroup->append_single_option_line("chamber_temperature");
optgroup->append_single_option_line("chamber_temperature","chamber-temperature");
optgroup->append_separator();