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

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

Inheritance diagram for Slic3r::GUI::UpgradePanel:
Collaboration diagram for Slic3r::GUI::UpgradePanel:

Public Member Functions

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

Public Attributes

MachineObject * m_obj { nullptr }

Protected Attributes

wxScrolledWindow * m_scrolledWindow
wxBoxSizer * m_machine_list_sizer
MachineInfoPanel * m_push_upgrade_panel {nullptr}
bool enable_select_firmware = false
bool m_need_update = false
DevFirmwareUpgradingState last_forced_hint_status = DevFirmwareUpgradingState::DC
DevFirmwareUpgradingState last_consistency_hint_status = DevFirmwareUpgradingState::DC
int last_status
bool m_show_forced_hint = true
bool m_show_consistency_hint = true
SecondaryCheckDialog * force_dlg { nullptr }
SecondaryCheckDialog * consistency_dlg { nullptr }

Detailed Description

Constructor & Destructor Documentation

◆ UpgradePanel()

Slic3r::GUI::UpgradePanel::UpgradePanel ( wxWindow * parent,
wxWindowID id = wxID_ANY,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = wxTAB_TRAVERSAL )
1646 :wxPanel(parent, id, pos, size, style)
1647{
1648 this->SetBackgroundColour(wxColour(238, 238, 238));
1649
1650 auto m_main_sizer = new wxBoxSizer(wxVERTICAL);
1651
1652 m_scrolledWindow = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
1653 m_scrolledWindow->SetScrollRate(5, FromDIP(20));
1654
1655 m_machine_list_sizer = new wxBoxSizer(wxVERTICAL);
1656
1657 m_scrolledWindow->SetSizerAndFit(m_machine_list_sizer);
1658
1659 m_main_sizer->Add(m_scrolledWindow, 1, wxEXPAND, 0);
1660
1661 this->SetSizerAndFit(m_main_sizer);
1662
1663 Layout();
1664}
#define style
Definition WipeTowerDialog.cpp:101
wxBoxSizer * m_machine_list_sizer
Definition UpgradePanel.hpp:300
wxScrolledWindow * m_scrolledWindow
Definition UpgradePanel.hpp:299

References m_machine_list_sizer, m_scrolledWindow, and style.

◆ ~UpgradePanel()

Slic3r::GUI::UpgradePanel::~UpgradePanel ( )
1667{
1668 if (force_dlg != nullptr)
1669 delete force_dlg ;
1670
1671 if (consistency_dlg != nullptr)
1672 delete consistency_dlg ;
1673}
SecondaryCheckDialog * consistency_dlg
Definition UpgradePanel.hpp:313
SecondaryCheckDialog * force_dlg
Definition UpgradePanel.hpp:312

References consistency_dlg, and force_dlg.

Member Function Documentation

◆ clean_push_upgrade_panel()

void Slic3r::GUI::UpgradePanel::clean_push_upgrade_panel ( )
1682{
1684 delete m_push_upgrade_panel;
1685 m_push_upgrade_panel = nullptr;
1686 }
1687}
MachineInfoPanel * m_push_upgrade_panel
Definition UpgradePanel.hpp:301

References m_push_upgrade_panel.

Referenced by update().

Here is the caller graph for this function:

◆ msw_rescale()

void Slic3r::GUI::UpgradePanel::msw_rescale ( )
1676{
1678 m_push_upgrade_panel->msw_rescale();
1679}

References m_push_upgrade_panel.

◆ on_sys_color_changed()

void Slic3r::GUI::UpgradePanel::on_sys_color_changed ( )
1792{
1793 //add some protection for Dark mode
1795 m_push_upgrade_panel->on_sys_color_changed();
1796 }
1797}

References m_push_upgrade_panel.

◆ refresh_version_and_firmware()

void Slic3r::GUI::UpgradePanel::refresh_version_and_firmware ( MachineObject * obj)
1690{
1691 BOOST_LOG_TRIVIAL(trace) << "refresh version";
1692 if (obj) {
1693 obj->command_get_version();
1694 obj->get_firmware_info();
1695 m_need_update = true;
1696 }
1697}
bool m_need_update
Definition UpgradePanel.hpp:305
void trace(unsigned int level, const char *message)
Definition utils.cpp:247

References Slic3r::MachineObject::command_get_version(), Slic3r::MachineObject::get_firmware_info(), m_need_update, and Slic3r::trace().

Referenced by Show(), and update().

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

◆ Show()

