OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::DeviceErrorDialog Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/DeviceErrorDialog.hpp>

Inheritance diagram for Slic3r::GUI::DeviceErrorDialog:
Collaboration diagram for Slic3r::GUI::DeviceErrorDialog:

Public Types

enum  ActionButton : int {
  RESUME_PRINTING = 2 , RESUME_PRINTING_DEFECTS = 3 , RESUME_PRINTING_PROBELM_SOLVED = 4 , STOP_PRINTING = 5 ,
  CHECK_ASSISTANT = 6 , FILAMENT_EXTRUDED = 7 , RETRY_FILAMENT_EXTRUDED = 8 , CONTINUE = 9 ,
  LOAD_VIRTUAL_TRAY = 10 , OK_BUTTON = 11 , FILAMENT_LOAD_RESUME = 12 , JUMP_TO_LIVEVIEW ,
  NO_REMINDER_NEXT_TIME = 23 , REFRESH_NOZZLE = 24 , IGNORE_NO_REMINDER_NEXT_TIME = 25 , IGNORE_RESUME = 27 ,
  PROBLEM_SOLVED_RESUME = 28 , TURN_OFF_FIRE_ALARM = 29 , RETRY_PROBLEM_SOLVED = 34 , STOP_DRYING = 35 ,
  CANCEL = 37 , REMOVE_CLOSE_BTN = 39 , PROCEED = 41 , OK_JUMP_RACK = 49 ,
  ABORT = 51 , DISABLE_PURIFICATION = 54 , DONT_REMIND_NEXT_TIME = 57 , ERROR_BUTTON_COUNT ,
  DBL_CHECK_CANCEL = 10000 , DBL_CHECK_DONE = 10001 , DBL_CHECK_RETRY = 10002 , DBL_CHECK_RESUME = 10003 ,
  DBL_CHECK_OK = 10004
}

Public Member Functions

 DeviceErrorDialog (MachineObject *obj, wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxCLOSE_BOX|wxCAPTION)
 ~DeviceErrorDialog ()
wxString show_error_code (int error_code)
void set_action_json (const nlohmann::json &action_json)
void EndModal (int retCode) override
float scale_factor () const
float prev_scale_factor () const
void set_scale_factor (float v)
void set_prev_scale_factor (float v)
void set_em_unit (int v)
bool force_rescale () const
int em_unit () const
const wxFont & normal_font () const
void enable_force_rescale ()
int ShowModal ()

Public Attributes

nlohmann::json m_action_json

Protected Member Functions

void init_button_list ()
void init_button (ActionButton style, wxString buton_text)
wxString parse_error_level (int error_code)
std::vector< int > convert_to_pseudo_buttons (std::string error_str)
void update_contents (const wxString &title, const wxString &text, const wxString &error_code, const wxString &image_url, const std::vector< int > &btns)
void on_button_click (ActionButton btn_id)
void on_webrequest_state (wxWebRequestEvent &evt)
void on_request_timeout (wxTimerEvent &event)
void clear_request_timer ()
wxBitmap make_placeholder_image (const wxString &text)
bool get_fail_snapshot_from_cloud ()
bool get_fail_snapshot_from_local (const wxString &image_url)
void on_dpi_changed (const wxRect &suggested_rect)
virtual void on_sys_color_changed ()

Private Member Functions

void update_em_unit ()
bool is_new_scale_factor () const
void rescale (const wxRect &suggested_rect)

Private Attributes

MachineObject * m_obj
int m_error_code
std::unordered_set< Button * > m_used_button
wxWebRequest web_request
wxTimer * m_request_timer { nullptr }
std::atomic< bool > m_request_cancelled { false }
int m_request_seq { 0 }
wxString m_local_img_url
std::shared_ptr< std::atomic_bool > m_alive { std::make_shared<std::atomic_bool>(true) }
wxStaticBitmap * m_error_picture
Label * m_error_msg_label { nullptr }
Label * m_error_code_label { nullptr }
wxBoxSizer * m_sizer_main
wxBoxSizer * m_sizer_button
wxScrolledWindow * m_scroll_area { nullptr }
std::map< int, Button * > m_button_list
StateColor btn_bg_white
float m_scale_factor
int m_em_unit
wxFont m_normal_font
float m_prev_scale_factor
bool m_can_rescale
bool m_force_rescale
int m_new_font_point_size

Detailed Description

Member Enumeration Documentation

◆ ActionButton

Enumerator
RESUME_PRINTING 
RESUME_PRINTING_DEFECTS 
RESUME_PRINTING_PROBELM_SOLVED 
STOP_PRINTING 
CHECK_ASSISTANT 
FILAMENT_EXTRUDED 
RETRY_FILAMENT_EXTRUDED 
CONTINUE 
LOAD_VIRTUAL_TRAY 
OK_BUTTON 
FILAMENT_LOAD_RESUME 
JUMP_TO_LIVEVIEW 
NO_REMINDER_NEXT_TIME 
REFRESH_NOZZLE 
IGNORE_NO_REMINDER_NEXT_TIME 
IGNORE_RESUME 
PROBLEM_SOLVED_RESUME 
TURN_OFF_FIRE_ALARM 
RETRY_PROBLEM_SOLVED 
STOP_DRYING 
CANCEL 
REMOVE_CLOSE_BTN 
PROCEED 
OK_JUMP_RACK 
ABORT 
DISABLE_PURIFICATION 
DONT_REMIND_NEXT_TIME 
ERROR_BUTTON_COUNT 
DBL_CHECK_CANCEL 
DBL_CHECK_DONE 
DBL_CHECK_RETRY 
DBL_CHECK_RESUME 
DBL_CHECK_OK 
41 : int {
45 STOP_PRINTING = 5,
49 CONTINUE = 9,
51 OK_BUTTON = 11,
54
56 REFRESH_NOZZLE = 24,
58 //LOAD_FILAMENT = 26*/
59 IGNORE_RESUME = 27,
62
64 STOP_DRYING = 35,
65 CANCEL = 37,
66 REMOVE_CLOSE_BTN = 39, // special case, do not show close button
67 PROCEED = 41,
68 OK_JUMP_RACK = 49,
69 ABORT = 51,
72
74
75 // old error code to pseudo action
76 DBL_CHECK_CANCEL = 10000,
77 DBL_CHECK_DONE = 10001,
78 DBL_CHECK_RETRY = 10002,
79 DBL_CHECK_RESUME = 10003,
80 DBL_CHECK_OK = 10004,
81 };
@ ABORT
Definition DeviceErrorDialog.hpp:69
@ FILAMENT_EXTRUDED
Definition DeviceErrorDialog.hpp:47
@ PROBLEM_SOLVED_RESUME
Definition DeviceErrorDialog.hpp:60
@ JUMP_TO_LIVEVIEW
Definition DeviceErrorDialog.hpp:53
@ REFRESH_NOZZLE
Definition DeviceErrorDialog.hpp:56
@ DBL_CHECK_OK
Definition DeviceErrorDialog.hpp:80
@ CHECK_ASSISTANT
Definition DeviceErrorDialog.hpp:46
@ DONT_REMIND_NEXT_TIME
Definition DeviceErrorDialog.hpp:71
@ FILAMENT_LOAD_RESUME
Definition DeviceErrorDialog.hpp:52
@ OK_BUTTON
Definition DeviceErrorDialog.hpp:51
@ STOP_DRYING
Definition DeviceErrorDialog.hpp:64
@ NO_REMINDER_NEXT_TIME
Definition DeviceErrorDialog.hpp:55
@ LOAD_VIRTUAL_TRAY
Definition DeviceErrorDialog.hpp:50
@ STOP_PRINTING
Definition DeviceErrorDialog.hpp:45
@ DBL_CHECK_RESUME
Definition DeviceErrorDialog.hpp:79
@ RESUME_PRINTING_PROBELM_SOLVED
Definition DeviceErrorDialog.hpp:44
@ DBL_CHECK_CANCEL
Definition DeviceErrorDialog.hpp:76
@ TURN_OFF_FIRE_ALARM
Definition DeviceErrorDialog.hpp:61
@ OK_JUMP_RACK
Definition DeviceErrorDialog.hpp:68
@ RETRY_PROBLEM_SOLVED
Definition DeviceErrorDialog.hpp:63
@ DBL_CHECK_RETRY
Definition DeviceErrorDialog.hpp:78
@ DBL_CHECK_DONE
Definition DeviceErrorDialog.hpp:77
@ REMOVE_CLOSE_BTN
Definition DeviceErrorDialog.hpp:66
@ IGNORE_RESUME
Definition DeviceErrorDialog.hpp:59
@ CONTINUE
Definition DeviceErrorDialog.hpp:49
@ RETRY_FILAMENT_EXTRUDED
Definition DeviceErrorDialog.hpp:48
@ DISABLE_PURIFICATION
Definition DeviceErrorDialog.hpp:70
@ IGNORE_NO_REMINDER_NEXT_TIME
Definition DeviceErrorDialog.hpp:57
@ PROCEED
Definition DeviceErrorDialog.hpp:67
@ CANCEL
Definition DeviceErrorDialog.hpp:65
@ RESUME_PRINTING
Definition DeviceErrorDialog.hpp:42
@ RESUME_PRINTING_DEFECTS
Definition DeviceErrorDialog.hpp:43
@ ERROR_BUTTON_COUNT
Definition DeviceErrorDialog.hpp:73

