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

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

Inheritance diagram for Slic3r::GUI::MultiTaskItem:
Collaboration diagram for Slic3r::GUI::MultiTaskItem:

Public Member Functions

 MultiTaskItem (wxWindow *parent, MachineObject *obj, int type)
 ~MultiTaskItem ()
void OnEnterWindow (wxMouseEvent &evt)
void OnLeaveWindow (wxMouseEvent &evt)
void OnSelectedDevice (wxCommandEvent &evt)
void OnLeftDown (wxMouseEvent &evt)
void OnMove (wxMouseEvent &evt)
void paintEvent (wxPaintEvent &evt)
void render (wxDC &dc)
void doRender (wxDC &dc)
void DrawTextWithEllipsis (wxDC &dc, const wxString &text, int maxWidth, int left, int top=0)
void post_event (wxCommandEvent &&event)
virtual void DoSetSize (int x, int y, int width, int height, int sizeFlags=wxSIZE_AUTO)
wxString get_left_time (int mc_left_time)
void update_info ()
void onPause ()
void onResume ()
void onStop ()
void onCancel ()
void on_refresh (wxCommandEvent &evt)
void sync_state ()
wxString get_state_printable ()
int get_state_printable () const
wxString get_state_device ()
int get_state_device () const
wxString get_local_state_task ()
wxString get_cloud_state_task ()
MachineObject * get_obj () const
int get_state_online () const
int get_state_selected () const
int get_state_enable_ams () const
int get_state_local_task () const
int get_state_cloud_task () const
std::string get_state_dev_name () const
void selected ()
void unselected ()
void update_item (const DeviceItem *item)

Public Attributes

bool m_hover { false }
ScalableBitmap m_bitmap_check_disable
ScalableBitmap m_bitmap_check_off
ScalableBitmap m_bitmap_check_on
int m_sending_percent {0}
int m_task_type {0}
wxString m_project_name
wxString m_dev_name
std::string m_dev_id
TaskStateInfo * task_obj { nullptr }
std::string m_job_id
Button * m_button_resume { nullptr }
Button * m_button_cancel { nullptr }
Button * m_button_pause { nullptr }
Button * m_button_stop { nullptr }
MachineObject * obj_ {nullptr}
int state_online = { 0 }
std::string state_dev_name
int state_printable { 0 }
int state_selected { 0 }
int state_enable_ams { 0 }
int state_device { 0 }
int state_local_task { 0 }
int state_cloud_task { 0 }
int state_optional {0}
std::string m_send_time

Detailed Description

Constructor & Destructor Documentation

◆ MultiTaskItem()

Slic3r::GUI::MultiTaskItem::MultiTaskItem ( wxWindow * parent,
MachineObject * obj,
int type )
53 : DeviceItem(parent, obj),
54 m_task_type(type)
55{
56 SetBackgroundColour(*wxWHITE);
57 SetMinSize(wxSize(FromDIP(CLOUD_TASK_ITEM_MAX_WIDTH), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
58 SetMaxSize(wxSize(FromDIP(CLOUD_TASK_ITEM_MAX_WIDTH), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
59
60 Bind(wxEVT_PAINT, &MultiTaskItem::paintEvent, this);
61 Bind(wxEVT_ENTER_WINDOW, &MultiTaskItem::OnEnterWindow, this);
62 Bind(wxEVT_LEAVE_WINDOW, &MultiTaskItem::OnLeaveWindow, this);
63 Bind(wxEVT_LEFT_DOWN, &MultiTaskItem::OnLeftDown, this);
64 Bind(wxEVT_MOTION, &MultiTaskItem::OnMove, this);
65 Bind(EVT_MULTI_DEVICE_SELECTED, &MultiTaskItem::OnSelectedDevice, this);
66
67 m_bitmap_check_disable = ScalableBitmap(this, "check_off_disabled", 18);
68 m_bitmap_check_off = ScalableBitmap(this, "check_off_focused", 18);
69 m_bitmap_check_on = ScalableBitmap(this, "check_on", 18);
70
71 wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL);
72 wxBoxSizer* item_sizer = new wxBoxSizer(wxHORIZONTAL);
73
74
75 auto m_btn_bg_enable = StateColor(
76 std::pair<wxColour, int>(wxColour(0, 137, 123), StateColor::Pressed),
77 std::pair<wxColour, int>(wxColour(38, 166, 154), StateColor::Hovered),
78 std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Normal)
79 );
80
81 m_button_resume = new Button(this, _L("Resume"));
82 m_button_resume->SetBackgroundColor(m_btn_bg_enable);
83 m_button_resume->SetBorderColor(m_btn_bg_enable);
85 m_button_resume->SetTextColor(StateColor::darkModeColorFor("#FFFFFE"));
86 m_button_resume->SetMinSize(wxSize(FromDIP(70), FromDIP(35)));
87 m_button_resume->SetCornerRadius(6);
88
89
90 StateColor clean_bg(std::pair<wxColour, int>(wxColour(255, 255, 255), StateColor::Disabled), std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Pressed),
91 std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered), std::pair<wxColour, int>(wxColour(255, 255, 255), StateColor::Enabled),
92 std::pair<wxColour, int>(wxColour(255, 255, 255), StateColor::Normal));
93 StateColor clean_bd(std::pair<wxColour, int>(wxColour(144, 144, 144), StateColor::Disabled), std::pair<wxColour, int>(wxColour(38, 46, 48), StateColor::Enabled));
94 StateColor clean_text(std::pair<wxColour, int>(wxColour(144, 144, 144), StateColor::Disabled), std::pair<wxColour, int>(wxColour(38, 46, 48), StateColor::Enabled));
95
96 m_button_cancel = new Button(this, _L("Cancel"));
97 m_button_cancel->SetBackgroundColor(clean_bg);
98 m_button_cancel->SetBorderColor(clean_bd);
99 m_button_cancel->SetTextColor(clean_text);
101 m_button_cancel->SetCornerRadius(6);
102 m_button_cancel->SetMinSize(wxSize(FromDIP(70), FromDIP(35)));
103
104 m_button_pause = new Button(this, _L_CONTEXT("Pause", "Verb"));
105 m_button_pause->SetBackgroundColor(clean_bg);
106 m_button_pause->SetBorderColor(clean_bd);
107 m_button_pause->SetTextColor(clean_text);
109 m_button_pause->SetCornerRadius(6);
110 m_button_pause->SetMinSize(wxSize(FromDIP(70), FromDIP(35)));
111
112 m_button_stop = new Button(this, _L("Stop"));
113 m_button_stop->SetBackgroundColor(clean_bg);
114 m_button_stop->SetBorderColor(clean_bd);
115 m_button_stop->SetTextColor(clean_text);
117 m_button_stop->SetCornerRadius(6);
118 m_button_stop->SetMinSize(wxSize(FromDIP(70), FromDIP(35)));
119
120
121 item_sizer->Add(0, 0, 1, wxEXPAND, 0);
122 item_sizer->Add(m_button_cancel, 0, wxALIGN_CENTER, 0);
123 item_sizer->Add(m_button_resume, 0, wxALIGN_CENTER, 0);
124 item_sizer->Add(m_button_pause, 0, wxALIGN_CENTER, 0);
125 item_sizer->Add(m_button_stop, 0, wxALIGN_CENTER, 0);
126
127 m_button_cancel->Hide();
128 m_button_pause->Hide();
129 m_button_resume->Hide();
130 m_button_stop->Hide();
131
132 main_sizer->Add(item_sizer, 1, wxEXPAND, 0);
133 SetSizer(main_sizer);
134 Layout();
135
136 m_button_cancel->Bind(wxEVT_BUTTON, [this](auto& e) {
137 onCancel();
138 });
139
140 m_button_pause->Bind(wxEVT_BUTTON, [this](auto& e) {
141 onPause();
142 });
143
144 m_button_resume->Bind(wxEVT_BUTTON, [this](auto& e) {
145 onResume();
146 });
147
148 m_button_stop->Bind(wxEVT_BUTTON, [this](auto& e) {
149 onStop();
150 });
151
152 wxGetApp().UpdateDarkUIWin(this);
153}
#define DEVICE_ITEM_MAX_HEIGHT
Definition MultiMachine.hpp:20
#define CLOUD_TASK_ITEM_MAX_WIDTH
Definition MultiTaskManagerPage.hpp:30
#define _L(s)
Definition OBJ.cpp:34
static wxFont Body_12
Definition Label.hpp:55
DeviceItem(wxWindow *parent, MachineObject *obj)
Definition MultiMachine.cpp:22
Button * m_button_cancel
Definition MultiTaskManagerPage.hpp:77
ScalableBitmap m_bitmap_check_disable
Definition MultiTaskManagerPage.hpp:63
Button * m_button_resume
Definition MultiTaskManagerPage.hpp:76
void onStop()
Definition MultiTaskManagerPage.cpp:237
void paintEvent(wxPaintEvent &evt)
Definition MultiTaskManagerPage.cpp:324
void OnLeftDown(wxMouseEvent &evt)
Definition MultiTaskManagerPage.cpp:287
Button * m_button_pause
Definition MultiTaskManagerPage.hpp:78
void onCancel()
Definition MultiTaskManagerPage.cpp:252
void onPause()
Definition MultiTaskManagerPage.cpp:215
void OnLeaveWindow(wxMouseEvent &evt)
Definition MultiTaskManagerPage.cpp:268
Button * m_button_stop
Definition MultiTaskManagerPage.hpp:79
ScalableBitmap m_bitmap_check_on
Definition MultiTaskManagerPage.hpp:65
void OnMove(wxMouseEvent &evt)
Definition MultiTaskManagerPage.cpp:307
int m_task_type
Definition MultiTaskManagerPage.hpp:68
ScalableBitmap m_bitmap_check_off
Definition MultiTaskManagerPage.hpp:64
void OnSelectedDevice(wxCommandEvent &evt)
Definition MultiTaskManagerPage.cpp:274
void onResume()
Definition MultiTaskManagerPage.cpp:226
void OnEnterWindow(wxMouseEvent &evt)
Definition MultiTaskManagerPage.cpp:262
static wxColour darkModeColorFor(wxColour const &color)
Definition StateColor.cpp:219
@ Hovered
Definition StateColor.hpp:20
@ Normal
Definition StateColor.hpp:16
@ Disabled
Definition StateColor.hpp:22
@ Pressed
Definition StateColor.hpp:21
@ Enabled
Definition StateColor.hpp:17
#define _L_CONTEXT(s, ctx)
Definition I18N.hpp:15

References Slic3r::GUI::DeviceItem::DeviceItem(), _L, _L_CONTEXT, Label::Body_12, CLOUD_TASK_ITEM_MAX_WIDTH, StateColor::darkModeColorFor(), DEVICE_ITEM_MAX_HEIGHT, StateColor::Disabled, StateColor::Enabled, StateColor::Hovered, m_bitmap_check_disable, m_bitmap_check_off, m_bitmap_check_on, m_button_cancel, m_button_pause, m_button_resume, m_button_stop, m_task_type, StateColor::Normal, onCancel(), OnEnterWindow(), OnLeaveWindow(), OnLeftDown(), OnMove(), onPause(), onResume(), OnSelectedDevice(), onStop(), paintEvent(), and StateColor::Pressed.

Here is the call graph for this function:

◆ ~MultiTaskItem()

