FIX: add hms action buttons
jira: [STUDIO-10823] Change-Id: I751f0951df439a5265cc53f5679fa69b8d1c728a
This commit is contained in:
parent
ae9929b5d4
commit
0ed457207e
|
@ -2031,6 +2031,50 @@ int MachineObject::command_task_resume()
|
|||
return this->publish_json(j.dump(), 1);
|
||||
}
|
||||
|
||||
int MachineObject::command_hms_idle_ignore(const std::string &error_str, int type)
|
||||
{
|
||||
json j;
|
||||
j["print"]["command"] = "idle_ignore";
|
||||
j["print"]["err"] = error_str;
|
||||
j["print"]["type"] = type;
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
return this->publish_json(j.dump(), 1);
|
||||
}
|
||||
|
||||
int MachineObject::command_hms_resume(const std::string& error_str, const std::string& job_id)
|
||||
{
|
||||
json j;
|
||||
j["print"]["command"] = "resume";
|
||||
j["print"]["err"] = error_str;
|
||||
j["print"]["param"] = "reserve";
|
||||
j["print"]["job_id"] = job_id;
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
|
||||
return this->publish_json(j.dump(), 1);
|
||||
}
|
||||
|
||||
int MachineObject::command_hms_ignore(const std::string& error_str, const std::string& job_id)
|
||||
{
|
||||
json j;
|
||||
j["print"]["command"] = "ignore";
|
||||
j["print"]["err"] = error_str;
|
||||
j["print"]["param"] = "reserve";
|
||||
j["print"]["job_id"] = job_id;
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
|
||||
return this->publish_json(j.dump(), 1);
|
||||
}
|
||||
|
||||
int MachineObject::command_stop_buzzer()
|
||||
{
|
||||
json j;
|
||||
j["print"]["command"] = "buzzer_ctrl";
|
||||
j["print"]["mode"] = 0;
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
|
||||
return this->publish_json(j.dump(), 1);
|
||||
}
|
||||
|
||||
int MachineObject::command_set_bed(int temp)
|
||||
{
|
||||
std::string gcode_str = (boost::format("M140 S%1%\n") % temp).str();
|
||||
|
|
|
@ -1146,6 +1146,13 @@ public:
|
|||
int command_task_cancel(std::string job_id);
|
||||
int command_task_pause();
|
||||
int command_task_resume();
|
||||
int command_hms_idle_ignore(const std::string &error_str, int type);
|
||||
int command_hms_resume(const std::string& error_str, const std::string& job_id);
|
||||
int command_hms_ignore(const std::string& error_str, const std::string& job_id);
|
||||
/* buzzer*/
|
||||
int command_stop_buzzer();
|
||||
|
||||
/* temp*/
|
||||
int command_set_bed(int temp);
|
||||
int command_set_nozzle(int temp);
|
||||
int command_set_nozzle_new(int nozzle_id, int temp);
|
||||
|
|
|
@ -40,6 +40,7 @@ wxDEFINE_EVENT(EVT_UPDATE_NOZZLE, wxCommandEvent);
|
|||
wxDEFINE_EVENT(EVT_JUMP_TO_HMS, wxCommandEvent);
|
||||
wxDEFINE_EVENT(EVT_JUMP_TO_LIVEVIEW, wxCommandEvent);
|
||||
wxDEFINE_EVENT(EVT_UPDATE_TEXT_MSG, wxCommandEvent);
|
||||
wxDEFINE_EVENT(EVT_ERROR_DIALOG_BTN_CLICKED, wxCommandEvent);
|
||||
|
||||
ReleaseNoteDialog::ReleaseNoteDialog(Plater *plater /*= nullptr*/)
|
||||
: DPIDialog(static_cast<wxWindow *>(wxGetApp().mainframe), wxID_ANY, _L("Release Note"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX)
|
||||
|
@ -900,7 +901,17 @@ PrintErrorDialog::PrintErrorDialog(wxWindow* parent, wxWindowID id, const wxStri
|
|||
wxGetApp().UpdateFrameDarkUI(this);
|
||||
}
|
||||
|
||||
void PrintErrorDialog::post_event(wxCommandEvent&& event)
|
||||
void PrintErrorDialog::post_event(wxCommandEvent& event)
|
||||
{
|
||||
if (event_parent) {
|
||||
event.SetString("");
|
||||
event.SetEventObject(event_parent);
|
||||
wxPostEvent(event_parent, event);
|
||||
event.Skip();
|
||||
}
|
||||
}
|
||||
|
||||
void PrintErrorDialog::post_event(wxCommandEvent &&event)
|
||||
{
|
||||
if (event_parent) {
|
||||
event.SetString("");
|
||||
|
@ -1154,6 +1165,49 @@ void PrintErrorDialog::init_button_list()
|
|||
post_event(wxCommandEvent(EVT_JUMP_TO_LIVEVIEW));
|
||||
e.Skip();
|
||||
});
|
||||
|
||||
init_button(NO_REMINDER_NEXT_TIME, _L("No Reminder Next Time"));
|
||||
m_button_list[NO_REMINDER_NEXT_TIME]->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& e) {
|
||||
wxCommandEvent evt(EVT_ERROR_DIALOG_BTN_CLICKED);
|
||||
evt.SetInt(NO_REMINDER_NEXT_TIME);
|
||||
post_event(evt);
|
||||
e.Skip();
|
||||
});
|
||||
|
||||
init_button(IGNORE_NO_REMINDER_NEXT_TIME, _L("Ignore. Don't Remind Next Time"));
|
||||
m_button_list[IGNORE_NO_REMINDER_NEXT_TIME]->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& e) {
|
||||
wxCommandEvent evt(EVT_ERROR_DIALOG_BTN_CLICKED);
|
||||
evt.SetInt(IGNORE_NO_REMINDER_NEXT_TIME);
|
||||
post_event(evt);
|
||||
e.Skip();
|
||||
});
|
||||
|
||||
init_button(IGNORE_RESUME, _L("Ignore this and Resume"));
|
||||
m_button_list[IGNORE_RESUME]->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& e)
|
||||
{
|
||||
wxCommandEvent evt(EVT_ERROR_DIALOG_BTN_CLICKED);
|
||||
evt.SetInt(IGNORE_RESUME);
|
||||
post_event(evt);
|
||||
e.Skip();
|
||||
});
|
||||
|
||||
init_button(PROBLEM_SOLVED_RESUME, _L("Problem Solved and Resume"));
|
||||
m_button_list[PROBLEM_SOLVED_RESUME]->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& e)
|
||||
{
|
||||
wxCommandEvent evt(EVT_ERROR_DIALOG_BTN_CLICKED);
|
||||
evt.SetInt(PROBLEM_SOLVED_RESUME);
|
||||
post_event(evt);
|
||||
e.Skip();
|
||||
});
|
||||
|
||||
init_button(STOP_BUZZER, _L("Stop Buzzer"));
|
||||
m_button_list[STOP_BUZZER]->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& e)
|
||||
{
|
||||
wxCommandEvent evt(EVT_ERROR_DIALOG_BTN_CLICKED);
|
||||
evt.SetInt(STOP_BUZZER);
|
||||
post_event(evt);
|
||||
e.Skip();
|
||||
});
|
||||
}
|
||||
|
||||
PrintErrorDialog::~PrintErrorDialog()
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <wx/hashmap.h>
|
||||
#include <wx/webview.h>
|
||||
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
wxDECLARE_EVENT(EVT_SECONDARY_CHECK_CONFIRM, wxCommandEvent);
|
||||
|
@ -51,6 +52,7 @@ wxDECLARE_EVENT(EVT_LOAD_VAMS_TRAY, wxCommandEvent);
|
|||
wxDECLARE_EVENT(EVT_JUMP_TO_HMS, wxCommandEvent);
|
||||
wxDECLARE_EVENT(EVT_JUMP_TO_LIVEVIEW, wxCommandEvent);
|
||||
wxDECLARE_EVENT(EVT_UPDATE_TEXT_MSG, wxCommandEvent);
|
||||
wxDECLARE_EVENT(EVT_ERROR_DIALOG_BTN_CLICKED, wxCommandEvent);
|
||||
|
||||
class ReleaseNoteDialog : public DPIDialog
|
||||
{
|
||||
|
@ -167,7 +169,7 @@ class PrintErrorDialog : public DPIFrame
|
|||
private:
|
||||
wxWindow* event_parent{ nullptr };
|
||||
public:
|
||||
enum PrintErrorButton {
|
||||
enum PrintErrorButton : int {
|
||||
RESUME_PRINTING = 2,
|
||||
RESUME_PRINTING_DEFECTS = 3,
|
||||
RESUME_PRINTING_PROBELM_SOLVED = 4,
|
||||
|
@ -178,8 +180,16 @@ public:
|
|||
CONTINUE = 9,
|
||||
LOAD_VIRTUAL_TRAY = 10,
|
||||
OK_BUTTON = 11,
|
||||
FILAMENT_LOAD_RESUME,
|
||||
FILAMENT_LOAD_RESUME = 12,
|
||||
JUMP_TO_LIVEVIEW,
|
||||
|
||||
NO_REMINDER_NEXT_TIME = 23,
|
||||
IGNORE_NO_REMINDER_NEXT_TIME = 25,
|
||||
//LOAD_FILAMENT = 26, /*TODO*/
|
||||
IGNORE_RESUME = 27,
|
||||
PROBLEM_SOLVED_RESUME = 28,
|
||||
STOP_BUZZER = 29,
|
||||
|
||||
ERROR_BUTTON_COUNT
|
||||
};
|
||||
PrintErrorDialog(
|
||||
|
@ -194,6 +204,7 @@ public:
|
|||
void on_show();
|
||||
void on_hide();
|
||||
void update_title_style(wxString title, std::vector<int> style, wxWindow* parent = nullptr);
|
||||
void post_event(wxCommandEvent& event);
|
||||
void post_event(wxCommandEvent&& event);
|
||||
void rescale();
|
||||
~PrintErrorDialog();
|
||||
|
|
|
@ -2298,7 +2298,7 @@ StatusPanel::StatusPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, co
|
|||
if (m_print_error_dlg)
|
||||
m_print_error_dlg->on_hide();
|
||||
});
|
||||
|
||||
Bind(EVT_ERROR_DIALOG_BTN_CLICKED, &StatusPanel::on_print_error_dlg_btn_clicked, 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);
|
||||
|
@ -4640,6 +4640,37 @@ void StatusPanel::on_print_error_done(wxCommandEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
void StatusPanel::on_print_error_dlg_btn_clicked(wxCommandEvent& event)
|
||||
{
|
||||
if (obj)
|
||||
{
|
||||
int id = event.GetInt();
|
||||
if (id == PrintErrorDialog::NO_REMINDER_NEXT_TIME)
|
||||
{
|
||||
obj->command_hms_idle_ignore(std::to_string(before_error_code), 0);/*the type is 0, supported by AP*/
|
||||
}
|
||||
else if (id == PrintErrorDialog::IGNORE_NO_REMINDER_NEXT_TIME)
|
||||
{
|
||||
obj->command_hms_ignore(std::to_string(before_error_code), obj->job_id_);
|
||||
}
|
||||
else if (id == PrintErrorDialog::IGNORE_RESUME)
|
||||
{
|
||||
obj->command_hms_ignore(std::to_string(before_error_code), obj->job_id_);
|
||||
}
|
||||
else if (id == PrintErrorDialog::PROBLEM_SOLVED_RESUME)
|
||||
{
|
||||
obj->command_hms_resume(std::to_string(before_error_code), obj->job_id_);
|
||||
}
|
||||
else if (id == PrintErrorDialog::STOP_BUZZER)
|
||||
{
|
||||
obj->command_stop_buzzer();
|
||||
}
|
||||
|
||||
if (m_print_error_dlg) { m_print_error_dlg->on_hide(); }
|
||||
if (m_print_error_dlg_no_action) { m_print_error_dlg_no_action->on_hide();}
|
||||
}
|
||||
}
|
||||
|
||||
void StatusPanel::on_fan_changed(wxCommandEvent& event)
|
||||
{
|
||||
auto type = event.GetInt();
|
||||
|
|
|
@ -700,6 +700,7 @@ protected:
|
|||
void on_ams_guide(wxCommandEvent &event);
|
||||
void on_ams_retry(wxCommandEvent &event);
|
||||
void on_print_error_done(wxCommandEvent& event);
|
||||
void on_print_error_dlg_btn_clicked(wxCommandEvent& event);
|
||||
|
||||
void on_fan_changed(wxCommandEvent& event);
|
||||
void on_cham_temp_kill_focus(wxFocusEvent& event);
|
||||
|
|
Loading…
Reference in New Issue