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

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

Inheritance diagram for Slic3r::GUI::HMSPanel:
Collaboration diagram for Slic3r::GUI::HMSPanel:

Public Member Functions

 HMSPanel (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
 ~HMSPanel ()
void msw_rescale ()
bool Show (bool show=true) override
void update (MachineObject *obj_)
void show_status (int status)
void clear_hms_tag ()

Public Attributes

MachineObject * obj { nullptr }
std::map< std::string, DevHMSItem > temp_hms_list

Protected Member Functions

void append_hms_panel (const std::string &dev_id, DevHMSItem &item)
void delete_hms_panels ()

Protected Attributes

wxScrolledWindow * m_scrolledWindow
wxBoxSizer * m_top_sizer
int last_status

Detailed Description

Constructor & Destructor Documentation

◆ HMSPanel()

Slic3r::GUI::HMSPanel::HMSPanel ( wxWindow * parent,
wxWindowID id = wxID_ANY,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = wxTAB_TRAVERSAL )
178 :wxPanel(parent, id, pos, size, style)
179{
180 this->SetBackgroundColour(wxColour(238, 238, 238));
181
182 auto m_main_sizer = new wxBoxSizer(wxVERTICAL);
183
184 m_scrolledWindow = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
185 m_scrolledWindow->SetBackgroundColour(*wxWHITE);
186 m_scrolledWindow->SetScrollRate(5, FromDIP(20));
187
188 m_top_sizer = new wxBoxSizer(wxVERTICAL);
189
190 m_top_sizer->AddSpacer(FromDIP(30));
191
192 m_scrolledWindow->SetSizerAndFit(m_top_sizer);
193
194 m_main_sizer->Add(m_scrolledWindow, 1, wxEXPAND, 0);
195
196 this->SetSizerAndFit(m_main_sizer);
197
198 Layout();
199
200 wxGetApp().UpdateDarkUIWin(this);
201}
#define style
Definition WipeTowerDialog.cpp:101
wxScrolledWindow * m_scrolledWindow
Definition HMSPanel.hpp:55
wxBoxSizer * m_top_sizer
Definition HMSPanel.hpp:56

References m_scrolledWindow, m_top_sizer, and style.

◆ ~HMSPanel()

Slic3r::GUI::HMSPanel::~HMSPanel ( )
203 {
204 ;
205}

Member Function Documentation

◆ append_hms_panel()

void Slic3r::GUI::HMSPanel::append_hms_panel ( const std::string & dev_id,
DevHMSItem & item )
protected
207 {
208 wxString msg = wxGetApp().get_hms_query()->query_hms_msg(dev_id, item.get_long_error_code());
209 if (!msg.empty()) {
210 HMSNotifyItem *notify_item = new HMSNotifyItem(dev_id, m_scrolledWindow, item);
211 m_top_sizer->Add(notify_item, 0, wxALIGN_CENTER_HORIZONTAL);
212 } else {
213 // debug for hms display error info
214 // m_top_sizer->Add(m_notify_item, 0, wxALIGN_CENTER_HORIZONTAL);
215 BOOST_LOG_TRIVIAL(info) << "hms: do not display empty_item";
216 }
217}

References Slic3r::DevHMSItem::get_long_error_code(), m_scrolledWindow, and m_top_sizer.

Referenced by update().

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

◆ clear_hms_tag()

void Slic3r::GUI::HMSPanel::clear_hms_tag ( )
224{
225 temp_hms_list.clear();
226}
std::map< std::string, DevHMSItem > temp_hms_list
Definition HMSPanel.hpp:79

References temp_hms_list.

◆ delete_hms_panels()

void Slic3r::GUI::HMSPanel::delete_hms_panels ( )
protected
219 {
220 m_scrolledWindow->DestroyChildren();
221}

References m_scrolledWindow.

Referenced by show_status(), and update().

Here is the caller graph for this function:

◆ msw_rescale()

void Slic3r::GUI::HMSPanel::msw_rescale ( )
inline
68{}

◆ Show()

bool Slic3r::GUI::HMSPanel::Show ( bool show = true)
override
289{
290 return wxPanel::Show(show);
291}

◆ show_status()

void Slic3r::GUI::HMSPanel::show_status ( int status)
274{
275 if (last_status == status) return;
276 last_status = status;
277
278 if (((status & (int)MonitorStatus::MONITOR_DISCONNECTED) != 0)
279 || ((status & (int)MonitorStatus::MONITOR_DISCONNECTED_SERVER) != 0)
280 || ((status & (int)MonitorStatus::MONITOR_CONNECTING) != 0)
281 || ((status & (int)MonitorStatus::MONITOR_NO_PRINTER) != 0)
282 ) {
284 Layout();
285 }
286}
@ MONITOR_DISCONNECTED
Definition SideTools.hpp:38
@ MONITOR_NO_PRINTER
Definition SideTools.hpp:37
@ MONITOR_CONNECTING
Definition SideTools.hpp:40
@ MONITOR_DISCONNECTED_SERVER
Definition SideTools.hpp:39
void delete_hms_panels()
Definition HMSPanel.cpp:219
int last_status
Definition HMSPanel.hpp:58

References delete_hms_panels(), last_status, MONITOR_CONNECTING, MONITOR_DISCONNECTED, MONITOR_DISCONNECTED_SERVER, and MONITOR_NO_PRINTER.

Here is the call graph for this function:

◆ update()

void Slic3r::GUI::HMSPanel::update ( MachineObject * obj_)
229{
230 if (obj) {
231 this->Freeze();
233 wxString hms_text;
234 for (auto item : obj->GetHMS()->GetHMSItems()) {
235 if (wxGetApp().get_hms_query()) {
236
237 auto key = item.get_long_error_code();
238 auto iter = temp_hms_list.find(key);
239 if (iter == temp_hms_list.end()) {
240 temp_hms_list[key] = item;
241 }
242
243 append_hms_panel(obj->get_dev_id(), item);
244 }
245 }
246
247 for (auto it = temp_hms_list.begin(); it != temp_hms_list.end(); ) {
248 auto key = it->second.get_long_error_code();
249 bool inr = false;
250 for (auto hms : obj->GetHMS()->GetHMSItems()) {
251 if (hms.get_long_error_code() == key) {
252 inr = true;
253 break;
254 }
255 }
256
257 if (!inr) {
258 it = temp_hms_list.erase(it);
259 }
260 else {
261 ++it;
262 }
263 }
264
265 Layout();
266 this->Thaw();
267 } else {
269 Layout();
270 }
271}
MachineObject * obj
Definition HMSPanel.hpp:78
void append_hms_panel(const std::string &dev_id, DevHMSItem &item)
Definition HMSPanel.cpp:207

References append_hms_panel(), delete_hms_panels(), obj, and temp_hms_list.

Here is the call graph for this function:

Member Data Documentation

◆ last_status

int Slic3r::GUI::HMSPanel::last_status
protected

Referenced by show_status().

◆ m_scrolledWindow

wxScrolledWindow* Slic3r::GUI::HMSPanel::m_scrolledWindow
protected

◆ m_top_sizer

wxBoxSizer* Slic3r::GUI::HMSPanel::m_top_sizer
protected

Referenced by HMSPanel(), and append_hms_panel().

◆ obj

MachineObject* Slic3r::GUI::HMSPanel::obj { nullptr }
78{ nullptr };

Referenced by update().

◆ temp_hms_list

std::map<std::string, DevHMSItem> Slic3r::GUI::HMSPanel::temp_hms_list

Referenced by clear_hms_tag(), and update().


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