Slic3r::GUI::MultiTaskItem::~MultiTaskItem ( )
inline
44{};

Member Function Documentation

◆ doRender()

void Slic3r::GUI::MultiTaskItem::doRender ( wxDC & dc)
352{
353 wxSize size = GetSize();
354 dc.SetPen(wxPen(*wxBLACK));
355
356 int left = FromDIP(TASK_LEFT_PADDING_LEFT);
357
358
359 //checkbox
360 if (m_task_type == 0) {
361 if (state_local_task >= 2) {
362 dc.DrawBitmap(m_bitmap_check_disable.bmp(), wxPoint(left, (size.y - m_bitmap_check_disable.GetBmpSize().y) / 2));
363 }
364 else {
365 if (state_selected == 0) {
366 dc.DrawBitmap(m_bitmap_check_off.bmp(), wxPoint(left, (size.y - m_bitmap_check_disable.GetBmpSize().y) / 2));
367 }
368 else if (state_selected == 1) {
369 dc.DrawBitmap(m_bitmap_check_on.bmp(), wxPoint(left, (size.y - m_bitmap_check_disable.GetBmpSize().y) / 2));
370 }
371 }
372 }
373 else if(m_task_type == 1){
374 if (state_cloud_task != 0) {
375 dc.DrawBitmap(m_bitmap_check_disable.bmp(), wxPoint(left, (size.y - m_bitmap_check_disable.GetBmpSize().y) / 2));
376 }
377 else {
378 if (state_selected == 0) {
379 dc.DrawBitmap(m_bitmap_check_off.bmp(), wxPoint(left, (size.y - m_bitmap_check_disable.GetBmpSize().y) / 2));
380 }
381 else if (state_selected == 1) {
382 dc.DrawBitmap(m_bitmap_check_on.bmp(), wxPoint(left, (size.y - m_bitmap_check_disable.GetBmpSize().y) / 2));
383 }
384 }
385 }
386
387
388 left += FromDIP(TASK_LEFT_PRINTABLE);
389
390 //project name
392 left += FromDIP(TASK_LEFT_PRO_NAME);
393
394 //dev name
396 left += FromDIP(TASK_LEFT_DEV_NAME);
397
398 //local task state
399 if (m_task_type == 0) {
401 }
402 else {
404 }
405
406 left += FromDIP(TASK_LEFT_PRO_STATE);
407
408 //cloud task info
409 if (m_task_type == 1) {
410 if (get_obj()) {
411 if (state_cloud_task == 0 && m_job_id == get_obj()->profile_id_) {
412 dc.SetFont(Label::Body_13);
413 if (state_device == 0) {
414 dc.SetTextForeground(*wxBLACK);
416 }
417 else if (state_device == 1) {
418 dc.SetTextForeground(wxColour(0, 150, 136));
420 }
421 else if (state_device == 2)
422 {
423 dc.SetTextForeground(wxColour(208, 27, 27));
425 }
426 else if (state_device > 2 && state_device < 7) {
427 dc.SetFont(Label::Body_12);
428 dc.SetTextForeground(wxColour(0, 150, 136));
429 if (obj_->get_curr_stage() == _L("Printing") && obj_->subtask_) {
430 //wxString layer_info = wxString::Format(_L("Layer: %d/%d"), obj_->curr_layer, obj_->total_layers);
431 wxString progress_info = wxString::Format("%d", obj_->subtask_->task_progress);
432 wxString left_time = wxString::Format("%s", get_left_time(obj_->mc_left_time));
433
434 DrawTextWithEllipsis(dc, progress_info + "% | " + left_time, FromDIP(TASK_LEFT_PRO_INFO), left, FromDIP(10));
435
436 dc.SetPen(wxPen(wxColour(233, 233, 233)));
437 dc.SetBrush(wxBrush(wxColour(233, 233, 233)));
438 dc.DrawRoundedRectangle(left, FromDIP(30), FromDIP(TASK_LEFT_PRO_INFO), FromDIP(10), 2);
439
440 dc.SetPen(wxPen(wxColour(0, 150, 136)));
441 dc.SetBrush(wxBrush(wxColour(0, 150, 136)));
442 dc.DrawRoundedRectangle(left, FromDIP(30), FromDIP(TASK_LEFT_PRO_INFO) * (static_cast<float>(obj_->subtask_->task_progress) / 100.0f), FromDIP(10), 2);
443 }
444 else {
445 DrawTextWithEllipsis(dc, obj_->get_curr_stage(), FromDIP(TASK_LEFT_PRO_INFO), left);
446 }
447 }
448 else {
449 dc.SetTextForeground(*wxBLACK);
451 }
452 }
453 }
454 }
455 else {
456 if (state_local_task == 1) {
457 wxString progress_info = wxString::Format("%d", m_sending_percent);
458 DrawTextWithEllipsis(dc, progress_info + "% " , FromDIP(TASK_LEFT_PRO_INFO), left, FromDIP(10));
459
460 dc.SetPen(wxPen(wxColour(233, 233, 233)));
461 dc.SetBrush(wxBrush(wxColour(233, 233, 233)));
462 dc.DrawRoundedRectangle(left, FromDIP(30), FromDIP(TASK_LEFT_PRO_INFO), FromDIP(10), 2);
463
464 dc.SetPen(wxPen(wxColour(0, 150, 136)));
465 dc.SetBrush(wxBrush(wxColour(0, 150, 136)));
466 dc.DrawRoundedRectangle(left, FromDIP(30), FromDIP(TASK_LEFT_PRO_INFO) * (static_cast<float>(m_sending_percent) / 100.0f), FromDIP(10), 2);
467 }
468 /*else {
469 if () {
470
471 }
472 if (m_button_cancel->IsShown()) {
473 m_button_cancel->Hide();
474 Layout();
475 }
476 }*/
477 }
478 left += FromDIP(TASK_LEFT_PRO_INFO);
479
480 //send time
481 dc.SetFont(Label::Body_13);
482 dc.SetTextForeground(*wxBLACK);
483
484 if (!boost::algorithm::contains(m_send_time, "1970")) {
486 }
487
488 left += FromDIP(TASK_LEFT_SEND_TIME);
489
490 if (m_hover) {
491 dc.SetPen(wxPen(wxColour(0, 150, 136)));
492 dc.SetBrush(*wxTRANSPARENT_BRUSH);
493 dc.DrawRoundedRectangle(0, 0, size.x, size.y, 3);
494 }
495}
#define DEVICE_LEFT_PRO_INFO
Definition MultiMachineManagerPage.hpp:25
#define TASK_LEFT_PRINTABLE
Definition MultiTaskManagerPage.hpp:33
#define TASK_LEFT_DEV_NAME
Definition MultiTaskManagerPage.hpp:35
#define TASK_LEFT_PRO_NAME
Definition MultiTaskManagerPage.hpp:34
#define TASK_LEFT_PRO_STATE
Definition MultiTaskManagerPage.hpp:36
#define TASK_LEFT_SEND_TIME
Definition MultiTaskManagerPage.hpp:38
#define TASK_LEFT_PRO_INFO
Definition MultiTaskManagerPage.hpp:37
#define TASK_LEFT_PADDING_LEFT
Definition MultiTaskManagerPage.hpp:32
static wxFont Body_13
Definition Label.hpp:54
wxString get_cloud_state_task()
Definition MultiMachine.cpp:171
MachineObject * obj_
Definition MultiMachine.hpp:32
int state_device
Definition MultiMachine.hpp:38
MachineObject * get_obj() const
Definition MultiMachine.hpp:55
wxString get_local_state_task()
Definition MultiMachine.cpp:154
wxString get_state_device()
Definition MultiMachine.cpp:138
int state_local_task
Definition MultiMachine.hpp:39
std::string m_send_time
Definition MultiMachine.hpp:42
int state_cloud_task
Definition MultiMachine.hpp:40
int state_selected
Definition MultiMachine.hpp:36
int m_sending_percent
Definition MultiTaskManagerPage.hpp:67
wxString m_project_name
Definition MultiTaskManagerPage.hpp:69
wxString m_dev_name
Definition MultiTaskManagerPage.hpp:70
void DrawTextWithEllipsis(wxDC &dc, const wxString &text, int maxWidth, int left, int top=0)
Definition MultiTaskManagerPage.cpp:497
wxString get_left_time(int mc_left_time)
Definition MultiTaskManagerPage.cpp:552
std::string m_job_id
Definition MultiTaskManagerPage.hpp:73
bool m_hover
Definition MultiTaskManagerPage.hpp:60
@ left
Definition MarchingSquares.hpp:188

