NEW:add pre print checker

jira:[none]

Change-Id: Ic1469d30dff30e1eba92d8bfacf58d0f0b789157
(cherry picked from commit 8cfa735c6cac432a2b97dea7703e810f8eef6d04)
This commit is contained in:
tao wang
2025-04-24 16:06:45 +08:00
committed by Noisyfox
parent 37a90cbf77
commit dc56608d13
10 changed files with 566 additions and 623 deletions

View File

@@ -0,0 +1,158 @@
#ifndef slic3r_GUI_PRE_PRINT_CHECK_hpp_
#define slic3r_GUI_PRE_PRINT_CHECK_hpp_
#include <wx/wx.h>
namespace Slic3r { namespace GUI {
enum prePrintInfoLevel {
Normal,
Warning,
Error
};
enum prePrintInfoType {
Printer,
Filament
};
struct prePrintInfo
{
prePrintInfoLevel level;
prePrintInfoType type;
wxString msg;
wxString tips;
int index;
};
enum PrintDialogStatus : unsigned int {
PrintStatusErrorBegin,//->start error<-
// Errors for printer, Block Print
PrintStatusPrinterErrorBegin,
PrintStatusInit,
PrintStatusNoUserLogin,
PrintStatusInvalidPrinter,
PrintStatusConnectingServer,
PrintStatusReadingTimeout,
PrintStatusReading,
PrintStatusInUpgrading,
PrintStatusModeNotFDM,
PrintStatusInSystemPrinting,
PrintStatusInPrinting,
PrintStatusNozzleMatchInvalid,
PrintStatusNozzleDataInvalid,
PrintStatusNozzleDiameterMismatch,
PrintStatusNozzleTypeMismatch,
PrintStatusRefreshingMachineList,
PrintStatusSending,
PrintStatusLanModeNoSdcard,
PrintStatusNoSdcard,
PrintStatusLanModeSDcardNotAvailable,
PrintStatusNeedForceUpgrading,
PrintStatusNeedConsistencyUpgrading,
PrintStatusNotSupportedPrintAll,
PrintStatusBlankPlate,
PrintStatusUnsupportedPrinter,
PrintStatusInvalidMapping,
PrintStatusPrinterErrorEnd,
// Errors for filament, Block Print
PrintStatusFilamentErrorBegin,
PrintStatusAmsOnSettingup,
PrintStatusAmsMappingInvalid,
PrintStatusAmsMappingU0Invalid,
PrintStatusAmsMappingMixInvalid,
PrintStatusTPUUnsupportAutoCali,
PrintStatusFilamentErrorEnd,
PrintStatusErrorEnd,//->end error<-
PrintStatusWarningBegin,//->start warning<-
// Warnings for printer
PrintStatusPrinterWarningBegin,
PrintStatusTimelapseNoSdcard,
PrintStatusTimelapseWarning,
PrintStatusMixAmsAndVtSlotWarning,
PrintStatusPrinterWarningEnd,
// Warnings for filament
PrintStatusFilamentWarningBegin,
PrintStatusWarningKvalueNotUsed,
PrintStatusFilamentWarningEnd,
PrintStatusWarningEnd,//->end error<-
/*success*/
// printer
PrintStatusReadingFinished,
PrintStatusSendingCanceled,
PrintStatusReadyToGo,
// filament
PrintStatusAmsMappingSuccess,
/*Other, SendToPrinterDialog*/
PrintStatusNotOnTheSameLAN,
PrintStatusNotSupportedSendToSDCard,
PrintStatusPublicInitFailed,
PrintStatusPublicUploadFiled,
};
class PrePrintChecker
{
public:
std::vector<prePrintInfo> printerList;
std::vector<prePrintInfo> filamentList;
public:
void clear();
/*auto merge*/
void add(PrintDialogStatus state, wxString msg, wxString tip);
static ::std::string get_print_status_info(PrintDialogStatus status);
wxString get_pre_state_msg(PrintDialogStatus status);
bool is_error(PrintDialogStatus status) { return (PrintStatusErrorBegin < status) && (PrintStatusErrorEnd > status); };
bool is_error_printer(PrintDialogStatus status) { return (PrintStatusPrinterErrorBegin < status) && (PrintStatusPrinterErrorEnd > status); };
bool is_error_filament(PrintDialogStatus status) { return (PrintStatusFilamentErrorBegin < status) && (PrintStatusFilamentErrorEnd > status); };
bool is_warning(PrintDialogStatus status) { return (PrintStatusWarningBegin < status) && (PrintStatusWarningEnd > status); };
bool is_warning_printer(PrintDialogStatus status) { return (PrintStatusPrinterWarningBegin < status) && (PrintStatusPrinterWarningEnd > status); };
bool is_warning_filament(PrintDialogStatus status) { return (PrintStatusFilamentWarningBegin < status) && (PrintStatusFilamentWarningEnd > status); };
};
//class PrePrintMsgBoard : public wxWindow
//{
//public:
// PrePrintMsgBoard(wxWindow * parent,
// wxWindowID winid = wxID_ANY,
// const wxPoint & pos = wxDefaultPosition,
// const wxSize & size = wxDefaultSize,
// long style = wxTAB_TRAVERSAL | wxNO_BORDER,
// const wxString &name = wxASCII_STR(wxPanelNameStr)
// );
//
//public:
// // Operations
// void addError(const wxString &msg, const wxString &tips = wxEmptyString) { Add(msg, tips, true); };
// void addWarning(const wxString &msg, const wxString &tips = wxEmptyString) { Add(msg, tips, false); };
// void clear() { m_sizer->Clear(); };
//
// // Const Access
// bool isEmpty() const { return m_sizer->IsEmpty(); }
//
//private:
// void add(const wxString &msg, const wxString &tips, bool is_error);
//
//private:
// wxBoxSizer *m_sizer{nullptr};
//};
}} // namespace Slic3r::GUI
#endif