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

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

Inheritance diagram for Slic3r::GUI::MonitorPanel:
Collaboration diagram for Slic3r::GUI::MonitorPanel:

Public Types

enum  PrinterTab {
  PT_STATUS = 0 , PT_MEDIA = 1 , PT_UPDATE = 2 , PT_HMS = 3 ,
  PT_DEBUG = 4 , PT_MAX_NUM = 5
}

Public Member Functions

 MonitorPanel (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
 ~MonitorPanel ()
void init_bitmap ()
void init_timer ()
void init_tabpanel ()
Tabbook * get_tabpanel ()
void set_default ()
wxWindow * create_side_tools ()
void on_sys_color_changed ()
void msw_rescale ()
StatusPanel * get_status_panel ()
void select_machine (std::string machine_sn)
void on_timer (wxTimerEvent &event)
void on_select_printer (wxCommandEvent &event)
void on_printer_clicked (wxMouseEvent &event)
void on_size (wxSizeEvent &event)
void update_all ()
void update_hms_tag ()
bool Show (bool show)
void show_status (int status)
std::string get_string_from_tab (PrinterTab tab)
void stop_update ()
void start_update ()
void jump_to_HMS ()
void jump_to_Upgrade ()
void jump_to_LiveView ()
void jump_to_Rack ()
void update_network_version_footer ()
bool built () const
bool build_step ()

Static Public Member Functions

static void on_machine_selected (MachineObject *obj)
static MonitorPanel * if_built ()
static MonitorPanel * ensure ()
static void when_built (std::function< void(MonitorPanel &)> fn)

Public Attributes

MachineObject * obj { nullptr }
std::string last_conn_type = "undedefined"

Protected Member Functions

void add_build_step (std::function< void()> step)
void add_build_steps_of (StagedBuild &child)

Private Member Functions

StagedBuild * unfinished_child () const

Private Attributes

Tabbook * m_tabpanel { nullptr }
wxSizer * m_main_sizer { nullptr }
StatusPanel * m_status_info_panel { nullptr }
MediaFilePanel * m_media_file_panel { nullptr }
UpgradePanel * m_upgrade_panel { nullptr }
HMSPanel * m_hms_panel { nullptr }
SideTools * m_side_tools {nullptr}
SelectMachinePopup m_select_machine
wxBitmap m_signal_strong_img
wxBitmap m_signal_middle_img
wxBitmap m_signal_weak_img
wxBitmap m_signal_no_img
wxBitmap m_printer_img
wxBitmap m_arrow_img
int last_status
bool update_flag {false}
wxTimer * m_refresh_timer = nullptr
std::vector< std::function< void()> > m_steps
std::vector< StagedBuild * > m_children
size_t m_next_step { 0 }

Static Private Attributes

static Lazy< MonitorPanel > * s_lazy

Detailed Description

Member Enumeration Documentation

◆ PrinterTab

Enumerator
PT_STATUS 
PT_MEDIA 
PT_UPDATE 
PT_HMS 
PT_DEBUG 
PT_MAX_NUM 
110 {
111 PT_STATUS = 0,
112 PT_MEDIA = 1,
113 PT_UPDATE = 2,
114 PT_HMS = 3,
115 PT_DEBUG = 4,
116 PT_MAX_NUM = 5
117 };
@ PT_UPDATE
Definition Monitor.hpp:113
@ PT_DEBUG
Definition Monitor.hpp:115
@ PT_MEDIA
Definition Monitor.hpp:112
@ PT_STATUS
Definition Monitor.hpp:111
@ PT_MAX_NUM
Definition Monitor.hpp:116
@ PT_HMS
Definition Monitor.hpp:114

Constructor & Destructor Documentation

◆ MonitorPanel()

Slic3r::GUI::MonitorPanel::MonitorPanel ( wxWindow * parent,
wxWindowID id = wxID_ANY,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = wxTAB_TRAVERSAL )
127 : wxPanel(parent, id, pos, size, style),
128 m_select_machine(SelectMachinePopup(this))
129{
130 SetBackgroundColour(*wxWHITE);
131#ifdef __WINDOWS__
132 SetDoubleBuffered(true);
133#endif //__WINDOWS__
134
135 init_bitmap();
136
138
139 m_main_sizer = new wxBoxSizer(wxHORIZONTAL);
140 m_main_sizer->Add(m_tabpanel, 1, wxEXPAND | wxLEFT, 0);
141 SetSizerAndFit(m_main_sizer);
142
143 init_timer();
144
145 m_side_tools->get_panel()->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(MonitorPanel::on_printer_clicked), NULL, this);
146
147 Bind(wxEVT_TIMER, &MonitorPanel::on_timer, this);
148 Bind(wxEVT_SIZE, &MonitorPanel::on_size, this);
149 Bind(wxEVT_COMMAND_CHOICE_SELECTED, &MonitorPanel::on_select_printer, this);
150
151 m_select_machine.Bind(EVT_FINISHED_UPDATE_MACHINE_LIST, [this](wxCommandEvent& e) {
152 m_side_tools->start_interval();
153 });
154
155 Bind(EVT_ALREADY_READ_HMS, [this](wxCommandEvent& e) {
156 auto key = e.GetString().ToStdString();
157 auto iter = m_hms_panel->temp_hms_list.find(key);
158 if (iter != m_hms_panel->temp_hms_list.end()) {
159 m_hms_panel->temp_hms_list[key].set_read();
160 }
161
163 e.Skip();
164 });
165}
#define style
Definition WipeTowerDialog.cpp:101
SelectMachinePopup m_select_machine
Definition Monitor.hpp:92
void init_tabpanel()
Definition Monitor.cpp:194
Tabbook * m_tabpanel
Definition Monitor.hpp:82
wxSizer * m_main_sizer
Definition Monitor.hpp:83
void on_select_printer(wxCommandEvent &event)
Definition Monitor.cpp:310
SideTools * m_side_tools
Definition Monitor.hpp:91
void on_timer(wxTimerEvent &event)
Definition Monitor.cpp:299
HMSPanel * m_hms_panel
Definition Monitor.hpp:88
void on_printer_clicked(wxMouseEvent &event)
Definition Monitor.cpp:349
void init_bitmap()
Definition Monitor.cpp:176
void init_timer()
Definition Monitor.cpp:186
void on_size(wxSizeEvent &event)
Definition Monitor.cpp:370
void update_hms_tag()
Definition Monitor.cpp:440