References _L, Label::Body_12, Label::Body_13, DEVICE_LEFT_PRO_INFO, DrawTextWithEllipsis(), Slic3r::GUI::DeviceItem::get_cloud_state_task(), get_left_time(), Slic3r::GUI::DeviceItem::get_local_state_task(), Slic3r::GUI::DeviceItem::get_obj(), Slic3r::GUI::DeviceItem::get_state_device(), m_bitmap_check_disable, m_bitmap_check_off, m_bitmap_check_on, m_dev_name, m_hover, m_job_id, m_project_name, Slic3r::GUI::DeviceItem::m_send_time, m_sending_percent, m_task_type, Slic3r::GUI::DeviceItem::obj_, Slic3r::GUI::DeviceItem::state_cloud_task, Slic3r::GUI::DeviceItem::state_device, Slic3r::GUI::DeviceItem::state_local_task, Slic3r::GUI::DeviceItem::state_selected, TASK_LEFT_DEV_NAME, TASK_LEFT_PADDING_LEFT, TASK_LEFT_PRINTABLE, TASK_LEFT_PRO_INFO, TASK_LEFT_PRO_NAME, TASK_LEFT_PRO_STATE, and TASK_LEFT_SEND_TIME.

Referenced by render().

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

◆ DoSetSize()

void Slic3r::GUI::MultiTaskItem::DoSetSize ( int x,
int y,
int width,
int height,
int sizeFlags = wxSIZE_AUTO )
virtual
548{
549 wxWindow::DoSetSize(x, y, width, height, sizeFlags);
550}

◆ DrawTextWithEllipsis()

void Slic3r::GUI::MultiTaskItem::DrawTextWithEllipsis ( wxDC & dc,
const wxString & text,
int maxWidth,
int left,
int top = 0 )
497 {
498 wxSize size = GetSize();
499 wxFont font = dc.GetFont();
500
501 wxSize textSize = dc.GetTextExtent(text);
502
503 dc.SetTextForeground(StateColor::darkModeColorFor(wxColour(50, 58, 61)));
504
505 int textWidth = textSize.GetWidth();
506
507 if (textWidth > maxWidth) {
508 wxString truncatedText = text;
509 int ellipsisWidth = dc.GetTextExtent("...").GetWidth();
510 int numChars = text.length();
511
512 for (int i = numChars - 1; i >= 0; --i) {
513 truncatedText = text.substr(0, i) + "...";
514 int truncatedWidth = dc.GetTextExtent(truncatedText).GetWidth();
515
516 if (truncatedWidth <= maxWidth - ellipsisWidth) {
517 break;
518 }
519 }
520
521 if (top == 0) {
522 dc.DrawText(truncatedText, left, (size.y - textSize.y) / 2);
523 }
524 else {
525 dc.DrawText(truncatedText, left, (size.y - textSize.y) / 2 - top);
526 }
527
528 }
529 else {
530 if (top == 0) {
531 dc.DrawText(text, left, (size.y - textSize.y) / 2);
532 }
533 else {
534 dc.DrawText(text, left, (size.y - textSize.y) / 2 - top);
535 }
536 }
537}