Constructor & Destructor Documentation

◆ DeviceErrorDialog()

Slic3r::GUI::DeviceErrorDialog::DeviceErrorDialog ( MachineObject * obj,
wxWindow * parent,
wxWindowID id = wxID_ANY,
const wxString & title = wxEmptyString,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = wxCLOSE_BOX | wxCAPTION )
50 :DPIDialog(parent, id, title, pos, size, style), m_obj(obj)
51{
52 std::string icon_path = (boost::format("%1%/images/OrcaSlicerTitle.ico") % resources_dir()).str();
53 SetIcon(wxIcon(encode_path(icon_path.c_str()), wxBITMAP_TYPE_ICO));
54 SetBackgroundColour(*wxWHITE);
55
56 SetTitle(_L("Error"));
57
58 auto m_line_top = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(350), 1));
59 m_line_top->SetBackgroundColour(wxColour(166, 169, 170));
60
61 m_scroll_area = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
62 m_scroll_area->SetScrollRate(0, FromDIP(20));
63 m_scroll_area->SetBackgroundColour(*wxWHITE);
64 m_scroll_area->SetMinSize(wxSize(FromDIP(320), FromDIP(250)));
65
66 wxBoxSizer* text_sizer = new wxBoxSizer(wxVERTICAL);
67
68 m_error_msg_label = new Label(m_scroll_area, wxEmptyString, LB_AUTO_WRAP);
69 m_error_picture = new wxStaticBitmap(m_scroll_area, wxID_ANY, wxBitmap(), wxDefaultPosition, wxSize(FromDIP(300), FromDIP(180)));
70
71 //Label* dev_name = new Label(m_scroll_area, wxString::FromUTF8(obj->dev_name) + ":", LB_AUTO_WRAP);
72 //dev_name->SetMaxSize(wxSize(FromDIP(300), -1));
73 //dev_name->SetMinSize(wxSize(FromDIP(300), -1));
74 //dev_name->Wrap(FromDIP(300));
75 //text_sizer->Add(dev_name, 0, wxALIGN_CENTER, FromDIP(5));
76 //text_sizer->AddSpacer(5);
77 text_sizer->Add(m_error_picture, 0, wxALIGN_CENTER, FromDIP(5));
78 text_sizer->AddSpacer(10);
79 text_sizer->Add(m_error_msg_label, 0, wxALIGN_CENTER, FromDIP(5));
80
81 m_error_code_label = new Label(m_scroll_area, wxEmptyString, LB_AUTO_WRAP);
82 text_sizer->AddSpacer(5);
83 text_sizer->Add(m_error_code_label, 0, wxALIGN_CENTER, FromDIP(5));
84 m_scroll_area->SetSizer(text_sizer);
85
86 auto bottom_sizer = new wxBoxSizer(wxVERTICAL);
87 m_sizer_button = new wxBoxSizer(wxVERTICAL);
88 bottom_sizer->Add(m_sizer_button, 0, wxEXPAND | wxRIGHT | wxLEFT, 0);
89
90 wxBoxSizer* m_center_sizer = new wxBoxSizer(wxVERTICAL);
91 m_center_sizer->Add(0, 0, 1, wxTOP, FromDIP(5));
92 m_center_sizer->Add(m_scroll_area, 0, wxEXPAND | wxRIGHT | wxLEFT, FromDIP(15));
93 m_center_sizer->Add(bottom_sizer, 0, wxEXPAND | wxRIGHT | wxLEFT, FromDIP(20));
94 m_center_sizer->Add(0, 0, 0, wxTOP, FromDIP(10));
95
96 m_sizer_main = new wxBoxSizer(wxVERTICAL);
97 m_sizer_main->Add(m_line_top, 0, wxEXPAND, 0);
98 m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(5));
99 m_sizer_main->Add(m_center_sizer, 0, wxBOTTOM | wxEXPAND, FromDIP(5));
100
101 SetSizer(m_sizer_main);
102 Layout();
103 m_sizer_main->Fit(this);
104
106
107 CenterOnParent();
108 wxGetApp().UpdateDlgDarkUI(this);
109
110 Bind(wxEVT_WEBREQUEST_STATE, &DeviceErrorDialog::on_webrequest_state, this);
111 Bind(wxEVT_CLOSE_WINDOW, [this](wxCloseEvent &e){
112 if (m_obj) { m_obj->command_clean_print_error_uiop(m_obj->print_error); }
113 e.Skip();
114 });
115
116 m_request_timer = new wxTimer(this);
117 Bind(wxEVT_TIMER, &DeviceErrorDialog::on_request_timeout, this, m_request_timer->GetId());
118}
#define LB_AUTO_WRAP
Definition Label.hpp:12
#define _L(s)
Definition OBJ.cpp:34
#define style
Definition WipeTowerDialog.cpp:101
void init_button_list()
Definition DeviceErrorDialog.cpp:318
wxScrolledWindow * m_scroll_area
Definition DeviceErrorDialog.hpp:137
void on_request_timeout(wxTimerEvent &event)
Definition DeviceErrorDialog.cpp:175
wxStaticBitmap * m_error_picture
Definition DeviceErrorDialog.hpp:132
MachineObject * m_obj
Definition DeviceErrorDialog.hpp:118
Label * m_error_code_label
Definition DeviceErrorDialog.hpp:134
wxBoxSizer * m_sizer_main
Definition DeviceErrorDialog.hpp:135
wxTimer * m_request_timer
Definition DeviceErrorDialog.hpp:124
Label * m_error_msg_label
Definition DeviceErrorDialog.hpp:133
void on_webrequest_state(wxWebRequestEvent &evt)
Definition DeviceErrorDialog.cpp:139
wxBoxSizer * m_sizer_button
Definition DeviceErrorDialog.hpp:136
std::string encode_path(const char *src)
Definition utils.cpp:1382
const std::string & resources_dir()
Definition utils.cpp:296

References _L, Slic3r::encode_path(), init_button_list(), LB_AUTO_WRAP, m_error_code_label, m_error_msg_label, m_error_picture, m_obj, m_request_timer, m_scroll_area, m_sizer_button, m_sizer_main, on_request_timeout(), on_webrequest_state(), Slic3r::resources_dir(), and style.

Here is the call graph for this function:

◆ ~DeviceErrorDialog()

Slic3r::GUI::DeviceErrorDialog::~DeviceErrorDialog ( )
121{
122 // Orca: invalidate any in-flight cloud snapshot callback (the request has no cancel handle)
123 *m_alive = false;
124
125 if (m_request_timer) {
126 m_request_timer->Stop();
127 delete m_request_timer;
128 m_request_timer = nullptr;
129 }
130
131 if (web_request.IsOk() && web_request.GetState() == wxWebRequest::State_Active)
132 {
133 BOOST_LOG_TRIVIAL(info) << "web_request: cancelled";
134 web_request.Cancel();
135 }
136 m_error_picture->SetBitmap(wxBitmap());
137}
wxWebRequest web_request
Definition DeviceErrorDialog.hpp:123
std::shared_ptr< std::atomic_bool > m_alive
Definition DeviceErrorDialog.hpp:131

References m_alive, m_error_picture, m_request_timer, and web_request.

Member Function Documentation

◆ clear_request_timer()

void Slic3r::GUI::DeviceErrorDialog::clear_request_timer ( )
protected
187{
188 if (m_request_timer && m_request_timer->IsRunning()) {
189 m_request_timer->Stop();
190 }
191}