References init_bitmap(), init_tabpanel(), init_timer(), m_hms_panel, m_main_sizer, m_select_machine, m_side_tools, m_tabpanel, on_printer_clicked(), on_select_printer(), on_size(), on_timer(), style, and update_hms_tag().

Here is the call graph for this function:

◆ ~MonitorPanel()

Slic3r::GUI::MonitorPanel::~MonitorPanel ( )
168{
169 m_side_tools->get_panel()->Disconnect(wxEVT_LEFT_DOWN, wxMouseEventHandler(MonitorPanel::on_printer_clicked), NULL, this);
170
171 if (m_refresh_timer)
172 m_refresh_timer->Stop();
173 delete m_refresh_timer;
174}
wxTimer * m_refresh_timer
Definition Monitor.hpp:104

References m_refresh_timer, m_side_tools, and on_printer_clicked().

Here is the call graph for this function:

Member Function Documentation

◆ add_build_step()

void Slic3r::GUI::StagedBuild::add_build_step ( std::function< void()> step)
inlineprotectedinherited
39{ m_steps.push_back(std::move(step)); }
std::vector< std::function< void()> > m_steps
Definition StagedBuild.hpp:57

References m_steps.

Referenced by Slic3r::GUI::StatusBasePanel::StatusBasePanel(), Slic3r::GUI::StatusPanel::StatusPanel(), add_build_steps_of(), Slic3r::GUI::CalibrationWizard::add_page_step(), Slic3r::GUI::StatusBasePanel::create_machine_control_page(), Slic3r::GUI::FlowRateWizard::create_pages(), Slic3r::GUI::PressureAdvanceWizard::create_pages(), Slic3r::GUI::AuxiliaryPanel::init_tabpanel(), and Slic3r::GUI::MonitorPanel::init_tabpanel().

Here is the caller graph for this function:

◆ add_build_steps_of()

void Slic3r::GUI::StagedBuild::add_build_steps_of ( StagedBuild & child)
inlineprotectedinherited
44 {
45 m_children.push_back(&child);
46 for (size_t i = child.m_next_step; i < child.m_steps.size(); ++i)
47 add_build_step([&child] { child.build_step(); });
48 }
std::vector< StagedBuild * > m_children
Definition StagedBuild.hpp:58
void add_build_step(std::function< void()> step)
Definition StagedBuild.hpp:39

References add_build_step(), build_step(), m_children, m_next_step, and m_steps.

Referenced by Slic3r::GUI::ProjectPanel::ProjectPanel(), Slic3r::GUI::CalibrationPanel::init_tabpanel(), and Slic3r::GUI::MonitorPanel::init_tabpanel().

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

◆ build_step()

bool Slic3r::GUI::StagedBuild::build_step ( )
inlineinherited
27 {
28 if (m_next_step < m_steps.size()) {
29 // Copied out, since a step may queue more steps and reallocate m_steps.
30 auto step = std::move(m_steps[m_next_step++]);
31 step();
32 } else if (StagedBuild* child = unfinished_child()) {
33 child->build_step();
34 }
35 return !built();
36 }
size_t m_next_step
Definition StagedBuild.hpp:59
StagedBuild * unfinished_child() const
Definition StagedBuild.hpp:51
bool built() const
Definition StagedBuild.hpp:18
void step(Coord &crd, const Dir d, const long n=1)
Definition MarchingSquares.hpp:213

References built(), m_next_step, m_steps, and unfinished_child().

Referenced by add_build_steps_of().

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

◆ built()

bool Slic3r::GUI::StagedBuild::built ( ) const
inlineinherited
19 {
20 return m_next_step == m_steps.size() &&
21 std::all_of(m_children.begin(), m_children.end(), [](const StagedBuild* child) { return child->built(); });
22 }

References m_children, m_next_step, and m_steps.

Referenced by Slic3r::GUI::StatusPanel::~StatusPanel(), build_step(), Slic3r::GUI::CalibrationPanel::show_status(), Slic3r::GUI::MonitorPanel::show_status(), Slic3r::GUI::CalibrationPanel::update_all(), and Slic3r::GUI::MonitorPanel::update_all().

Here is the caller graph for this function:

◆ create_side_tools()

wxWindow * Slic3r::GUI::MonitorPanel::create_side_tools ( )
253{
254 //TEST function
255 //m_bitmap_wifi_signal->Connect(wxEVT_LEFT_DCLICK, wxMouseEventHandler(MonitorPanel::on_update_all), NULL, this);
256
257 wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
258 auto panel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(0, FromDIP(50)));
259 panel->SetBackgroundColour(wxColour(135,206,250));
260 panel->SetSizer(sizer);
261 sizer->Layout();
262 panel->Fit();
263 return panel;
264}

◆ ensure()

MonitorPanel * Slic3r::GUI::LazyInstance< MonitorPanel >::ensure ( )
inlinestaticinherited
186{ return s_lazy ? s_lazy->ensure() : nullptr; }
Definition Lazy.hpp:180
static Self * ensure()
Definition Lazy.hpp:186

Referenced by Slic3r::GUI::MainFrame::jump_to_monitor(), and Slic3r::GUI::CalibrationCaliPage::update().

Here is the caller graph for this function:

◆ get_status_panel()

StatusPanel * Slic3r::GUI::MonitorPanel::get_status_panel ( )
inline
129{return m_status_info_panel;};
StatusPanel * m_status_info_panel
Definition Monitor.hpp:85

References m_status_info_panel.

Referenced by Slic3r::GUI::MultiMachineItem::MultiMachineItem(), and Slic3r::GUI::CalibrationCaliPage::update().

Here is the caller graph for this function:

◆ get_string_from_tab()

std::string Slic3r::GUI::MonitorPanel::get_string_from_tab ( PrinterTab tab)
539{
540 switch (tab) {
541 case PT_STATUS :
542 return "status";
543 case PT_MEDIA:
544 return "sd_card";
545 case PT_UPDATE:
546 return "update";
547 case PT_HMS:
548 return "HMS";
549 case PT_DEBUG:
550 return "debug";
551 default:
552 return "";
553 }
554 return "";
555}

References PT_DEBUG, PT_HMS, PT_MEDIA, PT_STATUS, and PT_UPDATE.

◆ get_tabpanel()

Tabbook * Slic3r::GUI::MonitorPanel::get_tabpanel ( )
inline
122{ return m_tabpanel; };

References m_tabpanel.

Referenced by Slic3r::GUI::SelectMachineDialog::navigate_to_timelapse_page(), and Slic3r::GUI::Plater::print_job_finished().

Here is the caller graph for this function:

◆ if_built()

◆ init_bitmap()

void Slic3r::GUI::MonitorPanel::init_bitmap ( )
177{
178 m_signal_strong_img = create_scaled_bitmap("monitor_signal_strong", nullptr, 24);
179 m_signal_middle_img = create_scaled_bitmap("monitor_signal_middle", nullptr, 24);
180 m_signal_weak_img = create_scaled_bitmap("monitor_signal_weak", nullptr, 24);
181 m_signal_no_img = create_scaled_bitmap("monitor_signal_no", nullptr, 24);
182 m_printer_img = create_scaled_bitmap("monitor_printer", nullptr, 26);
183 m_arrow_img = create_scaled_bitmap("monitor_arrow",nullptr, 14);
184}
wxBitmap m_signal_weak_img
Definition Monitor.hpp:97
wxBitmap m_signal_strong_img
Definition Monitor.hpp:95
wxBitmap m_signal_middle_img
Definition Monitor.hpp:96
wxBitmap m_signal_no_img
Definition Monitor.hpp:98
wxBitmap m_arrow_img
Definition Monitor.hpp:100
wxBitmap m_printer_img
Definition Monitor.hpp:99
wxBitmap create_scaled_bitmap(const std::string &bmp_name_in, wxWindow *win, const int px_cnt, const bool grayscale, const std::string &new_color, const bool menu_bitmap, const bool resize, const bool bitmap2, const std::vector< std::string > &array_new_color)
Definition wxExtensions.cpp:448

References create_scaled_bitmap(), m_arrow_img, m_printer_img, m_signal_middle_img, m_signal_no_img, m_signal_strong_img, and m_signal_weak_img.

Referenced by MonitorPanel(), and msw_rescale().

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

◆ init_tabpanel()

