mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2026-02-15 08:59:39 -07:00
NEW:Add safety button
jira: [STUDIO-14064] Change-Id: I6a9be69033ea80c2242561c4e1b0ca5626bc7a51 (cherry picked from commit ac4af3aa1de453330fbf2d58988a6e1ea8d5d445)
This commit is contained in:
parent
ac69e7cfbc
commit
299c7c0bac
17 changed files with 417 additions and 78 deletions
|
|
@ -64,7 +64,8 @@
|
|||
"printer_series": "series_x1",
|
||||
"has_cali_line": true,
|
||||
"printer_is_enclosed": true,
|
||||
"enable_set_nozzle_info": false
|
||||
"enable_set_nozzle_info": false,
|
||||
"support_safety_options": false
|
||||
},
|
||||
"01.01.01.00": {
|
||||
"print": {
|
||||
|
|
|
|||
|
|
@ -64,7 +64,8 @@
|
|||
"printer_series": "series_x1",
|
||||
"has_cali_line": true,
|
||||
"printer_is_enclosed": true,
|
||||
"enable_set_nozzle_info": false
|
||||
"enable_set_nozzle_info": false,
|
||||
"support_safety_options": false
|
||||
},
|
||||
"01.01.01.00": {
|
||||
"print": {
|
||||
|
|
|
|||
|
|
@ -68,7 +68,8 @@
|
|||
"printer_series": "series_x1",
|
||||
"has_cali_line": true,
|
||||
"printer_is_enclosed": true,
|
||||
"enable_set_nozzle_info": false
|
||||
"enable_set_nozzle_info": false,
|
||||
"support_safety_options": false
|
||||
},
|
||||
"01.05.06.06": {
|
||||
"rv2166": "00.00.21.20"
|
||||
|
|
|
|||
|
|
@ -60,7 +60,8 @@
|
|||
"printer_series": "series_n",
|
||||
"has_cali_line": false,
|
||||
"printer_is_enclosed": false,
|
||||
"enable_set_nozzle_info": false
|
||||
"enable_set_nozzle_info": false,
|
||||
"support_safety_options": false
|
||||
},
|
||||
"01.01.50.01": {
|
||||
"print": {
|
||||
|
|
|
|||
|
|
@ -60,7 +60,8 @@
|
|||
"printer_series": "series_n",
|
||||
"has_cali_line": false,
|
||||
"printer_is_enclosed": false,
|
||||
"enable_set_nozzle_info": false
|
||||
"enable_set_nozzle_info": false,
|
||||
"support_safety_options": false
|
||||
},
|
||||
"01.01.50.01": {
|
||||
"print": {
|
||||
|
|
|
|||
|
|
@ -69,6 +69,12 @@
|
|||
"printer_arch": "core_xy",
|
||||
"printer_series": "series_x1",
|
||||
"has_cali_line": true,
|
||||
<<<<<<< HEAD (372939 ENH: support proceed action)
|
||||
"enable_set_nozzle_info": false
|
||||
=======
|
||||
"printer_is_enclosed": true,
|
||||
"enable_set_nozzle_info": false,
|
||||
"support_safety_options": true
|
||||
>>>>>>> CHANGE (35a851 NEW:Add safety button)
|
||||
}
|
||||
}
|
||||
|
|
@ -78,6 +78,7 @@
|
|||
"printer_series": "series_o",
|
||||
"has_cali_line": true,
|
||||
"printer_is_enclosed": true,
|
||||
"enable_set_nozzle_info": false
|
||||
"enable_set_nozzle_info": false,
|
||||
"support_safety_options": false
|
||||
}
|
||||
}
|
||||
|
|
@ -76,6 +76,7 @@
|
|||
"printer_series": "series_o",
|
||||
"has_cali_line": true,
|
||||
"printer_is_enclosed": true,
|
||||
"enable_set_nozzle_info": false
|
||||
"enable_set_nozzle_info": false,
|
||||
"support_safety_options": false
|
||||
}
|
||||
}
|
||||
|
|
@ -75,6 +75,7 @@
|
|||
"printer_series": "series_o",
|
||||
"has_cali_line": true,
|
||||
"printer_is_enclosed": true,
|
||||
"enable_set_nozzle_info": false
|
||||
"enable_set_nozzle_info": false,
|
||||
"support_safety_options": false
|
||||
}
|
||||
}
|
||||
|
|
@ -474,6 +474,8 @@ set(SLIC3R_GUI_SOURCES
|
|||
GUI/Widgets/AMSItem.hpp
|
||||
GUI/Widgets/AxisCtrlButton.cpp
|
||||
GUI/Widgets/AxisCtrlButton.hpp
|
||||
GUI/SafetyOptionsDialog.hpp
|
||||
GUI/SafetyOptionsDialog.cpp
|
||||
GUI/Widgets/Button.cpp
|
||||
GUI/Widgets/Button.hpp
|
||||
GUI/Widgets/CheckBox.cpp
|
||||
|
|
|
|||
|
|
@ -78,7 +78,10 @@ public:
|
|||
static std::vector<std::string> get_unsupport_auto_cali_filaments(std::string type_str) { return get_value_from_config<std::vector<std::string>>(type_str, "auto_cali_not_support_filaments"); }
|
||||
|
||||
/*detection*/
|
||||
static bool support_wrapping_detection(const std::string& type_str) { return get_value_from_config<bool>(type_str, "support_wrapping_detection"); }
|
||||
static bool support_wrapping_detection(const std::string& type_str) { return get_value_from_config<bool>(type_str, "support_wrapping_detection"); }
|
||||
|
||||
/*safety options*/
|
||||
static bool support_safety_options(const std::string &type_str) { return get_value_from_config<bool>(type_str, "support_safety_options"); }
|
||||
|
||||
public:
|
||||
template<typename T>
|
||||
|
|
|
|||
|
|
@ -130,30 +130,6 @@ PrintOptionsDialog::PrintOptionsDialog(wxWindow* parent)
|
|||
evt.Skip();
|
||||
});
|
||||
|
||||
m_cb_open_door->Bind(wxEVT_TOGGLEBUTTON, [this](wxCommandEvent &evt) {
|
||||
if (m_cb_open_door->GetValue()) {
|
||||
if (obj) { obj->command_set_door_open_check(MachineObject::DOOR_OPEN_CHECK_ENABLE_WARNING); }
|
||||
} else {
|
||||
if (obj) { obj->command_set_door_open_check(MachineObject::DOOR_OPEN_CHECK_DISABLE); }
|
||||
}
|
||||
|
||||
evt.Skip();
|
||||
});
|
||||
|
||||
open_door_switch_board->Bind(wxCUSTOMEVT_SWITCH_POS, [this](wxCommandEvent &evt)
|
||||
{
|
||||
if (evt.GetInt() == 0)
|
||||
{
|
||||
if (obj) { obj->command_set_door_open_check(MachineObject::DOOR_OPEN_CHECK_ENABLE_PAUSE_PRINT); }
|
||||
}
|
||||
else if (evt.GetInt() == 1)
|
||||
{
|
||||
if (obj) { obj->command_set_door_open_check(MachineObject::DOOR_OPEN_CHECK_ENABLE_WARNING); }
|
||||
}
|
||||
|
||||
evt.Skip();
|
||||
});
|
||||
|
||||
m_cb_save_remote_print_file_to_storage->Bind(wxEVT_TOGGLEBUTTON, [this](wxCommandEvent& evt)
|
||||
{
|
||||
if (obj) { obj->command_set_save_remote_print_file_to_storage(m_cb_save_remote_print_file_to_storage->GetValue());}
|
||||
|
|
@ -185,6 +161,28 @@ PrintOptionsDialog::PrintOptionsDialog(wxWindow* parent)
|
|||
evt.Skip();
|
||||
});
|
||||
|
||||
m_cb_open_door->Bind(wxEVT_TOGGLEBUTTON, [this](wxCommandEvent& evt) {
|
||||
if (m_cb_open_door->GetValue()) {
|
||||
if (obj) { obj->command_set_door_open_check(MachineObject::DOOR_OPEN_CHECK_ENABLE_WARNING); }
|
||||
} else {
|
||||
if (obj) { obj->command_set_door_open_check(MachineObject::DOOR_OPEN_CHECK_DISABLE); }
|
||||
}
|
||||
evt.Skip();
|
||||
});
|
||||
|
||||
open_door_switch_board->Bind(wxCUSTOMEVT_SWITCH_POS, [this](wxCommandEvent& evt)
|
||||
{
|
||||
if (evt.GetInt() == 0)
|
||||
{
|
||||
if (obj) { obj->command_set_door_open_check(MachineObject::DOOR_OPEN_CHECK_ENABLE_PAUSE_PRINT); }
|
||||
}
|
||||
else if (evt.GetInt() == 1)
|
||||
{
|
||||
if (obj) { obj->command_set_door_open_check(MachineObject::DOOR_OPEN_CHECK_ENABLE_WARNING); }
|
||||
}
|
||||
evt.Skip();
|
||||
});
|
||||
|
||||
wxGetApp().UpdateDlgDarkUI(this);
|
||||
}
|
||||
|
||||
|
|
@ -439,8 +437,8 @@ void PrintOptionsDialog::update_options(MachineObject* obj_)
|
|||
line7->Hide();
|
||||
}
|
||||
|
||||
UpdateOptionOpenDoorCheck(obj_);
|
||||
UpdateOptionSavePrintFileToStorage(obj_);
|
||||
UpdateOptionOpenDoorCheck(obj_);
|
||||
|
||||
this->Freeze();
|
||||
|
||||
|
|
@ -505,7 +503,24 @@ void PrintOptionsDialog::update_options(MachineObject* obj_)
|
|||
Layout();
|
||||
}
|
||||
|
||||
void PrintOptionsDialog::UpdateOptionOpenDoorCheck(MachineObject *obj) {
|
||||
|
||||
|
||||
void PrintOptionsDialog::UpdateOptionSavePrintFileToStorage(MachineObject *obj)
|
||||
{
|
||||
if (obj && obj->GetConfig()->SupportSaveRemotePrintFileToStorage())
|
||||
{
|
||||
m_cb_save_remote_print_file_to_storage->SetValue(obj->get_save_remote_print_file_to_storage());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_cb_save_remote_print_file_to_storage->Hide();
|
||||
text_save_remote_print_file_to_storage->Hide();
|
||||
text_save_remote_print_file_to_storage_explain->Hide();
|
||||
}
|
||||
}
|
||||
|
||||
void PrintOptionsDialog::UpdateOptionOpenDoorCheck(MachineObject *obj)
|
||||
{
|
||||
if (!obj || !obj->support_door_open_check()) {
|
||||
m_cb_open_door->Hide();
|
||||
text_open_door->Hide();
|
||||
|
|
@ -513,6 +528,18 @@ void PrintOptionsDialog::UpdateOptionOpenDoorCheck(MachineObject *obj) {
|
|||
return;
|
||||
}
|
||||
|
||||
// Determine if current printer supports safety options
|
||||
std::string current_printer_type = obj->printer_type;
|
||||
bool supports_safety = DevPrinterConfigUtil::support_safety_options(current_printer_type);
|
||||
|
||||
// Hide door open check for printers that support safety options
|
||||
if (supports_safety) {
|
||||
m_cb_open_door->Hide();
|
||||
text_open_door->Hide();
|
||||
open_door_switch_board->Hide();
|
||||
return;
|
||||
}
|
||||
|
||||
if (obj->get_door_open_check_state() != MachineObject::DOOR_OPEN_CHECK_DISABLE) {
|
||||
m_cb_open_door->SetValue(true);
|
||||
open_door_switch_board->Enable();
|
||||
|
|
@ -535,20 +562,6 @@ void PrintOptionsDialog::UpdateOptionOpenDoorCheck(MachineObject *obj) {
|
|||
open_door_switch_board->Show();
|
||||
}
|
||||
|
||||
void PrintOptionsDialog::UpdateOptionSavePrintFileToStorage(MachineObject *obj)
|
||||
{
|
||||
if (obj && obj->GetConfig()->SupportSaveRemotePrintFileToStorage())
|
||||
{
|
||||
m_cb_save_remote_print_file_to_storage->SetValue(obj->get_save_remote_print_file_to_storage());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_cb_save_remote_print_file_to_storage->Hide();
|
||||
text_save_remote_print_file_to_storage->Hide();
|
||||
text_save_remote_print_file_to_storage_explain->Hide();
|
||||
}
|
||||
}
|
||||
|
||||
wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent)
|
||||
{
|
||||
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
|
@ -854,22 +867,6 @@ wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent)
|
|||
line4->SetLineColour(wxColour("#FFFFFF"));
|
||||
sizer->Add(line4, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(20));
|
||||
line4->Hide();
|
||||
sizer->Add(0, 0, 0, wxTOP, FromDIP(15));
|
||||
|
||||
//Open Door Detection
|
||||
line_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_cb_open_door = new CheckBox(parent);
|
||||
text_open_door = new Label(parent, _L("Open Door Detection"));
|
||||
text_open_door->SetFont(Label::Body_14);
|
||||
open_door_switch_board = new SwitchBoard(parent, _L("Notification"), _L("Pause printing"), wxSize(FromDIP(200), FromDIP(26)));
|
||||
open_door_switch_board->Disable();
|
||||
line_sizer->Add(FromDIP(5), 0, 0, 0);
|
||||
line_sizer->Add(m_cb_open_door, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
|
||||
line_sizer->Add(text_open_door, 1, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
|
||||
|
||||
sizer->Add(line_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(18));
|
||||
sizer->Add(open_door_switch_board, 0, wxLEFT, FromDIP(58));
|
||||
line_sizer->Add(FromDIP(10), 0, 0, 0);
|
||||
sizer->Add(0, 0, 0, wxTOP, FromDIP(15));
|
||||
|
||||
//Save remote file to local storage
|
||||
|
|
@ -955,6 +952,20 @@ wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent)
|
|||
m_cb_nozzle_blob->Hide();
|
||||
text_nozzle_blob_caption->Hide();
|
||||
line7->Hide();
|
||||
|
||||
//Open Door Detection
|
||||
line_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_cb_open_door = new CheckBox(parent);
|
||||
text_open_door = new Label(parent, _L("Open Door Detection"));
|
||||
text_open_door->SetFont(Label::Body_14);
|
||||
open_door_switch_board = new SwitchBoard(parent, _L("Notification"), _L("Pause printing"), wxSize(FromDIP(200), FromDIP(26)));
|
||||
open_door_switch_board->Disable();
|
||||
line_sizer->Add(FromDIP(5), 0, 0, 0);
|
||||
line_sizer->Add(m_cb_open_door, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
|
||||
line_sizer->Add(text_open_door, 1, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
|
||||
|
||||
sizer->Add(line_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(18));
|
||||
sizer->Add(open_door_switch_board, 0, wxLEFT, FromDIP(58));
|
||||
sizer->Add(0, 0, 0, wxTOP, FromDIP(15));
|
||||
|
||||
ai_monitoring_level_list->Connect(wxEVT_COMBOBOX, wxCommandEventHandler(PrintOptionsDialog::set_ai_monitor_sensitivity), NULL, this);
|
||||
|
|
|
|||
|
|
@ -84,11 +84,11 @@ protected:
|
|||
CheckBox* m_cb_airprinting_detection;
|
||||
CheckBox* m_cb_plate_mark;
|
||||
CheckBox* m_cb_auto_recovery;
|
||||
CheckBox* m_cb_open_door;
|
||||
CheckBox* m_cb_save_remote_print_file_to_storage;
|
||||
CheckBox* m_cb_sup_sound;
|
||||
CheckBox* m_cb_filament_tangle;
|
||||
CheckBox* m_cb_nozzle_blob;
|
||||
CheckBox* m_cb_open_door;
|
||||
Label* text_first_layer;
|
||||
Label* text_ai_detections;
|
||||
Label* text_ai_detections_caption;
|
||||
|
|
@ -125,13 +125,13 @@ protected:
|
|||
Label* text_plate_mark;
|
||||
Label* text_plate_mark_caption;
|
||||
Label* text_auto_recovery;
|
||||
Label* text_open_door;
|
||||
Label* text_save_remote_print_file_to_storage;
|
||||
Label* text_save_remote_print_file_to_storage_explain;
|
||||
Label* text_sup_sound;
|
||||
Label* text_filament_tangle;
|
||||
Label* text_nozzle_blob;
|
||||
Label* text_nozzle_blob_caption;
|
||||
Label* text_open_door;
|
||||
StaticLine* line1;
|
||||
StaticLine* line2;
|
||||
StaticLine* line3;
|
||||
|
|
@ -182,8 +182,8 @@ public:
|
|||
void set_airprinting_detection_sensitivity(wxCommandEvent &evt);
|
||||
|
||||
private:
|
||||
void UpdateOptionOpenDoorCheck(MachineObject *obj);
|
||||
void UpdateOptionSavePrintFileToStorage(MachineObject *obj);
|
||||
void UpdateOptionOpenDoorCheck(MachineObject *obj);
|
||||
};
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
|
|
|
|||
164
src/slic3r/GUI/SafetyOptionsDialog.cpp
Normal file
164
src/slic3r/GUI/SafetyOptionsDialog.cpp
Normal file
|
|
@ -0,0 +1,164 @@
|
|||
#include "SafetyOptionsDialog.hpp"
|
||||
#include "I18N.hpp"
|
||||
#include "GUI_App.hpp"
|
||||
#include "libslic3r/Utils.hpp"
|
||||
#include "Widgets/SwitchButton.hpp"
|
||||
#include "MsgDialog.hpp"
|
||||
|
||||
#include "DeviceCore/DevConfig.h"
|
||||
#include "DeviceCore/DevExtruderSystem.h"
|
||||
#include "DeviceCore/DevNozzleSystem.h"
|
||||
|
||||
static const wxColour STATIC_BOX_LINE_COL = wxColour(238, 238, 238);
|
||||
static const wxColour STATIC_TEXT_CAPTION_COL = wxColour(100, 100, 100);
|
||||
static const wxColour STATIC_TEXT_EXPLAIN_COL = wxColour(100, 100, 100);
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
static StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(194, 194, 194), StateColor::Disabled),
|
||||
std::pair<wxColour, int>(wxColour(27, 136, 68), StateColor::Pressed),
|
||||
std::pair<wxColour, int>(wxColour(61, 203, 115), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(wxColour(0, 177, 66), StateColor::Normal));
|
||||
|
||||
SafetyOptionsDialog::SafetyOptionsDialog(wxWindow* parent)
|
||||
: DPIDialog(parent, wxID_ANY, _L("Safety Options"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX)
|
||||
{
|
||||
this->SetDoubleBuffered(true);
|
||||
std::string icon_path = (boost::format("%1%/images/BambuStudioTitle.ico") % resources_dir()).str();
|
||||
SetIcon(wxIcon(encode_path(icon_path.c_str()), wxBITMAP_TYPE_ICO));
|
||||
SetBackgroundColour(*wxWHITE);
|
||||
SetSize(FromDIP(480),FromDIP(320));
|
||||
|
||||
m_scrollwindow = new wxScrolledWindow(this, wxID_ANY);
|
||||
m_scrollwindow->SetScrollRate(0, FromDIP(10));
|
||||
m_scrollwindow->SetBackgroundColour(*wxWHITE);
|
||||
m_scrollwindow->SetMinSize(wxSize(FromDIP(480), wxDefaultCoord));
|
||||
m_scrollwindow->SetMaxSize(wxSize(FromDIP(480), wxDefaultCoord));
|
||||
|
||||
auto m_options_sizer = create_settings_group(m_scrollwindow);
|
||||
m_options_sizer->SetMinSize(wxSize(FromDIP(460), wxDefaultCoord));
|
||||
|
||||
m_scrollwindow->SetSizer(m_options_sizer);
|
||||
|
||||
wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
|
||||
mainSizer->Add(m_scrollwindow, 1, wxEXPAND);
|
||||
this->SetSizer(mainSizer);
|
||||
|
||||
m_options_sizer->Fit(m_scrollwindow);
|
||||
m_scrollwindow->FitInside();
|
||||
|
||||
this->Layout();
|
||||
|
||||
m_cb_open_door->Bind(wxEVT_TOGGLEBUTTON, [this](wxCommandEvent &evt) {
|
||||
if (m_cb_open_door->GetValue()) {
|
||||
if (obj) { obj->command_set_door_open_check(MachineObject::DOOR_OPEN_CHECK_ENABLE_WARNING); }
|
||||
} else {
|
||||
if (obj) { obj->command_set_door_open_check(MachineObject::DOOR_OPEN_CHECK_DISABLE); }
|
||||
}
|
||||
evt.Skip();
|
||||
});
|
||||
|
||||
open_door_switch_board->Bind(wxCUSTOMEVT_SWITCH_POS, [this](wxCommandEvent &evt)
|
||||
{
|
||||
if (evt.GetInt() == 0)
|
||||
{
|
||||
if (obj) { obj->command_set_door_open_check(MachineObject::DOOR_OPEN_CHECK_ENABLE_PAUSE_PRINT); }
|
||||
}
|
||||
else if (evt.GetInt() == 1)
|
||||
{
|
||||
if (obj) { obj->command_set_door_open_check(MachineObject::DOOR_OPEN_CHECK_ENABLE_WARNING); }
|
||||
}
|
||||
evt.Skip();
|
||||
});
|
||||
|
||||
wxGetApp().UpdateDlgDarkUI(this);
|
||||
}
|
||||
|
||||
SafetyOptionsDialog::~SafetyOptionsDialog()
|
||||
{
|
||||
}
|
||||
|
||||
void SafetyOptionsDialog::on_dpi_changed(const wxRect& suggested_rect)
|
||||
{
|
||||
Fit();
|
||||
}
|
||||
|
||||
void SafetyOptionsDialog::update_options(MachineObject* obj_)
|
||||
{
|
||||
if (!obj_) return;
|
||||
|
||||
UpdateOptionOpenDoorCheck(obj_);
|
||||
|
||||
this->Freeze();
|
||||
this->Thaw();
|
||||
Layout();
|
||||
}
|
||||
|
||||
void SafetyOptionsDialog::UpdateOptionOpenDoorCheck(MachineObject *obj) {
|
||||
if (!obj || !obj->support_door_open_check()) {
|
||||
m_cb_open_door->Hide();
|
||||
text_open_door->Hide();
|
||||
open_door_switch_board->Hide();
|
||||
return;
|
||||
}
|
||||
|
||||
if (obj->get_door_open_check_state() != MachineObject::DOOR_OPEN_CHECK_DISABLE) {
|
||||
m_cb_open_door->SetValue(true);
|
||||
open_door_switch_board->Enable();
|
||||
|
||||
if (obj->get_door_open_check_state() == MachineObject::DOOR_OPEN_CHECK_ENABLE_WARNING) {
|
||||
open_door_switch_board->updateState("left");
|
||||
open_door_switch_board->Refresh();
|
||||
} else if (obj->get_door_open_check_state() == MachineObject::DOOR_OPEN_CHECK_ENABLE_PAUSE_PRINT) {
|
||||
open_door_switch_board->updateState("right");
|
||||
open_door_switch_board->Refresh();
|
||||
}
|
||||
|
||||
} else {
|
||||
m_cb_open_door->SetValue(false);
|
||||
open_door_switch_board->Disable();
|
||||
}
|
||||
|
||||
m_cb_open_door->Show();
|
||||
text_open_door->Show();
|
||||
open_door_switch_board->Show();
|
||||
}
|
||||
|
||||
wxBoxSizer* SafetyOptionsDialog::create_settings_group(wxWindow* parent)
|
||||
{
|
||||
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
//Open Door Detection
|
||||
wxBoxSizer* line_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_cb_open_door = new CheckBox(parent);
|
||||
text_open_door = new Label(parent, _L("Open Door Detection"));
|
||||
text_open_door->SetFont(Label::Body_14);
|
||||
open_door_switch_board = new SwitchBoard(parent, _L("Notification"), _L("Pause printing"), wxSize(FromDIP(200), FromDIP(26)));
|
||||
open_door_switch_board->Disable();
|
||||
line_sizer->Add(FromDIP(5), 0, 0, 0);
|
||||
line_sizer->Add(m_cb_open_door, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
|
||||
line_sizer->Add(text_open_door, 1, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
|
||||
|
||||
sizer->Add(line_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(18));
|
||||
sizer->Add(open_door_switch_board, 0, wxLEFT, FromDIP(58));
|
||||
line_sizer->Add(FromDIP(10), 0, 0, 0);
|
||||
sizer->Add(0, 0, 0, wxTOP, FromDIP(15));
|
||||
|
||||
return sizer;
|
||||
}
|
||||
|
||||
void SafetyOptionsDialog::update_machine_obj(MachineObject *obj_)
|
||||
{
|
||||
obj = obj_;
|
||||
}
|
||||
|
||||
bool SafetyOptionsDialog::Show(bool show)
|
||||
{
|
||||
if (show) {
|
||||
wxGetApp().UpdateDlgDarkUI(this);
|
||||
CentreOnParent();
|
||||
}
|
||||
return DPIDialog::Show(show);
|
||||
}
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
53
src/slic3r/GUI/SafetyOptionsDialog.hpp
Normal file
53
src/slic3r/GUI/SafetyOptionsDialog.hpp
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
#ifndef slic3r_GUI_SafetyOptionsDialog_hpp_
|
||||
#define slic3r_GUI_SafetyOptionsDialog_hpp_
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
#include "GUI_Utils.hpp"
|
||||
#include "wxExtensions.hpp"
|
||||
#include "DeviceManager.hpp"
|
||||
#include "Widgets/Label.hpp"
|
||||
#include "Widgets/CheckBox.hpp"
|
||||
#include "Widgets/StaticLine.hpp"
|
||||
#include "Widgets/ComboBox.hpp"
|
||||
|
||||
// Previous definitions
|
||||
class SwitchBoard;
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
class SafetyOptionsDialog : public DPIDialog
|
||||
{
|
||||
protected:
|
||||
// settings
|
||||
wxScrolledWindow* m_scrollwindow;
|
||||
CheckBox* m_cb_open_door;
|
||||
Label* text_open_door;
|
||||
SwitchBoard* open_door_switch_board;
|
||||
wxBoxSizer* create_settings_group(wxWindow* parent);
|
||||
|
||||
bool print_halt = false;
|
||||
|
||||
public:
|
||||
SafetyOptionsDialog(wxWindow* parent);
|
||||
~SafetyOptionsDialog();
|
||||
void on_dpi_changed(const wxRect &suggested_rect) override;
|
||||
|
||||
MachineObject *obj { nullptr };
|
||||
|
||||
void update_options(MachineObject *obj_);
|
||||
void update_machine_obj(MachineObject *obj_);
|
||||
bool Show(bool show) override;
|
||||
|
||||
private:
|
||||
void UpdateOptionOpenDoorCheck(MachineObject *obj);
|
||||
};
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
|
||||
#endif
|
||||
|
|
@ -36,6 +36,12 @@
|
|||
#include "DeviceCore/DevPrintTaskInfo.h"
|
||||
|
||||
|
||||
|
||||
#include "PrintOptionsDialog.hpp"
|
||||
#include "SafetyOptionsDialog.hpp"
|
||||
|
||||
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
#define TEMP_THRESHOLD_VAL 2
|
||||
|
|
@ -1519,6 +1525,12 @@ wxBoxSizer *StatusBasePanel::create_machine_control_page(wxWindow *parent)
|
|||
m_options_btn->SetSize(wxSize(FromDIP(128), FromDIP(26)));
|
||||
m_options_btn->SetMinSize(wxSize(-1, FromDIP(26)));
|
||||
|
||||
m_safety_btn = new Button(m_panel_control_title, _L("Safety Options"));
|
||||
m_safety_btn->SetBackgroundColor(btn_bg_green);
|
||||
m_safety_btn->SetBorderColor(btn_bd_green);
|
||||
m_safety_btn->SetTextColor(wxColour("#FFFFFE"));
|
||||
m_safety_btn->SetSize(wxSize(FromDIP(128), FromDIP(26)));
|
||||
m_safety_btn->SetMinSize(wxSize(-1, FromDIP(26)));
|
||||
|
||||
m_calibration_btn = new Button(m_panel_control_title, _L("Calibration"));
|
||||
m_calibration_btn->SetBackgroundColor(btn_bg_green);
|
||||
|
|
@ -1528,10 +1540,14 @@ wxBoxSizer *StatusBasePanel::create_machine_control_page(wxWindow *parent)
|
|||
m_calibration_btn->SetMinSize(wxSize(-1, FromDIP(26)));
|
||||
m_calibration_btn->EnableTooltipEvenDisabled();
|
||||
|
||||
m_options_btn->Hide();
|
||||
m_safety_btn->Hide();
|
||||
|
||||
bSizer_control_title->Add(m_staticText_control, 1, wxALIGN_CENTER_VERTICAL | wxLEFT, PAGE_TITLE_LEFT_MARGIN);
|
||||
bSizer_control_title->Add(0, 0, 1, wxEXPAND, 0);
|
||||
bSizer_control_title->Add(m_parts_btn, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, FromDIP(10));
|
||||
bSizer_control_title->Add(m_options_btn, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, FromDIP(10));
|
||||
bSizer_control_title->Add(m_safety_btn, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, FromDIP(10));
|
||||
bSizer_control_title->Add(m_calibration_btn, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, FromDIP(10));
|
||||
|
||||
m_panel_control_title->SetSizer(bSizer_control_title);
|
||||
|
|
@ -2365,6 +2381,7 @@ StatusPanel::StatusPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, co
|
|||
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);
|
||||
m_options_btn->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_show_print_options), NULL, this);
|
||||
m_safety_btn->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_show_safety_options), NULL, this);
|
||||
m_parts_btn->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_show_parts_options), NULL, this);
|
||||
}
|
||||
|
||||
|
|
@ -2409,6 +2426,7 @@ StatusPanel::~StatusPanel()
|
|||
m_switch_speed->Disconnect(wxEVT_LEFT_DOWN, wxCommandEventHandler(StatusPanel::on_switch_speed), NULL, this);
|
||||
m_calibration_btn->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_start_calibration), NULL, this);
|
||||
m_options_btn->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_show_print_options), NULL, this);
|
||||
m_safety_btn->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_show_safety_options), NULL, this);
|
||||
m_parts_btn->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_show_parts_options), NULL, this);
|
||||
|
||||
// remove warning dialogs
|
||||
|
|
@ -2717,21 +2735,57 @@ void StatusPanel::update(MachineObject *obj)
|
|||
calibration_dlg->update_cali(obj);
|
||||
}
|
||||
|
||||
std::string current_printer_type = obj->printer_type;
|
||||
bool supports_safety = DevPrinterConfigUtil::support_safety_options(current_printer_type);
|
||||
|
||||
DevConfig* config = obj->GetConfig();
|
||||
if (config->SupportFirstLayerInspect()
|
||||
|| config->SupportAIMonitor()
|
||||
|| obj->is_support_build_plate_marker_detect
|
||||
|| obj->is_support_auto_recovery_step_loss) {
|
||||
m_options_btn->Show();
|
||||
if (print_options_dlg) {
|
||||
print_options_dlg->update_machine_obj(obj);
|
||||
print_options_dlg->update_options(obj);
|
||||
if (supports_safety) {
|
||||
if (config->SupportFirstLayerInspect()
|
||||
|| config->SupportAIMonitor()
|
||||
|| obj->is_support_build_plate_marker_detect
|
||||
|| obj->is_support_auto_recovery_step_loss) {
|
||||
m_options_btn->Show();
|
||||
if (print_options_dlg) {
|
||||
print_options_dlg->update_machine_obj(obj);
|
||||
print_options_dlg->update_options(obj);
|
||||
}
|
||||
} else {
|
||||
m_options_btn->Hide();
|
||||
}
|
||||
} else {
|
||||
m_options_btn->Hide();
|
||||
if (obj->support_door_open_check()) {
|
||||
m_options_btn->Show();
|
||||
if (print_options_dlg) {
|
||||
print_options_dlg->update_machine_obj(obj);
|
||||
print_options_dlg->update_options(obj);
|
||||
}
|
||||
} else {
|
||||
m_options_btn->Hide();
|
||||
}
|
||||
}
|
||||
|
||||
if (obj->support_door_open_check()) {
|
||||
if (supports_safety) {
|
||||
m_safety_btn->Show();
|
||||
if (safety_options_dlg) {
|
||||
safety_options_dlg->update_machine_obj(obj);
|
||||
safety_options_dlg->update_options(obj);
|
||||
}
|
||||
} else {
|
||||
m_safety_btn->Hide();
|
||||
}
|
||||
} else {
|
||||
m_safety_btn->Hide();
|
||||
}
|
||||
|
||||
m_parts_btn->Show();
|
||||
|
||||
|
||||
if (m_panel_control_title) {
|
||||
m_panel_control_title->Layout();
|
||||
m_panel_control_title->Refresh();
|
||||
}
|
||||
|
||||
if (!obj->dev_connection_type.empty()) {
|
||||
auto iter_connect_type = m_print_connect_types.find(obj->get_dev_id());
|
||||
if (iter_connect_type != m_print_connect_types.end()) {
|
||||
|
|
@ -4986,6 +5040,7 @@ void StatusPanel::on_nozzle_selected(wxCommandEvent &event)
|
|||
void StatusPanel::on_show_print_options(wxCommandEvent& event)
|
||||
{
|
||||
if (obj) {
|
||||
// Always show print options dialog for all machines
|
||||
if (print_options_dlg == nullptr) {
|
||||
print_options_dlg = new PrintOptionsDialog(this);
|
||||
print_options_dlg->update_machine_obj(obj);
|
||||
|
|
@ -5000,6 +5055,26 @@ void StatusPanel::on_show_print_options(wxCommandEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
void StatusPanel::on_show_safety_options(wxCommandEvent& event)
|
||||
{
|
||||
if (obj) {
|
||||
std::string current_printer_type = obj->printer_type;
|
||||
bool supports_safety = DevPrinterConfigUtil::support_safety_options(current_printer_type);
|
||||
if (supports_safety) {
|
||||
if (safety_options_dlg == nullptr) {
|
||||
safety_options_dlg = new SafetyOptionsDialog(this);
|
||||
safety_options_dlg->update_machine_obj(obj);
|
||||
safety_options_dlg->update_options(obj);
|
||||
safety_options_dlg->ShowModal();
|
||||
}
|
||||
else {
|
||||
safety_options_dlg->update_machine_obj(obj);
|
||||
safety_options_dlg->update_options(obj);
|
||||
safety_options_dlg->ShowModal();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void StatusPanel::on_show_parts_options(wxCommandEvent &event)
|
||||
{
|
||||
|
|
@ -5081,8 +5156,15 @@ void StatusPanel::set_default()
|
|||
m_setting_button->Show();
|
||||
m_tempCtrl_chamber->Show();
|
||||
m_options_btn->Show();
|
||||
m_safety_btn->Show();
|
||||
m_parts_btn->Show();
|
||||
|
||||
|
||||
if (m_panel_control_title) {
|
||||
m_panel_control_title->Layout();
|
||||
m_panel_control_title->Refresh();
|
||||
}
|
||||
|
||||
reset_temp_misc_control();
|
||||
m_extruder_switching_status->Hide();
|
||||
m_ams_control->Hide();
|
||||
|
|
@ -5110,12 +5192,14 @@ void StatusPanel::show_status(int status)
|
|||
show_printing_status(false, false);
|
||||
m_calibration_btn->Disable();
|
||||
m_options_btn->Disable();
|
||||
m_safety_btn->Disable();
|
||||
m_parts_btn->Disable();
|
||||
m_panel_monitoring_title->Disable();
|
||||
} else if ((status & (int) MonitorStatus::MONITOR_NORMAL) != 0) {
|
||||
show_printing_status(true, true);
|
||||
m_calibration_btn->Disable();
|
||||
m_options_btn->Enable();
|
||||
m_safety_btn->Enable();
|
||||
m_parts_btn->Enable();
|
||||
m_panel_monitoring_title->Enable();
|
||||
}
|
||||
|
|
@ -5268,7 +5352,10 @@ void StatusPanel::msw_rescale()
|
|||
|
||||
m_options_btn->SetMinSize(wxSize(-1, FromDIP(26)));
|
||||
m_options_btn->Rescale();
|
||||
|
||||
|
||||
m_safety_btn->SetMinSize(wxSize(-1, FromDIP(26)));
|
||||
m_safety_btn->Rescale();
|
||||
|
||||
m_parts_btn->SetMinSize(wxSize(-1, FromDIP(26)));
|
||||
m_parts_btn->Rescale();
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
#include "Calibration.hpp"
|
||||
#include "CalibrationWizardPage.hpp"
|
||||
#include "PrintOptionsDialog.hpp"
|
||||
#include "SafetyOptionsDialog.hpp"
|
||||
#include "AMSMaterialsSetting.hpp"
|
||||
#include "ExtrusionCalibration.hpp"
|
||||
#include "ReleaseNote.hpp"
|
||||
|
|
@ -524,6 +525,7 @@ protected:
|
|||
wxStaticText* m_calibration_text;
|
||||
Button* m_parts_btn;
|
||||
Button* m_options_btn;
|
||||
Button* m_safety_btn;
|
||||
Button* m_calibration_btn;
|
||||
StepIndicator* m_calibration_flow;
|
||||
|
||||
|
|
@ -613,6 +615,7 @@ protected:
|
|||
AMSSetting *m_ams_setting_dlg{nullptr};
|
||||
PrinterPartsDialog* print_parts_dlg { nullptr };
|
||||
PrintOptionsDialog* print_options_dlg { nullptr };
|
||||
SafetyOptionsDialog* safety_options_dlg { nullptr };
|
||||
CalibrationDialog* calibration_dlg {nullptr};
|
||||
AMSMaterialsSetting *m_filament_setting_dlg{nullptr};
|
||||
|
||||
|
|
@ -732,6 +735,8 @@ protected:
|
|||
void on_show_parts_options(wxCommandEvent& event);
|
||||
/* print options */
|
||||
void on_show_print_options(wxCommandEvent &event);
|
||||
/* safety options */
|
||||
void on_show_safety_options(wxCommandEvent &event);
|
||||
|
||||
/* calibration */
|
||||
void on_start_calibration(wxCommandEvent &event);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue