ENH: add options list for param dialog
jira:NONE Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: Ic2dc62fae487b8c167ccb6d53572cba0fbc727c9
This commit is contained in:
parent
f7a6e8cdc1
commit
d599757bf8
|
@ -23,7 +23,7 @@ namespace Slic3r {
|
|||
namespace GUI {
|
||||
|
||||
|
||||
TipsDialog::TipsDialog(wxWindow *parent, const wxString &title, const wxString &description, std::string app_key, long style)
|
||||
TipsDialog::TipsDialog(wxWindow *parent, const wxString &title, const wxString &description, std::string app_key, long style,std::map<wxStandardID,wxString> option_map)
|
||||
: DPIDialog(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX),
|
||||
m_app_key(app_key)
|
||||
{
|
||||
|
@ -61,19 +61,31 @@ TipsDialog::TipsDialog(wxWindow *parent, const wxString &title, const wxString &
|
|||
wxBoxSizer *m_sizer_right = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
if (style & wxOK) {
|
||||
Button* btn = add_button(wxID_OK, _L("OK"), true);
|
||||
wxString str = _L("OK");
|
||||
if (auto iter = option_map.find(wxID_OK); iter != option_map.end())
|
||||
str = iter->second;
|
||||
Button* btn = add_button(wxID_OK, str, true);
|
||||
m_sizer_right->Add(btn, 0, wxALL, FromDIP(5));
|
||||
}
|
||||
if (style & wxYES) {
|
||||
Button *btn = add_button(wxID_YES, _L("Yes"), true);
|
||||
wxString str = _L("Yes");
|
||||
if (auto iter = option_map.find(wxID_YES); iter != option_map.end())
|
||||
str = iter->second;
|
||||
Button *btn = add_button(wxID_YES, str, true);
|
||||
m_sizer_right->Add(btn, 0, wxALL, FromDIP(5));
|
||||
}
|
||||
if (style & wxNO) {
|
||||
Button *btn = add_button(wxID_NO, _L("No"), false);
|
||||
wxString str = _L("No");
|
||||
if (auto iter = option_map.find(wxID_NO); iter != option_map.end())
|
||||
str = iter->second;
|
||||
Button *btn = add_button(wxID_NO, str, false);
|
||||
m_sizer_right->Add(btn, 0, wxALL, FromDIP(5));
|
||||
}
|
||||
if (style & wxCANCEL) {
|
||||
Button *btn = add_button(wxID_CANCEL, _L("Cancel"), false);
|
||||
wxString str = _L("Cancel");
|
||||
if (auto iter = option_map.find(wxID_CANCEL); iter != option_map.end())
|
||||
str = iter->second;
|
||||
Button *btn = add_button(wxID_CANCEL, str, false);
|
||||
m_sizer_right->Add(btn, 0, wxALL, FromDIP(5));
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ private:
|
|||
std::string m_app_key;
|
||||
|
||||
public:
|
||||
TipsDialog(wxWindow *parent, const wxString &title, const wxString &description, std::string app_key = "", long style = wxOK);
|
||||
TipsDialog(wxWindow *parent, const wxString &title, const wxString &description, std::string app_key = "", long style = wxOK, std::map<wxStandardID,wxString> option_map={});
|
||||
Button *m_confirm{nullptr};
|
||||
Button *m_cancel{nullptr};
|
||||
wxPanel *m_top_line{nullptr};
|
||||
|
|
|
@ -10542,9 +10542,13 @@ bool Plater::try_sync_preset_with_connected_printer()
|
|||
}
|
||||
else {
|
||||
tips = from_u8((boost::format(_u8L("The currently connected printer, %s, is a %s model.\nTo use this printer for printing, please switch the printer model of project file to %s.")) % obj->dev_name % printer_model % printer_model).str());
|
||||
|
||||
}
|
||||
TipsDialog dlg(wxGetApp().mainframe, _L("Tips"), tips, "sync_after_load_file_show_flag", wxYES_NO);
|
||||
|
||||
std::map<wxStandardID, wxString>option_map = {
|
||||
{wxID_YES,_L("Sync now")},
|
||||
{wxID_NO, _L("Later")}
|
||||
};
|
||||
TipsDialog dlg(wxGetApp().mainframe, _L("Tips"), tips, "sync_after_load_file_show_flag", wxYES_NO,option_map);
|
||||
if (dlg.ShowModal() == wxID_YES) { sync_printer_info = true; }
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue