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:
Stone Li 2022-11-30 14:29:27 +08:00 committed by Lane.Wei
parent 42633fda28
commit e344f8b8b9
5 changed files with 46 additions and 5 deletions

View File

@ -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)
{
return wxPanel::Show(show);

View File

@ -6,6 +6,7 @@
#include <slic3r/GUI/Widgets/Button.hpp>
#include <slic3r/GUI/DeviceManager.hpp>
#include <slic3r/GUI/Widgets/ScrolledWindow.hpp>
#include <slic3r/GUI/StatusPanel.hpp>
#include <wx/html/htmlwin.h>
namespace Slic3r {
@ -44,6 +45,7 @@ protected:
wxScrolledWindow *m_scrolledWindow;
wxBoxSizer * m_top_sizer;
HMSNotifyItem * m_notify_item;
int last_status;
void append_hms_panel(HMSItem &item);
void delete_hms_panels();
@ -58,6 +60,8 @@ public:
void update(MachineObject *obj_);
void show_status(int status);
MachineObject *obj { nullptr };
};

View File

@ -535,11 +535,16 @@ void MonitorPanel::show_status(int status)
}
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) {
set_default();
m_side_tools->set_none_printer_mode();
m_connection_info->Hide();
m_status_info_panel->show_status(status);
m_tabpanel->Refresh();
m_tabpanel->Layout();
#if !BBL_RELEASE_TO_PUBLIC
@ -556,8 +561,6 @@ void MonitorPanel::show_status(int status)
m_side_tools->set_current_printer_signal(WifiSignal::NONE);
set_default();
}
m_status_info_panel->show_status(status);
m_tabpanel->Refresh();
m_tabpanel->Layout();
}

View File

@ -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));
m_button_upgrade_firmware->SetBackgroundColor(btn_bg);
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->SetMinSize(wxSize(FromDIP(-1), FromDIP(24)));
m_button_upgrade_firmware->SetCornerRadius(FromDIP(12));
@ -856,6 +856,23 @@ void UpgradePanel::update(MachineObject *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)
{
if (show) {

View File

@ -6,9 +6,9 @@
#include "Widgets/ProgressBar.hpp"
#include <slic3r/GUI/DeviceManager.hpp>
#include <slic3r/GUI/Widgets/ScrolledWindow.hpp>
#include <slic3r/GUI/StatusPanel.hpp>
#include "ReleaseNote.hpp"
namespace Slic3r {
namespace GUI {
@ -137,6 +137,7 @@ protected:
//hint of force upgrade or consistency upgrade
int last_forced_hint_status = -1;
int last_consistency_hint_status = -1;
int last_status;
bool m_show_forced_hint = true;
bool m_show_consistency_hint = true;
SecondaryCheckDialog* force_dlg{ nullptr };
@ -151,6 +152,7 @@ public:
void refresh_version_and_firmware(MachineObject* obj);
void update(MachineObject *obj);
void show_status(int status);
MachineObject *m_obj { nullptr };
};