mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-23 02:42:08 +00:00
Treat nozzle diameter mismatch as a warning (#14890)
This commit is contained in:
@@ -218,6 +218,49 @@ void PrePrintChecker::add_with_link(PrintDialogStatus state, wxString msg, wxStr
|
||||
}
|
||||
}
|
||||
|
||||
// Orca: acknowledgement-checkbox variant of add(); see add_with_link() for the shared classification.
|
||||
void PrePrintChecker::add_with_checkbox(PrintDialogStatus state, wxString msg, wxString checkbox_label, bool checked, std::function<void(bool)> checkbox_callback)
|
||||
{
|
||||
prePrintInfo info;
|
||||
|
||||
if (is_error(state)) {
|
||||
info.level = prePrintInfoLevel::Error;
|
||||
} else if (is_warning(state)) {
|
||||
info.level = prePrintInfoLevel::Warning;
|
||||
} else {
|
||||
info.level = prePrintInfoLevel::Normal;
|
||||
}
|
||||
|
||||
if (is_error_printer(state)) {
|
||||
info.type = prePrintInfoType::Printer;
|
||||
} else if (is_error_filament(state)) {
|
||||
info.type = prePrintInfoType::Filament;
|
||||
} else if (is_warning_printer(state)) {
|
||||
info.type = prePrintInfoType::Printer;
|
||||
} else if (is_warning_filament(state)) {
|
||||
info.type = prePrintInfoType::Filament;
|
||||
}
|
||||
|
||||
info.msg = msg;
|
||||
info.checkbox_label = checkbox_label;
|
||||
info.checkbox_checked = checked;
|
||||
info.checkbox_callback = checkbox_callback;
|
||||
|
||||
switch (info.type) {
|
||||
case prePrintInfoType::Filament:
|
||||
if (std::find(filamentList.begin(), filamentList.end(), info) == filamentList.end()) {
|
||||
filamentList.push_back(info);
|
||||
}
|
||||
break;
|
||||
case prePrintInfoType::Printer:
|
||||
if (std::find(printerList.begin(), printerList.end(), info) == printerList.end()) {
|
||||
printerList.push_back(info);
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//void PrePrintMsgBoard::add(const wxString &msg, const wxString &tips, bool is_error)
|
||||
//{
|
||||
@@ -310,6 +353,18 @@ bool PrinterMsgPanel::UpdateInfos(const std::vector<prePrintInfo>& infos)
|
||||
label->Show();
|
||||
m_sizer->Add(label, 0, wxBOTTOM, FromDIP(4));
|
||||
}
|
||||
|
||||
// Orca: acknowledgement checkbox rendered beneath the message (e.g. a nozzle diameter that
|
||||
// differs from the one the printer remembers, which the user may legitimately override).
|
||||
if (!info.checkbox_label.empty())
|
||||
{
|
||||
wxCheckBox* checkbox = new wxCheckBox(this, wxID_ANY, info.checkbox_label);
|
||||
checkbox->SetForegroundColour(_GetLabelColour(info));
|
||||
checkbox->SetValue(info.checkbox_checked);
|
||||
auto cb = info.checkbox_callback;
|
||||
checkbox->Bind(wxEVT_CHECKBOX, [cb](wxCommandEvent& e) { if (cb) cb(e.IsChecked()); });
|
||||
m_sizer->Add(checkbox, 0, wxBOTTOM, FromDIP(4));
|
||||
}
|
||||
}
|
||||
|
||||
this->Show();
|
||||
|
||||
@@ -26,6 +26,9 @@ struct prePrintInfo
|
||||
wxString wiki_url;
|
||||
wxString link_label; // optional: clickable text appended after msg
|
||||
std::function<void()> link_callback; // optional: internal action for link_label click
|
||||
wxString checkbox_label; // optional: an acknowledgement checkbox under msg
|
||||
bool checkbox_checked{false};
|
||||
std::function<void(bool)> checkbox_callback; // called with the new state on toggle
|
||||
int index{0};
|
||||
|
||||
public:
|
||||
@@ -33,8 +36,9 @@ public:
|
||||
return level == other.level && type == other.type &&
|
||||
msg == other.msg && tips == other.tips &&
|
||||
wiki_url == other.wiki_url && link_label == other.link_label &&
|
||||
checkbox_label == other.checkbox_label && checkbox_checked == other.checkbox_checked &&
|
||||
index == other.index;
|
||||
// link_callback excluded: std::function is not comparable
|
||||
// link_callback / checkbox_callback excluded: std::function is not comparable
|
||||
}
|
||||
};
|
||||
|
||||
@@ -59,7 +63,6 @@ enum PrintDialogStatus : unsigned int {
|
||||
PrintStatusInPrinting,
|
||||
PrintStatusNozzleMatchInvalid,
|
||||
PrintStatusNozzleDataInvalid,
|
||||
PrintStatusNozzleDiameterMismatch,
|
||||
PrintStatusNozzleTypeMismatch,
|
||||
PrintStatusNozzleNoMatchedHotends,
|
||||
PrintStatusNozzleRackMaximumInstalled,
|
||||
@@ -106,6 +109,9 @@ enum PrintDialogStatus : unsigned int {
|
||||
PrintStatusFilaSwitcherSlicingNotMatch,
|
||||
PrintStatusRackNozzleNumUnmeetWarning,
|
||||
PrintStatusHasUnreliableNozzleWarning,
|
||||
// Orca: a nozzle diameter that differs from the one the printer remembers is a warning,
|
||||
// not an error, so non-standard nozzles can still be printed with.
|
||||
PrintStatusNozzleDiameterMismatch,
|
||||
PrintStatusPrinterWarningEnd,
|
||||
|
||||
// Warnings for filament
|
||||
@@ -159,6 +165,9 @@ public:
|
||||
void add(PrintDialogStatus state, wxString msg, wxString tip, const wxString& wiki_url);
|
||||
// Orca: minimal callback-link render path instead of the full style-bitmask machinery.
|
||||
void add_with_link(PrintDialogStatus state, wxString msg, wxString link_label, std::function<void()> link_callback);
|
||||
// Orca: render msg with an acknowledgement checkbox beneath it, for an overridable warning that
|
||||
// the user must tick before proceeding (checkbox_callback reports the new state).
|
||||
void add_with_checkbox(PrintDialogStatus state, wxString msg, wxString checkbox_label, bool checked, std::function<void(bool)> checkbox_callback);
|
||||
static ::std::string get_print_status_info(PrintDialogStatus status);
|
||||
|
||||
wxString get_pre_state_msg(PrintDialogStatus status);
|
||||
|
||||
@@ -2269,8 +2269,11 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt
|
||||
Enable_Refresh_Button(true);
|
||||
Enable_Send_Button(false);
|
||||
} else if (status == PrintStatusNozzleDiameterMismatch) {
|
||||
// Orca: overridable — a non-standard nozzle is a valid reason to differ. Send is gated on
|
||||
// the acknowledgement checkbox added to the message board below (add_with_checkbox), which
|
||||
// is enabled only while the user's acknowledgement still matches the current mismatch.
|
||||
Enable_Refresh_Button(true);
|
||||
Enable_Send_Button(false);
|
||||
Enable_Send_Button(!m_nozzle_diameter_ack_msg.empty() && m_nozzle_diameter_ack_msg == m_nozzle_diameter_mismatch_msg);
|
||||
} else if (status == PrintStatusNozzleTypeMismatch) {
|
||||
Enable_Refresh_Button(true);
|
||||
Enable_Send_Button(false);
|
||||
@@ -2470,7 +2473,19 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt
|
||||
|
||||
/*enter perpare mode*/
|
||||
prepare_mode(false);
|
||||
m_pre_print_checker.add(status, msg, tips, wiki_url);
|
||||
if (status == PrintDialogStatus::PrintStatusNozzleDiameterMismatch) {
|
||||
// Short label on purpose: the 420px message panel caps its width and a wxCheckBox label
|
||||
// does not wrap; the full explanation is in the warning text above it.
|
||||
m_pre_print_checker.add_with_checkbox(status, msg,
|
||||
_L("I have checked the installed nozzle and want to print anyway."),
|
||||
!m_nozzle_diameter_ack_msg.empty() && m_nozzle_diameter_ack_msg == m_nozzle_diameter_mismatch_msg,
|
||||
[this](bool checked) {
|
||||
m_nozzle_diameter_ack_msg = checked ? m_nozzle_diameter_mismatch_msg : wxString();
|
||||
Enable_Send_Button(checked);
|
||||
});
|
||||
} else {
|
||||
m_pre_print_checker.add(status, msg, tips, wiki_url);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4565,8 +4580,14 @@ bool SelectMachineDialog::CheckErrorExtruderNozzleWithSlicing(MachineObject* obj
|
||||
}
|
||||
|
||||
msg_params.emplace_back(_L("Tips: If you changed your nozzle of your printer lately, please go to 'Device -> Printer parts' to change your nozzle setting."));
|
||||
|
||||
// Orca: non-blocking. A diameter that differs from the one the printer
|
||||
// remembers is legitimate with a non-standard nozzle, so the print is held back
|
||||
// only by the acknowledgement checkbox shown in the message board, not by a
|
||||
// disabled Send outright. Keep checking the remaining extruders.
|
||||
m_nozzle_diameter_mismatch_msg = msg_params.front();
|
||||
show_status(PrintDialogStatus::PrintStatusNozzleDiameterMismatch, msg_params);
|
||||
return false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4608,6 +4629,9 @@ static wxString _get_ext_loc_str(const std::unordered_set<int>& extruders, int t
|
||||
void SelectMachineDialog::update_show_status(MachineObject* obj_)
|
||||
{
|
||||
m_pre_print_checker.clear();
|
||||
// Orca: re-raised by CheckErrorExtruderNozzleWithSlicing() below if the mismatch is still there,
|
||||
// so an early return from this pass cannot leave a stale warning behind.
|
||||
m_nozzle_diameter_mismatch_msg.clear();
|
||||
|
||||
/*agent check and printer valid check*/
|
||||
NetworkAgent* agent = Slic3r::GUI::wxGetApp().getAgent();
|
||||
|
||||
@@ -550,6 +550,13 @@ public:
|
||||
// Compare the slicing file's nozzle requirements (validity, flow, diameter) against the
|
||||
// printer; the rack extruder is checked against its whole inventory (mounted + rack).
|
||||
bool CheckErrorExtruderNozzleWithSlicing(MachineObject* obj_);//return true if no errors
|
||||
// Orca: a nozzle diameter differing from the one the printer remembers is a non-blocking
|
||||
// warning shown in the message board with an acknowledgement checkbox; Send stays disabled
|
||||
// until the user ticks it. m_nozzle_diameter_mismatch_msg is the current mismatch text (empty
|
||||
// when there is none), m_nozzle_diameter_ack_msg the text the user acknowledged; Send is
|
||||
// allowed only while the two match, so a changed or cleared mismatch re-requires acknowledgement.
|
||||
wxString m_nozzle_diameter_mismatch_msg;
|
||||
wxString m_nozzle_diameter_ack_msg;
|
||||
// Warn (without blocking) when a mapped filament would be printed from both extruders on a
|
||||
// dual-extruder printer, so per-nozzle manual K-value can't follow it across the whole print.
|
||||
bool CheckWarningFilamentCrossExtruder(MachineObject* obj_);
|
||||
|
||||
Reference in New Issue
Block a user