References StateColor::darkModeColorFor().

Referenced by doRender().

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

◆ get_cloud_state_task()

wxString Slic3r::GUI::DeviceItem::get_cloud_state_task ( )
inherited
172{
173 //0-printing 1-printing finish 2-printing failed
174 std::vector<wxString> str_state_task;
175 str_state_task.push_back(_L("Printing"));
176 str_state_task.push_back(_L("Printing Finish"));
177 str_state_task.push_back(_L("Printing Failed"));
178
179 return str_state_task[state_cloud_task];
180}

References _L, and state_cloud_task.

Referenced by Slic3r::GUI::MultiTaskItem::doRender().

Here is the caller graph for this function:

◆ get_left_time()

wxString Slic3r::GUI::MultiTaskItem::get_left_time ( int mc_left_time)
553{
554 // update gcode progress
555 std::string left_time;
556 wxString left_time_text = _L("N/A");
557
558 try {
559 left_time = get_bbl_monitor_time_dhm(mc_left_time);
560 }
561 catch (...) {
562 ;
563 }
564
565 if (!left_time.empty()) left_time_text = wxString::Format("-%s", left_time);
566 return left_time_text;
567}
std::string get_bbl_monitor_time_dhm(float time_in_secs)
Definition Utils.hpp:707

References _L, and Slic3r::get_bbl_monitor_time_dhm().

Referenced by doRender().

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

◆ get_local_state_task()

wxString Slic3r::GUI::DeviceItem::get_local_state_task ( )
inherited
155{
156 //0-padding 1-sending 2-sending finish 3-sending cancel 4-sending failed 5-Removed
157 std::vector<wxString> str_state_task;
158 str_state_task.push_back(_L("Pending"));
159 str_state_task.push_back(_L("Sending"));
160 str_state_task.push_back(_L("Sending Finish"));
161 str_state_task.push_back(_L("Sending Cancel"));
162 str_state_task.push_back(_L("Sending Failed"));
163 str_state_task.push_back(_L("Printing"));
164 str_state_task.push_back(_L("Print Success"));
165 str_state_task.push_back(_L("Print Failed"));
166 str_state_task.push_back(_L("Removed"));
167 str_state_task.push_back(_L("Idle"));
168 return str_state_task[state_local_task];
169}

References _L, and state_local_task.

Referenced by Slic3r::GUI::MultiTaskItem::doRender().

Here is the caller graph for this function:

◆ get_obj()

MachineObject * Slic3r::GUI::DeviceItem::get_obj ( ) const
inlineinherited

◆ get_state_cloud_task()

int Slic3r::GUI::DeviceItem::get_state_cloud_task ( ) const
inlineinherited
63{ return state_cloud_task; }

References state_cloud_task.

◆ get_state_dev_name()

std::string Slic3r::GUI::DeviceItem::get_state_dev_name ( ) const
inlineinherited
64{ return state_dev_name; }
std::string state_dev_name
Definition MultiMachine.hpp:34

References state_dev_name.

◆ get_state_device() [1/2]

wxString Slic3r::GUI::DeviceItem::get_state_device ( )
inherited
139{
140 //0-idle 1-finish 2-running 3-pause 4-failed 5-prepare
141 std::vector<wxString> str_state_device;
142 str_state_device.push_back(_L("Idle"));
143 str_state_device.push_back(_L("Printing Finish"));
144 str_state_device.push_back(_L("Printing Failed"));
145 str_state_device.push_back(_L("Printing"));
146 str_state_device.push_back(_L("Printing Pause"));
147 str_state_device.push_back(_L_CONTEXT("Prepare", "Device status"));
148 str_state_device.push_back(_L("Slicing"));
149 str_state_device.push_back(_L("Syncing"));
150
151 return str_state_device[state_device];
152}

References _L, _L_CONTEXT, and state_device.

Referenced by Slic3r::GUI::MultiMachineItem::doRender(), and Slic3r::GUI::MultiTaskItem::doRender().

Here is the caller graph for this function:

◆ get_state_device() [2/2]

int Slic3r::GUI::DeviceItem::get_state_device ( ) const
inlineinherited
61{ return state_device; }

References state_device.

◆ get_state_enable_ams()

int Slic3r::GUI::DeviceItem::get_state_enable_ams ( ) const
inlineinherited
60{ return state_enable_ams; }
int state_enable_ams
Definition MultiMachine.hpp:37

References state_enable_ams.

◆ get_state_local_task()

int Slic3r::GUI::DeviceItem::get_state_local_task ( ) const
inlineinherited
62{ return state_local_task; }

References state_local_task.

◆ get_state_online()

int Slic3r::GUI::DeviceItem::get_state_online ( ) const
inlineinherited
57{ return state_online; }
int state_online
Definition MultiMachine.hpp:33

References state_online.

◆ get_state_printable() [1/2]

wxString Slic3r::GUI::DeviceItem::get_state_printable ( )
inherited
124{
125 //0-idle 1-finish 2-printing 3-upgrading 4-preset incompatible 5-unknown
126 std::vector<wxString> str_state_printable;
127 str_state_printable.push_back(_L("Idle"));
128 str_state_printable.push_back(_L("Idle"));
129 str_state_printable.push_back(_L("Idle"));
130 str_state_printable.push_back(_L("Printing"));
131 str_state_printable.push_back(_L("Upgrading"));
132 str_state_printable.push_back(_L("Incompatible"));
133 str_state_printable.push_back(_L("Syncing"));
134
135 return str_state_printable[state_printable];
136}
int state_printable
Definition MultiMachine.hpp:35