bool Slic3r::GUI::UpgradePanel::Show ( bool show = true)
override
1800{
1801 if (show) {
1802 DeviceManager* dev = wxGetApp().getDeviceManager();
1803 if (dev) {
1804 MachineObject* obj = dev->get_selected_machine();
1806 }
1807 }
1808 return wxPanel::Show(show);
1809}
void refresh_version_and_firmware(MachineObject *obj)
Definition UpgradePanel.cpp:1689

References Slic3r::DeviceManager::get_selected_machine(), and refresh_version_and_firmware().

Here is the call graph for this function:

◆ show_status()

void Slic3r::GUI::UpgradePanel::show_status ( int status)
1775{
1776 if (last_status == status) return;
1777 last_status = status;
1778
1779 if (((status & (int)MonitorStatus::MONITOR_DISCONNECTED) != 0)
1780 || ((status & (int)MonitorStatus::MONITOR_DISCONNECTED_SERVER) != 0)
1781 || ((status & (int)MonitorStatus::MONITOR_CONNECTING) != 0)
1782 || ((status & (int)MonitorStatus::MONITOR_NO_PRINTER) != 0)
1783 ) {
1784 ;
1785 }
1786 else if ((status & (int)MonitorStatus::MONITOR_NORMAL) != 0) {
1787 ;
1788 }
1789}
@ MONITOR_DISCONNECTED
Definition SideTools.hpp:38
@ MONITOR_NO_PRINTER
Definition SideTools.hpp:37
@ MONITOR_NORMAL
Definition SideTools.hpp:36
@ MONITOR_CONNECTING
Definition SideTools.hpp:40
@ MONITOR_DISCONNECTED_SERVER
Definition SideTools.hpp:39
int last_status
Definition UpgradePanel.hpp:309

References last_status, MONITOR_CONNECTING, MONITOR_DISCONNECTED, MONITOR_DISCONNECTED_SERVER, MONITOR_NO_PRINTER, and MONITOR_NORMAL.

◆ update()

void Slic3r::GUI::UpgradePanel::update ( MachineObject * obj)
1700{
1701 if (m_obj != obj) {
1702 m_obj = obj;
1704 }
1705
1706 Freeze();
1707 if (m_obj && m_need_update) {
1708 if (m_obj->is_firmware_info_valid()) {
1710 m_push_upgrade_panel = new MachineInfoPanel(m_scrolledWindow);
1711 m_machine_list_sizer->Add(m_push_upgrade_panel, 0, wxTOP | wxALIGN_CENTER_HORIZONTAL, FromDIP(8));
1712 m_need_update = false;
1713 }
1714 }
1715
1716 //force upgrade
1717 //unlock hint
1718 if (m_obj && (m_obj->upgrade_display_state == DevFirmwareUpgradingState::UpgradingFinished) && (last_forced_hint_status != m_obj->upgrade_display_state)) {
1719 last_forced_hint_status = m_obj->upgrade_display_state;
1720 m_show_forced_hint = true;
1721 }
1722 if (m_obj && m_show_forced_hint) {
1723 if (m_obj->upgrade_force_upgrade) {
1724 m_show_forced_hint = false; //lock hint
1725 if (force_dlg == nullptr) {
1726 force_dlg = new SecondaryCheckDialog(this->GetParent(), wxID_ANY, _L("Update firmware"), SecondaryCheckDialog::VisibleButtons::CONFIRM_AND_CANCEL, wxDefaultPosition, wxDefaultSize); // ORCA VisibleButtons instead ButtonStyle
1727 force_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this](wxCommandEvent& e) {
1728 if (m_obj) {
1729 m_obj->command_upgrade_confirm();
1731 m_obj->upgrade_display_hold_count = HOLD_COUNT_MAX;
1732 }
1733 });
1734 }
1735 force_dlg->update_text(_L("An important update was detected and needs to be run before printing can continue. Do you want to update now\? You can also update later from \'Update firmware\'."));
1736 force_dlg->on_show();
1737 }
1738 }
1739
1740 //consistency upgrade
1741 if (m_obj && (m_obj->upgrade_display_state == DevFirmwareUpgradingState::UpgradingFinished) && (last_consistency_hint_status != m_obj->upgrade_display_state)) {
1742 last_consistency_hint_status = m_obj->upgrade_display_state;
1744 }
1746 if (m_obj->upgrade_consistency_request) {
1748 if (consistency_dlg == nullptr) {
1749 consistency_dlg = new SecondaryCheckDialog(this->GetParent(), wxID_ANY, _L("Update firmware"), SecondaryCheckDialog::VisibleButtons::CONFIRM_AND_CANCEL, wxDefaultPosition, wxDefaultSize); // ORCA VisibleButtons instead ButtonStyle
1750 consistency_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this](wxCommandEvent& e) {
1751 if (m_obj) {
1752 m_obj->command_consistency_upgrade_confirm();
1753 }
1754 });
1755 }
1756 consistency_dlg->update_text(_L("The firmware version is abnormal. Repairing and updating are required before printing. Do you want to update now\? You can also update later on the printer or update next time you start Orca Slicer."));
1757 consistency_dlg->on_show();
1758 }
1759 }
1760
1761 //update panels
1763 m_push_upgrade_panel->update(obj);
1764 }
1765
1766 if (!obj)
1768 this->Layout();
1769 Thaw();
1770
1771 m_obj = obj;
1772}
#define HOLD_COUNT_MAX
Definition DevFilaSystem.h:21
#define _L(s)
Definition OBJ.cpp:34
@ CONFIRM_AND_CANCEL
Definition ReleaseNote.hpp:130
DevFirmwareUpgradingState last_forced_hint_status
Definition UpgradePanel.hpp:307
bool m_show_consistency_hint
Definition UpgradePanel.hpp:311
MachineObject * m_obj
Definition UpgradePanel.hpp:327
bool m_show_forced_hint
Definition UpgradePanel.hpp:310
DevFirmwareUpgradingState last_consistency_hint_status
Definition UpgradePanel.hpp:308
void clean_push_upgrade_panel()
Definition UpgradePanel.cpp:1681
@ UpgradingFinished
Definition DevDefs.h:151
@ UpgradingInProgress
Definition DevDefs.h:150

