NEW:add pre print checker

jira:[none]

Change-Id: Ic1469d30dff30e1eba92d8bfacf58d0f0b789157
This commit is contained in:
tao wang 2025-04-24 16:06:45 +08:00 committed by lane.wei
parent 41c0db1029
commit 8cfa735c6c
10 changed files with 566 additions and 623 deletions

View File

@ -112,6 +112,7 @@ src/slic3r/GUI/SavePresetDialog.cpp
src/slic3r/GUI/Search.cpp src/slic3r/GUI/Search.cpp
src/slic3r/GUI/Selection.cpp src/slic3r/GUI/Selection.cpp
src/slic3r/GUI/SelectMachine.cpp src/slic3r/GUI/SelectMachine.cpp
src/slic3r/GUI/PrePrintChecker.cpp
src/slic3r/GUI/SendSystemInfoDialog.cpp src/slic3r/GUI/SendSystemInfoDialog.cpp
src/slic3r/GUI/SendToPrinter.cpp src/slic3r/GUI/SendToPrinter.cpp
src/slic3r/GUI/SlicingProgressNotification.cpp src/slic3r/GUI/SlicingProgressNotification.cpp

View File

@ -446,6 +446,8 @@ set(SLIC3R_GUI_SOURCES
GUI/ModelMall.cpp GUI/ModelMall.cpp
GUI/SelectMachine.hpp GUI/SelectMachine.hpp
GUI/SelectMachine.cpp GUI/SelectMachine.cpp
GUI/PrePrintChecker.hpp
GUI/PrePrintChecker.cpp
GUI/SelectMachinePop.hpp GUI/SelectMachinePop.hpp
GUI/SelectMachinePop.cpp GUI/SelectMachinePop.cpp
GUI/SendToPrinter.hpp GUI/SendToPrinter.hpp

View File

@ -1777,7 +1777,7 @@ void CalibrationPresetPage::update_show_status()
} }
} }
if (wxGetApp().app_config && wxGetApp().app_config->get("internal_debug").empty()) { if (wxGetApp().app_config) {
if (obj_->upgrade_force_upgrade) { if (obj_->upgrade_force_upgrade) {
show_status(CaliPresetPageStatus::CaliPresetStatusNeedForceUpgrading); show_status(CaliPresetPageStatus::CaliPresetStatusNeedForceUpgrading);
return; return;

View File

@ -0,0 +1,163 @@
#include "PrePrintChecker.hpp"
#include "GUI_Utils.hpp"
#include "I18N.hpp"
namespace Slic3r { namespace GUI {
std::string PrePrintChecker::get_print_status_info(PrintDialogStatus status)
{
switch (status) {
case PrintStatusInit: return "PrintStatusInit";
case PrintStatusNoUserLogin: return "PrintStatusNoUserLogin";
case PrintStatusInvalidPrinter: return "PrintStatusInvalidPrinter";
case PrintStatusConnectingServer: return "PrintStatusConnectingServer";
case PrintStatusReadingTimeout: return "PrintStatusReadingTimeout";
case PrintStatusReading: return "PrintStatusReading";
case PrintStatusInUpgrading: return "PrintStatusInUpgrading";
case PrintStatusModeNotFDM: return "PrintStatusModeNotFDM";
case PrintStatusInSystemPrinting: return "PrintStatusInSystemPrinting";
case PrintStatusInPrinting: return "PrintStatusInPrinting";
case PrintStatusNozzleMatchInvalid: return "PrintStatusNozzleMatchInvalid";
case PrintStatusNozzleDataInvalid: return "PrintStatusNozzleDataInvalid";
case PrintStatusNozzleDiameterMismatch: return "PrintStatusNozzleDiameterMismatch";
case PrintStatusNozzleTypeMismatch: return "PrintStatusNozzleTypeMismatch";
case PrintStatusRefreshingMachineList: return "PrintStatusRefreshingMachineList";
case PrintStatusSending: return "PrintStatusSending";
case PrintStatusLanModeNoSdcard: return "PrintStatusLanModeNoSdcard";
case PrintStatusNoSdcard: return "PrintStatusNoSdcard";
case PrintStatusLanModeSDcardNotAvailable: return "PrintStatusLanModeSDcardNotAvailable";
case PrintStatusNeedForceUpgrading: return "PrintStatusNeedForceUpgrading";
case PrintStatusNeedConsistencyUpgrading: return "PrintStatusNeedConsistencyUpgrading";
case PrintStatusNotSupportedPrintAll: return "PrintStatusNotSupportedPrintAll";
case PrintStatusBlankPlate: return "PrintStatusBlankPlate";
case PrintStatusUnsupportedPrinter: return "PrintStatusUnsupportedPrinter";
case PrintStatusInvalidMapping: return "PrintStatusInvalidMapping";
// Handle filament errors
case PrintStatusAmsOnSettingup: return "PrintStatusAmsOnSettingup";
case PrintStatusAmsMappingInvalid: return "PrintStatusAmsMappingInvalid";
case PrintStatusAmsMappingU0Invalid: return "PrintStatusAmsMappingU0Invalid";
case PrintStatusAmsMappingMixInvalid: return "PrintStatusAmsMappingMixInvalid";
case PrintStatusTPUUnsupportAutoCali: return "PrintStatusTPUUnsupportAutoCali";
// Handle warnings
case PrintStatusTimelapseNoSdcard: return "PrintStatusTimelapseNoSdcard";
case PrintStatusTimelapseWarning: return "PrintStatusTimelapseWarning";
case PrintStatusMixAmsAndVtSlotWarning: return "PrintStatusMixAmsAndVtSlotWarning";
// Handle success statuses
case PrintStatusReadingFinished: return "PrintStatusReadingFinished";
case PrintStatusSendingCanceled: return "PrintStatusSendingCanceled";
case PrintStatusAmsMappingSuccess: return "PrintStatusAmsMappingSuccess";
case PrintStatusNotOnTheSameLAN: return "PrintStatusNotOnTheSameLAN";
case PrintStatusNotSupportedSendToSDCard: return "PrintStatusNotSupportedSendToSDCard";
case PrintStatusPublicInitFailed: return "PrintStatusPublicInitFailed";
case PrintStatusPublicUploadFiled: return "PrintStatusPublicUploadFiled";
case PrintStatusReadyToGo: return "PrintStatusReadyToGo";
default: return "Unknown status";
}
}
wxString PrePrintChecker::get_pre_state_msg(PrintDialogStatus status)
{
switch (status) {
case PrintStatusNoUserLogin: return _L("No login account, only printers in LAN mode are displayed");
case PrintStatusConnectingServer: return _L("Connecting to server");
case PrintStatusReading: return _L("Synchronizing device information");
case PrintStatusReadingTimeout: return _L("Synchronizing device information time out");
case PrintStatusModeNotFDM: return _L("Cannot send the print job when the printer is not at FDM mode");
case PrintStatusInUpgrading: return _L("Cannot send the print job when the printer is updating firmware");
case PrintStatusInSystemPrinting: return _L("The printer is executing instructions. Please restart printing after it ends");
case PrintStatusInPrinting: return _L("The printer is busy on other print job");
case PrintStatusAmsOnSettingup: return _L("AMS is setting up. Please try again later.");
case PrintStatusAmsMappingMixInvalid: return _L("Please do not mix-use the Ext with AMS");
case PrintStatusNozzleDataInvalid: return _L("Invalid nozzle information, please refresh or manually set nozzle information.");
case PrintStatusLanModeNoSdcard: return _L("Storage needs to be inserted before printing via LAN.");
case PrintStatusLanModeSDcardNotAvailable: return _L("Storage is not available or is in read-only mode.");
case PrintStatusNoSdcard: return _L("Storage needs to be inserted before printing.");
case PrintStatusNeedForceUpgrading: return _L("Cannot send the print job to a printer whose firmware is required to get updated.");
case PrintStatusNeedConsistencyUpgrading: return _L("Cannot send the print job to a printer whose firmware is required to get updated.");
case PrintStatusBlankPlate: return _L("Cannot send the print job for empty plate");
case PrintStatusTimelapseNoSdcard: return _L("Storage needs to be inserted to record timelapse.");
case PrintStatusMixAmsAndVtSlotWarning: return _L("You have selected both external and AMS filaments for an extruder. You will need to manually switch the external filament during printing.");
case PrintStatusTPUUnsupportAutoCali: return _L("TPU 90A/TPU 85A is too soft and does not support automatic Flow Dynamics calibration.");
case PrintStatusWarningKvalueNotUsed: return _L("Set dynamic flow calibration to 'OFF' to enable custom dynamic flow value.");
case PrintStatusNotSupportedPrintAll: return _L("This printer does not support printing all plates");
}
return wxEmptyString;
}
void PrePrintChecker::clear()
{
printerList.clear();
filamentList.clear();
}
void PrePrintChecker::add(PrintDialogStatus state, wxString msg, wxString tip)
{
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;
}
if (!msg.IsEmpty()) {
info.msg = msg;
info.tips = tip;
} else {
info.msg = get_pre_state_msg(state);
info.tips = wxEmptyString;
}
switch (info.type) {
case prePrintInfoType::Filament:
filamentList.push_back(info);
break;
case prePrintInfoType::Printer:
printerList.push_back(info);
break;
default: break;
}
}
//void PrePrintMsgBoard::add(const wxString &msg, const wxString &tips, bool is_error)
//{
// if (msg.IsEmpty()) { return; }
//
// /*message*/
// // create label
// if (!m_sizer->IsEmpty()) { m_sizer->AddSpacer(FromDIP(10)); }
// Label *msg_label = new Label(this, wxEmptyString);
// m_sizer->Add(msg_label, 0, wxLEFT, 0);
//
// // set message
// msg_label->SetLabel(msg);
// msg_label->SetMinSize(wxSize(FromDIP(420), -1));
// msg_label->SetMaxSize(wxSize(FromDIP(420), -1));
// msg_label->Wrap(FromDIP(420));
//
// // font color
// auto colour = is_error ? wxColour("#D01B1B") : wxColour(0xFF, 0x6F, 0x00);
// msg_label->SetForegroundColour(colour);
//
// /*tips*/
// if (!tips.IsEmpty()) { /*Not supported yet*/
// }
//
// Layout();
// Fit();
//}
}};

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

File diff suppressed because it is too large Load Diff

View File

@ -35,6 +35,7 @@
#include "Plater.hpp" #include "Plater.hpp"
#include "BBLStatusBar.hpp" #include "BBLStatusBar.hpp"
#include "BBLStatusBarPrint.hpp" #include "BBLStatusBarPrint.hpp"
#include "PrePrintChecker.hpp"
#include "Widgets/Label.hpp" #include "Widgets/Label.hpp"
#include "Widgets/Button.hpp" #include "Widgets/Button.hpp"
#include "Widgets/CheckBox.hpp" #include "Widgets/CheckBox.hpp"
@ -62,86 +63,6 @@ enum PrintPageMode {
PrintPageModeFinish PrintPageModeFinish
}; };
enum PrintDialogStatus : unsigned int {
/*Errors*/
PrintStatusErrorBegin,
//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,
PrintStatusNeedUpgradingAms,
PrintStatusAmsOnSettingup,
PrintStatusAmsMappingInvalid,
PrintStatusAmsMappingU0Invalid,
PrintStatusAmsMappingMixInvalid,
PrintStatusTPUUnsupportAutoCali,
PrintStatusFilamentErrorEnd,
PrintStatusErrorEnd,
/*Warnings*/
PrintStatusWarningBegin,
//Warnings for printer
PrintStatusPrinterWarningBegin,
PrintStatusTimelapseNoSdcard,
PrintStatusTimelapseWarning,
PrintStatusMixAmsAndVtSlotWarning,
PrintStatusPrinterWarningEnd,
//Warnings for filament
PrintStatusFilamentWarningBegin,
PrintStatusAmsMappingByOrder,
PrintStatusWarningKvalueNotUsed,
PrintStatusFilamentWarningEnd,
PrintStatusWarningEnd,
/*Success*/
//printer
PrintStatusReadingFinished,
PrintStatusSendingCanceled,
//filament
PrintStatusDisableAms,
PrintStatusAmsMappingSuccess,
PrintStatusAmsMappingValid,
/*Other, SendToPrinterDialog*/
PrintStatusNotOnTheSameLAN,
PrintStatusNotSupportedSendToSDCard,
PrintStatusPublicInitFailed,
PrintStatusPublicUploadFiled,
};
class Material class Material
{ {
public: public:
@ -465,6 +386,8 @@ protected:
wxGridSizer* m_sizer_ams_mapping_left{ nullptr }; wxGridSizer* m_sizer_ams_mapping_left{ nullptr };
wxGridSizer* m_sizer_ams_mapping_right{ nullptr }; wxGridSizer* m_sizer_ams_mapping_right{ nullptr };
PrePrintChecker m_pre_print_checker;
public: public:
static std::vector<wxString> MACHINE_BED_TYPE_STRING; static std::vector<wxString> MACHINE_BED_TYPE_STRING;
static void init_machine_bed_types(); static void init_machine_bed_types();
@ -476,7 +399,6 @@ public:
void init_bind(); void init_bind();
void init_timer(); void init_timer();
void check_focus(wxWindow* window);
void show_print_failed_info(bool show, int code = 0, wxString description = wxEmptyString, wxString extra = wxEmptyString); void show_print_failed_info(bool show, int code = 0, wxString description = wxEmptyString, wxString extra = wxEmptyString);
void check_fcous_state(wxWindow* window); void check_fcous_state(wxWindow* window);
void popup_filament_backup(); void popup_filament_backup();
@ -491,10 +413,10 @@ public:
void reset_timeout(); void reset_timeout();
void update_user_printer(); void update_user_printer();
void reset_ams_material(); void reset_ams_material();
void update_show_status(); void update_show_status(MachineObject* obj_ = nullptr);
void update_ams_check(MachineObject* obj); void update_ams_check(MachineObject* obj);
void update_filament_change_count(); void update_filament_change_count();
void on_rename_click(wxMouseEvent &event); void on_rename_click(wxMouseEvent &event);
void on_rename_enter(); void on_rename_enter();
void update_printer_combobox(wxCommandEvent& event); void update_printer_combobox(wxCommandEvent& event);
void on_cancel(wxCloseEvent& event); void on_cancel(wxCloseEvent& event);
@ -522,26 +444,22 @@ public:
void update_page_turn_state(bool show); void update_page_turn_state(bool show);
void on_timer(wxTimerEvent& event); void on_timer(wxTimerEvent& event);
void on_selection_changed(wxCommandEvent &event); void on_selection_changed(wxCommandEvent &event);
void update_flow_cali_check(MachineObject* obj);
void Enable_Refresh_Button(bool en); void Enable_Refresh_Button(bool en);
void Enable_Send_Button(bool en); void Enable_Send_Button(bool en);
void on_dpi_changed(const wxRect& suggested_rect) override; void on_dpi_changed(const wxRect& suggested_rect) override;
void update_user_machine_list(); void update_user_machine_list();
void update_lan_machine_list(); void update_ams_status_msg(wxString msg, bool is_error);
void stripWhiteSpace(std::string& str); void update_priner_status_msg(wxString msg, bool is_error);
void update_ams_status_msg(wxString msg, bool can_send_print);
void update_priner_status_msg(wxString msg, bool can_send_print);
void update_printer_status_msg_tips(const wxString& msg_tips); void update_printer_status_msg_tips(const wxString& msg_tips);
void update_print_status_msg(wxString msg, bool is_printer, bool can_send_print, bool can_refresh, const wxString& printer_msg_tips = wxEmptyString); void update_print_status_msg();
void update_print_error_info(int code, std::string msg, std::string extra); void update_print_error_info(int code, std::string msg, std::string extra);
void set_flow_calibration_state(bool state, bool show_tips = true);
bool has_timelapse_warning(wxString& msg); bool has_timelapse_warning(wxString& msg);
bool has_timelapse_warning() { wxString msg; return has_timelapse_warning(msg);}; bool has_timelapse_warning() { wxString msg; return has_timelapse_warning(msg);};
bool can_support_auto_cali(); bool can_support_auto_cali();
bool is_same_printer_model(); bool is_same_printer_model();
bool is_blocking_printing(MachineObject* obj_); bool is_blocking_printing(MachineObject* obj_);
bool is_nozzle_hrc_matched(const Extder& extruder, std::string& filament_type) const; bool is_nozzle_hrc_matched(const Extder& extruder, std::string& filament_type) const;
bool has_tips(MachineObject* obj); bool check_sdcard_for_timelpase(MachineObject* obj);
bool is_timeout(); bool is_timeout();
int update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name, std::string file_path); int update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name, std::string file_path);
void set_print_type(PrintFromType type) {m_print_type = type;}; void set_print_type(PrintFromType type) {m_print_type = type;};
@ -555,8 +473,6 @@ public:
bool is_nozzle_type_match(ExtderData data, wxString& error_message) const; bool is_nozzle_type_match(ExtderData data, wxString& error_message) const;
int convert_filament_map_nozzle_id_to_task_nozzle_id(int nozzle_id); int convert_filament_map_nozzle_id_to_task_nozzle_id(int nozzle_id);
std::string get_print_status_info(PrintDialogStatus status);
PrintFromType get_print_type() {return m_print_type;}; PrintFromType get_print_type() {return m_print_type;};
wxString format_bed_name(std::string plate_name); wxString format_bed_name(std::string plate_name);
wxString format_steel_name(NozzleType type); wxString format_steel_name(NozzleType type);
@ -576,14 +492,6 @@ private:
void load_option_vals(MachineObject* obj); void load_option_vals(MachineObject* obj);
void save_option_vals(); void save_option_vals();
void save_option_vals(MachineObject *obj); void save_option_vals(MachineObject *obj);
/*go check*/
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); };
}; };