void Slic3r::GUI::MonitorPanel::init_tabpanel ( )
195{
196 m_side_tools = new SideTools(this, wxID_ANY);
197 wxBoxSizer* sizer_side_tools = new wxBoxSizer(wxVERTICAL);
198 sizer_side_tools->Add(m_side_tools, 1, wxEXPAND, 0);
199 m_tabpanel = new Tabbook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, sizer_side_tools, wxNB_LEFT | wxTAB_TRAVERSAL | wxNB_NOPAGETHEME);
200 m_side_tools->set_table_panel(m_tabpanel);
201 m_tabpanel->SetBackgroundColour(wxColour("#FEFFFF"));
202 m_tabpanel->Bind(wxEVT_BOOKCTRL_PAGE_CHANGED, [this](wxBookCtrlEvent& e) {
203 auto page = m_tabpanel->GetCurrentPage();
204 if (page == m_media_file_panel) {
205 auto title = m_tabpanel->GetPageText(m_tabpanel->GetSelection());
206 m_media_file_panel->SwitchStorage(title == _L("Storage"));
207 }
208 // The first page is selected while the panel is built off screen.
209 if (page->IsShownOnScreen())
210 page->SetFocus();
211 update_all();
212 }, m_tabpanel->GetId());
213
214 m_status_info_panel = new StatusPanel(m_tabpanel);
215 // Queued before the page is added, since adding it selects it and runs the handler above,
216 // where built() must already be false.
218 m_tabpanel->AddPage(m_status_info_panel, _L("Status"), true);
219 add_build_step([this] {
220 m_media_file_panel = new MediaFilePanel(m_tabpanel);
221 m_tabpanel->AddPage(m_media_file_panel, _L("Storage"), false);
222 });
223 add_build_step([this] {
224 m_upgrade_panel = new UpgradePanel(m_tabpanel);
225 m_tabpanel->AddPage(m_upgrade_panel, _L_CONTEXT(L_CONTEXT("Update", "Firmware"), "Firmware"), false);
226 });
227 add_build_step([this] {
228 m_hms_panel = new HMSPanel(m_tabpanel);
229 m_tabpanel->AddPage(m_hms_panel, _L("Assistant(HMS)"), false);
230
231 std::string network_ver = Slic3r::NetworkAgent::get_version();
232 if (!network_ver.empty()) {
233 m_tabpanel->SetFooterText(wxString::Format(_L("Network plug-in v%s"), network_ver));
234 }
235
237 });
238}
#define L_CONTEXT(s, context)
Definition DesignOffer.hpp:17
#define _L(s)
Definition OBJ.cpp:34
@ MONITOR_NO_PRINTER
Definition SideTools.hpp:37
UpgradePanel * m_upgrade_panel
Definition Monitor.hpp:87
void show_status(int status)
Definition Monitor.cpp:491
MediaFilePanel * m_media_file_panel
Definition Monitor.hpp:86
void update_all()
Definition Monitor.cpp:377
void add_build_steps_of(StagedBuild &child)
Definition StagedBuild.hpp:43
static std::string get_version()
Definition NetworkAgent.cpp:84
#define _L_CONTEXT(s, ctx)
Definition I18N.hpp:15

References _L, _L_CONTEXT, Slic3r::GUI::StagedBuild::add_build_step(), Slic3r::GUI::StagedBuild::add_build_steps_of(), Slic3r::NetworkAgent::get_version(), L_CONTEXT, m_hms_panel, m_media_file_panel, m_side_tools, m_status_info_panel, m_tabpanel, m_upgrade_panel, MONITOR_NO_PRINTER, show_status(), and update_all().

Referenced by MonitorPanel().

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

◆ init_timer()

void Slic3r::GUI::MonitorPanel::init_timer ( )
187{
188 m_refresh_timer = new wxTimer();
189 m_refresh_timer->SetOwner(this);
191 if (update_flag) { update_all();}
192}
#define REFRESH_INTERVAL
Definition CalibrationPanel.cpp:43
bool update_flag
Definition Monitor.hpp:103

References m_refresh_timer, REFRESH_INTERVAL, update_all(), and update_flag.

Referenced by MonitorPanel().

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

◆ jump_to_HMS()

void Slic3r::GUI::MonitorPanel::jump_to_HMS ( )
558{
559 if (!this->IsShown())
560 return;
561 auto page = m_tabpanel->GetCurrentPage();
562 if (page && page != m_hms_panel)
563 m_tabpanel->SetSelection(PT_HMS);
564}

References m_hms_panel, m_tabpanel, and PT_HMS.

◆ jump_to_LiveView()

void Slic3r::GUI::MonitorPanel::jump_to_LiveView ( )
577{
578 if (!this->IsShown()) { return; }
579
580 auto page = m_tabpanel->GetCurrentPage();
581 if (page && page != m_hms_panel)
582 {
583 m_tabpanel->SetSelection(PT_STATUS);
584 }
585
586 m_status_info_panel->get_media_play_ctrl()->jump_to_play();
587}

References m_hms_panel, m_status_info_panel, m_tabpanel, and PT_STATUS.

◆ jump_to_Rack()

void Slic3r::GUI::MonitorPanel::jump_to_Rack ( )
590{
591 if (!this->IsShown()) {
592 return;
593 }
594
595 auto page = m_tabpanel->GetCurrentPage();
596 if (page && page != m_status_info_panel) {
597 m_tabpanel->SetSelection(PT_STATUS);
598 }
599
600 m_status_info_panel->jump_to_Rack();
601}

References m_status_info_panel, m_tabpanel, and PT_STATUS.

◆ jump_to_Upgrade()

void Slic3r::GUI::MonitorPanel::jump_to_Upgrade ( )
567{
568 if (this->IsShown()) {
569 auto page = m_tabpanel->GetCurrentPage();
570 if (page && page != m_upgrade_panel) {
571 m_tabpanel->SetSelection(PT_UPDATE);
572 }
573 }
574}

References m_tabpanel, m_upgrade_panel, and PT_UPDATE.

◆ msw_rescale()