References _L, and state_printable.

Referenced by Slic3r::GUI::SendDeviceItem::doRender().

Here is the caller graph for this function:

◆ get_state_printable() [2/2]

int Slic3r::GUI::DeviceItem::get_state_printable ( ) const
inlineinherited
58{ return state_printable; }

References state_printable.

◆ get_state_selected()

int Slic3r::GUI::DeviceItem::get_state_selected ( ) const
inlineinherited
59{ return state_selected; }

References state_selected.

◆ on_refresh()

void Slic3r::GUI::DeviceItem::on_refresh ( wxCommandEvent & evt)
inherited
31{
32 Refresh();
33}

Referenced by DeviceItem().

Here is the caller graph for this function:

◆ onCancel()

void Slic3r::GUI::MultiTaskItem::onCancel ( )
253{
254 if (task_obj) {
255 task_obj->cancel();
256 if (!task_obj->get_job_id().empty()) {
257 get_obj()->command_task_cancel(task_obj->get_job_id());
258 }
259 }
260}
TaskStateInfo * task_obj
Definition MultiTaskManagerPage.hpp:72
int command_task_cancel(std::string job_id)
Definition DeviceManager.cpp:1589

References Slic3r::MachineObject::command_task_cancel(), Slic3r::GUI::DeviceItem::get_obj(), and task_obj.

Referenced by MultiTaskItem().

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

◆ OnEnterWindow()

void Slic3r::GUI::MultiTaskItem::OnEnterWindow ( wxMouseEvent & evt)
263{
264 m_hover = true;
265 Refresh();
266}

References m_hover, and Slic3r::GUI::wxMouseEvent.

Referenced by MultiTaskItem().

Here is the caller graph for this function:

◆ OnLeaveWindow()

void Slic3r::GUI::MultiTaskItem::OnLeaveWindow ( wxMouseEvent & evt)
269{
270 m_hover = false;
271 Refresh();
272}

References m_hover, and Slic3r::GUI::wxMouseEvent.

Referenced by MultiTaskItem().

Here is the caller graph for this function:

◆ OnLeftDown()

void Slic3r::GUI::MultiTaskItem::OnLeftDown ( wxMouseEvent & evt)
288{
289 int left = FromDIP(15);
290 auto mouse_pos = ClientToScreen(evt.GetPosition());
291 auto item = this->ClientToScreen(wxPoint(0, 0));
292
293 if (mouse_pos.x > (item.x + left) &&
294 mouse_pos.x < (item.x + left + m_bitmap_check_disable.GetBmpWidth()) &&
295 mouse_pos.y > item.y &&
296 mouse_pos.y < (item.y + DEVICE_ITEM_MAX_HEIGHT)) {
297
298 if (m_task_type == 0 && state_local_task <= 1) {
299 post_event(wxCommandEvent(EVT_MULTI_DEVICE_SELECTED));
300 }
301 else if (m_task_type == 1 && state_cloud_task == 0) {
302 post_event(wxCommandEvent(EVT_MULTI_DEVICE_SELECTED));
303 }
304 }
305}
void post_event(wxCommandEvent &&event)
Definition MultiTaskManagerPage.cpp:539

References DEVICE_ITEM_MAX_HEIGHT, m_bitmap_check_disable, m_task_type, post_event(), Slic3r::GUI::DeviceItem::state_cloud_task, Slic3r::GUI::DeviceItem::state_local_task, and Slic3r::GUI::wxMouseEvent.

Referenced by MultiTaskItem().

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

◆ OnMove()

void Slic3r::GUI::MultiTaskItem::OnMove ( wxMouseEvent & evt)
308{
309 int left = FromDIP(15);
310 auto mouse_pos = ClientToScreen(evt.GetPosition());
311 auto item = this->ClientToScreen(wxPoint(0, 0));
312
313 if (mouse_pos.x > (item.x + left) &&
314 mouse_pos.x < (item.x + left + m_bitmap_check_disable.GetBmpWidth()) &&
315 mouse_pos.y > item.y &&
316 mouse_pos.y < (item.y + DEVICE_ITEM_MAX_HEIGHT)) {
317 SetCursor(wxCURSOR_HAND);
318 }
319 else {
320 SetCursor(wxCURSOR_ARROW);
321 }
322}

References DEVICE_ITEM_MAX_HEIGHT, m_bitmap_check_disable, and Slic3r::GUI::wxMouseEvent.

Referenced by MultiTaskItem().

Here is the caller graph for this function:

◆ onPause()

void Slic3r::GUI::MultiTaskItem::onPause ( )
216{
217 if (get_obj() && !get_obj()->can_resume()) {
218 BOOST_LOG_TRIVIAL(info) << "MultiTask: pause current print task dev_id =" << get_obj()->get_dev_id();
220 m_button_pause->Hide();
221 m_button_resume->Show();
222 Layout();
223 }
224}
int command_task_pause()
Definition DeviceManager.cpp:1601
std::string get_dev_id() const
Definition DeviceManager.hpp:206

References Slic3r::MachineObject::command_task_pause(), Slic3r::MachineObject::get_dev_id(), Slic3r::GUI::DeviceItem::get_obj(), m_button_pause, and m_button_resume.

Referenced by MultiTaskItem().

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

◆ onResume()

void Slic3r::GUI::MultiTaskItem::onResume ( )
227{
228 if (get_obj() && get_obj()->can_resume()) {
229 BOOST_LOG_TRIVIAL(info) << "MultiTask: resume current print task dev_id =" << get_obj()->get_dev_id();
231 m_button_pause->Show();
232 m_button_resume->Hide();
233 Layout();
234 }
235}
int command_task_resume()
Definition DeviceManager.cpp:1611

References Slic3r::MachineObject::command_task_resume(), Slic3r::MachineObject::get_dev_id(), Slic3r::GUI::DeviceItem::get_obj(), m_button_pause, and m_button_resume.

Referenced by MultiTaskItem().

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

◆ OnSelectedDevice()

void Slic3r::GUI::MultiTaskItem::OnSelectedDevice ( wxCommandEvent & evt)
275{
276 auto dev_id = evt.GetString();
277 auto state = evt.GetInt();
278 if (state == 0) {
279 state_selected = 1;
280 }
281 else if (state == 1) {
282 state_selected = 0;
283 }
284 Refresh();
285}

References Slic3r::GUI::DeviceItem::state_selected.

Referenced by MultiTaskItem().

Here is the caller graph for this function:

◆ onStop()

void Slic3r::GUI::MultiTaskItem::onStop ( )
238{
239 if (get_obj()) {
240 BOOST_LOG_TRIVIAL(info) << "MultiTask: abort current print task dev_id =" << get_obj()->get_dev_id();
242 m_button_pause->Hide();
243 m_button_resume->Hide();
244 m_button_stop->Hide();
246 Layout();
247 Refresh();
248 }
249}
int command_task_abort()
Definition DeviceManager.cpp:1578

References Slic3r::MachineObject::command_task_abort(), Slic3r::MachineObject::get_dev_id(), Slic3r::GUI::DeviceItem::get_obj(), m_button_pause, m_button_resume, m_button_stop, and Slic3r::GUI::DeviceItem::state_cloud_task.

Referenced by MultiTaskItem().

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

◆ paintEvent()

void Slic3r::GUI::MultiTaskItem::paintEvent ( wxPaintEvent & evt)
325{
326 wxPaintDC dc(this);
327 render(dc);
328}
void render(wxDC &dc)
Definition MultiTaskManagerPage.cpp:330

References render().

Referenced by MultiTaskItem().

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

◆ post_event()

void Slic3r::GUI::MultiTaskItem::post_event ( wxCommandEvent && event)
540{
541 event.SetEventObject(this);
542 event.SetString(m_dev_id);
543 event.SetInt(state_selected);
544 wxPostEvent(this, event);
545}
std::string m_dev_id
Definition MultiTaskManagerPage.hpp:71

References m_dev_id, and Slic3r::GUI::DeviceItem::state_selected.

Referenced by OnLeftDown().

Here is the caller graph for this function:

◆ render()

void Slic3r::GUI::MultiTaskItem::render ( wxDC & dc)
331{
332#ifdef __WXMSW__
333 wxSize size = GetSize();
334 wxMemoryDC memdc;
335 wxBitmap bmp(size.x, size.y);
336 memdc.SelectObject(bmp);
337 memdc.Blit({ 0, 0 }, size, &dc, { 0, 0 });
338
339 {
340 wxGCDC dc2(memdc);
341 doRender(dc2);
342 }
343
344 memdc.SelectObject(wxNullBitmap);
345 dc.DrawBitmap(bmp, 0, 0);
346#else
347 doRender(dc);
348#endif
349}
void doRender(wxDC &dc)
Definition MultiTaskManagerPage.cpp:351

References doRender().

Referenced by paintEvent().

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

◆ selected()

void Slic3r::GUI::DeviceItem::selected ( )
inherited
98{
99 if (state_selected != 2) {
100 state_selected = 1;
101 }
102}

References state_selected.

◆ sync_state()

void Slic3r::GUI::DeviceItem::sync_state ( )
inherited
36{
37 if (obj_) {
38 state_online = obj_->is_online();
39 state_dev_name = obj_->get_dev_name();
40
41 //printable
42 if (obj_->print_status == "IDLE") {
44 }
45 else if (obj_->print_status == "FINISH") {
47 }
48 else if (obj_->print_status == "FAILED") {
50 }
51 else if (obj_->is_in_printing()) {
53 }
54 else {
56 }
57
58 if (wxGetApp().is_blocking_printing(obj_)) {
60 }
61
62 if (obj_->is_in_upgrading()) {
64 }
65
66 state_enable_ams = obj_->ams_exist_bits;
67
68
69 //device
70 if (obj_->print_status == "IDLE") {
71 state_device = 0;
72 }
73 else if (obj_->print_status == "FINISH") {
74 state_device = 1;
75 }
76 else if (obj_->print_status == "FAILED") {
77 state_device = 2;
78 }
79 else if (obj_->print_status == "RUNNING") {
80 state_device = 3;
81 }
82 else if (obj_->print_status == "PAUSE") {
83 state_device = 4;
84 }
85 else if (obj_->print_status == "PREPARE") {
86 state_device = 5;
87 }
88 else if (obj_->print_status == "SLICING") {
89 state_device = 6;
90 }
91 else {
92 state_device = 7;
93 }
94 }
95}

References obj_, state_dev_name, state_device, state_enable_ams, state_online, and state_printable.

Referenced by DeviceItem().

Here is the caller graph for this function:

◆ unselected()

void Slic3r::GUI::DeviceItem::unselected ( )
inherited
105{
106 if (state_selected != 2) {
107 state_selected = 0;
108 }
109}

References state_selected.

Referenced by Slic3r::GUI::MultiMachinePickPage::refresh_user_device().

Here is the caller graph for this function:

◆ update_info()