References m_request_timer.

Referenced by get_fail_snapshot_from_cloud(), get_fail_snapshot_from_local(), on_webrequest_state(), and update_contents().

Here is the caller graph for this function:

◆ convert_to_pseudo_buttons()

std::vector< int > Slic3r::GUI::DeviceErrorDialog::convert_to_pseudo_buttons ( std::string error_str)
protected
422{
423 std::vector<int> pseudo_button;
424
425 pseudo_button.emplace_back(DBL_CHECK_RETRY);
426 pseudo_button.emplace_back(DBL_CHECK_OK);
427
428 return pseudo_button;
429}

References convert_to_pseudo_buttons(), DBL_CHECK_OK, and DBL_CHECK_RETRY.

Referenced by convert_to_pseudo_buttons(), and show_error_code().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ em_unit()

int Slic3r::GUI::DPIAware< wxDialog >::em_unit ( ) const
inlineinherited
203{ return m_em_unit; }
Definition GUI_Utils.hpp:107

Referenced by Slic3r::GUI::AuxiliaryDialog::AuxiliaryDialog(), Slic3r::GUI::CopyrightsDialog::CopyrightsDialog(), Slic3r::GUI::DesignTextDialog::DesignTextDialog(), Slic3r::GUI::EditGCodeDialog::EditGCodeDialog(), Slic3r::GUI::FileArchiveDialog::FileArchiveDialog(), Slic3r::GUI::MsgNoUpdates::MsgNoUpdates(), Slic3r::GUI::MsgUpdateForced::MsgUpdateForced(), Slic3r::GUI::OAuthDialog::OAuthDialog(), Slic3r::GUI::ParamsDialog::ParamsDialog(), Slic3r::GUI::PhysicalPrinterDialog::PhysicalPrinterDialog(), Slic3r::GUI::SettingsDialog::SettingsDialog(), anonymous_namespace{3DPrinterOS.cpp}::TokenAuthDialog::TokenAuthDialog(), anonymous_namespace{3DPrinterOS.cpp}::UploadOptionsDialog::UploadOptionsDialog(), Slic3r::GUI::PublishSettingsDialog::add_row_ui(), Slic3r::GUI::DiffPresetDialog::complete_dialog_creation(), Slic3r::GUI::DiffPresetDialog::create_edit_sizer(), Slic3r::GUI::DiffPresetDialog::create_presets_sizer(), Slic3r::GUI::DiffPresetDialog::create_tree(), Slic3r::GUI::ElegooPrintHostSendDialog::init(), Slic3r::GUI::FlashforgePrintHostSendDialog::init(), Slic3r::GUI::PrintHostSendDialog::init(), Slic3r::GUI::AboutDialog::on_dpi_changed(), Slic3r::GUI::AuxiliaryDialog::on_dpi_changed(), Slic3r::GUI::BedShapeDialog::on_dpi_changed(), Slic3r::GUI::ConfigWizard::on_dpi_changed(), Slic3r::GUI::CopyrightsDialog::on_dpi_changed(), Slic3r::GUI::DiffPresetDialog::on_dpi_changed(), Slic3r::GUI::EditGCodeDialog::on_dpi_changed(), Slic3r::GUI::FileArchiveDialog::on_dpi_changed(), Slic3r::GUI::OAuthDialog::on_dpi_changed(), Slic3r::GUI::ObjectTableDialog::on_dpi_changed(), Slic3r::GUI::ParamsDialog::on_dpi_changed(), Slic3r::GUI::PhysicalPrinterDialog::on_dpi_changed(), Slic3r::GUI::PrintHostQueueDialog::on_dpi_changed(), Slic3r::GUI::PurgeModeDialog::on_dpi_changed(), Slic3r::GUI::SavePresetDialog::on_dpi_changed(), Slic3r::GUI::SendSystemInfoDialog::on_dpi_changed(), Slic3r::GUI::SettingsDialog::on_dpi_changed(), and Slic3r::GUI::UnsavedChangesDialog::on_dpi_changed().

Here is the caller graph for this function:

◆ enable_force_rescale()

void Slic3r::GUI::DPIAware< wxDialog >::enable_force_rescale ( )
inlineinherited
206{ m_force_rescale = true; }

◆ EndModal()

void Slic3r::GUI::DPIDialog::EndModal ( int retCode)
inlineoverrideinherited
306 {
307 if (!dialogStack.empty() && dialogStack.front() != this) {
308 // This is a bug in wxWidgets
309 // when the dialog is not top modal dialog, EndModal() just hide dialog without quit
310 // the modal event loop. And the modal event loop blocks us from bottom widgets.
311 // Solution: let user click it manually or close outside. FIXME
312 BOOST_LOG_TRIVIAL(warning) << "DPIAware::EndModal Error: dialogStack is not empty, but top dialog is not this one. retCode=" << retCode;
313 return;
314 }
315
316 return wxDialog::EndModal(retCode);
317 }
std::deque< wxDialog * > dialogStack
Definition GUI_Utils.cpp:549

References Slic3r::GUI::dialogStack.

Referenced by Slic3r::GUI::CloneDialog::CloneDialog(), Slic3r::GUI::ConfigWizard::ConfigWizard(), Slic3r::GUI::CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(), Slic3r::GUI::DeleteConfirmDialog::DeleteConfirmDialog(), Slic3r::GUI::DesignVariableDialog::DesignVariableDialog(), Slic3r::GUI::anonymous_namespace{PrintHostDialogs.cpp}::FlashforgeSlotDialog::FlashforgeSlotDialog(), Slic3r::GUI::GuideFrame::GuideFrame(), Slic3r::GUI::InputIpAddressDialog::InputIpAddressDialog(), Slic3r::GUI::ManualNozzleCountDialog::ManualNozzleCountDialog(), Slic3r::GUI::MsgUpdateConfig::MsgUpdateConfig(), Slic3r::GUI::MsgUpdateForced::MsgUpdateForced(), Slic3r::GUI::MultiChoiceDialog::MultiChoiceDialog(), Slic3r::GUI::NetworkErrorDialog::NetworkErrorDialog(), Slic3r::GUI::NetworkPluginRestartDialog::NetworkPluginRestartDialog(), Slic3r::GUI::PartSkipConfirmDialog::PartSkipConfirmDialog(), Slic3r::GUI::PhysicalPrinterDialog::PhysicalPrinterDialog(), Slic3r::GUI::PlateNameEditDialog::PlateNameEditDialog(), Slic3r::GUI::PlateSettingsDialog::PlateSettingsDialog(), Slic3r::GUI::PublishSettingsDialog::PublishSettingsDialog(), Slic3r::GUI::SelectMachineDialog::SelectMachineDialog(), Slic3r::GUI::SendFailedConfirm::SendFailedConfirm(), Slic3r::GUI::SendSystemInfoDialog::SendSystemInfoDialog(), Slic3r::GUI::ShortcutCaptureDialog::ShortcutCaptureDialog(), Slic3r::GUI::SingleChoiceDialog::SingleChoiceDialog(), StepMeshDialog::StepMeshDialog(), Slic3r::GUI::SyncAmsInfoDialog::SyncAmsInfoDialog(), anonymous_namespace{3DPrinterOS.cpp}::TokenAuthDialog::TokenAuthDialog(), Slic3r::GUI::UpdatePluginDialog::UpdatePluginDialog(), Slic3r::GUI::UpdateVersionDialog::UpdateVersionDialog(), Slic3r::GUI::wgtDeviceNozzleRackUpgradeDlg::wgtDeviceNozzleRackUpgradeDlg(), Slic3r::GUI::SavePresetDialog::accept(), Slic3r::GUI::MsgDialog::add_button(), Slic3r::GUI::TipsDialog::add_button(), Slic3r::GUI::FilamentPickerDialog::BindEvents(), Slic3r::GUI::PluginPickerDialog::build_capability_ui(), Slic3r::GUI::BedShapeDialog::build_dialog(), Slic3r::GUI::PluginPickerDialog::build_ui(), Slic3r::GUI::UnsavedChangesDialog::close(), Slic3r::GUI::FileArchiveDialog::create_btn_sizer(), Slic3r::GUI::ColorDecomposeDialog::create_button_panel(), Slic3r::GUI::MixedFilamentDialog::create_button_panel(), Slic3r::GUI::CreateFilamentPresetDialog::create_dialog_buttons(), Slic3r::GUI::CreatePresetForPrinterDialog::create_dialog_buttons(), Slic3r::GUI::EditFilamentPresetDialog::create_dialog_buttons(), Slic3r::GUI::ExportConfigsDialog::create_dialog_buttons(), Slic3r::GUI::PreferencesDialog::create_item_language_combobox(), Slic3r::GUI::PreferencesDialog::create_item_region_combobox(), Slic3r::GUI::PreferencesDialog::create_items(), Slic3r::GUI::CreatePrinterPresetDialog::create_page1_dialog_buttons(), Slic3r::GUI::CreatePrinterPresetDialog::create_page2_dialog_buttons(), Slic3r::GUI::ExportConfigsDialog::data_init(), Slic3r::GUI::WebDialog::destroy_silently(), Slic3r::GUI::EditFilamentPresetDialog::edit_preset(), Slic3r::GUI::ConnectPrinterDialog::end_modal(), Slic3r::GUI::PrintHostSendDialog::EndModal(), Slic3r::GUI::ColorPickerDialog::finish(), Slic3r::GUI::WebDialog::finish(), Slic3r::GUI::Newer3mfVersionDialog::get_btn_sizer(), Slic3r::GUI::ScoreDialog::get_button_sizer(), Slic3r::GUI::WebViewHostDialog::handle_common_script_command(), Slic3r::GUI::ExportPresetBundleDialog::InitExportData(), Slic3r::GUI::SelectMachineDialog::navigate_to_timelapse_page(), Slic3r::GUI::BindMachineDialog::on_bind_success(), Slic3r::GUI::ConnectPrinterDialog::on_button_confirm(), Slic3r::GUI::RecenterDialog::on_button_confirm(), Slic3r::GUI::BindMachineDialog::on_cancel(), Slic3r::GUI::EditCalibrationHistoryDialog::on_cancel(), Slic3r::GUI::InputIpAddressDialog::on_cancel(), Slic3r::GUI::NewCalibrationHistoryDialog::on_cancel(), Slic3r::GUI::OAuthDialog::on_cancel(), Slic3r::GUI::PingCodeBindDialog::on_cancel(), Slic3r::GUI::SelectMachineDialog::on_cancel(), Slic3r::GUI::SendToPrinterDialog::on_cancel(), Slic3r::GUI::SyncAmsInfoDialog::on_cancel(), Slic3r::GUI::UnBindMachineDialog::on_cancel(), Slic3r::GUI::WebDialog::on_close_window(), Slic3r::GUI::NetworkPluginDownloadDialog::on_dont_ask(), Slic3r::GUI::NetworkPluginDownloadDialog::on_download(), Slic3r::GUI::EditDevNameDialog::on_edit_name(), Slic3r::GUI::ConfirmBeforeSendDialog::on_hide(), Slic3r::GUI::PrivacyUpdateDialog::on_hide(), Slic3r::GUI::ShortcutCaptureDialog::on_key(), Slic3r::GUI::TextureImportDialog::on_ok_clicked(), Slic3r::GUI::FileArchiveDialog::on_open_button(), Slic3r::GUI::NetworkPluginDownloadDialog::on_remind_later(), Slic3r::GUI::ProjectDropDialog::on_select_cancel(), Slic3r::GUI::SavePresetDialog::on_select_cancel(), Slic3r::GUI::ProjectDropDialog::on_select_ok(), Slic3r::GUI::SendMultiMachinePage::on_send(), Slic3r::GUI::NetworkPluginDownloadDialog::on_skip(), Slic3r::GUI::TextureImportDialog::on_skip_clicked(), Slic3r::GUI::NetworkPluginDownloadDialog::on_skip_version(), Slic3r::GUI::Cornering_Test_Dlg::on_start(), Slic3r::GUI::FlowRateCalibrationDialog::on_start(), Slic3r::GUI::Input_Shaping_Damp_Test_Dlg::on_start(), Slic3r::GUI::Input_Shaping_Freq_Test_Dlg::on_start(), Slic3r::GUI::MaxVolumetricSpeed_Test_Dlg::on_start(), Slic3r::GUI::PA_Calibration_Dlg::on_start(), Slic3r::GUI::Retraction_Test_Dlg::on_start(), Slic3r::GUI::Temp_Calibration_Dlg::on_start(), Slic3r::GUI::VFA_Test_Dlg::on_start(), Slic3r::GUI::CalibrationDialog::on_start_calibration(), Slic3r::GUI::UnBindMachineDialog::on_unbind_printer(), Slic3r::GUI::PartSkipDialog::OnApplyDialog(), anonymous_namespace{3DPrinterOS.cpp}::TokenAuthDialog::OnCancel(), Slic3r::GUI::AboutDialog::onCloseDialog(), Slic3r::GUI::CopyrightsDialog::onCloseDialog(), Slic3r::GUI::MultiNozzleSyncDialog::OnRackStatusReadingFinished(), Slic3r::GUI::GuideFrame::OnScriptMessage(), Slic3r::GUI::InputIpAddressDialog::OnTimer(), Slic3r::GUI::KBShortcutsDialog::open_mouse_preferences(), Slic3r::GUI::TroubleshootDialog::PackAll(), Slic3r::GUI::TroubleshootDialog::RebuildSystemProfiles(), Slic3r::GUI::SpeedDialWebDialog::run_action(), Slic3r::GUI::OAuthDialog::Show(), Slic3r::GUI::MultiNozzleSyncDialog::UpdateButton(), and Slic3r::GUI::CreatePrinterPresetDialog::validate_input_valid().

◆ force_rescale()

bool Slic3r::GUI::DPIAware< wxDialog >::force_rescale ( ) const
inlineinherited
201{ return m_force_rescale; }

◆ get_fail_snapshot_from_cloud()

bool Slic3r::GUI::DeviceErrorDialog::get_fail_snapshot_from_cloud ( )
protected
223{
224 if (!m_obj || m_obj->m_print_error_img_id.empty()) { return false; }
225
226 NetworkAgent* agent = wxGetApp().getAgent();
227 if (!agent) { return false; }
228
229 // Orca: the cloud request has no cancel handle, so guard the callback against dialog
230 // destruction with a liveness token (m_alive, cleared in the dtor) and marshal onto the UI
231 // thread via the always-valid app handler instead of this->CallAfter. The raw bytes are
232 // decoded on the UI thread so no wxImage (non-atomic refcount) is shared across threads.
233 // m_request_seq guards against a callback from a previous error painting over the
234 // current one when the dialog is reused by a later show_error_code().
235 auto alive = m_alive;
236 const int seq = m_request_seq;
237 int ret = agent->get_hms_snapshot(m_obj->get_dev_id(), m_obj->m_print_error_img_id,
238 [this, alive, seq](std::string body, int status) {
239 if (!alive->load()) { return; }
240 wxGetApp().CallAfter([this, alive, seq, body = std::move(body), status]() {
241 if (!alive->load()) { return; }
242 if (seq != m_request_seq) { return; }
243 m_request_cancelled.store(true);
245
246 wxImage image;
247 bool ok = false;
248 if (status == 200) {
249 wxMemoryInputStream stream(body.data(), body.size());
250 ok = image.LoadFile(stream, wxBITMAP_TYPE_ANY);
251 if (!ok) { BOOST_LOG_TRIVIAL(error) << "get_fail_snapshot_from_cloud: failed to resolve stream"; }
252 } else {
253 BOOST_LOG_TRIVIAL(error) << "get_fail_snapshot_from_cloud: status = " << status;
254 }
255
256 if (ok) {
257 wxImage resize_img = image.Scale(FromDIP(320), FromDIP(180), wxIMAGE_QUALITY_HIGH);
258 m_error_picture->SetBitmap(wxBitmap(resize_img));
260 m_error_picture->SetBitmap(make_placeholder_image(_L("Network unavailable")));
261 }
262 Layout();
263 Fit();
264 });
265 });
266
267 return ret == 0; // dispatched; the frame arrives later via the callback
268}
int m_request_seq
Definition DeviceErrorDialog.hpp:128
std::atomic< bool > m_request_cancelled
Definition DeviceErrorDialog.hpp:125
void clear_request_timer()
Definition DeviceErrorDialog.cpp:186
wxBitmap make_placeholder_image(const wxString &text)
Definition DeviceErrorDialog.cpp:193
bool get_fail_snapshot_from_local(const wxString &image_url)
Definition DeviceErrorDialog.cpp:270
wxString m_local_img_url
Definition DeviceErrorDialog.hpp:129