void Slic3r::GUI::MonitorPanel::msw_rescale ( )
274{
275 init_bitmap();
276
277 /* side_tool rescale */
278 m_side_tools->msw_rescale();
279 m_tabpanel->Rescale();
280 //m_status_add_machine_panel->msw_rescale();
281 m_status_info_panel->msw_rescale();
282 m_media_file_panel->Rescale();
283 m_upgrade_panel->msw_rescale();
284 m_hms_panel->msw_rescale();
285
286 Layout();
287 Refresh();
288}

References init_bitmap(), m_hms_panel, m_media_file_panel, m_side_tools, m_status_info_panel, m_tabpanel, and m_upgrade_panel.

Referenced by Slic3r::GUI::MainFrame::on_dpi_changed().

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

◆ on_machine_selected()

void Slic3r::GUI::MonitorPanel::on_machine_selected ( MachineObject * obj)
static
338{
339 if (obj == nullptr)
340 return;
341 obj->last_cali_version = -1;
342 obj->reset_pa_cali_history_result();
343 obj->reset_pa_cali_result();
344 Sidebar& sidebar = GUI::wxGetApp().sidebar();
345 sidebar.update_sync_status(obj);
346 sidebar.set_need_auto_sync_after_connect_printer(sidebar.need_auto_sync_extruder_list_after_connect_priner(obj));
347}
MachineObject * obj
Definition Monitor.hpp:149

References Slic3r::GUI::Sidebar::need_auto_sync_extruder_list_after_connect_priner(), obj, Slic3r::GUI::Sidebar::set_need_auto_sync_after_connect_printer(), and Slic3r::GUI::Sidebar::update_sync_status().

Referenced by on_select_printer(), and Slic3r::GUI::GUI_App::select_machine().

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

◆ on_printer_clicked()

void Slic3r::GUI::MonitorPanel::on_printer_clicked ( wxMouseEvent & event)
350{
351 auto mouse_pos = ClientToScreen(event.GetPosition());
352 wxPoint rect = m_side_tools->ClientToScreen(wxPoint(0, 0));
353
354 if (!m_side_tools->is_in_interval()) {
355 wxPoint pos = m_side_tools->ClientToScreen(wxPoint(0, 0));
356 pos.y += m_side_tools->GetRect().height;
357 //pos.x = pos.x < 0? 0:pos.x;
358 m_select_machine.Move(pos);
359
360#ifdef __linux__
361 m_select_machine.SetSize(wxSize(m_side_tools->GetSize().x, -1));
362 m_select_machine.SetMaxSize(wxSize(m_side_tools->GetSize().x, -1));
363 m_select_machine.SetMinSize(wxSize(m_side_tools->GetSize().x, -1));
364#endif
365
366 m_select_machine.Popup();
367 }
368}
Vec3d pos(const Pt &p)
Definition ReprojectPointsOnMesh.hpp:16

References m_select_machine, m_side_tools, and Slic3r::GUI::wxMouseEvent.

Referenced by MonitorPanel(), and ~MonitorPanel().

Here is the caller graph for this function:

◆ on_select_printer()

void Slic3r::GUI::MonitorPanel::on_select_printer ( wxCommandEvent & event)
311{
312 Slic3r::DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
313 const std::string requested_dev_id = event.GetString().ToStdString();
314 BOOST_LOG_TRIVIAL(trace) << "Orca diagnostic: MonitorPanel::on_select_printer requested_dev_id="
315 << requested_dev_id << " device_manager=" << (dev ? "set" : "null");
316 if (!dev) return;
317
318 if ( dev->get_selected_machine() && (dev->get_selected_machine()->get_dev_id() != event.GetString().ToStdString()) && m_hms_panel) {
319 m_hms_panel->clear_hms_tag();
320 }
321
322 const bool selected = dev->set_selected_machine(requested_dev_id);
323 BOOST_LOG_TRIVIAL(trace) << "Orca diagnostic: MonitorPanel::on_select_printer set_selected_machine result="
324 << selected << " selected_dev_id="
325 << (dev->get_selected_machine() ? dev->get_selected_machine()->get_dev_id() : "<null>");
326 if (!selected)
327 return;
328
329 set_default();
330 update_all();
331
333
334 Layout();
335}
bool set_selected_machine(std::string dev_id)
Definition DevManager.cpp:636
MachineObject * get_selected_machine()
Definition DevManager.cpp:747
static void on_machine_selected(MachineObject *obj)
Definition Monitor.cpp:337
void set_default()
Definition Monitor.cpp:240
std::string get_dev_id() const
Definition DeviceManager.hpp:206
void trace(unsigned int level, const char *message)
Definition utils.cpp:247

References Slic3r::MachineObject::get_dev_id(), Slic3r::DeviceManager::get_selected_machine(), m_hms_panel, on_machine_selected(), set_default(), Slic3r::DeviceManager::set_selected_machine(), Slic3r::trace(), and update_all().

Referenced by MonitorPanel().

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

◆ on_size()

void Slic3r::GUI::MonitorPanel::on_size ( wxSizeEvent & event)
371{
372 Layout();
373 //event.Skip();
374 //Refresh();
375}

Referenced by MonitorPanel().

Here is the caller graph for this function:

◆ on_sys_color_changed()

void Slic3r::GUI::MonitorPanel::on_sys_color_changed ( )
267{
268 m_status_info_panel->on_sys_color_changed();
269 m_upgrade_panel->on_sys_color_changed();
270 m_media_file_panel->Rescale();
271}