References _L, clean_push_upgrade_panel(), Slic3r::GUI::SecondaryCheckDialog::CONFIRM_AND_CANCEL, consistency_dlg, force_dlg, HOLD_COUNT_MAX, last_consistency_hint_status, last_forced_hint_status, m_machine_list_sizer, m_need_update, m_obj, m_push_upgrade_panel, m_scrolledWindow, m_show_consistency_hint, m_show_forced_hint, refresh_version_and_firmware(), Slic3r::UpgradingFinished, and Slic3r::UpgradingInProgress.

Here is the call graph for this function:

Member Data Documentation

◆ consistency_dlg

SecondaryCheckDialog* Slic3r::GUI::UpgradePanel::consistency_dlg { nullptr }
protected
313{ nullptr };

Referenced by ~UpgradePanel(), and update().

◆ enable_select_firmware

bool Slic3r::GUI::UpgradePanel::enable_select_firmware = false
protected

◆ force_dlg

SecondaryCheckDialog* Slic3r::GUI::UpgradePanel::force_dlg { nullptr }
protected
312{ nullptr };

Referenced by ~UpgradePanel(), and update().

◆ last_consistency_hint_status

DevFirmwareUpgradingState Slic3r::GUI::UpgradePanel::last_consistency_hint_status = DevFirmwareUpgradingState::DC
protected

Referenced by update().

◆ last_forced_hint_status

DevFirmwareUpgradingState Slic3r::GUI::UpgradePanel::last_forced_hint_status = DevFirmwareUpgradingState::DC
protected

Referenced by update().

◆ last_status

int Slic3r::GUI::UpgradePanel::last_status
protected

Referenced by show_status().

◆ m_machine_list_sizer

wxBoxSizer* Slic3r::GUI::UpgradePanel::m_machine_list_sizer
protected

Referenced by UpgradePanel(), and update().

◆ m_need_update

bool Slic3r::GUI::UpgradePanel::m_need_update = false
protected

◆ m_obj

MachineObject* Slic3r::GUI::UpgradePanel::m_obj { nullptr }
327{ nullptr };

Referenced by update().

◆ m_push_upgrade_panel

MachineInfoPanel* Slic3r::GUI::UpgradePanel::m_push_upgrade_panel {nullptr}
protected

◆ m_scrolledWindow

wxScrolledWindow* Slic3r::GUI::UpgradePanel::m_scrolledWindow
protected

Referenced by UpgradePanel(), and update().

◆ m_show_consistency_hint

bool Slic3r::GUI::UpgradePanel::m_show_consistency_hint = true
protected

Referenced by update().

◆ m_show_forced_hint

bool Slic3r::GUI::UpgradePanel::m_show_forced_hint = true
protected

Referenced by update().


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