mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-12-26 17:48:35 -07:00
NEW: add some filament check supports for printers
JIRA: [STUDIO-12604] Change-Id: Ic0e7b517319621907c3c6b8ad82dbcf881c780e8 (cherry picked from commit 55a8c98e9125cdacc801ecebfd82acdcc3e8e7f7)
This commit is contained in:
parent
6f7704470f
commit
a339677d08
10 changed files with 164 additions and 236 deletions
|
|
@ -5,22 +5,26 @@
|
|||
{
|
||||
"type": "TPU",
|
||||
"action": "prohibition",
|
||||
"description": "TPU: not supported"
|
||||
"slot": "ams",
|
||||
"description": "TPU is not supported by AMS."
|
||||
},
|
||||
{
|
||||
"type": "PVA",
|
||||
"action": "warning",
|
||||
"description": "PVA: flexible"
|
||||
"slot": "ams",
|
||||
"description": "Damp PVA will become flexible and get stuck inside AMS, please take care to dry it before use."
|
||||
},
|
||||
{
|
||||
"type_suffix": "CF",
|
||||
"action": "warning",
|
||||
"description": "CF/GF: hard and brittle"
|
||||
"slot": "ams",
|
||||
"description": "CF/GF filaments are hard and brittle, it's easy to break or get stuck in AMS, please use with caution."
|
||||
},
|
||||
{
|
||||
"type_suffix": "GF",
|
||||
"action": "warning",
|
||||
"description": "CF/GF: hard and brittle"
|
||||
"slot": "ams",
|
||||
"description": "CF/GF filaments are hard and brittle, it's easy to break or get stuck in AMS, please use with caution."
|
||||
},
|
||||
{
|
||||
"vendor": "Bambu Lab",
|
||||
|
|
@ -28,7 +32,8 @@
|
|||
"name": "PLA Glow",
|
||||
"model_id":["N1","N2S"],
|
||||
"action": "warning",
|
||||
"description": "PLA-Glow"
|
||||
"slot": "ams",
|
||||
"description": "The rough surface of PLA Glow can accelerate wear on the AMS system, particularly on the internal components of the AMS Lite."
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
02.00.00.24
|
||||
02.00.00.25
|
||||
|
|
@ -7859,31 +7859,23 @@ void DeviceManager::OnSelectedMachineLost() {
|
|||
GUI::wxGetApp().sidebar().load_ams_list(string(), nullptr);
|
||||
}
|
||||
|
||||
// moved from tao.wang and zhimin.zeng
|
||||
void check_filaments_for_ams_slot(std::string model_id,
|
||||
std::string tag_vendor,
|
||||
std::string tag_type,
|
||||
int ams_id,
|
||||
int slot_id,
|
||||
std::string tag_name,
|
||||
bool& in_blacklist,
|
||||
std::string& ac,
|
||||
wxString& info)
|
||||
|
||||
void check_filaments(std::string model_id,
|
||||
std::string tag_vendor,
|
||||
std::string tag_type,
|
||||
int ams_id,
|
||||
int slot_id,
|
||||
std::string tag_name,
|
||||
bool& in_blacklist,
|
||||
std::string& ac,
|
||||
wxString& info,
|
||||
wxString& wiki_url)
|
||||
{
|
||||
if (tag_name.empty())
|
||||
{
|
||||
tag_name = DeviceManager::get_filament_name_from_ams(ams_id, slot_id);
|
||||
}
|
||||
|
||||
std::unordered_map<std::string, wxString> blacklist_prompt =
|
||||
{
|
||||
{"TPU: not supported", _L("TPU is not supported by AMS.")},
|
||||
{"Bambu CF: not supported", _L("Bambu PET-CF/PA6-CF/PPA-CF/PPS-CF is not supported by AMS.")},
|
||||
{"PVA: flexible", _L("Damp PVA will become flexible and get stuck inside AMS, please take care to dry it before use.")},
|
||||
{"CF/GF: hard and brittle", _L("CF/GF filaments are hard and brittle, it's easy to break or get stuck in AMS, please use with caution.")},
|
||||
{"PLA-Glow", _L("The rough surface of PLA Glow can accelerate wear on the AMS system, particularly on the internal components of the AMS Lite.")}
|
||||
};
|
||||
|
||||
in_blacklist = false;
|
||||
|
||||
std::transform(tag_vendor.begin(), tag_vendor.end(), tag_vendor.begin(), ::tolower);
|
||||
|
|
@ -7896,6 +7888,7 @@ void check_filaments_for_ams_slot(std::string model_id,
|
|||
std::string type = filament_item.contains("type") ? filament_item["type"].get<std::string>() : "";
|
||||
std::string type_suffix = filament_item.contains("type_suffix") ? filament_item["type_suffix"].get<std::string>() : "";
|
||||
std::string name = filament_item.contains("name") ? filament_item["name"].get<std::string>() : "";
|
||||
std::string slot = filament_item.contains("slot") ? filament_item["slot"].get<std::string>() : "";
|
||||
std::vector<std::string> model_ids = filament_item.contains("model_id") ? filament_item["model_id"].get<std::vector<std::string>>() : std::vector<std::string>();
|
||||
std::string action = filament_item.contains("action") ? filament_item["action"].get<std::string>() : "";
|
||||
std::string description = filament_item.contains("description") ? filament_item["description"].get<std::string>() : "";
|
||||
|
|
@ -7929,14 +7922,35 @@ void check_filaments_for_ams_slot(std::string model_id,
|
|||
std::transform(name.begin(), name.end(), name.begin(), ::tolower);
|
||||
if (!name.empty() && (name != tag_name)) { continue;}
|
||||
|
||||
// check loc
|
||||
if (!slot.empty()) {
|
||||
bool is_virtual_slot = DeviceManager::is_virtual_slot(ams_id);
|
||||
bool check_virtual_slot = (slot == "ext");
|
||||
bool check_ams_slot = (slot == "ams");
|
||||
if (is_virtual_slot && !check_virtual_slot) {
|
||||
continue;
|
||||
} else if (!is_virtual_slot && !check_ams_slot) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (GUI::wxGetApp().app_config->get("skip_ams_blacklist_check") == "true") {
|
||||
action = "warning";
|
||||
}
|
||||
|
||||
in_blacklist = true;
|
||||
ac = action;
|
||||
info = blacklist_prompt[description];
|
||||
info = _L(description);
|
||||
wiki_url = filament_item.contains("wiki") ? filament_item["wiki"].get<std::string>() : "";
|
||||
return;
|
||||
|
||||
// Using in description
|
||||
L("TPU is not supported by AMS.");
|
||||
L("Damp PVA will become flexible and get stuck inside AMS, please take care to dry it before use.");
|
||||
L("The rough surface of PLA Glow can accelerate wear on the AMS system, particularly on the internal components of the AMS Lite.");
|
||||
L("CF/GF filaments are hard and brittle, it's easy to break or get stuck in AMS, please use with caution.");
|
||||
L("PPS-CF is brittle and could break in bended PTFE tube above Toolhead.");
|
||||
L("PPA-CF is brittle and could break in bended PTFE tube above Toolhead.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -7954,17 +7968,23 @@ void DeviceManager::check_filaments_in_blacklist(std::string model_id,
|
|||
std::string &ac,
|
||||
wxString &info)
|
||||
{
|
||||
if (ams_id < 0 || slot_id < 0) {
|
||||
wxString wiki_url;
|
||||
check_filaments_in_blacklist_url(model_id, tag_vendor, tag_type, filament_id, ams_id, slot_id, tag_name, in_blacklist, ac, info, wiki_url);
|
||||
}
|
||||
|
||||
void DeviceManager::check_filaments_in_blacklist_url(std::string model_id, std::string tag_vendor, std::string tag_type, const std::string& filament_id, int ams_id, int slot_id, std::string tag_name, bool& in_blacklist, std::string& ac, wxString& info, wxString& wiki_url)
|
||||
{
|
||||
if (ams_id < 0 || slot_id < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!check_filaments_printable(tag_vendor, tag_type, filament_id, ams_id, in_blacklist, ac, info)) {
|
||||
if (!check_filaments_printable(tag_vendor, tag_type, filament_id, ams_id, in_blacklist, ac, info))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!DeviceManager::is_virtual_slot(ams_id)) {
|
||||
check_filaments_for_ams_slot(model_id, tag_vendor, tag_type, ams_id, slot_id, tag_name, in_blacklist, ac, info);
|
||||
}
|
||||
check_filaments(model_id, tag_vendor, tag_type, ams_id, slot_id, tag_name, in_blacklist, ac, info, wiki_url);
|
||||
}
|
||||
|
||||
std::string DeviceManager::load_gcode(std::string type_str, std::string gcode_file)
|
||||
|
|
|
|||
|
|
@ -1510,6 +1510,7 @@ public:
|
|||
static std::vector<std::string> get_compatible_machine(std::string type_str);
|
||||
static std::vector<std::string> get_unsupport_auto_cali_filaments(std::string type_str);
|
||||
static void check_filaments_in_blacklist(std::string model_id, std::string tag_vendor, std::string tag_type, const std::string& filament_id, int ams_id, int slot_id, std::string tag_name, bool &in_blacklist, std::string &ac, wxString &info);
|
||||
static void check_filaments_in_blacklist_url(std::string model_id, std::string tag_vendor, std::string tag_type, const std::string& filament_id, int ams_id, int slot_id, std::string tag_name, bool& in_blacklist, std::string& ac, wxString& info, wxString& wiki_url);
|
||||
static boost::bimaps::bimap<std::string, std::string> get_all_model_id_with_name();
|
||||
static std::string load_gcode(std::string type_str, std::string gcode_file);
|
||||
static bool is_virtual_slot(int ams_id);
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ void PrePrintChecker::clear()
|
|||
filamentList.clear();
|
||||
}
|
||||
|
||||
void PrePrintChecker::add(PrintDialogStatus state, wxString msg, wxString tip)
|
||||
void PrePrintChecker::add(PrintDialogStatus state, wxString msg, wxString tip, const wxString& wiki_url)
|
||||
{
|
||||
prePrintInfo info;
|
||||
|
||||
|
|
@ -124,12 +124,18 @@ void PrePrintChecker::add(PrintDialogStatus state, wxString msg, wxString tip)
|
|||
info.tips = wxEmptyString;
|
||||
}
|
||||
|
||||
info.wiki_url = wiki_url;
|
||||
|
||||
switch (info.type) {
|
||||
case prePrintInfoType::Filament:
|
||||
filamentList.push_back(info);
|
||||
if (std::find(filamentList.begin(), filamentList.end(), info) == filamentList.end()) {
|
||||
filamentList.push_back(info);
|
||||
}
|
||||
break;
|
||||
case prePrintInfoType::Printer:
|
||||
printerList.push_back(info);
|
||||
if (std::find(printerList.begin(), printerList.end(), info) == printerList.end()) {
|
||||
printerList.push_back(info);
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
|
@ -171,67 +177,61 @@ PrinterMsgPanel::PrinterMsgPanel(wxWindow *parent)
|
|||
this->SetSizer(m_sizer);
|
||||
}
|
||||
|
||||
void PrinterMsgPanel::SetLabelList(const std::vector<wxString> &texts, const wxColour &colour)
|
||||
static wxColour _GetLabelColour(const prePrintInfo& info)
|
||||
{
|
||||
if (texts == m_last_texts)
|
||||
return;
|
||||
|
||||
m_last_texts = texts;
|
||||
m_labels.clear();
|
||||
m_sizer->Clear(true);
|
||||
std::set<wxString> unique_texts;
|
||||
|
||||
for (const wxString &text : texts) {
|
||||
if (text.empty()) {
|
||||
continue;
|
||||
}
|
||||
if (!unique_texts.insert(text).second) {
|
||||
continue;
|
||||
}
|
||||
Label *label = new Label(this);
|
||||
label->SetFont(::Label::Body_13);
|
||||
label->SetForegroundColour(colour);
|
||||
label->SetLabel(text);
|
||||
label->Wrap(this->GetMinSize().GetWidth());
|
||||
label->Show();
|
||||
m_sizer->Add(label, 0, wxBOTTOM, FromDIP(4));
|
||||
m_labels.push_back(label);
|
||||
if (info.level == Error)
|
||||
{
|
||||
return wxColour("#D01B1B");
|
||||
}
|
||||
else if (info.level == Warning)
|
||||
{
|
||||
return wxColour("#FF6F00");
|
||||
}
|
||||
|
||||
return *wxBLACK; // Default colour for normal messages
|
||||
}
|
||||
|
||||
void PrinterMsgPanel::UpdateInfos(const std::vector<prePrintInfo>& infos)
|
||||
{
|
||||
if (m_infos == infos)
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_infos = infos;
|
||||
|
||||
m_sizer->Clear(true);
|
||||
for (const prePrintInfo& info : infos)
|
||||
{
|
||||
if (!info.msg.empty())
|
||||
{
|
||||
Label* label = new Label(this);
|
||||
label->SetFont(::Label::Body_13);
|
||||
label->SetForegroundColour(_GetLabelColour(info));
|
||||
|
||||
|
||||
if (info.wiki_url.empty())
|
||||
{
|
||||
label->SetLabel(info.msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
label->SetLabel(info.msg + " " + _L("Please refer to Wiki before use->"));
|
||||
label->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) { SetCursor(wxCURSOR_HAND); });
|
||||
label->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) { SetCursor(wxCURSOR_ARROW); });
|
||||
label->Bind(wxEVT_LEFT_DOWN, [info](wxMouseEvent& event) { wxLaunchDefaultBrowser(info.wiki_url); });
|
||||
}
|
||||
|
||||
label->Wrap(this->GetMinSize().GetWidth());
|
||||
label->Show();
|
||||
m_sizer->Add(label, 0, wxBOTTOM, FromDIP(4));
|
||||
}
|
||||
}
|
||||
|
||||
this->Show();
|
||||
this->Layout();
|
||||
Fit();
|
||||
}
|
||||
|
||||
//void PrinterMsgPanel::SetLabelSingle(const wxString &texts, const wxColour &colour)
|
||||
//{
|
||||
// Label *label = new Label(this);
|
||||
// label->SetMinSize(wxSize(FromDIP(420), -1));
|
||||
// label->SetMaxSize(wxSize(FromDIP(420), -1));
|
||||
// label->SetFont(::Label::Body_13);
|
||||
// label->SetForegroundColour(colour);
|
||||
// label->SetLabel(texts);
|
||||
// label->Wrap(FromDIP(-1));
|
||||
// label->Show();
|
||||
// m_sizer->Add(label, 0, wxBOTTOM, FromDIP(4));
|
||||
// m_labels.push_back(label);
|
||||
// this->Layout();
|
||||
// Fit();
|
||||
//}
|
||||
|
||||
wxString PrinterMsgPanel::GetLabel() {
|
||||
if (!m_labels.empty() && m_labels[0] != nullptr)
|
||||
return m_labels[0]->GetLabel();
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
||||
|
||||
std::vector<wxString> PrinterMsgPanel::GetLabelList() {
|
||||
if (m_last_texts.empty())
|
||||
wxLogDebug(_L("No labels are currently stored."));
|
||||
return m_last_texts;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -22,7 +22,15 @@ struct prePrintInfo
|
|||
prePrintInfoType type;
|
||||
wxString msg;
|
||||
wxString tips;
|
||||
wxString wiki_url;
|
||||
int index;
|
||||
|
||||
public:
|
||||
bool operator==(const prePrintInfo& other) const {
|
||||
return level == other.level && type == other.type &&
|
||||
msg == other.msg && tips == other.tips &&
|
||||
wiki_url == other.wiki_url && index == other.index;
|
||||
}
|
||||
};
|
||||
|
||||
enum PrintDialogStatus : unsigned int {
|
||||
|
|
@ -119,7 +127,7 @@ public:
|
|||
public:
|
||||
void clear();
|
||||
/*auto merge*/
|
||||
void add(PrintDialogStatus state, wxString msg, wxString tip);
|
||||
void add(PrintDialogStatus state, wxString msg, wxString tip, const wxString& wiki_url);
|
||||
static ::std::string get_print_status_info(PrintDialogStatus status);
|
||||
|
||||
wxString get_pre_state_msg(PrintDialogStatus status);
|
||||
|
|
@ -164,17 +172,13 @@ class PrinterMsgPanel : public wxPanel
|
|||
public:
|
||||
PrinterMsgPanel(wxWindow *parent);
|
||||
|
||||
void SetLabelList(const std::vector<wxString> &texts, const wxColour &colour);
|
||||
|
||||
// void SetLabelSingle(const wxString &texts,const wxColour& colour);
|
||||
|
||||
wxString GetLabel();
|
||||
std::vector<wxString> GetLabelList();
|
||||
public:
|
||||
void UpdateInfos(const std::vector<prePrintInfo>& infos);
|
||||
|
||||
private:
|
||||
wxBoxSizer * m_sizer = nullptr;
|
||||
std::vector<Label *> m_labels;
|
||||
std::vector<wxString> m_last_texts;
|
||||
wxBoxSizer* m_sizer = nullptr;
|
||||
std::vector<prePrintInfo> m_infos;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1305,14 +1305,30 @@ void ConfirmBeforeSendDialog::update_text(std::vector<ConfirmBeforeSendInfo> tex
|
|||
|
||||
auto height = 0;
|
||||
for (auto text : texts) {
|
||||
auto label_item = new Label(m_vebview_release_note, text.text, LB_AUTO_WRAP);
|
||||
if (enable_warning_clr && text.level == ConfirmBeforeSendInfo::InfoLevel::Warning) {
|
||||
|
||||
Label* label_item = nullptr;
|
||||
if (text.wiki_url.empty())
|
||||
{
|
||||
label_item = new Label(m_vebview_release_note, text.text, LB_AUTO_WRAP);
|
||||
}
|
||||
else
|
||||
{
|
||||
label_item = new Label(m_vebview_release_note, text.text + " " + _L("Please refer to Wiki before use->"), LB_AUTO_WRAP);
|
||||
label_item->Bind(wxEVT_LEFT_DOWN, [this, text](wxMouseEvent& e) { wxLaunchDefaultBrowser(text.wiki_url);});
|
||||
label_item->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) { SetCursor(wxCURSOR_HAND); });
|
||||
label_item->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) { SetCursor(wxCURSOR_ARROW); });
|
||||
}
|
||||
|
||||
if (enable_warning_clr && text.level == ConfirmBeforeSendInfo::InfoLevel::Warning)
|
||||
{
|
||||
label_item->SetForegroundColour(wxColour(0xFF, 0x6F, 0x00));
|
||||
}
|
||||
|
||||
label_item->SetMaxSize(wxSize(FromDIP(494), -1));
|
||||
label_item->SetMinSize(wxSize(FromDIP(494), -1));
|
||||
label_item->Wrap(FromDIP(494));
|
||||
label_item->Layout();
|
||||
|
||||
sizer_text_release_note->Add(label_item, 0, wxALIGN_CENTER | wxALL, FromDIP(3));
|
||||
height += label_item->GetSize().y;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -227,13 +227,15 @@ public:
|
|||
|
||||
struct ConfirmBeforeSendInfo
|
||||
{
|
||||
public:
|
||||
enum InfoLevel {
|
||||
Normal = 0,
|
||||
Warning = 1
|
||||
};
|
||||
InfoLevel level;
|
||||
wxString text;
|
||||
ConfirmBeforeSendInfo(wxString txt, InfoLevel lev = Normal) : text(txt), level(lev) {}
|
||||
wxString wiki_url;
|
||||
ConfirmBeforeSendInfo(const wxString& txt, const wxString& url = wxEmptyString, InfoLevel lev = Normal) : text(txt), wiki_url(url), level(lev){}
|
||||
};
|
||||
|
||||
class ConfirmBeforeSendDialog : public DPIDialog
|
||||
|
|
|
|||
|
|
@ -1419,129 +1419,12 @@ void SelectMachineDialog::prepare(int print_plate_idx)
|
|||
m_print_plate_idx = print_plate_idx;
|
||||
}
|
||||
|
||||
void SelectMachineDialog::update_ams_status_msg(vector<wxString> msg, bool is_error,bool is_single)
|
||||
{
|
||||
auto colour = is_error ? wxColour("#D01B1B") : wxColour("#FF6F00");
|
||||
m_statictext_ams_msg->SetForegroundColour(colour);
|
||||
|
||||
if (msg.empty()) {
|
||||
if (!m_statictext_ams_msg->GetLabel().empty()) {
|
||||
m_statictext_ams_msg->SetLabelList(std::vector<wxString>{}, colour);
|
||||
m_statictext_ams_msg->Hide();
|
||||
Layout();
|
||||
Fit();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (m_statictext_ams_msg->GetLabelList() != msg) {
|
||||
vector<wxString> TempMsg = {};
|
||||
|
||||
if (is_single)
|
||||
TempMsg = {msg[0]};
|
||||
else
|
||||
TempMsg = msg;
|
||||
|
||||
m_statictext_ams_msg->SetLabelList(TempMsg, colour);
|
||||
m_statictext_ams_msg->Show();
|
||||
Layout();
|
||||
Fit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SelectMachineDialog::update_priner_status_msg(vector<wxString> msg, bool is_error,bool is_single)
|
||||
{
|
||||
auto colour = is_error ? wxColour("#D01B1B") : wxColour("#FF6F00");
|
||||
m_text_printer_msg->SetForegroundColour(colour);
|
||||
|
||||
if (msg.empty()) {
|
||||
if (!m_text_printer_msg->GetLabel().empty()) {
|
||||
m_text_printer_msg->SetLabelList(std::vector<wxString>{}, colour);
|
||||
m_text_printer_msg->Hide();
|
||||
Layout();
|
||||
Fit();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (m_text_printer_msg->GetLabelList() != msg) {
|
||||
vector<wxString> TempMsg = {};
|
||||
|
||||
if (is_single)
|
||||
TempMsg = {msg[0]};
|
||||
else
|
||||
TempMsg = msg;
|
||||
|
||||
m_text_printer_msg->SetLabelList(TempMsg, colour);
|
||||
m_text_printer_msg->Show();
|
||||
Layout();
|
||||
Fit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SelectMachineDialog::update_printer_status_msg_tips(const wxString &msg_tips)
|
||||
{
|
||||
if (msg_tips.empty()) {
|
||||
if (!m_text_printer_msg_tips->GetLabel().empty()) {
|
||||
m_text_printer_msg_tips->SetLabel(wxEmptyString);
|
||||
m_text_printer_msg_tips->Hide();
|
||||
Layout();
|
||||
Fit();
|
||||
}
|
||||
} else {
|
||||
auto str_new = msg_tips.utf8_string();
|
||||
auto str_old = m_text_printer_msg_tips->GetLabel().utf8_string();
|
||||
|
||||
if (str_new != str_old) {
|
||||
if (m_text_printer_msg_tips->GetLabel() != msg_tips) {
|
||||
m_text_printer_msg_tips->SetLabel(msg_tips);
|
||||
m_text_printer_msg_tips->SetMinSize(wxSize(FromDIP(420), -1));
|
||||
m_text_printer_msg_tips->SetMaxSize(wxSize(FromDIP(420), -1));
|
||||
m_text_printer_msg_tips->Wrap(FromDIP(420));
|
||||
m_text_printer_msg_tips->Show();
|
||||
Layout();
|
||||
Fit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SelectMachineDialog::update_print_status_msg()
|
||||
{
|
||||
//if (m_pre_print_checker.filamentList.size() <= 0) update_ams_status_msg(wxEmptyString, false);
|
||||
if (m_pre_print_checker.filamentList.size() <= 0) update_ams_status_msg(std::vector<wxString>{}, false,false);
|
||||
if (m_pre_print_checker.printerList.size() <= 0) update_priner_status_msg(std::vector<wxString>{}, false,false);
|
||||
|
||||
// for (const auto &info : m_pre_print_checker.filamentList) { update_ams_status_msg(info.msg, info.level == Error ? true : false); }
|
||||
|
||||
std::vector<wxString> filamentList_msgs;
|
||||
bool has_filamen_error = false;
|
||||
for (const auto &info : m_pre_print_checker.filamentList) {
|
||||
filamentList_msgs.push_back(info.msg);
|
||||
if (!has_filamen_error)
|
||||
has_filamen_error = (info.level == Error);
|
||||
|
||||
}
|
||||
update_ams_status_msg(filamentList_msgs, has_filamen_error, false);
|
||||
|
||||
|
||||
std::vector<wxString> printerList_msgs;
|
||||
bool has_printer_error = false;
|
||||
for (const auto &info : m_pre_print_checker.printerList) {
|
||||
printerList_msgs.push_back(info.msg);
|
||||
if (!has_printer_error)
|
||||
has_printer_error = (info.level == Error );
|
||||
|
||||
update_printer_status_msg_tips(info.tips);
|
||||
}
|
||||
update_priner_status_msg(printerList_msgs, has_printer_error, false);
|
||||
|
||||
m_statictext_ams_msg->UpdateInfos(m_pre_print_checker.filamentList);
|
||||
m_text_printer_msg->UpdateInfos(m_pre_print_checker.printerList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SelectMachineDialog::update_print_error_info(int code, std::string msg, std::string extra)
|
||||
{
|
||||
m_print_error_code = code;
|
||||
|
|
@ -1565,7 +1448,7 @@ bool SelectMachineDialog::check_sdcard_for_timelpase(MachineObject* obj)
|
|||
return false;
|
||||
}
|
||||
|
||||
void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxString> params)
|
||||
void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxString> params, wxString wiki_url)
|
||||
{
|
||||
wxString msg;
|
||||
wxString tips;
|
||||
|
|
@ -1766,7 +1649,7 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt
|
|||
|
||||
/*enter perpare mode*/
|
||||
prepare_mode(false);
|
||||
m_pre_print_checker.add(status, msg, tips);
|
||||
m_pre_print_checker.add(status, msg, tips, wiki_url);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -2045,11 +1928,11 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
|||
bool in_blacklist = false;
|
||||
std::string action;
|
||||
wxString info;
|
||||
DeviceManager::check_filaments_in_blacklist(obj_->printer_type, filament_brand, filament_type, m_ams_mapping_result[i].filament_id, ams_id, slot_id, "", in_blacklist,
|
||||
action, info);
|
||||
|
||||
wxString wiki_url;
|
||||
DeviceManager::check_filaments_in_blacklist_url(obj_->printer_type, filament_brand, filament_type, m_ams_mapping_result[i].filament_id, ams_id, slot_id, "", in_blacklist,
|
||||
action, info, wiki_url);
|
||||
if (in_blacklist && action == "warning") {
|
||||
confirm_text.push_back(ConfirmBeforeSendInfo(info));
|
||||
confirm_text.push_back(ConfirmBeforeSendInfo(info, wiki_url));
|
||||
has_slice_warnings = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -2183,7 +2066,7 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
|||
|
||||
if (is_printing_block)
|
||||
{
|
||||
shown_infos.emplace_back(ConfirmBeforeSendInfo(_L("Please fix the error above, otherwise printing cannot continue."), ConfirmBeforeSendInfo::InfoLevel::Warning));
|
||||
shown_infos.emplace_back(ConfirmBeforeSendInfo(_L("Please fix the error above, otherwise printing cannot continue."), wxEmptyString, ConfirmBeforeSendInfo::InfoLevel::Warning));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -3490,17 +3373,18 @@ void SelectMachineDialog::update_show_status(MachineObject* obj_)
|
|||
bool in_blacklist = false;
|
||||
std::string action;
|
||||
wxString info;
|
||||
DeviceManager::check_filaments_in_blacklist(obj_->printer_type, filament_brand, filament_type, m_ams_mapping_result[i].filament_id, ams_id, slot_id, "", in_blacklist,
|
||||
action, info);
|
||||
wxString wiki_url;
|
||||
DeviceManager::check_filaments_in_blacklist_url(obj_->printer_type, filament_brand, filament_type, m_ams_mapping_result[i].filament_id, ams_id, slot_id, "", in_blacklist,
|
||||
action, info, wiki_url);
|
||||
if (in_blacklist) {
|
||||
|
||||
std::vector<wxString> error_msg { info };
|
||||
if (action == "prohibition") {
|
||||
show_status(PrintDialogStatus::PrintStatusHasFilamentInBlackListError, error_msg);
|
||||
show_status(PrintDialogStatus::PrintStatusHasFilamentInBlackListError, error_msg, wiki_url);
|
||||
return;
|
||||
}
|
||||
else if (action == "warning") {
|
||||
show_status(PrintDialogStatus::PrintStatusHasFilamentInBlackListWarning, error_msg);/** warning check **/
|
||||
show_status(PrintDialogStatus::PrintStatusHasFilamentInBlackListWarning, error_msg, wiki_url);/** warning check **/
|
||||
// return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -429,7 +429,7 @@ public:
|
|||
void finish_mode();
|
||||
void sync_ams_mapping_result(std::vector<FilamentInfo>& result);
|
||||
void prepare(int print_plate_idx);
|
||||
void show_status(PrintDialogStatus status, std::vector<wxString> params = std::vector<wxString>());
|
||||
void show_status(PrintDialogStatus status, std::vector<wxString> params = std::vector<wxString>(), wxString wiki_url = wxEmptyString);
|
||||
void sys_color_changed();
|
||||
void reset_timeout();
|
||||
void update_user_printer();
|
||||
|
|
@ -469,10 +469,6 @@ public:
|
|||
void Enable_Send_Button(bool en);
|
||||
void on_dpi_changed(const wxRect& suggested_rect) override;
|
||||
void update_user_machine_list();
|
||||
void update_ams_status_msg(vector<wxString> msg, bool is_error, bool is_single);
|
||||
void update_priner_status_msg(vector<wxString> msg, bool is_error, bool is_single);
|
||||
//void update_priner_status_msg(vector<wxString> msg);
|
||||
void update_printer_status_msg_tips(const wxString& msg_tips);
|
||||
void update_print_status_msg();
|
||||
void update_print_error_info(int code, std::string msg, std::string extra);
|
||||
bool has_timelapse_warning(wxString& msg);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue