350{
351 Slic3r::DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
352 if (!dev) return;
353
357 }
358
361
362
363 std::vector<std::pair<std::string, MachineObject*>> user_machine_list;
365 user_machine_list.push_back(it);
366 }
367
368 std::sort(user_machine_list.begin(), user_machine_list.end(), [&](auto& a, auto& b) {
369 if (a.second && b.second) {
370 return a.second->get_dev_name().compare(b.second->get_dev_name()) < 0;
371 }
372 return false;
373 });
374
375 BOOST_LOG_TRIVIAL(
trace) <<
"SelectMObjectPopup update_machine_list start";
376 this->Freeze();
378 int i = 0;
379
380 for (auto& elem : user_machine_list) {
381 MachineObject* mobj = elem.second;
382 MObjectPanel* op = nullptr;
385 op->Show();
386 }
387 else {
389 MPanel* mpanel = new MPanel();
390 mpanel->mIndex = wxString::Format("%d", i);
391 mpanel->mPanel = op;
394 }
395 i++;
396 op->update_machine_info(mobj, true);
397
398 if (mobj->is_lan_mode_printer()) {
399 if (!mobj->is_online()) {
400 continue;
401 }
402 else {
403 if (mobj->has_access_right() && mobj->is_avaliable()) {
405 op->SetToolTip(
_L(
"Online"));
406 }
407 else {
409 }
410 }
411 }
412 else {
413 if (!mobj->is_online()) {
414 op->SetToolTip(
_L(
"Offline"));
416 }
417 else {
418 if (mobj->is_in_printing()) {
419 op->SetToolTip(
_L(
"Busy"));
421 }
422 else {
423 op->SetToolTip(
_L(
"Online"));
425 }
426 }
427 }
428 }
429
433 }
434
435
438 }
441 Layout();
442 Fit();
443 this->Thaw();
445}
#define _L(s)
Definition OBJ.cpp:34
std::map< std::string, MachineObject * > get_my_machine_list(const std::string &agent_id="")
Definition DevManager.cpp:824
void parse_user_print_info(std::string body)
Definition DevManager.cpp:894
std::string get_current_printer_agent_id() const
Definition DevManager.cpp:192
@ BUSY
Definition SelectMachinePop.hpp:55
@ IDLE
Definition SelectMachinePop.hpp:54
@ IN_LAN
Definition SelectMachinePop.hpp:57
@ OFFLINE
Definition SelectMachinePop.hpp:53
@ LOCK
Definition SelectMachinePop.hpp:56