References _L, clear_request_timer(), get_fail_snapshot_from_local(), Slic3r::NetworkAgent::get_hms_snapshot(), m_alive, m_error_picture, m_local_img_url, m_obj, m_request_cancelled, m_request_seq, and make_placeholder_image().

Referenced by update_contents().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_fail_snapshot_from_local()

bool Slic3r::GUI::DeviceErrorDialog::get_fail_snapshot_from_local ( const wxString & image_url)
protected
271{
272 if (image_url.empty()) { return false; }
273
274 const wxImage& img = wxGetApp().get_hms_query()->query_image_from_local(image_url);
275 if (!img.IsOk() && image_url.Contains("http"))
276 {
277 web_request = wxWebSession::GetDefault().CreateRequest(this, image_url);
278 BOOST_LOG_TRIVIAL(trace) << "monitor: create new webrequest, state = " << web_request.GetState();
279 if (web_request.GetState() == wxWebRequest::State_Idle) web_request.Start();
280 BOOST_LOG_TRIVIAL(trace) << "monitor: start new webrequest, state = " << web_request.GetState();
281 }
282 else
283 {
284 m_request_cancelled.store(true);
286 const wxImage& resize_img = img.Scale(FromDIP(320), FromDIP(180), wxIMAGE_QUALITY_HIGH);
287 m_error_picture->SetBitmap(wxBitmap(resize_img));
288 }
289 return true;
290}
void trace(unsigned int level, const char *message)
Definition utils.cpp:247

References clear_request_timer(), get_fail_snapshot_from_local(), m_error_picture, m_request_cancelled, Slic3r::trace(), and web_request.

Referenced by get_fail_snapshot_from_cloud(), get_fail_snapshot_from_local(), on_request_timeout(), and update_contents().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_button()

void Slic3r::GUI::DeviceErrorDialog::init_button ( ActionButton style,
wxString buton_text )
protected
293{
294 if (btn_bg_white.count() == 0)
295 {
296 btn_bg_white = StateColor(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Pressed),
297 std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
298 std::pair<wxColour, int>(*wxWHITE, StateColor::Normal));
299 }
300
301 Button* print_error_button = new Button(this, buton_text);
302 print_error_button->SetBackgroundColor(btn_bg_white);
303 print_error_button->SetBorderColor(wxColour(38, 46, 48));
304 print_error_button->SetFont(Label::Body_14);
305 print_error_button->SetSize(wxSize(FromDIP(300), FromDIP(30)));
306 print_error_button->SetMinSize(wxSize(FromDIP(300), FromDIP(30)));
307 print_error_button->SetMaxSize(wxSize(-1, FromDIP(30)));
308 print_error_button->SetCornerRadius(FromDIP(5));
309 print_error_button->Hide();
310 m_button_list[style] = print_error_button;
311 m_button_list[style]->Bind(wxEVT_LEFT_DOWN, [this, style](wxMouseEvent& e)
312 {
313 this->on_button_click(style);
314 e.Skip();
315 });
316}
void SetMinSize(const wxSize &size) override
Definition Button.cpp:112
void SetMaxSize(const wxSize &size) override
Definition Button.cpp:118
bool SetFont(const wxFont &font) override
Definition Button.cpp:81
static wxFont Body_14
Definition Label.hpp:53
void on_button_click(ActionButton btn_id)
Definition DeviceErrorDialog.cpp:541
StateColor btn_bg_white
Definition DeviceErrorDialog.hpp:140
std::map< int, Button * > m_button_list
Definition DeviceErrorDialog.hpp:139
@ Hovered
Definition StateColor.hpp:20
@ Normal
Definition StateColor.hpp:16
@ Pressed
Definition StateColor.hpp:21
void SetCornerRadius(double radius)
Definition StaticBox.cpp:62
void SetBorderColor(StateColor const &color)
Definition StaticBox.cpp:87
void SetBackgroundColor(StateColor const &color)
Definition StaticBox.cpp:102
wxMouseEvent
Definition CameraPopup.cpp:47

References Label::Body_14, btn_bg_white, StateColor::Hovered, init_button(), m_button_list, StateColor::Normal, on_button_click(), StateColor::Pressed, StaticBox::SetBackgroundColor(), StaticBox::SetBorderColor(), StaticBox::SetCornerRadius(), Button::SetFont(), Button::SetMaxSize(), Button::SetMinSize(), style, and Slic3r::GUI::wxMouseEvent.

Referenced by init_button(), and init_button_list().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_button_list()

void Slic3r::GUI::DeviceErrorDialog::init_button_list ( )
protected
319{
320 init_button(RESUME_PRINTING, _L("Resume Printing"));
321 init_button(RESUME_PRINTING_DEFECTS, _L("Resume (defects acceptable)"));
322 init_button(RESUME_PRINTING_PROBELM_SOLVED, _L("Resume (problem solved)"));
323 init_button(STOP_PRINTING, _L("Stop Printing"));// pop up recheck dialog?
324 init_button(CHECK_ASSISTANT, _L("Check Assistant"));
325 init_button(FILAMENT_EXTRUDED, _L("Filament Extruded, Continue"));
326 init_button(RETRY_FILAMENT_EXTRUDED, _L("Not Extruded Yet, Retry"));
327 init_button(CONTINUE, _L("Finished, Continue"));
329 init_button(OK_BUTTON, _L("OK"));
330 init_button(FILAMENT_LOAD_RESUME, _L("Filament Loaded, Resume"));
331 init_button(JUMP_TO_LIVEVIEW, _L("View Liveview"));
332 init_button(NO_REMINDER_NEXT_TIME, _L("No Reminder Next Time"));
333 init_button(REFRESH_NOZZLE, _L("Recheck"));
334 init_button(IGNORE_NO_REMINDER_NEXT_TIME, _L("Ignore. Don't Remind Next Time"));
335 init_button(IGNORE_RESUME, _L("Ignore this and Resume"));
336 init_button(PROBLEM_SOLVED_RESUME, _L("Problem Solved and Resume"));
337 init_button(TURN_OFF_FIRE_ALARM, _L("Got it, Turn off the Fire Alarm."));
338 init_button(RETRY_PROBLEM_SOLVED, _L("Retry (problem solved)"));
339 init_button(CANCEL, _L("Cancel"));
340 init_button(STOP_DRYING, _L("Stop Drying"));
341 init_button(PROCEED, _L("Proceed"));
343 init_button(ABORT, _L("Abort"));
344 init_button(DISABLE_PURIFICATION, _L("Disable Purification for This Print"));
345 init_button(DONT_REMIND_NEXT_TIME, _L("Don't Remind Me"));
346 init_button(DBL_CHECK_CANCEL, _L("Cancel"));
347 init_button(DBL_CHECK_DONE, _L("Done"));
348 init_button(DBL_CHECK_RETRY, _L("Retry"));
349 init_button(DBL_CHECK_RESUME, _L("Resume"));
350 init_button(DBL_CHECK_OK, _L("Confirm"));
351}
void init_button(ActionButton style, wxString buton_text)
Definition DeviceErrorDialog.cpp:292

References _L, ABORT, CANCEL, CHECK_ASSISTANT, CONTINUE, DBL_CHECK_CANCEL, DBL_CHECK_DONE, DBL_CHECK_OK, DBL_CHECK_RESUME, DBL_CHECK_RETRY, DISABLE_PURIFICATION, DONT_REMIND_NEXT_TIME, FILAMENT_EXTRUDED, FILAMENT_LOAD_RESUME, IGNORE_NO_REMINDER_NEXT_TIME, IGNORE_RESUME, init_button(), init_button_list(), JUMP_TO_LIVEVIEW, LOAD_VIRTUAL_TRAY, NO_REMINDER_NEXT_TIME, OK_BUTTON, OK_JUMP_RACK, PROBLEM_SOLVED_RESUME, PROCEED, REFRESH_NOZZLE, RESUME_PRINTING, RESUME_PRINTING_DEFECTS, RESUME_PRINTING_PROBELM_SOLVED, RETRY_FILAMENT_EXTRUDED, RETRY_PROBLEM_SOLVED, STOP_DRYING, STOP_PRINTING, and TURN_OFF_FIRE_ALARM.