References m_media_file_panel, m_status_info_panel, and m_upgrade_panel.

Referenced by Slic3r::GUI::MainFrame::on_sys_color_changed().

Here is the caller graph for this function:

◆ on_timer()

void Slic3r::GUI::MonitorPanel::on_timer ( wxTimerEvent & event)
300{
301 // MediaPlayCtrl may yield the event loop while it joins its camera worker
302 // during window teardown. Do not let a queued monitor refresh touch panels
303 // that are already being destroyed.
304 if (!wxGetApp().is_closing() && update_flag) {
305 update_all();
306 //Layout();
307 }
308}

References update_all(), and update_flag.

Referenced by MonitorPanel().

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

◆ select_machine()

void Slic3r::GUI::MonitorPanel::select_machine ( std::string machine_sn)
291{
292 BOOST_LOG_TRIVIAL(trace) << "Orca diagnostic: MonitorPanel::select_machine queueing machine_sn=" << machine_sn;
293 wxCommandEvent *event = new wxCommandEvent(wxEVT_COMMAND_CHOICE_SELECTED);
294 event->SetString(machine_sn);
295 wxQueueEvent(this, event);
296}

References Slic3r::trace().

Referenced by Slic3r::GUI::MainFrame::jump_to_monitor().

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

◆ set_default()

void Slic3r::GUI::MonitorPanel::set_default ( )
241{
242 obj = nullptr;
243 last_conn_type = "undefined";
244
245 /* reset status panel*/
246 m_status_info_panel->set_default();
247
248 /* reset side tool*/
249 //m_bitmap_wifi_signal->SetBitmap(wxNullBitmap);
250}
std::string last_conn_type
Definition Monitor.hpp:150

References last_conn_type, m_status_info_panel, and obj.

Referenced by on_select_printer(), and show_status().

Here is the caller graph for this function:

◆ Show()

bool Slic3r::GUI::MonitorPanel::Show ( bool show)
460{
461 NetworkAgent* m_agent = wxGetApp().getAgent();
462 DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
463 if (show) {
464#ifdef __APPLE__
465 wxGetApp().mainframe->SetMinSize(wxGetApp().plater()->GetMinSize());
466#endif
467 start_update();
469
470 m_refresh_timer->Stop();
471 m_refresh_timer->SetOwner(this);
473 if (update_flag) { update_all(); }
474
475 if (dev) {
476 //set a default machine when obj is null
477 obj = dev->get_selected_machine();
478 if (obj == nullptr) {
479 dev->load_last_machine();
480 } else {
481 obj->reset_update_time();
482 }
483 }
484 } else {
485 stop_update();
486 m_refresh_timer->Stop();
487 }
488 return wxPanel::Show(show);
489}
void start_update()
Definition Monitor.hpp:153
void update_network_version_footer()
Definition Monitor.cpp:603
void stop_update()
Definition Monitor.hpp:152
static Plater * plater()
Definition GUI_Factories.cpp:400

References Slic3r::DeviceManager::get_selected_machine(), Slic3r::DeviceManager::load_last_machine(), m_refresh_timer, obj, Slic3r::GUI::plater(), REFRESH_INTERVAL, start_update(), stop_update(), update_all(), update_flag, and update_network_version_footer().

Here is the call graph for this function:

◆ show_status()

void Slic3r::GUI::MonitorPanel::show_status ( int status)
492{
493 if (!built()) return;
494 if (last_status == status)return;
496 NetworkAgent* agent = wxGetApp().getAgent();
497 json j;
498 j["dev_id"] = obj ? obj->get_dev_id() : "obj_nullptr";
499 if ((status & (int)MonitorStatus::MONITOR_DISCONNECTED) != 0) {
500 j["result"] = "failed";
501 }
502 else if ((status & (int)MonitorStatus::MONITOR_NORMAL) != 0) {
503 j["result"] = "success";
504 }
505 }
506 last_status = status;
507
508 BOOST_LOG_TRIVIAL(info) << "monitor: show_status = " << status;
509
510 //Freeze();
511 // update panels
512 if (m_side_tools) { m_side_tools->show_status(status); };
513 m_status_info_panel->show_status(status);
514 m_hms_panel->show_status(status);
515 m_upgrade_panel->show_status(status);
516
517 if ((status & (int)MonitorStatus::MONITOR_NO_PRINTER) != 0) {
518 set_default();
519 m_tabpanel->Layout();
520 } else if (((status & (int)MonitorStatus::MONITOR_NORMAL) != 0)
521 || ((status & (int)MonitorStatus::MONITOR_DISCONNECTED) != 0)
522 || ((status & (int) MonitorStatus::MONITOR_DISCONNECTED_SERVER) != 0)
523 || ((status & (int)MonitorStatus::MONITOR_CONNECTING) != 0) )
524 {
525
526 if (((status & (int) MonitorStatus::MONITOR_DISCONNECTED) != 0)
527 || ((status & (int) MonitorStatus::MONITOR_DISCONNECTED_SERVER) != 0)
528 || ((status & (int)MonitorStatus::MONITOR_CONNECTING) != 0))
529 {
530 set_default();
531 }
532 m_tabpanel->Layout();
533 }
534 Layout();
535 //Thaw();
536}
@ MONITOR_DISCONNECTED
Definition SideTools.hpp:38
@ MONITOR_NORMAL
Definition SideTools.hpp:36
@ MONITOR_CONNECTING
Definition SideTools.hpp:40
@ MONITOR_DISCONNECTED_SERVER
Definition SideTools.hpp:39
int last_status
Definition Monitor.hpp:102
nlohmann::json json
Definition AssembleList.cpp:42

