ENH:add confirmation pop-up window

jira:[STUDIO-12237]

Change-Id: I255e074f5f4eba4a6d7fdbf8f3a6c1c3751a951c
(cherry picked from commit 6c3e57dd3d3ea0b4cfb1db0754e56d15d8aba826)
This commit is contained in:
tao wang 2025-05-19 17:21:20 +08:00 committed by Noisyfox
parent 22f3a2f8bd
commit 48bc942cc4
2 changed files with 14 additions and 5 deletions

View file

@ -2067,7 +2067,7 @@ int MachineObject::command_task_pause()
int MachineObject::command_task_resume()
{
if (jobState_ > 1) return 0;
if(check_resume_condition()) return 0;
json j;
j["print"]["command"] = "resume";
@ -2079,7 +2079,7 @@ int MachineObject::command_task_resume()
int MachineObject::command_hms_idle_ignore(const std::string &error_str, int type)
{
if (jobState_ > 1) return 0;
if(check_resume_condition()) return 0;
json j;
j["print"]["command"] = "idle_ignore";
@ -2091,7 +2091,7 @@ int MachineObject::command_hms_idle_ignore(const std::string &error_str, int typ
int MachineObject::command_hms_resume(const std::string& error_str, const std::string& job_id)
{
if (jobState_ > 1) return 0;
if(check_resume_condition()) return 0;
json j;
j["print"]["command"] = "resume";
@ -2105,7 +2105,7 @@ int MachineObject::command_hms_resume(const std::string& error_str, const std::s
int MachineObject::command_hms_ignore(const std::string& error_str, const std::string& job_id)
{
if (jobState_ > 1) return 0;
if(check_resume_condition()) return 0;
json j;
j["print"]["command"] = "ignore";
@ -2173,6 +2173,14 @@ int MachineObject::command_set_chamber(int temp)
return this->publish_json(j.dump(), 1);
}
int MachineObject::check_resume_condition()
{
if (jobState_ > 1) {
GUI::wxGetApp().show_dialog(_L("To ensure your safety, certain processing tasks (such as laser) can only be resumed on printer."));
return 1;
}
return 0;
}
int MachineObject::command_ams_change_filament(bool load, std::string ams_id, std::string slot_id, int old_temp, int new_temp)
{
json j;
@ -2295,7 +2303,7 @@ int MachineObject::command_ams_select_tray(std::string tray_id)
int MachineObject::command_ams_control(std::string action)
{
if (action == "resume" && jobState_ > 1 ) return 0;
if (action == "resume" && check_resume_condition()) return 0;
//valid actions
if (action == "resume" || action == "reset" || action == "pause" || action == "done" || action == "abort") {

View file

@ -1209,6 +1209,7 @@ public:
int command_set_nozzle(int temp);
int command_set_nozzle_new(int nozzle_id, int temp);
int command_set_chamber(int temp);
int check_resume_condition();
// ams controls
//int command_ams_switch(int tray_index, int old_temp = 210, int new_temp = 210);
int command_ams_change_filament(bool load, std::string ams_id, std::string slot_id, int old_temp = 210, int new_temp = 210);