Referenced by DeviceErrorDialog(), and init_button_list().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_new_scale_factor()

bool Slic3r::GUI::DPIAware< wxDialog >::is_new_scale_factor ( ) const
inlineprivateinherited
262{ return fabs(m_scale_factor - m_prev_scale_factor) > 0.001; }

◆ make_placeholder_image()

wxBitmap Slic3r::GUI::DeviceErrorDialog::make_placeholder_image ( const wxString & text)
protected
194{
195 const int w = FromDIP(320);
196 const int h = FromDIP(180);
197
198 wxBitmap bmp(wxSize(w, h));
199 wxMemoryDC dc(bmp);
200 dc.SetBackground(wxBrush(wxColour(238, 238, 238)));
201 dc.Clear();
202
203 ScalableBitmap icon = ScalableBitmap(this, "dev_hms_diag_loading", 80);
204 wxBitmap icon_bmp = icon.bmp();
205 if (icon_bmp.IsOk()) {
206 int ix = (w - icon_bmp.GetWidth()) / 2;
207 int iy = (h - icon_bmp.GetHeight()) / 3;
208 dc.DrawBitmap(icon_bmp, ix, iy, true);
209 }
210
211 dc.SetTextForeground(wxColour(158, 158, 158));
212 dc.SetFont(Label::Body_14);
213 wxSize txtSize = dc.GetTextExtent(text);
214 int tx = (w - txtSize.GetWidth()) / 2;
215 int ty = h - txtSize.GetHeight() - FromDIP(45);
216 dc.DrawText(text, tx, ty);
217
218 dc.SelectObject(wxNullBitmap);
219 return bmp;
220}
const wxBitmap & bmp() const
Definition wxExtensions.hpp:189

References ScalableBitmap::bmp(), and Label::Body_14.

Referenced by get_fail_snapshot_from_cloud(), on_request_timeout(), on_webrequest_state(), and update_contents().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ normal_font()

◆ on_button_click()

void Slic3r::GUI::DeviceErrorDialog::on_button_click ( ActionButton btn_id)
protected
542{
543 switch (btn_id) {
545 m_obj->command_hms_resume(std::to_string(m_error_code), m_obj->job_id_);
546 break;
547 }
549 m_obj->command_hms_resume(std::to_string(m_error_code), m_obj->job_id_);
550 break;
551 }
553 m_obj->command_hms_resume(std::to_string(m_error_code), m_obj->job_id_);
554 break;
555 }
557 m_obj->command_hms_stop(std::to_string(m_error_code), m_obj->job_id_);
558 break;
559 }
561 if (MonitorPanel* monitor = MonitorPanel::if_built())
562 monitor->jump_to_HMS(); // go to assistant page
563 break;
564 }
566 m_obj->command_ams_control("done");
567 break;
568 }
570 m_obj->command_ams_control("resume");
571 return;// do not hide the dialogs
572 }
574 m_obj->command_ams_control("resume");
575 break;
576 }
578 //m_ams_control->SwitchAms(std::to_string(VIRTUAL_TRAY_MAIN_ID));
579 //on_ams_load_curr();
580 break;/*AP, unknown what it is*/
581 }
583 m_obj->command_clean_print_error(m_obj->subtask_id_, m_error_code);
584 break;/*do nothing*/
585 }
587 m_obj->command_hms_resume(std::to_string(m_error_code), m_obj->job_id_);
588 break;
589 }
591 Slic3r::GUI::wxGetApp().mainframe->jump_to_monitor();
592 if (MonitorPanel* monitor = MonitorPanel::if_built())
593 monitor->jump_to_LiveView();
594 break;
595 }
597 m_obj->command_hms_idle_ignore(std::to_string(m_error_code), 0); /*the type is 0, supported by AP*/
598 break;
599 }
601 m_obj->command_hms_ignore(std::to_string(m_error_code), m_obj->job_id_);
602 break;
603 }
605 m_obj->command_hms_ignore(std::to_string(m_error_code), m_obj->job_id_);
606 break;
607 }
609 m_obj->command_hms_resume(std::to_string(m_error_code), m_obj->job_id_);
610 break;
611 }
613 m_obj->command_stop_buzzer();
614 break;
615 }
617 m_obj->command_ams_control("resume");
618 break;
619 }
621 break;
622 }
624 m_obj->command_ams_drying_stop();
625 break;
626 }
628 if(!m_action_json.is_null()){
629 try{
630 m_obj->command_ack_proceed(m_action_json);
631 } catch(...){
632 BOOST_LOG_TRIVIAL(error) << "DeviceErrorDialog: Action Proceed missing params.";
633 }
634 }
635 break;
636 }
638 m_obj->command_refresh_nozzle();
639 break;
640 }
642 Slic3r::GUI::wxGetApp().mainframe->jump_to_monitor();
643 if (MonitorPanel* monitor = MonitorPanel::if_built())
644 monitor->jump_to_Rack();
645 break;
646 }
648 m_obj->command_ams_control("abort");
649 break;
650 }
652 m_obj->command_purification_disable();
653 break;
654 }
656 if (!m_action_json.is_null()) {
657 m_obj->command_dont_remind_next_time(m_action_json);
658 }
659 break;
660 }
662
664 // post EVT_SECONDARY_CHECK_CANCEL
665 // no event
666 break;
667 }
669 // post EVT_SECONDARY_CHECK_DONE
670 m_obj->command_ams_control("done");
671 break;
672 }
674 // post EVT_SECONDARY_CHECK_RETRY
675 wxCommandEvent event(EVT_SECONDARY_CHECK_RETRY);
676 wxPostEvent(GetParent(), event);
677 break;
678 }
680 // post EVT_SECONDARY_CHECK_RESUME
681 wxCommandEvent event(EVT_SECONDARY_CHECK_RESUME);
682 wxPostEvent(GetParent(), event);
683 break;
684 }
686 // post EVT_SECONDARY_CHECK_CONFIRM
687 m_obj->command_clean_print_error(m_obj->subtask_id_, m_error_code);
688 m_obj->command_clean_print_error_uiop(m_error_code);
689 break;
690 }
691
692 default: break;
693 }
694
695 Hide();
696}
nlohmann::json m_action_json
Definition DeviceErrorDialog.hpp:83
int m_error_code
Definition DeviceErrorDialog.hpp:120
static MonitorPanel * if_built()
Definition Lazy.hpp:183

References ABORT, CANCEL, CHECK_ASSISTANT, CONTINUE, DBL_CHECK_CANCEL, DBL_CHECK_DONE, DBL_CHECK_OK, DBL_CHECK_RESUME, DBL_CHECK_RETRY, DISABLE_PURIFICATION, DONT_REMIND_NEXT_TIME, ERROR_BUTTON_COUNT, FILAMENT_EXTRUDED, FILAMENT_LOAD_RESUME, Slic3r::GUI::LazyInstance< MonitorPanel >::if_built(), IGNORE_NO_REMINDER_NEXT_TIME, IGNORE_RESUME, JUMP_TO_LIVEVIEW, LOAD_VIRTUAL_TRAY, m_action_json, m_error_code, m_obj, NO_REMINDER_NEXT_TIME, OK_BUTTON, OK_JUMP_RACK, on_button_click(), PROBLEM_SOLVED_RESUME, PROCEED, REFRESH_NOZZLE, RESUME_PRINTING, RESUME_PRINTING_DEFECTS, RESUME_PRINTING_PROBELM_SOLVED, RETRY_FILAMENT_EXTRUDED, RETRY_PROBLEM_SOLVED, STOP_DRYING, STOP_PRINTING, and TURN_OFF_FIRE_ALARM.

Referenced by init_button(), and on_button_click().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_dpi_changed()

void Slic3r::GUI::DeviceErrorDialog::on_dpi_changed ( const wxRect & suggested_rect)
protectedvirtual

Implements Slic3r::GUI::DPIAware< wxDialog >.

354{
355 for (auto used_button : m_used_button) { used_button->Rescale();}
356 wxGetApp().UpdateDlgDarkUI(this);
357 Refresh();
358}
std::unordered_set< Button * > m_used_button
Definition DeviceErrorDialog.hpp:121

References m_used_button, and on_dpi_changed().

Referenced by on_dpi_changed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_request_timeout()