void Slic3r::GUI::MultiTaskItem::update_info ( )
156{
157 //local
158 if (m_task_type == 0) {
159 m_button_stop->Hide();
160 m_button_pause->Hide();
161 m_button_resume->Hide();
162 if (state_local_task == 0 || state_local_task == 1) {
163 m_button_cancel->Show();
164 Layout();
165 }
166 else {
167 m_button_cancel->Hide();
168 Layout();
169 }
170 }
171 //cloud
172 else if (m_task_type == 1 && get_obj() && (m_job_id == get_obj()->profile_id_)) {
173 m_button_cancel->Hide();
174
175 if (obj_ && obj_->is_in_printing() && state_cloud_task == 0 ) {
176 if (obj_->can_abort()) {
177 m_button_stop->Show();
178 }
179 else {
180 m_button_stop->Hide();
181 }
182
183 if (obj_->can_pause()) {
184 m_button_pause->Show();
185 }
186 else {
187 m_button_pause->Hide();
188 }
189
190 if (obj_->can_resume()) {
191 m_button_resume->Show();
192 }
193 else {
194 m_button_resume->Hide();
195 }
196
197 Layout();
198 }
199 else {
200 m_button_stop->Hide();
201 m_button_pause->Hide();
202 m_button_resume->Hide();
203 Layout();
204 }
205 }
206 else {
207 m_button_cancel->Hide();
208 m_button_stop->Hide();
209 m_button_pause->Hide();
210 m_button_resume->Hide();
211 Layout();
212 }
213}

References Slic3r::GUI::DeviceItem::get_obj(), m_button_cancel, m_button_pause, m_button_resume, m_button_stop, m_job_id, m_task_type, Slic3r::GUI::DeviceItem::obj_, Slic3r::GUI::DeviceItem::state_cloud_task, and Slic3r::GUI::DeviceItem::state_local_task.

Referenced by Slic3r::GUI::CloudTaskManagerPage::refresh_user_device().

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

◆ update_item()

void Slic3r::GUI::DeviceItem::update_item ( const DeviceItem * item)
inherited
112{
113 // Except for the selected status, everything else is updated
114 if (this == item)
115 return;
116 this->state_online = item->state_online;
117 this->state_printable = item->state_printable;
118 this->state_enable_ams = item->state_enable_ams;
119 this->state_device = item->state_device;
120 this->state_local_task = item->state_local_task;
121}

References DeviceItem(), state_device, state_enable_ams, state_local_task, state_online, and state_printable.

Here is the call graph for this function:

Member Data Documentation

◆ m_bitmap_check_disable

ScalableBitmap Slic3r::GUI::MultiTaskItem::m_bitmap_check_disable

◆ m_bitmap_check_off

ScalableBitmap Slic3r::GUI::MultiTaskItem::m_bitmap_check_off

Referenced by MultiTaskItem(), and doRender().

◆ m_bitmap_check_on

ScalableBitmap Slic3r::GUI::MultiTaskItem::m_bitmap_check_on

Referenced by MultiTaskItem(), and doRender().

◆ m_button_cancel

Button* Slic3r::GUI::MultiTaskItem::m_button_cancel { nullptr }
77{ nullptr };

Referenced by MultiTaskItem(), and update_info().

◆ m_button_pause

Button* Slic3r::GUI::MultiTaskItem::m_button_pause { nullptr }
78{ nullptr };

Referenced by MultiTaskItem(), onPause(), onResume(), onStop(), and update_info().

◆ m_button_resume

Button* Slic3r::GUI::MultiTaskItem::m_button_resume { nullptr }
76{ nullptr };

Referenced by MultiTaskItem(), onPause(), onResume(), onStop(), and update_info().

◆ m_button_stop

Button* Slic3r::GUI::MultiTaskItem::m_button_stop { nullptr }
79{ nullptr };

Referenced by MultiTaskItem(), onStop(), and update_info().

◆ m_dev_id

◆ m_dev_name

◆ m_hover

bool Slic3r::GUI::MultiTaskItem::m_hover { false }
60{ false };

Referenced by doRender(), OnEnterWindow(), and OnLeaveWindow().

◆ m_job_id

std::string Slic3r::GUI::MultiTaskItem::m_job_id

◆ m_project_name

◆ m_send_time

◆ m_sending_percent

int Slic3r::GUI::MultiTaskItem::m_sending_percent {0}

◆ m_task_type

int Slic3r::GUI::MultiTaskItem::m_task_type {0}
68{0}; //0-local 1-cloud

Referenced by MultiTaskItem(), doRender(), OnLeftDown(), and update_info().

◆ obj_

◆ state_cloud_task

◆ state_dev_name

std::string Slic3r::GUI::DeviceItem::state_dev_name
inherited

◆ state_device

int Slic3r::GUI::DeviceItem::state_device { 0 }
inherited
38{ 0 }; //0-idle 1-finish 2-failed 3-running 4-pause 5-prepare 6-slicing 7-removed

Referenced by Slic3r::GUI::SortItem::SortItem(), Slic3r::GUI::MultiMachineItem::doRender(), Slic3r::GUI::MultiTaskItem::doRender(), get_state_device(), get_state_device(), sync_state(), and update_item().

◆ state_enable_ams

int Slic3r::GUI::DeviceItem::state_enable_ams { 0 }
inherited
37{ 0 };//0-no ams 1-enabled ams 2-not enabled ams

Referenced by Slic3r::GUI::SortItem::SortItem(), get_state_enable_ams(), sync_state(), and update_item().

◆ state_local_task

int Slic3r::GUI::DeviceItem::state_local_task { 0 }
inherited

◆ state_online

int Slic3r::GUI::DeviceItem::state_online = { 0 }
inherited
33{ 0 }; //0-Offline 1-Online

Referenced by Slic3r::GUI::SortItem::SortItem(), get_state_online(), sync_state(), and update_item().

◆ state_optional

int Slic3r::GUI::DeviceItem::state_optional {0}
inherited
41{0}; //0-Not optional 1-Optional

◆ state_printable

int Slic3r::GUI::DeviceItem::state_printable { 0 }
inherited

◆ state_selected

◆ task_obj

TaskStateInfo* Slic3r::GUI::MultiTaskItem::task_obj { nullptr }

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