References Slic3r::GUI::StagedBuild::built(), last_status, m_hms_panel, m_side_tools, m_status_info_panel, m_tabpanel, m_upgrade_panel, MONITOR_CONNECTING, MONITOR_DISCONNECTED, MONITOR_DISCONNECTED_SERVER, MONITOR_NO_PRINTER, MONITOR_NORMAL, obj, and set_default().

Referenced by init_tabpanel(), and update_all().

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

◆ start_update()

void Slic3r::GUI::MonitorPanel::start_update ( )
inline
153{update_flag = true;};

References update_flag.

Referenced by Show().

Here is the caller graph for this function:

◆ stop_update()

void Slic3r::GUI::MonitorPanel::stop_update ( )
inline
152{update_flag = false;};

References update_flag.

Referenced by Show().

Here is the caller graph for this function:

◆ unfinished_child()

StagedBuild * Slic3r::GUI::StagedBuild::unfinished_child ( ) const
inlineprivateinherited
52 {
53 auto it = std::find_if(m_children.begin(), m_children.end(), [](const StagedBuild* child) { return !child->built(); });
54 return it == m_children.end() ? nullptr : *it;
55 }

References m_children.

Referenced by build_step().

Here is the caller graph for this function:

◆ update_all()

void Slic3r::GUI::MonitorPanel::update_all ( )
378{
379 // Every page exists once the last build step has run.
380 if (!built())
381 return;
382
383 NetworkAgent* m_agent = wxGetApp().getAgent();
384 Slic3r::DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
385 if (!dev) return;
386 obj = dev->get_selected_machine();
387
388 if (!obj) {
390 m_hms_panel->clear_hms_tag();
391 m_tabpanel->GetBtnsListCtrl()->showNewTag(3, false);
392 if (m_status_info_panel->IsShown()) {
393 m_status_info_panel->m_media_play_ctrl->SetMachineObject(obj);
394 m_status_info_panel->update(obj);
395 }
396 return;
397 }
398
399 if (obj->connection_type() != last_conn_type) { last_conn_type = obj->connection_type(); }
400
401 m_side_tools->update_status(obj);
402
403 if (obj->is_connecting()) {
405 return;
406 } else if (!obj->is_connected()) {
407 int server_status = 0;
408 // only disconnected server in cloud mode
409 if (obj->connection_type() != "lan") {
410 if (m_agent) {
411 server_status = m_agent->is_server_connected(wxGetApp().get_printer_cloud_provider()) ? 0 : (int)MONITOR_DISCONNECTED_SERVER;
412 }
413 }
414 show_status((int) MONITOR_DISCONNECTED + server_status);
415 return;
416 }
417
419
420 auto current_page = m_tabpanel->GetCurrentPage();
421 if (current_page == m_status_info_panel) {
422 if (m_status_info_panel->IsShown()) {
424 m_status_info_panel->m_media_play_ctrl->SetMachineObject(obj);
425 m_status_info_panel->update(obj);
426 }
427 } else if (current_page == m_upgrade_panel) {
428 m_upgrade_panel->update(obj);
429 } else if (current_page == m_media_file_panel) {
430 m_media_file_panel->UpdateByObj(obj);
431 }
432
433 if (current_page == m_hms_panel || (obj->GetHMS()->GetHMSItems().size() != m_hms_panel->temp_hms_list.size())) {
434 m_hms_panel->update(obj);
435 }
436
438}

References Slic3r::GUI::StagedBuild::built(), Slic3r::DeviceManager::get_selected_machine(), Slic3r::NetworkAgent::is_server_connected(), last_conn_type, m_hms_panel, m_media_file_panel, m_side_tools, m_status_info_panel, m_tabpanel, m_upgrade_panel, MONITOR_CONNECTING, MONITOR_DISCONNECTED, MONITOR_DISCONNECTED_SERVER, MONITOR_NO_PRINTER, MONITOR_NORMAL, obj, show_status(), and update_hms_tag().

Referenced by init_tabpanel(), init_timer(), on_select_printer(), on_timer(), and Show().

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

◆ update_hms_tag()

void Slic3r::GUI::MonitorPanel::update_hms_tag ( )
441{
442 for (auto hmsitem : m_hms_panel->temp_hms_list) {
443
444 if (!obj) { break;}
445
446 const wxString &msg = wxGetApp().get_hms_query()->query_hms_msg(obj->get_dev_id(), hmsitem.second.get_long_error_code());
447 if (msg.empty()){ continue;} /*STUDIO-10363 it's hidden message*/
448
449 if (!hmsitem.second.has_read()) {
450 //show HMS new tag
451 m_tabpanel->GetBtnsListCtrl()->showNewTag(3, true);
452 return;
453 }
454 }
455
456 m_tabpanel->GetBtnsListCtrl()->showNewTag(3, false);
457}

References m_hms_panel, m_tabpanel, and obj.

Referenced by MonitorPanel(), and update_all().

Here is the caller graph for this function:

◆ update_network_version_footer()

void Slic3r::GUI::MonitorPanel::update_network_version_footer ( )
604{
605 std::string binary_version = Slic3r::NetworkAgent::get_version();
606 if (binary_version.empty())
607 return;
608
609 std::string configured_version = wxGetApp().app_config->get_network_plugin_version();
610 std::string suffix = extract_suffix(configured_version);
611 std::string configured_base = extract_base_version(configured_version);
612
613 wxString footer_text;
614 if (!suffix.empty() && configured_base == binary_version) {
615 footer_text = wxString::Format(_L("Network plug-in v%s (%s)"), binary_version, suffix);
616 } else {
617 footer_text = wxString::Format(_L("Network plug-in v%s"), binary_version);
618 }
619
620 m_tabpanel->SetFooterText(footer_text);
621}
std::string extract_suffix(const std::string &full_version)
Definition bambu_networking.hpp:529
std::string extract_base_version(const std::string &full_version)
Definition bambu_networking.hpp:524

References _L, Slic3r::extract_base_version(), Slic3r::extract_suffix(), Slic3r::NetworkAgent::get_version(), and m_tabpanel.

Referenced by Show().

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

◆ when_built()

void Slic3r::GUI::LazyInstance< MonitorPanel >::when_built ( std::function< void(MonitorPanel &)> fn)
inlinestaticinherited
189 {
190 if (s_lazy)
192 }
static void when_built(std::function< void(Self &)> fn)
Definition Lazy.hpp:188

Referenced by Slic3r::GUI::MainFrame::on_dpi_changed(), and Slic3r::GUI::MainFrame::on_sys_color_changed().

Here is the caller graph for this function:

Member Data Documentation

◆ last_conn_type

std::string Slic3r::GUI::MonitorPanel::last_conn_type = "undedefined"

Referenced by set_default(), and update_all().

◆ last_status

int Slic3r::GUI::MonitorPanel::last_status
private

Referenced by show_status().

◆ m_arrow_img

wxBitmap Slic3r::GUI::MonitorPanel::m_arrow_img
private

Referenced by init_bitmap().

◆ m_children

std::vector<StagedBuild*> Slic3r::GUI::StagedBuild::m_children
privateinherited

◆ m_hms_panel

HMSPanel* Slic3r::GUI::MonitorPanel::m_hms_panel { nullptr }
private

◆ m_main_sizer

wxSizer* Slic3r::GUI::MonitorPanel::m_main_sizer { nullptr }
private
83{ nullptr };

Referenced by MonitorPanel().

◆ m_media_file_panel

MediaFilePanel* Slic3r::GUI::MonitorPanel::m_media_file_panel { nullptr }
private
86{ nullptr };

Referenced by init_tabpanel(), msw_rescale(), on_sys_color_changed(), and update_all().

◆ m_next_step

size_t Slic3r::GUI::StagedBuild::m_next_step { 0 }
privateinherited
59{ 0 };

Referenced by add_build_steps_of(), build_step(), and built().

◆ m_printer_img

wxBitmap Slic3r::GUI::MonitorPanel::m_printer_img
private

Referenced by init_bitmap().

◆ m_refresh_timer

wxTimer* Slic3r::GUI::MonitorPanel::m_refresh_timer = nullptr
private

Referenced by ~MonitorPanel(), init_timer(), and Show().

◆ m_select_machine

SelectMachinePopup Slic3r::GUI::MonitorPanel::m_select_machine
private

Referenced by MonitorPanel(), and on_printer_clicked().

◆ m_side_tools

SideTools* Slic3r::GUI::MonitorPanel::m_side_tools {nullptr}
private

◆ m_signal_middle_img

wxBitmap Slic3r::GUI::MonitorPanel::m_signal_middle_img
private

Referenced by init_bitmap().

◆ m_signal_no_img

wxBitmap Slic3r::GUI::MonitorPanel::m_signal_no_img
private

Referenced by init_bitmap().

◆ m_signal_strong_img

wxBitmap Slic3r::GUI::MonitorPanel::m_signal_strong_img
private

Referenced by init_bitmap().

◆ m_signal_weak_img

wxBitmap Slic3r::GUI::MonitorPanel::m_signal_weak_img
private

Referenced by init_bitmap().

◆ m_status_info_panel

StatusPanel* Slic3r::GUI::MonitorPanel::m_status_info_panel { nullptr }
private

◆ m_steps

std::vector<std::function<void()> > Slic3r::GUI::StagedBuild::m_steps
privateinherited

◆ m_tabpanel

◆ m_upgrade_panel

UpgradePanel* Slic3r::GUI::MonitorPanel::m_upgrade_panel { nullptr }
private

◆ obj

MachineObject* Slic3r::GUI::MonitorPanel::obj { nullptr }

◆ s_lazy

Lazy<MonitorPanel>* Slic3r::GUI::LazyInstance< MonitorPanel >::s_lazy
inlinestaticprivateinherited
196{ nullptr };

◆ update_flag

bool Slic3r::GUI::MonitorPanel::update_flag {false}
private
103{false};

Referenced by init_timer(), on_timer(), Show(), start_update(), and stop_update().


The documentation for this class was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/Monitor.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/Monitor.cpp