void Slic3r::GUI::DeviceErrorDialog::on_request_timeout ( wxTimerEvent & event)
protected
176{
177 if (m_request_cancelled.load()) { return; }
178 // Same fallback order as the cloud callback: local/HTTP illustration first, placeholder last.
180 m_error_picture->SetBitmap(make_placeholder_image(_L("Network unavailable")));
181 }
182 Layout();
183 Fit();
184}

References _L, get_fail_snapshot_from_local(), m_error_picture, m_local_img_url, m_request_cancelled, and make_placeholder_image().

Referenced by DeviceErrorDialog().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_sys_color_changed()

◆ on_webrequest_state()

void Slic3r::GUI::DeviceErrorDialog::on_webrequest_state ( wxWebRequestEvent & evt)
protected
140{
141 BOOST_LOG_TRIVIAL(trace) << "monitor: monitor_panel web request state = " << evt.GetState();
142
143 // A local/HTTP illustration resolved (or the cloud path fell back to it): stop the watchdog.
144 m_request_cancelled.store(true);
146
147 switch (evt.GetState())
148 {
149 case wxWebRequest::State_Completed:
150 {
151 wxImage img(*evt.GetResponse().GetStream());
152 wxImage resize_img = img.Scale(FromDIP(320), FromDIP(180), wxIMAGE_QUALITY_HIGH);
153 wxBitmap error_prompt_pic = resize_img;
154 m_error_picture->SetBitmap(error_prompt_pic);
155 Layout();
156 Fit();
157
158 break;
159 }
160 case wxWebRequest::State_Failed:
161 case wxWebRequest::State_Cancelled:
162 case wxWebRequest::State_Unauthorized:
163 {
164 m_error_picture->SetBitmap(make_placeholder_image(_L("Network unavailable")));
165 Layout();
166 Fit();
167 break;
168 }
169 case wxWebRequest::State_Active:
170 case wxWebRequest::State_Idle: break;
171 default: break;
172 }
173}

References _L, clear_request_timer(), m_error_picture, m_request_cancelled, make_placeholder_image(), and Slic3r::trace().

Referenced by DeviceErrorDialog().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_error_level()

wxString Slic3r::GUI::DeviceErrorDialog::parse_error_level ( int error_code)
protected
361{
362 int level = (error_code & 0x0000F000) >> 12;
363 switch (level) {
364 case 0x4: return _L("Error");
365 case 0x8: return _L("Warning");
366 case 0xC: return _L("Info");
367 default: return _L("Unknown");
368 }
369}

References _L, and parse_error_level().

Referenced by parse_error_level(), and show_error_code().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ prev_scale_factor()

float Slic3r::GUI::DPIAware< wxDialog >::prev_scale_factor ( ) const
inlineinherited
196{ return m_prev_scale_factor; }

◆ rescale()

void Slic3r::GUI::DPIAware< wxDialog >::rescale ( const wxRect & suggested_rect)
inlineprivateinherited
265 {
266 this->Freeze();
267
268 m_force_rescale = false;
269
270 // set normal application font as a current window font
271 m_normal_font = this->GetFont();
272
274
275 // rescale missed controls sizes and images
277
278 this->Layout();
279 this->Thaw();
280
281 // reset previous scale factor from current scale factor value
283 }
virtual void on_dpi_changed(const wxRect &suggested_rect)=0
void update_em_unit()
Definition GUI_Utils.hpp:249

◆ scale_factor()

float Slic3r::GUI::DPIAware< wxDialog >::scale_factor ( ) const
inlineinherited
195{ return m_scale_factor; }

◆ set_action_json()

void Slic3r::GUI::DeviceErrorDialog::set_action_json ( const nlohmann::json & action_json)
inline
nlohmann::json action_json(const AppAction &a)
Definition ActionRegistry.cpp:443

References Slic3r::GUI::action_json(), and m_action_json.

Referenced by Slic3r::MachineObject::add_command_error_code_dlg().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_em_unit()

void Slic3r::GUI::DPIAware< wxDialog >::set_em_unit ( int v)
inlineinherited
200{ m_em_unit = v; }

◆ set_prev_scale_factor()

void Slic3r::GUI::DPIAware< wxDialog >::set_prev_scale_factor ( float v)
inlineinherited

◆ set_scale_factor()

void Slic3r::GUI::DPIAware< wxDialog >::set_scale_factor ( float v)
inlineinherited
198{ m_scale_factor = v; }

◆ show_error_code()

wxString Slic3r::GUI::DeviceErrorDialog::show_error_code ( int error_code)
373{
374 if (m_error_code == error_code) { return wxEmptyString;}
375 if (wxGetApp().get_hms_query()->is_internal_error(m_obj, error_code)) { return wxEmptyString;}
376
377 /* error code str*/
378 std::string error_str = m_obj->get_error_code_str(error_code);
379
380 /* error code message*/
381 wxString error_msg = wxGetApp().get_hms_query()->query_print_error_msg(m_obj, error_code);
382 if (error_msg.IsEmpty()) { error_msg = _L("Unknown error.");}
383
384 /* parse error level */
385 wxString error_level = parse_error_level(error_code);
386
387 /* error_str is old error code*/
388 if (message_containing_retry.count(error_str)) {
389 /* convert old error code to pseudo buttons*/
390 std::vector<int> pseudo_button = convert_to_pseudo_buttons(error_str);
391
392 /* do update*/
393 update_contents(error_level, error_msg, error_str, wxEmptyString, pseudo_button);
394 } else {
395 /* action buttons*/
396 std::vector<int> used_button;
397 wxString error_image_url = wxGetApp().get_hms_query()->query_print_image_action(m_obj, error_code, used_button);
398 if (s_jump_liveview_error_codes.count(error_str)) { used_button.emplace_back(DeviceErrorDialog::JUMP_TO_LIVEVIEW); } // special case
399
400 /* do update*/
401 update_contents(error_level, error_msg, error_str, error_image_url, used_button);
402 }
403
404 wxGetApp().UpdateDlgDarkUI(this);
405 Show();
406 Raise();
407
408#ifndef __linux__
409 // Orca: skip RequestUserAttention on Linux/Wayland (urgency-hint deadlock).
410 // On Linux (especially Wayland) RequestUserAttention(wxUSER_ATTENTION_ERROR) maps to
411 // gtk_window_set_urgency_hint(TRUE) which can leave the window in an urgent-but-unfocused
412 // state — clicks no longer reach any widget in the app and the user has to kill the
413 // process to recover. Same root cause as #9874, where SecondaryCheckDialog had its
414 // RequestUserAttention call removed for the identical reason.
415 this->RequestUserAttention(wxUSER_ATTENTION_ERROR);
416#endif
417
418 return error_msg;
419}
wxString parse_error_level(int error_code)
Definition DeviceErrorDialog.cpp:360
std::vector< int > convert_to_pseudo_buttons(std::string error_str)
Definition DeviceErrorDialog.cpp:421
void update_contents(const wxString &title, const wxString &text, const wxString &error_code, const wxString &image_url, const std::vector< int > &btns)
Definition DeviceErrorDialog.cpp:431
static std::unordered_set< std::string > message_containing_retry
Definition DeviceErrorDialog.cpp:37
static const std::unordered_set< std::string > s_jump_liveview_error_codes
Definition DeviceErrorDialog.cpp:371

References _L, convert_to_pseudo_buttons(), JUMP_TO_LIVEVIEW, m_error_code, m_obj, Slic3r::GUI::message_containing_retry, parse_error_level(), Slic3r::GUI::s_jump_liveview_error_codes, show_error_code(), and update_contents().

Referenced by Slic3r::MachineObject::add_command_error_code_dlg(), and show_error_code().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ShowModal()

◆ update_contents()

