ENH: rebuild warning dialog with frame
Change-Id: Id4a8ab80ecec30b668de59556823dad6838276fe
This commit is contained in:
parent
5b7ebc3684
commit
2ffa56633c
8 changed files with 133 additions and 64 deletions
|
@ -343,7 +343,7 @@ void UpdateVersionDialog::update_version_info(wxString release_note, wxString ve
|
||||||
}
|
}
|
||||||
|
|
||||||
SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, const wxString& title, enum ButtonStyle btn_style, const wxPoint& pos, const wxSize& size, long style)
|
SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, const wxString& title, enum ButtonStyle btn_style, const wxPoint& pos, const wxSize& size, long style)
|
||||||
:DPIDialog(parent, id, title, pos, size, style)
|
:DPIFrame(parent, id, title, pos, size, style)
|
||||||
{
|
{
|
||||||
std::string icon_path = (boost::format("%1%/images/BambuStudioTitle.ico") % resources_dir()).str();
|
std::string icon_path = (boost::format("%1%/images/BambuStudioTitle.ico") % resources_dir()).str();
|
||||||
SetIcon(wxIcon(encode_path(icon_path.c_str()), wxBITMAP_TYPE_ICO));
|
SetIcon(wxIcon(encode_path(icon_path.c_str()), wxBITMAP_TYPE_ICO));
|
||||||
|
@ -385,10 +385,7 @@ SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, cons
|
||||||
wxCommandEvent evt(EVT_SECONDARY_CHECK_CONFIRM, GetId());
|
wxCommandEvent evt(EVT_SECONDARY_CHECK_CONFIRM, GetId());
|
||||||
e.SetEventObject(this);
|
e.SetEventObject(this);
|
||||||
GetEventHandler()->ProcessEvent(evt);
|
GetEventHandler()->ProcessEvent(evt);
|
||||||
if (this->IsModal())
|
this->Hide();
|
||||||
EndModal(wxID_YES);
|
|
||||||
else
|
|
||||||
this->Close();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
m_button_cancel = new Button(this, _L("Cancel"));
|
m_button_cancel = new Button(this, _L("Cancel"));
|
||||||
|
@ -400,10 +397,7 @@ SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, cons
|
||||||
m_button_cancel->SetCornerRadius(FromDIP(12));
|
m_button_cancel->SetCornerRadius(FromDIP(12));
|
||||||
|
|
||||||
m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& e) {
|
m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& e) {
|
||||||
if (this->IsModal())
|
this->Hide();
|
||||||
EndModal(wxID_NO);
|
|
||||||
else
|
|
||||||
this->Close();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (btn_style != CONFIRM_AND_CANCEL)
|
if (btn_style != CONFIRM_AND_CANCEL)
|
||||||
|
@ -420,6 +414,7 @@ SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, cons
|
||||||
m_sizer_right->Add(sizer_button, 0, wxEXPAND | wxRIGHT | wxLEFT, FromDIP(35));
|
m_sizer_right->Add(sizer_button, 0, wxEXPAND | wxRIGHT | wxLEFT, FromDIP(35));
|
||||||
m_sizer_right->Add(0, 0, 0, wxTOP,FromDIP(18));
|
m_sizer_right->Add(0, 0, 0, wxTOP,FromDIP(18));
|
||||||
|
|
||||||
|
Bind(wxEVT_CLOSE_WINDOW, [this](auto& e) {this->Hide();});
|
||||||
|
|
||||||
SetSizer(m_sizer_right);
|
SetSizer(m_sizer_right);
|
||||||
Layout();
|
Layout();
|
||||||
|
@ -457,6 +452,39 @@ void SecondaryCheckDialog::update_text(wxString text)
|
||||||
m_sizer_main->Fit(this);
|
m_sizer_main->Fit(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SecondaryCheckDialog::on_show()
|
||||||
|
{
|
||||||
|
// recover button color
|
||||||
|
wxMouseEvent evt_ok(wxEVT_LEFT_UP);
|
||||||
|
m_button_ok->GetEventHandler()->ProcessEvent(evt_ok);
|
||||||
|
wxMouseEvent evt_cancel(wxEVT_LEFT_UP);
|
||||||
|
m_button_cancel->GetEventHandler()->ProcessEvent(evt_cancel);
|
||||||
|
|
||||||
|
this->Show();
|
||||||
|
this->SetFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SecondaryCheckDialog::is_english_text(wxString str)
|
||||||
|
{
|
||||||
|
std::regex reg("^[0-9a-zA-Z]+$");
|
||||||
|
std::smatch matchResult;
|
||||||
|
|
||||||
|
std::string pattern_Special = "{}[]<>~!@#$%^&*(),.?/ :";
|
||||||
|
for (auto i = 0; i < str.Length(); i++) {
|
||||||
|
std::string regex_str = wxString(str[i]).ToStdString();
|
||||||
|
if(std::regex_match(regex_str, matchResult, reg)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
int result = pattern_Special.find(regex_str.c_str());
|
||||||
|
if (result < 0 || result > pattern_Special.length()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
wxString SecondaryCheckDialog::format_text(wxStaticText* st, wxString str, int warp)
|
wxString SecondaryCheckDialog::format_text(wxStaticText* st, wxString str, int warp)
|
||||||
{
|
{
|
||||||
if (wxGetApp().app_config->get("language") != "zh_CN") { return str; }
|
if (wxGetApp().app_config->get("language") != "zh_CN") { return str; }
|
||||||
|
|
|
@ -80,7 +80,7 @@ public:
|
||||||
Button* m_button_cancel;
|
Button* m_button_cancel;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SecondaryCheckDialog : public DPIDialog
|
class SecondaryCheckDialog : public DPIFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum ButtonStyle {
|
enum ButtonStyle {
|
||||||
|
@ -98,9 +98,11 @@ public:
|
||||||
long style = wxCLOSE_BOX | wxCAPTION
|
long style = wxCLOSE_BOX | wxCAPTION
|
||||||
);
|
);
|
||||||
void update_text(wxString text);
|
void update_text(wxString text);
|
||||||
|
void on_show();
|
||||||
|
bool is_english_text(wxString str);
|
||||||
wxString format_text(wxStaticText* st, wxString str, int warp);
|
wxString format_text(wxStaticText* st, wxString str, int warp);
|
||||||
~SecondaryCheckDialog();
|
~SecondaryCheckDialog();
|
||||||
void on_dpi_changed(const wxRect& suggested_rect) override;
|
void on_dpi_changed(const wxRect& suggested_rect);
|
||||||
|
|
||||||
wxBoxSizer* m_sizer_main;
|
wxBoxSizer* m_sizer_main;
|
||||||
wxScrolledWindow *m_vebview_release_note {nullptr};
|
wxScrolledWindow *m_vebview_release_note {nullptr};
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include "Plater.hpp"
|
#include "Plater.hpp"
|
||||||
#include "BitmapCache.hpp"
|
#include "BitmapCache.hpp"
|
||||||
#include "BindDialog.hpp"
|
#include "BindDialog.hpp"
|
||||||
#include "ReleaseNote.hpp"
|
|
||||||
|
|
||||||
namespace Slic3r { namespace GUI {
|
namespace Slic3r { namespace GUI {
|
||||||
|
|
||||||
|
@ -1935,7 +1934,12 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
||||||
|
|
||||||
if (!is_same_printer_type || has_slice_warnings) {
|
if (!is_same_printer_type || has_slice_warnings) {
|
||||||
wxString confirm_title = _L("Warning");
|
wxString confirm_title = _L("Warning");
|
||||||
SecondaryCheckDialog confirm_dlg(this, wxID_ANY, confirm_title);
|
if (confirm_dlg == nullptr) {
|
||||||
|
confirm_dlg = new SecondaryCheckDialog(this, wxID_ANY, confirm_title);
|
||||||
|
confirm_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this](wxCommandEvent &e) {
|
||||||
|
this->on_ok();
|
||||||
|
});
|
||||||
|
}
|
||||||
wxString info_msg = wxEmptyString;
|
wxString info_msg = wxEmptyString;
|
||||||
|
|
||||||
for (auto i = 0; i < confirm_text.size(); i++) {
|
for (auto i = 0; i < confirm_text.size(); i++) {
|
||||||
|
@ -1947,10 +1951,9 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
confirm_dlg.update_text(info_msg);
|
confirm_dlg->update_text(info_msg);
|
||||||
if (confirm_dlg.ShowModal() == wxID_YES) {
|
confirm_dlg->on_show();
|
||||||
this->on_ok();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
this->on_ok();
|
this->on_ok();
|
||||||
}
|
}
|
||||||
|
@ -2938,6 +2941,9 @@ bool SelectMachineDialog::Show(bool show)
|
||||||
SelectMachineDialog::~SelectMachineDialog()
|
SelectMachineDialog::~SelectMachineDialog()
|
||||||
{
|
{
|
||||||
delete m_refresh_timer;
|
delete m_refresh_timer;
|
||||||
|
|
||||||
|
if (confirm_dlg != nullptr)
|
||||||
|
delete confirm_dlg;
|
||||||
}
|
}
|
||||||
|
|
||||||
EditDevNameDialog::EditDevNameDialog(Plater *plater /*= nullptr*/)
|
EditDevNameDialog::EditDevNameDialog(Plater *plater /*= nullptr*/)
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <wx/srchctrl.h>
|
#include <wx/srchctrl.h>
|
||||||
|
|
||||||
#include "AmsMappingPopup.hpp"
|
#include "AmsMappingPopup.hpp"
|
||||||
|
#include "ReleaseNote.hpp"
|
||||||
#include "GUI_Utils.hpp"
|
#include "GUI_Utils.hpp"
|
||||||
#include "wxExtensions.hpp"
|
#include "wxExtensions.hpp"
|
||||||
#include "DeviceManager.hpp"
|
#include "DeviceManager.hpp"
|
||||||
|
@ -279,6 +280,8 @@ private:
|
||||||
wxColour m_colour_def_color{wxColour(255, 255, 255)};
|
wxColour m_colour_def_color{wxColour(255, 255, 255)};
|
||||||
wxColour m_colour_bold_color{wxColour(38, 46, 48)};
|
wxColour m_colour_bold_color{wxColour(38, 46, 48)};
|
||||||
|
|
||||||
|
SecondaryCheckDialog* confirm_dlg = nullptr;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MaterialHash m_materialList;
|
MaterialHash m_materialList;
|
||||||
std::vector<FilamentInfo> m_filaments;
|
std::vector<FilamentInfo> m_filaments;
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#include "libslic3r/Thread.hpp"
|
#include "libslic3r/Thread.hpp"
|
||||||
|
|
||||||
#include "RecenterDialog.hpp"
|
#include "RecenterDialog.hpp"
|
||||||
#include "ReleaseNote.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
namespace Slic3r { namespace GUI {
|
namespace Slic3r { namespace GUI {
|
||||||
|
@ -1175,6 +1174,13 @@ StatusPanel::~StatusPanel()
|
||||||
m_calibration_btn->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_start_calibration), NULL, this);
|
m_calibration_btn->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_start_calibration), NULL, this);
|
||||||
m_options_btn->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_show_print_options), NULL, this);
|
m_options_btn->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_show_print_options), NULL, this);
|
||||||
m_button_unload->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_start_unload), NULL, this);
|
m_button_unload->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_start_unload), NULL, this);
|
||||||
|
|
||||||
|
// remove warning dialogs
|
||||||
|
if (m_print_error_dlg != nullptr)
|
||||||
|
delete m_print_error_dlg;
|
||||||
|
|
||||||
|
if (abort_dlg != nullptr)
|
||||||
|
delete abort_dlg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatusPanel::init_scaled_buttons()
|
void StatusPanel::init_scaled_buttons()
|
||||||
|
@ -1262,12 +1268,14 @@ void StatusPanel::on_subtask_pause_resume(wxCommandEvent &event)
|
||||||
|
|
||||||
void StatusPanel::on_subtask_abort(wxCommandEvent &event)
|
void StatusPanel::on_subtask_abort(wxCommandEvent &event)
|
||||||
{
|
{
|
||||||
SecondaryCheckDialog abort_dlg(this->GetParent(), wxID_ANY, _L("Cancel print"));
|
if (abort_dlg == nullptr) {
|
||||||
abort_dlg.update_text(_L("Are you sure you want to cancel this print?"));
|
abort_dlg = new SecondaryCheckDialog(this->GetParent(), wxID_ANY, _L("Cancel print"));
|
||||||
abort_dlg.Bind(EVT_SECONDARY_CHECK_CONFIRM, [this](wxCommandEvent &e) {
|
abort_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this](wxCommandEvent &e) {
|
||||||
if (obj) obj->command_task_abort();
|
if (obj) obj->command_task_abort();
|
||||||
});
|
});
|
||||||
abort_dlg.ShowModal();
|
}
|
||||||
|
abort_dlg->update_text(_L("Are you sure you want to cancel this print?"));
|
||||||
|
abort_dlg->on_show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatusPanel::error_info_reset()
|
void StatusPanel::error_info_reset()
|
||||||
|
@ -1425,9 +1433,9 @@ void StatusPanel::show_error_message(wxString msg)
|
||||||
if (m_panel_error_txt->IsShown()) {
|
if (m_panel_error_txt->IsShown()) {
|
||||||
error_info_reset();
|
error_info_reset();
|
||||||
}
|
}
|
||||||
if (m_print_error_dlg.get() != nullptr) {
|
if (m_print_error_dlg != nullptr) {
|
||||||
if (m_print_error_dlg.get()->IsShown()) {
|
if (m_print_error_dlg->IsShown()) {
|
||||||
m_print_error_dlg.get()->EndModal(wxID_OK);
|
m_print_error_dlg->Hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1436,9 +1444,11 @@ void StatusPanel::show_error_message(wxString msg)
|
||||||
m_panel_error_txt->Show();
|
m_panel_error_txt->Show();
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(info) << "show print error! error_msg = " << msg;
|
BOOST_LOG_TRIVIAL(info) << "show print error! error_msg = " << msg;
|
||||||
m_print_error_dlg = std::make_shared<SecondaryCheckDialog>(this->GetParent(), wxID_ANY, _L("Warning"), SecondaryCheckDialog::ButtonStyle::ONLY_CONFIRM);
|
if (m_print_error_dlg == nullptr) {
|
||||||
m_print_error_dlg.get()->update_text(msg);
|
m_print_error_dlg = new SecondaryCheckDialog(this->GetParent(), wxID_ANY, _L("Warning"), SecondaryCheckDialog::ButtonStyle::ONLY_CONFIRM);
|
||||||
m_print_error_dlg.get()->ShowModal();
|
}
|
||||||
|
m_print_error_dlg->update_text(msg);
|
||||||
|
m_print_error_dlg->on_show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -257,7 +257,8 @@ protected:
|
||||||
PrintOptionsDialog* print_options_dlg { nullptr };
|
PrintOptionsDialog* print_options_dlg { nullptr };
|
||||||
CalibrationDialog* calibration_dlg {nullptr};
|
CalibrationDialog* calibration_dlg {nullptr};
|
||||||
AMSMaterialsSetting *m_filament_setting_dlg{nullptr};
|
AMSMaterialsSetting *m_filament_setting_dlg{nullptr};
|
||||||
std::shared_ptr<SecondaryCheckDialog> m_print_error_dlg = nullptr;
|
SecondaryCheckDialog* m_print_error_dlg = nullptr;
|
||||||
|
SecondaryCheckDialog* abort_dlg = nullptr;
|
||||||
|
|
||||||
wxString m_request_url;
|
wxString m_request_url;
|
||||||
bool m_start_loading_thumbnail = false;
|
bool m_start_loading_thumbnail = false;
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#include "GUI.hpp"
|
#include "GUI.hpp"
|
||||||
#include "GUI_App.hpp"
|
#include "GUI_App.hpp"
|
||||||
#include "libslic3r/Thread.hpp"
|
#include "libslic3r/Thread.hpp"
|
||||||
#include "ReleaseNote.hpp"
|
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
@ -268,6 +267,9 @@ MachineInfoPanel::~MachineInfoPanel()
|
||||||
{
|
{
|
||||||
// Disconnect Events
|
// Disconnect Events
|
||||||
m_button_upgrade_firmware->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MachineInfoPanel::on_upgrade_firmware), NULL, this);
|
m_button_upgrade_firmware->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MachineInfoPanel::on_upgrade_firmware), NULL, this);
|
||||||
|
|
||||||
|
if (confirm_dlg != nullptr)
|
||||||
|
delete confirm_dlg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MachineInfoPanel::update(MachineObject* obj)
|
void MachineInfoPanel::update(MachineObject* obj)
|
||||||
|
@ -661,30 +663,30 @@ void MachineInfoPanel::upgrade_firmware_internal() {
|
||||||
|
|
||||||
void MachineInfoPanel::on_upgrade_firmware(wxCommandEvent &event)
|
void MachineInfoPanel::on_upgrade_firmware(wxCommandEvent &event)
|
||||||
{
|
{
|
||||||
SecondaryCheckDialog* confirm_dlg = new SecondaryCheckDialog(this->GetParent(), wxID_ANY, _L("Update firmware"));
|
if (confirm_dlg == nullptr) {
|
||||||
confirm_dlg->update_text(_L("Are you sure you want to update? This will take about 10 minutes. Do not turn off the power while the printer is updating."));
|
confirm_dlg = new SecondaryCheckDialog(this->GetParent(), wxID_ANY, _L("Update firmware"));
|
||||||
confirm_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this](wxCommandEvent &e) {
|
confirm_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this](wxCommandEvent& e) {
|
||||||
if (m_obj) {
|
if (m_obj) {
|
||||||
m_obj->command_upgrade_confirm();
|
m_obj->command_upgrade_confirm();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (confirm_dlg->ShowModal()) {
|
|
||||||
delete confirm_dlg;
|
|
||||||
}
|
}
|
||||||
|
confirm_dlg->update_text(_L("Are you sure you want to update? This will take about 10 minutes. Do not turn off the power while the printer is updating."));
|
||||||
|
confirm_dlg->on_show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MachineInfoPanel::on_consisitency_upgrade_firmware(wxCommandEvent &event)
|
void MachineInfoPanel::on_consisitency_upgrade_firmware(wxCommandEvent &event)
|
||||||
{
|
{
|
||||||
SecondaryCheckDialog* confirm_dlg = new SecondaryCheckDialog(this->GetParent(), wxID_ANY, _L("Update firmware"));
|
if (confirm_dlg == nullptr) {
|
||||||
confirm_dlg->update_text(_L("Are you sure you want to update? This will take about 10 minutes. Do not turn off the power while the printer is updating."));
|
confirm_dlg = new SecondaryCheckDialog(this->GetParent(), wxID_ANY, _L("Update firmware"));
|
||||||
confirm_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this](wxCommandEvent &e) {
|
confirm_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this](wxCommandEvent& e) {
|
||||||
if (m_obj) {
|
if (m_obj) {
|
||||||
m_obj->command_consistency_upgrade_confirm();
|
m_obj->command_consistency_upgrade_confirm();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (confirm_dlg->ShowModal()) {
|
|
||||||
delete confirm_dlg;
|
|
||||||
}
|
}
|
||||||
|
confirm_dlg->update_text(_L("Are you sure you want to update? This will take about 10 minutes. Do not turn off the power while the printer is updating."));
|
||||||
|
confirm_dlg->on_show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MachineInfoPanel::on_show_release_note(wxMouseEvent &event)
|
void MachineInfoPanel::on_show_release_note(wxMouseEvent &event)
|
||||||
|
@ -746,7 +748,11 @@ UpgradePanel::UpgradePanel(wxWindow *parent, wxWindowID id, const wxPoint &pos,
|
||||||
|
|
||||||
UpgradePanel::~UpgradePanel()
|
UpgradePanel::~UpgradePanel()
|
||||||
{
|
{
|
||||||
|
if (force_dlg != nullptr)
|
||||||
|
delete force_dlg ;
|
||||||
|
|
||||||
|
if (consistency_dlg != nullptr)
|
||||||
|
delete consistency_dlg ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpgradePanel::msw_rescale()
|
void UpgradePanel::msw_rescale()
|
||||||
|
@ -799,14 +805,18 @@ void UpgradePanel::update(MachineObject *obj)
|
||||||
if (m_obj && m_show_forced_hint) {
|
if (m_obj && m_show_forced_hint) {
|
||||||
if (m_obj->upgrade_force_upgrade) {
|
if (m_obj->upgrade_force_upgrade) {
|
||||||
m_show_forced_hint = false; //lock hint
|
m_show_forced_hint = false; //lock hint
|
||||||
SecondaryCheckDialog force_dlg(this->GetParent(), wxID_ANY, _L("Update firmware"), SecondaryCheckDialog::ButtonStyle::CONFIRM_AND_CANCEL, wxDefaultPosition, wxDefaultSize, wxPD_APP_MODAL | wxCLOSE_BOX | wxCAPTION);
|
if (force_dlg == nullptr) {
|
||||||
force_dlg.update_text(_L(
|
force_dlg = new SecondaryCheckDialog(this->GetParent(), wxID_ANY, _L("Update firmware"), SecondaryCheckDialog::ButtonStyle::CONFIRM_AND_CANCEL, wxDefaultPosition, wxDefaultSize);
|
||||||
"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 'Upgrade firmware'."
|
force_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this](wxCommandEvent& e) {
|
||||||
));
|
if (m_obj) {
|
||||||
force_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, &MachineInfoPanel::on_upgrade_firmware, m_push_upgrade_panel);
|
m_obj->command_upgrade_confirm();
|
||||||
if (force_dlg->ShowModal()) {
|
}
|
||||||
delete force_dlg;
|
});
|
||||||
}
|
}
|
||||||
|
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 'Upgrade firmware'."
|
||||||
|
));
|
||||||
|
force_dlg->on_show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -818,14 +828,18 @@ void UpgradePanel::update(MachineObject *obj)
|
||||||
if (m_obj && m_show_consistency_hint) {
|
if (m_obj && m_show_consistency_hint) {
|
||||||
if (m_obj->upgrade_consistency_request) {
|
if (m_obj->upgrade_consistency_request) {
|
||||||
m_show_consistency_hint = false;
|
m_show_consistency_hint = false;
|
||||||
SecondaryCheckDialog consistency_dlg(this->GetParent(), wxID_ANY, _L("Update firmware"), SecondaryCheckDialog::ButtonStyle::CONFIRM_AND_CANCEL, wxDefaultPosition, wxDefaultSize, wxPD_APP_MODAL | wxCLOSE_BOX | wxCAPTION);
|
if (consistency_dlg == nullptr) {
|
||||||
consistency_dlg.update_text(_L(
|
consistency_dlg = new SecondaryCheckDialog(this->GetParent(), wxID_ANY, _L("Update firmware"), SecondaryCheckDialog::ButtonStyle::CONFIRM_AND_CANCEL, wxDefaultPosition, wxDefaultSize);
|
||||||
"The firmware version is abnormal. Repairing and updating are required before printing. Do you want to update now? You can also update later on printer or update next time starting the studio."
|
consistency_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this](wxCommandEvent& e) {
|
||||||
));
|
if (m_obj) {
|
||||||
consistency_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, &MachineInfoPanel::on_consisitency_upgrade_firmware, m_push_upgrade_panel);
|
m_obj->command_consistency_upgrade_confirm();
|
||||||
if (consistency_dlg->ShowModal()) {
|
}
|
||||||
delete consistency_dlg;
|
});
|
||||||
}
|
}
|
||||||
|
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 printer or update next time starting the studio."
|
||||||
|
));
|
||||||
|
consistency_dlg->on_show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#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 "ReleaseNote.hpp"
|
||||||
|
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
@ -77,6 +78,8 @@ protected:
|
||||||
int last_status = -1;
|
int last_status = -1;
|
||||||
std::string last_status_str = "";
|
std::string last_status_str = "";
|
||||||
|
|
||||||
|
SecondaryCheckDialog* confirm_dlg = nullptr;
|
||||||
|
|
||||||
void upgrade_firmware_internal();
|
void upgrade_firmware_internal();
|
||||||
void on_show_release_note(wxMouseEvent &event);
|
void on_show_release_note(wxMouseEvent &event);
|
||||||
|
|
||||||
|
@ -136,6 +139,8 @@ protected:
|
||||||
int last_consistency_hint_status = -1;
|
int last_consistency_hint_status = -1;
|
||||||
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* consistency_dlg{ nullptr };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UpgradePanel(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
UpgradePanel(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
||||||
|
|
Loading…
Reference in a new issue