View File

@ -1171,9 +1171,6 @@ void SendToPrinterDialog::update_show_status()
if (agent->is_user_login()) { if (agent->is_user_login()) {
show_status(PrintDialogStatus::PrintStatusInvalidPrinter); show_status(PrintDialogStatus::PrintStatusInvalidPrinter);
} }
else {
show_status(PrintDialogStatus::PrintStatusNoUserLogin);
}
} }
return; return;
} }
@ -1437,12 +1434,6 @@ void SendToPrinterDialog::show_status(PrintDialogStatus status, std::vector<wxSt
Enable_Send_Button(false); Enable_Send_Button(false);
Enable_Refresh_Button(false); Enable_Refresh_Button(false);
} }
else if (status == PrintDialogStatus::PrintStatusNoUserLogin) {
wxString msg_text = _L("No login account, only printers in LAN mode are displayed");
update_print_status_msg(msg_text, false, true);
Enable_Send_Button(false);
Enable_Refresh_Button(true);
}
else if (status == PrintDialogStatus::PrintStatusInvalidPrinter) { else if (status == PrintDialogStatus::PrintStatusInvalidPrinter) {
update_print_status_msg(wxEmptyString, true, true); update_print_status_msg(wxEmptyString, true, true);
Enable_Send_Button(false); Enable_Send_Button(false);
@ -1600,8 +1591,6 @@ void SendToPrinterDialog::set_default()
if (agent) { if (agent) {
if (agent->is_user_login()) { if (agent->is_user_login()) {
show_status(PrintDialogStatus::PrintStatusInit); show_status(PrintDialogStatus::PrintStatusInit);
} else {
show_status(PrintDialogStatus::PrintStatusNoUserLogin);
} }
} }

View File

@ -18,6 +18,8 @@
#include "Widgets/Button.hpp" #include "Widgets/Button.hpp"
#include "Widgets/CheckBox.hpp" #include "Widgets/CheckBox.hpp"
#include "CapsuleButton.hpp" #include "CapsuleButton.hpp"
#include "PrePrintChecker.hpp"
using namespace Slic3r; using namespace Slic3r;
using namespace Slic3r::GUI; using namespace Slic3r::GUI;
@ -1720,35 +1722,17 @@ void SyncAmsInfoDialog::update_print_error_info(int code, std::string msg, std::
m_print_error_extra = extra; m_print_error_extra = extra;
} }
bool SyncAmsInfoDialog::has_tips(MachineObject *obj)
{
if (!obj) return false;
// must set to a status if return true
if (m_checkbox_list["timelapse"]->IsShown() && (m_checkbox_list["timelapse"]->getValue() == "on")) {
if (obj->get_sdcard_state() == MachineObject::SdcardState::NO_SDCARD) {
show_status(PrintDialogStatus::PrintStatusTimelapseNoSdcard);
return true;
}
}
return false;
}
void SyncAmsInfoDialog::show_status(PrintDialogStatus status, std::vector<wxString> params) void SyncAmsInfoDialog::show_status(PrintDialogStatus status, std::vector<wxString> params)
{ {
if (m_print_status != status) { if (m_print_status != status) {
m_result.is_same_printer = true; m_result.is_same_printer = true;
BOOST_LOG_TRIVIAL(info) << "select_machine_dialog: show_status = " << status << "(" << get_print_status_info(status) << ")"; BOOST_LOG_TRIVIAL(info) << "select_machine_dialog: show_status = " << status << "(" << PrePrintChecker::get_print_status_info(status) << ")";
} }
m_print_status = status; m_print_status = status;
// other // other
if (status == PrintDialogStatus::PrintStatusInit) { if (status == PrintDialogStatus::PrintStatusInit) {
update_print_status_msg(wxEmptyString, false, false); update_print_status_msg(wxEmptyString, false, false);
} else if (status == PrintDialogStatus::PrintStatusNoUserLogin) {
wxString msg_text = _L("No login account, only printers in LAN mode are displayed");
update_print_status_msg(msg_text, false, true);
} else if (status == PrintDialogStatus::PrintStatusInvalidPrinter) { } else if (status == PrintDialogStatus::PrintStatusInvalidPrinter) {
update_print_status_msg(wxEmptyString, true, true); update_print_status_msg(wxEmptyString, true, true);
} else if (status == PrintDialogStatus::PrintStatusConnectingServer) { } else if (status == PrintDialogStatus::PrintStatusConnectingServer) {
@ -1771,15 +1755,6 @@ void SyncAmsInfoDialog::show_status(PrintDialogStatus status, std::vector<wxStri
} else if (status == PrintDialogStatus::PrintStatusInPrinting) { } else if (status == PrintDialogStatus::PrintStatusInPrinting) {
wxString msg_text = _L("The printer is busy on other print job"); wxString msg_text = _L("The printer is busy on other print job");
update_print_status_msg(msg_text, true, true); update_print_status_msg(msg_text, true, true);
} else if (status == PrintDialogStatus::PrintStatusDisableAms) {
update_print_status_msg(wxEmptyString, false, false);
} else if (status == PrintDialogStatus::PrintStatusNeedUpgradingAms) {
wxString msg_text;
if (params.size() > 0)
msg_text = wxString::Format(_L("Filament %s exceeds the number of AMS slots. Please update the printer firmware to support AMS slot assignment."), params[0]);
else
msg_text = _L("Filament exceeds the number of AMS slots. Please update the printer firmware to support AMS slot assignment.");
update_print_status_msg(msg_text, true, false);
} else if (status == PrintDialogStatus::PrintStatusAmsMappingSuccess) { } else if (status == PrintDialogStatus::PrintStatusAmsMappingSuccess) {
update_print_status_msg(wxEmptyString, false, false); update_print_status_msg(wxEmptyString, false, false);
} else if (status == PrintDialogStatus::PrintStatusAmsMappingInvalid) { } else if (status == PrintDialogStatus::PrintStatusAmsMappingInvalid) {
@ -1800,8 +1775,6 @@ void SyncAmsInfoDialog::show_status(PrintDialogStatus status, std::vector<wxStri
params[0], params[1]); params[0], params[1]);
else else
msg_text = _L("Filament does not match the filament in AMS slot. Please update the printer firmware to support AMS slot assignment."); msg_text = _L("Filament does not match the filament in AMS slot. Please update the printer firmware to support AMS slot assignment.");
} else if (status == PrintDialogStatus::PrintStatusAmsMappingValid) {
update_print_status_msg(wxEmptyString, false, false);
} else if (status == PrintDialogStatus::PrintStatusRefreshingMachineList) { } else if (status == PrintDialogStatus::PrintStatusRefreshingMachineList) {
update_print_status_msg(wxEmptyString, false, true); update_print_status_msg(wxEmptyString, false, true);
} else if (status == PrintDialogStatus::PrintStatusSending) { } else if (status == PrintDialogStatus::PrintStatusSending) {
@ -1812,9 +1785,6 @@ void SyncAmsInfoDialog::show_status(PrintDialogStatus status, std::vector<wxStri
} else if (status == PrintDialogStatus::PrintStatusLanModeSDcardNotAvailable) { } else if (status == PrintDialogStatus::PrintStatusLanModeSDcardNotAvailable) {
wxString msg_text = _L("Storage is not available or is in read-only mode."); wxString msg_text = _L("Storage is not available or is in read-only mode.");
update_print_status_msg(msg_text, true, true); update_print_status_msg(msg_text, true, true);
} else if (status == PrintDialogStatus::PrintStatusAmsMappingByOrder) {
wxString msg_text = _L("The printer firmware only supports sequential mapping of filament => AMS slot.");
update_print_status_msg(msg_text, false, false);
} else if (status == PrintDialogStatus::PrintStatusNoSdcard) { } else if (status == PrintDialogStatus::PrintStatusNoSdcard) {
wxString msg_text = _L("Storage needs to be inserted before printing."); wxString msg_text = _L("Storage needs to be inserted before printing.");
update_print_status_msg(msg_text, true, true); update_print_status_msg(msg_text, true, true);
@ -2346,8 +2316,6 @@ void SyncAmsInfoDialog::update_show_status()
if (agent) { if (agent) {
if (agent->is_user_login()) { if (agent->is_user_login()) {
show_status(PrintDialogStatus::PrintStatusInvalidPrinter); show_status(PrintDialogStatus::PrintStatusInvalidPrinter);
} else {
show_status(PrintDialogStatus::PrintStatusNoUserLogin);
} }
} }
return; return;
@ -2391,7 +2359,7 @@ void SyncAmsInfoDialog::update_show_status()
// reading done // reading done
if (wxGetApp().app_config && wxGetApp().app_config->get("internal_debug").empty()) { if (wxGetApp().app_config) {
if (obj_->upgrade_force_upgrade) { if (obj_->upgrade_force_upgrade) {
show_status(PrintDialogStatus::PrintStatusNeedForceUpgrading); show_status(PrintDialogStatus::PrintStatusNeedForceUpgrading);
return; return;
@ -2431,18 +2399,6 @@ void SyncAmsInfoDialog::update_show_status()
} }
} }
// no ams
if (!obj_->has_ams() || m_checkbox_list["use_ams"]->getValue() != "on") {
if (!has_tips(obj_)) {
if (has_timelapse_warning()) {
show_status(PrintDialogStatus::PrintStatusTimelapseWarning);
} else {
show_status(PrintDialogStatus::PrintStatusReadingFinished);
}
}
return;
}
// do ams mapping if no ams result // do ams mapping if no ams result
if (m_ams_mapping_result.empty()) { do_ams_mapping(obj_); } if (m_ams_mapping_result.empty()) { do_ams_mapping(obj_); }
@ -2502,29 +2458,6 @@ void SyncAmsInfoDialog::update_show_status()
} }
} }
} }
if (m_ams_mapping_res) {
if (has_timelapse_warning()) {
show_status(PrintDialogStatus::PrintStatusTimelapseWarning);
} else {
show_status(PrintDialogStatus::PrintStatusAmsMappingSuccess);
}
return;
} else {
if (obj_->is_valid_mapping_result(m_ams_mapping_result)) {
if (!has_tips(obj_)) {
if (has_timelapse_warning()) {
show_status(PrintDialogStatus::PrintStatusTimelapseWarning);
} else {
show_status(PrintDialogStatus::PrintStatusAmsMappingValid);
}
return;
}
} else {
show_status(PrintDialogStatus::PrintStatusAmsMappingInvalid);
return;
}
}
} }
bool SyncAmsInfoDialog::has_timelapse_warning() bool SyncAmsInfoDialog::has_timelapse_warning()
@ -2672,8 +2605,6 @@ void SyncAmsInfoDialog::set_default(bool hide_some)
if (!hide_some) { if (!hide_some) {
if (agent->is_user_login()) { if (agent->is_user_login()) {
show_status(PrintDialogStatus::PrintStatusInit); show_status(PrintDialogStatus::PrintStatusInit);
} else {
show_status(PrintDialogStatus::PrintStatusNoUserLogin);
} }
} }
} }
@ -3376,39 +3307,6 @@ void SyncAmsInfoDialog::update_lan_machine_list()
BOOST_LOG_TRIVIAL(info) << "SyncAmsInfoDialog update_lan_devices end"; BOOST_LOG_TRIVIAL(info) << "SyncAmsInfoDialog update_lan_devices end";
} }
std::string SyncAmsInfoDialog::get_print_status_info(PrintDialogStatus status)
{
switch (status) {
case PrintStatusInit: return "PrintStatusInit";
case PrintStatusNoUserLogin: return "PrintStatusNoUserLogin";
case PrintStatusInvalidPrinter: return "PrintStatusInvalidPrinter";
case PrintStatusConnectingServer: return "PrintStatusConnectingServer";
case PrintStatusReading: return "PrintStatusReading";
case PrintStatusReadingFinished: return "PrintStatusReadingFinished";
case PrintStatusReadingTimeout: return "PrintStatusReadingTimeout";
case PrintStatusInUpgrading: return "PrintStatusInUpgrading";
case PrintStatusNeedUpgradingAms: return "PrintStatusNeedUpgradingAms";
case PrintStatusInSystemPrinting: return "PrintStatusInSystemPrinting";
case PrintStatusInPrinting: return "PrintStatusInPrinting";
case PrintStatusDisableAms: return "PrintStatusDisableAms";
case PrintStatusAmsMappingSuccess: return "PrintStatusAmsMappingSuccess";
case PrintStatusAmsMappingInvalid: return "PrintStatusAmsMappingInvalid";
case PrintStatusAmsMappingU0Invalid: return "PrintStatusAmsMappingU0Invalid";
case PrintStatusAmsMappingValid: return "PrintStatusAmsMappingValid";
case PrintStatusAmsMappingByOrder: return "PrintStatusAmsMappingByOrder";
case PrintStatusRefreshingMachineList: return "PrintStatusRefreshingMachineList";
case PrintStatusSending: return "PrintStatusSending";
case PrintStatusSendingCanceled: return "PrintStatusSendingCanceled";
case PrintStatusLanModeNoSdcard: return "PrintStatusLanModeNoSdcard";
case PrintStatusLanModeSDcardNotAvailable: return "PrintStatusLanModeSDcardNotAvailable";
case PrintStatusNoSdcard: return "PrintStatusNoSdcard";
case PrintStatusUnsupportedPrinter: return "PrintStatusUnsupportedPrinter";
case PrintStatusTimelapseNoSdcard: return "PrintStatusTimelapseNoSdcard";
case PrintStatusNotSupportedPrintAll: return "PrintStatusNotSupportedPrintAll";
}
return "unknown";
}
SyncNozzleAndAmsDialog::SyncNozzleAndAmsDialog(InputInfo &input_info) SyncNozzleAndAmsDialog::SyncNozzleAndAmsDialog(InputInfo &input_info)
: BaseTransparentDPIFrame(static_cast<wxWindow *>(wxGetApp().mainframe), : BaseTransparentDPIFrame(static_cast<wxWindow *>(wxGetApp().mainframe),
320, 320,

View File

@ -207,7 +207,6 @@ public:
bool is_blocking_printing(MachineObject *obj_); bool is_blocking_printing(MachineObject *obj_);
bool is_same_nozzle_diameters(NozzleType &tag_nozzle_type, float &nozzle_diameter); bool is_same_nozzle_diameters(NozzleType &tag_nozzle_type, float &nozzle_diameter);
bool is_same_nozzle_type(std::string &filament_type, NozzleType &tag_nozzle_type); bool is_same_nozzle_type(std::string &filament_type, NozzleType &tag_nozzle_type);
bool has_tips(MachineObject *obj);
bool is_timeout(); bool is_timeout();
int update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name, std::string file_path); int update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name, std::string file_path);
void set_print_type(PrintFromType type) { m_print_type = type; }; void set_print_type(PrintFromType type) { m_print_type = type; };
@ -221,8 +220,6 @@ public:
bool is_nozzle_type_match(ExtderData data, wxString &error_message) const; bool is_nozzle_type_match(ExtderData data, wxString &error_message) const;
int convert_filament_map_nozzle_id_to_task_nozzle_id(int nozzle_id); int convert_filament_map_nozzle_id_to_task_nozzle_id(int nozzle_id);
std::string get_print_status_info(PrintDialogStatus status);
PrintFromType get_print_type() { return m_print_type; }; PrintFromType get_print_type() { return m_print_type; };
wxString format_text(wxString &m_msg); wxString format_text(wxString &m_msg);
PrintDialogStatus get_status() { return m_print_status; } PrintDialogStatus get_status() { return m_print_status; }