void Slic3r::GUI::DeviceErrorDialog::update_contents ( const wxString & title,
const wxString & text,
const wxString & error_code,
const wxString & image_url,
const std::vector< int > & btns )
protected
432{
433 if (error_code.empty()) { return; }
434
435 /* buttons*/
436 {
437 m_sizer_button->Clear();
438 m_used_button.clear();
439
440 // Show the used buttons
441 bool need_remove_close_btn = false;
442 std::unordered_set<int> shown_btns;
443 for (int button_id : btns)
444 {
445 need_remove_close_btn |= (button_id == REMOVE_CLOSE_BTN); // special case, do not show close button
446
447 auto iter = m_button_list.find(button_id);
448 if (iter != m_button_list.end())
449 {
450 m_sizer_button->Add(iter->second, 0, wxALL, FromDIP(5));
451 iter->second->Show();
452 m_used_button.insert(iter->second);
453 }
454 }
455
456 // Special case, do not show close button
457 if (need_remove_close_btn)
458 {
459 SetWindowStyle(GetWindowStyle() & ~wxCLOSE_BOX);
460 }
461 else
462 {
463 SetWindowStyle(GetWindowStyle() | wxCLOSE_BOX);
464 }
465
466 // Hide unused buttons
467 for (const auto& pair : m_button_list)
468 {
469 if (m_used_button.count(pair.second) == 0) { pair.second->Hide(); }
470 }
471 }
472
473 /* image */
474 // Orca: tiered image slot — prefer the printer's captured camera frame of the failure
475 // (cloud, keyed by m_print_error_img_id), else the local/HTTP HMS illustration, else hide.
476 // Reuses m_error_picture + on_webrequest_state (single widget, no second request). The
477 // loading placeholder and 10s watchdog are armed only for the async cloud fetch; the local
478 // path keeps its existing behavior.
479 m_local_img_url = image_url;
480 m_request_cancelled.store(false);
481 ++m_request_seq; // invalidate any snapshot fetch still in flight for the previous error
484 {
485 m_error_picture->SetBitmap(make_placeholder_image(_L("Loading ...")));
486 m_request_timer->StartOnce(10000);
487 m_error_picture->Show();
488 }
489 else if (get_fail_snapshot_from_local(image_url))
490 {
491 m_error_picture->Show();
492 }
493 else
494 {
495 m_error_picture->Hide();
496 }
497
498 /* error code*/
499 const wxString& show_time = wxDateTime::Now().Format("%H%M%d");
500 const wxString& error_code_msg = wxString::Format("[%S %S]", error_code, show_time);
501 m_error_code_label->SetMaxSize(wxSize(FromDIP(300), -1));
502 m_error_code_label->SetMinSize(wxSize(FromDIP(300), -1));
503 m_error_code_label->SetLabelText(error_code_msg);
504
505 /* error message*/
506 m_error_msg_label->SetMaxSize(wxSize(FromDIP(300), -1));
507 m_error_msg_label->SetMinSize(wxSize(FromDIP(300), -1));
508 m_error_msg_label->SetLabelText(text);
509
510 /* dialog title*/
511 SetTitle(title);
512
513 /* update layout*/
514 {
515 m_scroll_area->Layout();
516 auto text_size = m_error_msg_label->GetBestSize();
517 if (text_size.y < FromDIP(360))
518 {
519 // Orca: reserve the image area exactly when an image is coming (cloud snapshot,
520 // local illustration, or the loading placeholder) - m_error_picture's visibility
521 // was decided above, so no blank slot is reserved when neither source is usable.
522 if (m_error_picture->IsShown())
523 {
524 m_scroll_area->SetMinSize(wxSize(FromDIP(320), text_size.y + FromDIP(220)));
525 }
526 else
527 {
528 m_scroll_area->SetMinSize(wxSize(FromDIP(320), text_size.y + FromDIP(50)));
529 }
530 }
531 else
532 {
533 m_scroll_area->SetMinSize(wxSize(FromDIP(320), FromDIP(340)));
534 }
535
536 Layout();
537 Fit();
538 }
539};
bool get_fail_snapshot_from_cloud()
Definition DeviceErrorDialog.cpp:222

References _L, clear_request_timer(), get_fail_snapshot_from_cloud(), get_fail_snapshot_from_local(), m_button_list, m_error_code_label, m_error_msg_label, m_error_picture, m_local_img_url, m_request_cancelled, m_request_seq, m_request_timer, m_scroll_area, m_sizer_button, m_used_button, make_placeholder_image(), REMOVE_CLOSE_BTN, and update_contents().

Referenced by show_error_code(), and update_contents().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_em_unit()

void Slic3r::GUI::DPIAware< wxDialog >::update_em_unit ( )
inlineprivateinherited
250 {
251 // Linux specific issue : get_dpi_for_window(this) still doesn't responce to the Display's scale in new wxWidgets(3.1.3).
252 // So, calculate the m_em_unit value from the font size, as before
253#if !defined(__WXGTK__)
255#else
256 // initialize default width_unit according to the width of the one symbol ("m") of the currently active font of this window.
257 m_em_unit = std::max<size_t>(10, this->GetTextExtent("m").x - 1);
258#endif // __WXGTK__
259 }

Member Data Documentation

◆ btn_bg_white

StateColor Slic3r::GUI::DeviceErrorDialog::btn_bg_white
private

Referenced by init_button().

◆ m_action_json

nlohmann::json Slic3r::GUI::DeviceErrorDialog::m_action_json

Referenced by on_button_click(), and set_action_json().

◆ m_alive

std::shared_ptr<std::atomic_bool> Slic3r::GUI::DeviceErrorDialog::m_alive { std::make_shared<std::atomic_bool>(true) }
private
131{ std::make_shared<std::atomic_bool>(true) };

Referenced by ~DeviceErrorDialog(), and get_fail_snapshot_from_cloud().

◆ m_button_list

std::map<int, Button*> Slic3r::GUI::DeviceErrorDialog::m_button_list
private

Referenced by init_button(), and update_contents().

◆ m_can_rescale

bool Slic3r::GUI::DPIAware< wxDialog >::m_can_rescale
privateinherited
235{ true };

◆ m_em_unit

int Slic3r::GUI::DPIAware< wxDialog >::m_em_unit
privateinherited

◆ m_error_code

int Slic3r::GUI::DeviceErrorDialog::m_error_code
private

Referenced by on_button_click(), and show_error_code().

◆ m_error_code_label

Label* Slic3r::GUI::DeviceErrorDialog::m_error_code_label { nullptr }
private
134{ nullptr };

Referenced by DeviceErrorDialog(), and update_contents().

◆ m_error_msg_label

Label* Slic3r::GUI::DeviceErrorDialog::m_error_msg_label { nullptr }
private
133{ nullptr };

Referenced by DeviceErrorDialog(), and update_contents().

◆ m_error_picture

wxStaticBitmap* Slic3r::GUI::DeviceErrorDialog::m_error_picture
private

◆ m_force_rescale

bool Slic3r::GUI::DPIAware< wxDialog >::m_force_rescale
privateinherited
236{ false };

◆ m_local_img_url

wxString Slic3r::GUI::DeviceErrorDialog::m_local_img_url
private

◆ m_new_font_point_size

int Slic3r::GUI::DPIAware< wxDialog >::m_new_font_point_size
privateinherited

◆ m_normal_font

wxFont Slic3r::GUI::DPIAware< wxDialog >::m_normal_font
privateinherited

◆ m_obj

MachineObject* Slic3r::GUI::DeviceErrorDialog::m_obj
private

◆ m_prev_scale_factor

float Slic3r::GUI::DPIAware< wxDialog >::m_prev_scale_factor
privateinherited

◆ m_request_cancelled

std::atomic<bool> Slic3r::GUI::DeviceErrorDialog::m_request_cancelled { false }
private

◆ m_request_seq

int Slic3r::GUI::DeviceErrorDialog::m_request_seq { 0 }
private
128{ 0 };

Referenced by get_fail_snapshot_from_cloud(), and update_contents().

◆ m_request_timer

wxTimer* Slic3r::GUI::DeviceErrorDialog::m_request_timer { nullptr }
private

◆ m_scale_factor

float Slic3r::GUI::DPIAware< wxDialog >::m_scale_factor
privateinherited

◆ m_scroll_area

wxScrolledWindow* Slic3r::GUI::DeviceErrorDialog::m_scroll_area { nullptr }
private
137{ nullptr };

Referenced by DeviceErrorDialog(), and update_contents().

◆ m_sizer_button

wxBoxSizer* Slic3r::GUI::DeviceErrorDialog::m_sizer_button
private

◆ m_sizer_main

wxBoxSizer* Slic3r::GUI::DeviceErrorDialog::m_sizer_main
private

Referenced by DeviceErrorDialog().

◆ m_used_button

std::unordered_set<Button*> Slic3r::GUI::DeviceErrorDialog::m_used_button
private

Referenced by on_dpi_changed(), and update_contents().

◆ web_request

wxWebRequest Slic3r::GUI::DeviceErrorDialog::web_request
private

The documentation for this class was generated from the following files: