ENH: update hms panel and upgrade panel when disconnected
Change-Id: I75d724c99ec2029190641cd2cfa22b6337d0060d Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
parent
42633fda28
commit
e344f8b8b9
|
@ -210,6 +210,21 @@ void HMSPanel::update(MachineObject *obj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HMSPanel::show_status(int status)
|
||||||
|
{
|
||||||
|
if (last_status == status) return;
|
||||||
|
last_status = status;
|
||||||
|
|
||||||
|
if (((status & (int)MonitorStatus::MONITOR_DISCONNECTED) != 0)
|
||||||
|
|| ((status & (int)MonitorStatus::MONITOR_DISCONNECTED_SERVER) != 0)
|
||||||
|
|| ((status & (int)MonitorStatus::MONITOR_CONNECTING) != 0)
|
||||||
|
|| ((status & (int)MonitorStatus::MONITOR_NO_PRINTER) != 0)
|
||||||
|
) {
|
||||||
|
delete_hms_panels();
|
||||||
|
Layout();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool HMSPanel::Show(bool show)
|
bool HMSPanel::Show(bool show)
|
||||||
{
|
{
|
||||||
return wxPanel::Show(show);
|
return wxPanel::Show(show);
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <slic3r/GUI/Widgets/Button.hpp>
|
#include <slic3r/GUI/Widgets/Button.hpp>
|
||||||
#include <slic3r/GUI/DeviceManager.hpp>
|
#include <slic3r/GUI/DeviceManager.hpp>
|
||||||
#include <slic3r/GUI/Widgets/ScrolledWindow.hpp>
|
#include <slic3r/GUI/Widgets/ScrolledWindow.hpp>
|
||||||
|
#include <slic3r/GUI/StatusPanel.hpp>
|
||||||
#include <wx/html/htmlwin.h>
|
#include <wx/html/htmlwin.h>
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
@ -44,6 +45,7 @@ protected:
|
||||||
wxScrolledWindow *m_scrolledWindow;
|
wxScrolledWindow *m_scrolledWindow;
|
||||||
wxBoxSizer * m_top_sizer;
|
wxBoxSizer * m_top_sizer;
|
||||||
HMSNotifyItem * m_notify_item;
|
HMSNotifyItem * m_notify_item;
|
||||||
|
int last_status;
|
||||||
|
|
||||||
void append_hms_panel(HMSItem &item);
|
void append_hms_panel(HMSItem &item);
|
||||||
void delete_hms_panels();
|
void delete_hms_panels();
|
||||||
|
@ -58,6 +60,8 @@ public:
|
||||||
|
|
||||||
void update(MachineObject *obj_);
|
void update(MachineObject *obj_);
|
||||||
|
|
||||||
|
void show_status(int status);
|
||||||
|
|
||||||
MachineObject *obj { nullptr };
|
MachineObject *obj { nullptr };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -535,11 +535,16 @@ void MonitorPanel::show_status(int status)
|
||||||
}
|
}
|
||||||
|
|
||||||
Freeze();
|
Freeze();
|
||||||
|
|
||||||
|
// update panels
|
||||||
|
m_status_info_panel->show_status(status);
|
||||||
|
m_hms_panel->show_status(status);
|
||||||
|
m_upgrade_panel->show_status(status);
|
||||||
|
|
||||||
if ((status & (int)MonitorStatus::MONITOR_NO_PRINTER) != 0) {
|
if ((status & (int)MonitorStatus::MONITOR_NO_PRINTER) != 0) {
|
||||||
set_default();
|
set_default();
|
||||||
m_side_tools->set_none_printer_mode();
|
m_side_tools->set_none_printer_mode();
|
||||||
m_connection_info->Hide();
|
m_connection_info->Hide();
|
||||||
m_status_info_panel->show_status(status);
|
|
||||||
m_tabpanel->Refresh();
|
m_tabpanel->Refresh();
|
||||||
m_tabpanel->Layout();
|
m_tabpanel->Layout();
|
||||||
#if !BBL_RELEASE_TO_PUBLIC
|
#if !BBL_RELEASE_TO_PUBLIC
|
||||||
|
@ -556,8 +561,6 @@ void MonitorPanel::show_status(int status)
|
||||||
m_side_tools->set_current_printer_signal(WifiSignal::NONE);
|
m_side_tools->set_current_printer_signal(WifiSignal::NONE);
|
||||||
set_default();
|
set_default();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_status_info_panel->show_status(status);
|
|
||||||
m_tabpanel->Refresh();
|
m_tabpanel->Refresh();
|
||||||
m_tabpanel->Layout();
|
m_tabpanel->Layout();
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,7 @@ MachineInfoPanel::MachineInfoPanel(wxWindow* parent, wxWindowID id, const wxPoin
|
||||||
StateColor btn_text(std::pair<wxColour, int>(wxColour(144, 144, 144), StateColor::Disabled), std::pair<wxColour, int>(wxColour(255, 255, 255), StateColor::Enabled));
|
StateColor btn_text(std::pair<wxColour, int>(wxColour(144, 144, 144), StateColor::Disabled), std::pair<wxColour, int>(wxColour(255, 255, 255), StateColor::Enabled));
|
||||||
m_button_upgrade_firmware->SetBackgroundColor(btn_bg);
|
m_button_upgrade_firmware->SetBackgroundColor(btn_bg);
|
||||||
m_button_upgrade_firmware->SetBorderColor(btn_bd);
|
m_button_upgrade_firmware->SetBorderColor(btn_bd);
|
||||||
m_button_upgrade_firmware->SetTextColor(wxColour("#FFFFFE"));
|
m_button_upgrade_firmware->SetTextColor(btn_text);
|
||||||
m_button_upgrade_firmware->SetFont(Label::Body_10);
|
m_button_upgrade_firmware->SetFont(Label::Body_10);
|
||||||
m_button_upgrade_firmware->SetMinSize(wxSize(FromDIP(-1), FromDIP(24)));
|
m_button_upgrade_firmware->SetMinSize(wxSize(FromDIP(-1), FromDIP(24)));
|
||||||
m_button_upgrade_firmware->SetCornerRadius(FromDIP(12));
|
m_button_upgrade_firmware->SetCornerRadius(FromDIP(12));
|
||||||
|
@ -856,6 +856,23 @@ void UpgradePanel::update(MachineObject *obj)
|
||||||
m_obj = obj;
|
m_obj = obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UpgradePanel::show_status(int status)
|
||||||
|
{
|
||||||
|
if (last_status == status) return;
|
||||||
|
last_status = status;
|
||||||
|
|
||||||
|
if (((status & (int)MonitorStatus::MONITOR_DISCONNECTED) != 0)
|
||||||
|
|| ((status & (int)MonitorStatus::MONITOR_DISCONNECTED_SERVER) != 0)
|
||||||
|
|| ((status & (int)MonitorStatus::MONITOR_CONNECTING) != 0)
|
||||||
|
|| ((status & (int)MonitorStatus::MONITOR_NO_PRINTER) != 0)
|
||||||
|
) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
else if ((status & (int)MonitorStatus::MONITOR_NORMAL) != 0) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool UpgradePanel::Show(bool show)
|
bool UpgradePanel::Show(bool show)
|
||||||
{
|
{
|
||||||
if (show) {
|
if (show) {
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
#include "Widgets/ProgressBar.hpp"
|
#include "Widgets/ProgressBar.hpp"
|
||||||
#include <slic3r/GUI/DeviceManager.hpp>
|
#include <slic3r/GUI/DeviceManager.hpp>
|
||||||
#include <slic3r/GUI/Widgets/ScrolledWindow.hpp>
|
#include <slic3r/GUI/Widgets/ScrolledWindow.hpp>
|
||||||
|
#include <slic3r/GUI/StatusPanel.hpp>
|
||||||
#include "ReleaseNote.hpp"
|
#include "ReleaseNote.hpp"
|
||||||
|
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
|
@ -137,6 +137,7 @@ protected:
|
||||||
//hint of force upgrade or consistency upgrade
|
//hint of force upgrade or consistency upgrade
|
||||||
int last_forced_hint_status = -1;
|
int last_forced_hint_status = -1;
|
||||||
int last_consistency_hint_status = -1;
|
int last_consistency_hint_status = -1;
|
||||||
|
int last_status;
|
||||||
bool m_show_forced_hint = true;
|
bool m_show_forced_hint = true;
|
||||||
bool m_show_consistency_hint = true;
|
bool m_show_consistency_hint = true;
|
||||||
SecondaryCheckDialog* force_dlg{ nullptr };
|
SecondaryCheckDialog* force_dlg{ nullptr };
|
||||||
|
@ -151,6 +152,7 @@ public:
|
||||||
|
|
||||||
void refresh_version_and_firmware(MachineObject* obj);
|
void refresh_version_and_firmware(MachineObject* obj);
|
||||||
void update(MachineObject *obj);
|
void update(MachineObject *obj);
|
||||||
|
void show_status(int status);
|
||||||
|
|
||||||
MachineObject *m_obj { nullptr };
|
MachineObject *m_obj { nullptr };
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue