FIX: print-error dialog: hide cancel button, fix msg display
Change-Id: I26fe098cedd16ee568060f12bb5aea855e9ae279
This commit is contained in:
parent
508f814bbc
commit
a0e273fd06
3 changed files with 19 additions and 5 deletions
|
@ -9,7 +9,7 @@ namespace Slic3r { namespace GUI {
|
|||
|
||||
wxDEFINE_EVENT(EVT_CONFIRM_HINT, wxCommandEvent);
|
||||
|
||||
ConfirmHintDialog::ConfirmHintDialog(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style)
|
||||
ConfirmHintDialog::ConfirmHintDialog(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)
|
||||
{
|
||||
std::string icon_path = (boost::format("%1%/images/BambuStudioTitle.ico") % resources_dir()).str();
|
||||
|
@ -46,6 +46,11 @@ ConfirmHintDialog::ConfirmHintDialog(wxWindow* parent, wxWindowID id, const wxSt
|
|||
button_sizer->AddSpacer(FromDIP(20));
|
||||
button_sizer->Add(m_button_close);
|
||||
|
||||
if (btn_style == CONFIRM_AND_CANCEL)
|
||||
m_button_close->Show();
|
||||
else
|
||||
m_button_close->Hide();
|
||||
|
||||
main_sizer->Add(m_line_top, 0, wxEXPAND, 0);
|
||||
main_sizer->AddSpacer(wxSize(FromDIP(475), FromDIP(100)).y);
|
||||
main_sizer->Add(button_sizer, 0, wxBOTTOM | wxRIGHT | wxEXPAND, FromDIP(25));
|
||||
|
@ -109,7 +114,7 @@ void ConfirmHintDialog::render(wxDC& dc) {
|
|||
break;
|
||||
}
|
||||
else {
|
||||
fisrt_line = firm_up_hint.SubString(0, i);
|
||||
fisrt_line = firm_up_hint.SubString(0, i - 1);
|
||||
remaining_line = firm_up_hint.SubString(i, firm_up_hint.length());
|
||||
break;
|
||||
}
|
||||
|
@ -165,8 +170,10 @@ void ConfirmHintDialog::on_button_close(wxCommandEvent& event) {
|
|||
void ConfirmHintDialog::on_dpi_changed(const wxRect& suggested_rect) {
|
||||
m_button_confirm->SetMinSize(wxSize(-1, FromDIP(24)));
|
||||
m_button_confirm->SetCornerRadius(FromDIP(12));
|
||||
m_button_close->SetMinSize(wxSize(-1, FromDIP(24)));
|
||||
m_button_close->SetCornerRadius(FromDIP(12));
|
||||
if (m_button_close->IsShown()) {
|
||||
m_button_close->SetMinSize(wxSize(-1, FromDIP(24)));
|
||||
m_button_close->SetCornerRadius(FromDIP(12));
|
||||
}
|
||||
Layout();
|
||||
}
|
||||
|
||||
|
|
|
@ -27,9 +27,16 @@ private:
|
|||
void on_dpi_changed(const wxRect& suggested_rect) override;
|
||||
|
||||
public:
|
||||
enum ButtonStyle {
|
||||
ONLY_CONFIRM = 0,
|
||||
CONFIRM_AND_CANCEL = 1,
|
||||
MAX_STYLE_NUM = 2
|
||||
};
|
||||
|
||||
ConfirmHintDialog(wxWindow* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxString& title = wxEmptyString,
|
||||
enum ButtonStyle btn_style = CONFIRM_AND_CANCEL,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxCLOSE_BOX | wxCAPTION);
|
||||
|
|
|
@ -1410,7 +1410,7 @@ void StatusPanel::update_error_message()
|
|||
show_error_message(error_msg);
|
||||
//hint dialog
|
||||
BOOST_LOG_TRIVIAL(info) << "Print error! " << error_msg;
|
||||
ConfirmHintDialog print_error_dlg(this->GetParent(), wxID_ANY, _L("Warning"));
|
||||
ConfirmHintDialog print_error_dlg(this->GetParent(), wxID_ANY, _L("Warning"), ConfirmHintDialog::ButtonStyle::ONLY_CONFIRM);
|
||||
print_error_dlg.SetHint(error_msg);
|
||||
print_error_dlg.ShowModal();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue