NEW:add SyncNozzleAndAmsDialog

jira: none
Change-Id: Ib2e8d645a1b9a280da5c91b6de2fee313075bc17
This commit is contained in:
zhou.xu 2025-01-16 21:43:52 +08:00 committed by lane.wei
parent 3573bbd985
commit 4845e4c585
4 changed files with 316 additions and 61 deletions

View File

@ -1215,6 +1215,14 @@ bool Sidebar::priv::sync_extruder_list()
AMSCountPopupWindow::SetAMSCount(main_index, main_4, main_1);
AMSCountPopupWindow::UpdateAMSCount(0, left_extruder);
AMSCountPopupWindow::UpdateAMSCount(1, right_extruder);
SyncNozzleAndAmsDialog::InputInfo temp_na_info;
wxPoint big_btn_pt;
wxSize big_btn_size;
wxGetApp().plater()->sidebar().get_big_btn_sync_pos_size(big_btn_pt, big_btn_size);
temp_na_info.dialog_pos = big_btn_pt + wxPoint(big_btn_size.x, big_btn_size.y) + wxPoint(FromDIP(big_btn_size.x / 10.f - 2), FromDIP(big_btn_size.y / 10.f));
SyncNozzleAndAmsDialog na_dialog(nullptr, temp_na_info);
na_dialog.ShowModal();
return true;
}
@ -1613,7 +1621,7 @@ Sidebar::Sidebar(Plater *parent)
project_config.set_key_value("curr_bed_type", new ConfigOptionEnum<BedType>(bed_type));
// Sync printer information
auto btn_sync = new Button(p->m_panel_printer_content, _L("Sync printer information"), "printer_sync", 0, 32);
btn_sync = new Button(p->m_panel_printer_content, _L("Sync printer information"), "printer_sync", 0, 32);
//btn_sync->SetFont(Label::Body_8);
btn_sync->SetToolTip(_L("Synchronize nozzle information and the number of AMS"));
btn_sync->SetCornerRadius(8);
@ -1788,7 +1796,7 @@ Sidebar::Sidebar(Plater *parent)
bSizer39->Add(del_btn, 0, wxALIGN_CENTER_VERTICAL, FromDIP(5));
bSizer39->Add(FromDIP(20), 0, 0, 0, 0);
auto ams_btn = new ScalableButton(p->m_panel_filament_title, wxID_ANY, "ams_fila_sync", wxEmptyString, wxDefaultSize, wxDefaultPosition,
ams_btn = new ScalableButton(p->m_panel_filament_title, wxID_ANY, "ams_fila_sync", wxEmptyString, wxDefaultSize, wxDefaultPosition,
wxBU_EXACTFIT | wxNO_BORDER, false, 18);
ams_btn->SetToolTip(_L("Synchronize filament list from AMS"));
ams_btn->Bind(wxEVT_BUTTON, [this, scrolled_sizer](wxCommandEvent &e) {
@ -2784,6 +2792,15 @@ void Sidebar::update_sync_status(const MachineObject *obj)
p->update_sync_status(obj);
}
void Sidebar::get_big_btn_sync_pos_size(wxPoint &pt, wxSize &size) {
size =btn_sync->GetSize();
pt = btn_sync->GetScreenPosition();
}
void Sidebar::get_small_btn_sync_pos_size(wxPoint &pt, wxSize &size) {
size = ams_btn->GetSize();
pt = ams_btn->GetScreenPosition();
}
void Sidebar::load_ams_list(std::string const &device, MachineObject* obj)
{
std::map<int, DynamicPrintConfig> filament_ams_list = build_filament_ams_list(obj);
@ -2807,7 +2824,7 @@ void Sidebar::load_ams_list(std::string const &device, MachineObject* obj)
p->combo_printer->update();
}
void Sidebar::sync_ams_list()
void Sidebar::sync_ams_list(bool is_from_big_sync_btn)
{
wxBusyCursor cursor;
// Force load ams list
@ -2822,6 +2839,9 @@ void Sidebar::sync_ams_list()
sync_dlg.ShowModal();//printer is not connected
return;
}
if (!wxGetApp().plater()->is_same_printer_for_connected_and_selected()) {
return;
}
std::string ams_filament_ids = wxGetApp().app_config->get("ams_filament_ids", p->ams_list_device);
std::vector<std::string> list2;
if (!ams_filament_ids.empty()) {
@ -2829,8 +2849,14 @@ void Sidebar::sync_ams_list()
}
wxGetApp().plater()->update_all_plate_thumbnails(true);//preview thumbnail for sync_dlg
SyncAmsInfoDialog::SyncInfo temp_info;
temp_info.use_dialog_pos = true;
temp_info.cancel_text_to_later = is_from_big_sync_btn;
wxPoint small_btn_pt;
wxSize big_btn_size;
get_small_btn_sync_pos_size(small_btn_pt, big_btn_size);
auto cur_dialog_pos = small_btn_pt + wxPoint(big_btn_size.x * 3.6 + 5,0);
temp_info.dialog_pos = cur_dialog_pos;
temp_info.connected_printer = true;
temp_info.first_sync = ams_filament_ids.empty();
SyncAmsInfoDialog sync_dlg(this, temp_info);
int dlg_res{(int) wxID_CANCEL};
if (sync_dlg.is_need_show()) {
@ -2979,9 +3005,10 @@ void Sidebar::sync_ams_list()
}
Layout();
NotificationManager *notify_manager = p->plater->get_notification_manager();
std::string info_text = _u8L("Sync filaments with AMS successfully.");
notify_manager->bbl_show_seqprintinfo_notification(info_text);
FinishSyncAmsDialog::InputInfo temp_fsa_info;
temp_fsa_info.dialog_pos = cur_dialog_pos;
FinishSyncAmsDialog fsa_dialog(this, temp_fsa_info);
fsa_dialog.ShowModal();
}
PlaterPresetComboBox* Sidebar::printer_combox()
@ -15148,6 +15175,30 @@ void Plater::split_object() { p->split_object(); }
void Plater::split_volume() { p->split_volume(); }
void Plater::optimize_rotation() { if (!p->m_ui_jobs.is_any_running()) p->m_ui_jobs.optimize_rotation(); }
void Plater::update_menus() { p->menus.update(); }
bool Plater::is_same_printer_for_connected_and_selected()
{
MachineObject *obj = wxGetApp().getDeviceManager()->get_selected_machine();
if (obj == nullptr) {
return false;
}
if (!check_printer_initialized(obj))
return false;
std::string machine_print_name = obj->printer_type;
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
std::string target_model_id = preset_bundle->printers.get_selected_preset().get_printer_type(preset_bundle);
Preset * machine_preset = get_printer_preset(obj);
if (!machine_preset)
return false;
if (machine_print_name != target_model_id) {
MessageDialog dlg(this,_L("The currently selected machine preset is inconsistent with the connected printer type.Please change device or currently selected machine.\n"),
_L("Synchronize AMS Filament Information"), wxICON_WARNING | wxOK);
dlg.ShowModal();
return false;
}
return true;
}
bool Plater::is_printer_configed_by_BBL() {
auto curr_preset = wxGetApp().preset_bundle->printers.get_edited_preset();
bool is_configed_by_BBL = PresetUtils::system_printer_bed_model(curr_preset).size() > 0;

View File

@ -116,6 +116,9 @@ const wxString DEFAULT_PROJECT_NAME = "Untitled";
class Sidebar : public wxPanel
{
ConfigOptionMode m_mode;
Button * btn_sync{nullptr};
ScalableButton * ams_btn{nullptr};
public:
Sidebar(Plater *parent);
Sidebar(Sidebar &&) = delete;
@ -156,10 +159,12 @@ public:
void on_bed_type_change(BedType bed_type);
void load_ams_list(std::string const & device, MachineObject* obj);
std::map<int, DynamicPrintConfig> build_filament_ams_list(MachineObject* obj);
void sync_ams_list();
void sync_ams_list(bool is_from_big_sync_btn = false);
bool sync_extruder_list();
bool auto_sync_extruder_list_on_connect_priner(const MachineObject* obj);
void update_sync_status(const MachineObject* obj);
void get_big_btn_sync_pos_size(wxPoint &pt, wxSize &size);
void get_small_btn_sync_pos_size(wxPoint &pt, wxSize &size);
PlaterPresetComboBox * printer_combox();
ObjectList* obj_list();
@ -470,6 +475,7 @@ public:
FilamentMapMode get_global_filament_map_mode() const;
void update_menus();
bool is_same_printer_for_connected_and_selected();
bool is_printer_configed_by_BBL();
// BBS
//void show_action_buttons(const bool is_ready_to_slice) const;

View File

@ -6,6 +6,7 @@
#include <wx/slider.h>
#include <wx/dcmemory.h>
#include "GUI_App.hpp"
#include "Tab.hpp"
#include "PartPlate.hpp"
#include "I18N.hpp"
#include "MainFrame.hpp"
@ -126,7 +127,12 @@ bool SyncAmsInfoDialog::Show(bool show)
}
Layout();
Fit();
CenterOnParent();
if (m_input_info.use_dialog_pos) {
SetPosition(m_input_info.dialog_pos);
}
else {
CenterOnParent();
}
return DPIDialog::Show(show);
}
@ -266,19 +272,6 @@ bool SyncAmsInfoDialog::is_must_finish_slice_then_connected_printer() {
return true;
}
void SyncAmsInfoDialog::update_printer_name() {
if (m_printer_title) {
m_printer_device_name->SetLabel(m_printer_name);
if (!m_result.is_same_printer && m_printer_title->IsShown()) {
m_printer_is_map_title->Show();
}
else {
m_printer_is_map_title->Show(false);
}
Layout();
}
}
void SyncAmsInfoDialog::hide_no_use_controls() {
show_sizer(sizer_basic_right_info,false);
show_sizer(m_basicl_sizer, false);
@ -421,7 +414,7 @@ void SyncAmsInfoDialog::update_panel_status(PageType page)
void SyncAmsInfoDialog::show_color_panel(bool flag, bool update_layout)
{
show_sizer(m_plate_combox_sizer, flag);
//show_sizer(m_plate_combox_sizer, flag);
if (m_sizer_line) {
show_sizer(m_sizer_line, flag);
}
@ -449,7 +442,6 @@ void SyncAmsInfoDialog::show_color_panel(bool flag, bool update_layout)
} else {
//m_used_colors_tip_text->Hide();
}
update_printer_name();
if (update_layout){
Layout();
Fit();
@ -621,7 +613,7 @@ void SyncAmsInfoDialog::updata_ui_when_priner_not_same() {
}
SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) :
DPIDialog(static_cast<wxWindow *>(wxGetApp().mainframe), wxID_ANY, _L("Ams filaments synchronization"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX)
DPIDialog(static_cast<wxWindow *>(wxGetApp().mainframe), wxID_ANY, _L("Synchronize AMS Filament Information"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX)
, m_input_info(info)
, m_export_3mf_cancel(false)
, m_mapping_popup(AmsMapingPopup(this))
@ -697,32 +689,32 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) :
bSizer->Add(m_mode_combox_sizer, FromDIP(0), wxEXPAND | wxALIGN_LEFT | wxTOP, FromDIP(10));
m_specify_plate_idx = GUI::wxGetApp().plater()->get_partplate_list().get_curr_plate_index();
{ // choose camera view angle type
m_plate_combox_sizer = new wxBoxSizer(wxHORIZONTAL);
m_plate_combox_sizer->AddSpacer(FromDIP(25));
//{
// m_plate_combox_sizer = new wxBoxSizer(wxHORIZONTAL);
// m_plate_combox_sizer->AddSpacer(FromDIP(25));
m_plate_combox_sizer->AddStretchSpacer(1); // m_plate_combox_sizer->AddSpacer(FromDIP(230));
m_printer_title = new wxStaticText(this, wxID_ANY, _L("Printer") + ": ");
m_printer_title->SetForegroundColour(wxColour(107, 107, 107, 100));
m_plate_combox_sizer->Add(m_printer_title, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxEXPAND | wxTOP , FromDIP(6));
m_printer_device_name = new wxStaticText(this, wxID_ANY, "");
m_plate_combox_sizer->Add(m_printer_device_name, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxEXPAND | wxTOP, FromDIP(6));
m_printer_is_map_title = new wxStaticText(this, wxID_ANY, " " + _L("(Inconsistent)"));
// m_printer_is_map_title->SetBackgroundColour(wxColour(38, 46, 48, 255));
m_printer_is_map_title->SetForegroundColour(wxColour(255, 111, 0, 255));
m_printer_is_map_title->SetToolTip(_L("The device printer and the currently selected printer are not consistent. It is recommended to be consistent."));
// m_plate_combox_sizer->AddStretchSpacer(1); // m_plate_combox_sizer->AddSpacer(FromDIP(230));
// m_printer_title = new wxStaticText(this, wxID_ANY, _L("Printer") + ": ");
// m_printer_title->SetForegroundColour(wxColour(107, 107, 107, 100));
// m_plate_combox_sizer->Add(m_printer_title, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxEXPAND | wxTOP , FromDIP(6));
// m_printer_device_name = new wxStaticText(this, wxID_ANY, "");
// m_plate_combox_sizer->Add(m_printer_device_name, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxEXPAND | wxTOP, FromDIP(6));
// m_printer_is_map_title = new wxStaticText(this, wxID_ANY, " " + _L("(Inconsistent)"));
// // m_printer_is_map_title->SetBackgroundColour(wxColour(38, 46, 48, 255));
// m_printer_is_map_title->SetForegroundColour(wxColour(255, 111, 0, 255));
// m_printer_is_map_title->SetToolTip(_L("The device printer and the currently selected printer are not consistent. It is recommended to be consistent."));
m_plate_combox_sizer->Add(m_printer_is_map_title, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxEXPAND | wxTOP, FromDIP(6));
// m_plate_combox_sizer->Add(m_printer_is_map_title, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxEXPAND | wxTOP, FromDIP(6));
m_plate_combox_sizer->AddSpacer(FromDIP(25));
bSizer->Add(m_plate_combox_sizer, FromDIP(0), wxEXPAND |wxALIGN_LEFT | wxBOTTOM, FromDIP(8));
// m_plate_combox_sizer->AddSpacer(FromDIP(25));
// bSizer->Add(m_plate_combox_sizer, FromDIP(0), wxEXPAND |wxALIGN_LEFT | wxBOTTOM, FromDIP(8));
m_sizer_line = new wxBoxSizer(wxVERTICAL);
auto staticline1 = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL);
staticline1->SetBackgroundColour(wxColour(224, 224, 224, 100));
m_sizer_line->Add(staticline1, 0, wxEXPAND | wxBOTTOM, FromDIP(8));
bSizer->Add(m_sizer_line, FromDIP(0), wxEXPAND | wxLEFT | wxRIGHT, FromDIP(25));
}
// m_sizer_line = new wxBoxSizer(wxVERTICAL);
// auto staticline1 = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL);
// staticline1->SetBackgroundColour(wxColour(224, 224, 224, 100));
// m_sizer_line->Add(staticline1, 0, wxEXPAND | wxBOTTOM, FromDIP(8));
// bSizer->Add(m_sizer_line, FromDIP(0), wxEXPAND | wxLEFT | wxRIGHT, FromDIP(25));
//}
//add_two_image_control();
}
// wxBoxSizer * snyc_ship_boxsizer = new wxBoxSizer(wxHORIZONTAL);
@ -1284,7 +1276,7 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) :
more_setting_sizer->Add(m_more_setting_tips, 0, wxALIGN_LEFT | wxTOP, FromDIP(4));
m_append_color_sizer = new wxBoxSizer(wxHORIZONTAL);
m_append_color_checkbox = new CheckBox(this, wxID_ANY);
m_append_color_checkbox = new ::CheckBox(this, wxID_ANY);
m_append_color_checkbox->SetToolTip(_L("When you click ok button,it will append unmapped color."));
//m_append_color_checkbox->SetForegroundColour(wxColour(107, 107, 107, 100));
m_append_color_checkbox->SetValue(wxGetApp().app_config->get_bool("enable_append_color_by_sync_ams"));
@ -1303,7 +1295,7 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) :
more_setting_sizer->Add(m_append_color_sizer, 0, wxALIGN_LEFT | wxTOP, FromDIP(4));
m_merge_color_sizer = new wxBoxSizer(wxHORIZONTAL);
m_merge_color_checkbox = new CheckBox(this, wxID_ANY);
m_merge_color_checkbox = new ::CheckBox(this, wxID_ANY);
m_merge_color_checkbox->SetToolTip(_L("When you click ok button,it will merge same ams to only one color."));
//m_merge_color_checkbox->SetForegroundColour(wxColour(107, 107, 107, 100));
m_merge_color_checkbox->SetValue(wxGetApp().app_config->get_bool("enable_merge_color_by_sync_ams"));
@ -1391,7 +1383,7 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) :
init_bind();
init_timer();
Centre(wxBOTH);
//Centre(wxBOTH);
wxGetApp().UpdateDlgDarkUI(this);
}
@ -2129,7 +2121,6 @@ void SyncAmsInfoDialog::show_status(PrintDialogStatus status, std::vector<wxStri
{
if (m_print_status != status) {
m_result.is_same_printer = true;
update_printer_name();
BOOST_LOG_TRIVIAL(info) << "select_machine_dialog: show_status = " << status << "(" << get_print_status_info(status) << ")";
}
m_print_status = status;
@ -2300,8 +2291,6 @@ void SyncAmsInfoDialog::show_status(PrintDialogStatus status, std::vector<wxStri
m_result.is_same_printer = false;
updata_ui_when_priner_not_same();
}
//update_printer_name();
//update_print_status_msg(msg_text, true, true);
return;
} catch (...) {}
@ -3193,7 +3182,6 @@ void SyncAmsInfoDialog::update_user_printer()
if (obj && !obj->get_lan_mode_connection_state()) {
m_comboBox_printer->SetSelection(i);
m_printer_name = m_comboBox_printer->GetValue();
update_printer_name();
wxCommandEvent event(wxEVT_COMBOBOX);
event.SetEventObject(m_comboBox_printer);
wxPostEvent(m_comboBox_printer, event);
@ -3315,9 +3303,6 @@ void SyncAmsInfoDialog::on_timer(wxTimerEvent &event)
update_select_layout(obj_);
update_ams_check(obj_);
m_check_flag = true;
show_sizer(m_plate_combox_sizer, true);
update_printer_name(); // m_printer_is_map_title is in m_plate_combox_sizer
}
if (!obj_ || obj_->amsList.empty() || obj_->ams_exist_bits == 0 || !obj_->is_support_filament_backup || !obj_->is_support_show_filament_backup ||
@ -4522,4 +4507,168 @@ std::string SyncAmsInfoDialog::get_print_status_info(PrintDialogStatus status)
return "unknown";
}
}} // namespace Slic3r::GUI
SyncNozzleAndAmsDialog::SyncNozzleAndAmsDialog(wxWindow *parent, InputInfo &input_info)
: DPIDialog(static_cast<wxWindow *>(wxGetApp().mainframe), wxID_ANY, "", wxDefaultPosition, wxDefaultSize, !wxCAPTION | !wxCLOSE_BOX | wxBORDER_NONE)
, m_input_info(input_info)
{
//SetBackgroundStyle(wxBackgroundStyle::wxBG_STYLE_TRANSPARENT);
SetTransparent(220);
SetBackgroundColour(wxColour(23, 25, 22, 128));
auto win_width = 288;
SetMinSize(wxSize(FromDIP(win_width), -1));
SetMaxSize(wxSize(FromDIP(win_width), -1));
SetPosition(m_input_info.dialog_pos);
m_sizer_main = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *text_sizer = new wxBoxSizer(wxHORIZONTAL);
text_sizer->AddSpacer(FromDIP(20));
auto image_sizer= new wxBoxSizer(wxVERTICAL);
auto imgsize = FromDIP(25);
auto completedimg = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap("completed", this, 25), wxDefaultPosition, wxSize(imgsize, imgsize), 0);
image_sizer->Add(completedimg, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, FromDIP(0));
image_sizer->AddStretchSpacer();
text_sizer->Add(image_sizer);
text_sizer->AddSpacer(FromDIP(5));
auto finish_text = new wxStaticText(this, wxID_ANY, _L("Successfully synchronized nozzle and AMS number information."));
finish_text->Wrap(win_width - 40);
finish_text->SetForegroundColour(wxColour(255, 255, 255, 255));
text_sizer->Add(finish_text, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 0);
text_sizer->AddSpacer(FromDIP(20));
m_sizer_main->Add(text_sizer, FromDIP(0), wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxTOP, FromDIP(20));
wxBoxSizer *bSizer_button = new wxBoxSizer(wxHORIZONTAL);
bSizer_button->SetMinSize(wxSize(FromDIP(100), -1));
/* m_checkbox = new wxCheckBox(this, wxID_ANY, _L("Don't show again"), wxDefaultPosition, wxDefaultSize, 0);
bSizer_button->Add(m_checkbox, 0, wxALIGN_LEFT);*/
bSizer_button->AddStretchSpacer(1);
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(27, 136, 68), StateColor::Pressed), std::pair<wxColour, int>(wxColour(61, 203, 115), StateColor::Hovered),
std::pair<wxColour, int>(AMS_CONTROL_BRAND_COLOUR, StateColor::Normal));
StateColor btn_bg_white(std::pair<wxColour, int>(wxColour(23, 25, 22), StateColor::Pressed), std::pair<wxColour, int>(wxColour(43, 45, 42), StateColor::Hovered),
std::pair<wxColour, int>(wxColour(23, 25, 22), StateColor::Normal));
m_button_ok = new Button(this, _L("Sync AMS filament"));
m_button_ok->SetBackgroundColor(btn_bg_green);
m_button_ok->SetBorderWidth(0);
m_button_ok->SetTextColor(wxColour(0xFFFFFF));
m_button_ok->SetFont(Label::Body_12);
m_button_ok->SetSize(wxSize(FromDIP(60), FromDIP(30)));
m_button_ok->SetMinSize(wxSize(FromDIP(90), FromDIP(30)));
m_button_ok->SetCornerRadius(FromDIP(6));
bSizer_button->Add(m_button_ok, 0, wxALIGN_RIGHT | wxLEFT | wxTOP, FromDIP(10));
m_button_ok->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
deal_ok();
});
m_button_cancel = new Button(this, _CTX(L_CONTEXT("Cancel", "Sync_Nozzle_AMS"), "Sync_Nozzle_AMS"));
m_button_cancel->SetBackgroundColor(btn_bg_white);
m_button_cancel->SetBorderColor(wxColour(93, 93, 91));
m_button_cancel->SetFont(Label::Body_12);
m_button_cancel->SetTextColor(wxColour(0xFFFFFF));
m_button_cancel->SetSize(wxSize(FromDIP(65), FromDIP(30)));
m_button_cancel->SetMinSize(wxSize(FromDIP(65), FromDIP(30)));
m_button_cancel->SetCornerRadius(FromDIP(6));
bSizer_button->Add(m_button_cancel, 0, wxALIGN_RIGHT | wxLEFT | wxTOP, FromDIP(10));
m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); });
m_sizer_main->Add(bSizer_button, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(20));
SetSizer(m_sizer_main);
Layout();
Fit();
wxGetApp().UpdateDlgDarkUI(this);
}
SyncNozzleAndAmsDialog::~SyncNozzleAndAmsDialog() {}
void SyncNozzleAndAmsDialog::on_dpi_changed(const wxRect &suggested_rect) {}
void SyncNozzleAndAmsDialog::deal_ok() {
//SyncAmsInfoDialog::SyncInfo temp_info;
//temp_info.connected_printer = true;
//SyncAmsInfoDialog sync_dlg(this, temp_info);
//auto dlg_res = wxGetApp().plater()->sidebar().pop_sync_ams_info_dialog(sync_dlg);
Close();
wxGetApp().plater()->sidebar().sync_ams_list(true);
}
void SyncNozzleAndAmsDialog::deal_cancel() {
//no deal
}
FinishSyncAmsDialog::FinishSyncAmsDialog(wxWindow *parent, InputInfo &input_info)
: DPIDialog(static_cast<wxWindow *>(wxGetApp().mainframe), wxID_ANY, "", wxDefaultPosition, wxDefaultSize, !wxCAPTION | !wxCLOSE_BOX | wxBORDER_NONE)
, m_input_info(input_info)
{
// SetBackgroundStyle(wxBackgroundStyle::wxBG_STYLE_TRANSPARENT);
SetTransparent(200);
SetBackgroundColour(wxColour(23, 25, 22, 128));
auto win_width = 288;
SetMinSize(wxSize(FromDIP(win_width), -1));
SetMaxSize(wxSize(FromDIP(win_width), -1));
SetPosition(m_input_info.dialog_pos);
m_sizer_main = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *text_sizer = new wxBoxSizer(wxHORIZONTAL);
text_sizer->AddSpacer(FromDIP(20));
auto image_sizer = new wxBoxSizer(wxVERTICAL);
auto imgsize = FromDIP(25);
auto completedimg = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap("completed", this, 25), wxDefaultPosition, wxSize(imgsize, imgsize), 0);
image_sizer->Add(completedimg, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, FromDIP(0));
image_sizer->AddStretchSpacer();
text_sizer->Add(image_sizer);
text_sizer->AddSpacer(FromDIP(5));
auto finish_text = new wxStaticText(this, wxID_ANY, _L("Successfully synchronized color and type of filament in AMS."));
finish_text->Wrap(win_width - 40);
finish_text->SetForegroundColour(wxColour(255, 255, 255, 255));
text_sizer->Add(finish_text, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 0);
text_sizer->AddSpacer(FromDIP(20));
m_sizer_main->Add(text_sizer, FromDIP(0), wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxTOP, FromDIP(20));
wxBoxSizer *bSizer_button = new wxBoxSizer(wxHORIZONTAL);
bSizer_button->SetMinSize(wxSize(FromDIP(100), -1));
/* m_checkbox = new wxCheckBox(this, wxID_ANY, _L("Don't show again"), wxDefaultPosition, wxDefaultSize, 0);
bSizer_button->Add(m_checkbox, 0, wxALIGN_LEFT);*/
bSizer_button->AddStretchSpacer(1);
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(27, 136, 68), StateColor::Pressed), std::pair<wxColour, int>(wxColour(61, 203, 115), StateColor::Hovered),
std::pair<wxColour, int>(AMS_CONTROL_BRAND_COLOUR, StateColor::Normal));
StateColor btn_bg_white(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Pressed), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
std::pair<wxColour, int>(*wxWHITE, StateColor::Normal));
m_button_ok = new Button(this, _CTX(L_CONTEXT("OK", "FinishSyncAms"), "FinishSyncAms"));
m_button_ok->SetBackgroundColor(btn_bg_green);
m_button_ok->SetBorderWidth(0);
m_button_ok->SetTextColor(wxColour(0xFFFFFF));
m_button_ok->SetFont(Label::Body_12);
m_button_ok->SetSize(wxSize(FromDIP(68), FromDIP(30)));
m_button_ok->SetMinSize(wxSize(FromDIP(68), FromDIP(30)));
m_button_ok->SetCornerRadius(FromDIP(6));
bSizer_button->Add(m_button_ok, 0, wxALIGN_RIGHT | wxLEFT | wxTOP, FromDIP(10));
m_button_ok->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
deal_ok();
EndModal(wxID_YES);
SetFocusIgnoringChildren();
});
//m_button_cancel = new Button(this, _CTX(L_CONTEXT("Cancel", "Sync_Nozzle_AMS"), "Sync_Nozzle_AMS"));
//m_button_cancel->SetBackgroundColor(btn_bg_white);
//m_button_cancel->SetBorderColor(wxColour(38, 46, 48));
//m_button_cancel->SetFont(Label::Body_12);
//m_button_cancel->SetSize(wxSize(FromDIP(65), FromDIP(30)));
//m_button_cancel->SetMinSize(wxSize(FromDIP(65), FromDIP(30)));
//m_button_cancel->SetCornerRadius(FromDIP(6));
//m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); });
//bSizer_button->Add(m_button_cancel, 0, wxALIGN_RIGHT | wxLEFT | wxTOP, FromDIP(10));
m_sizer_main->Add(bSizer_button, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(20));
SetSizer(m_sizer_main);
Layout();
Fit();
wxGetApp().UpdateDlgDarkUI(this);
}
FinishSyncAmsDialog::~FinishSyncAmsDialog() {}
void FinishSyncAmsDialog::on_dpi_changed(const wxRect &suggested_rect) {}
void FinishSyncAmsDialog::deal_ok() {}
void FinishSyncAmsDialog::deal_cancel() {}
}} // namespace Slic3r

View File

@ -244,6 +244,8 @@ public:
public:
struct SyncInfo
{
wxPoint dialog_pos;
bool use_dialog_pos = false;
bool connected_printer = false;
bool first_sync = false;
bool cancel_text_to_later = false;
@ -267,7 +269,6 @@ public:
void update_select_layout(MachineObject *obj);
void set_default_normal(const ThumbnailData &);
bool is_must_finish_slice_then_connected_printer() ;
void update_printer_name() ;
void hide_no_use_controls();
void show_sizer(wxSizer *sizer, bool show);
void deal_ok();
@ -312,10 +313,10 @@ private:
wxStaticText * m_confirm_title = nullptr;
wxStaticText * m_are_you_sure_title = nullptr;
wxBoxSizer * m_plate_combox_sizer = nullptr;
// wxBoxSizer * m_plate_combox_sizer = nullptr;
wxBoxSizer * m_mode_combox_sizer = nullptr;
wxBoxSizer * m_sizer_line = nullptr;
wxStaticText * m_printer_title = nullptr;
//wxStaticText * m_printer_title = nullptr;
wxStaticText * m_printer_device_name = nullptr;
wxStaticText * m_printer_is_map_title = nullptr;
@ -345,5 +346,53 @@ private:
};
MapModeEnum m_map_mode{MapModeEnum::ColorMap};
};
class SyncNozzleAndAmsDialog : public Slic3r::GUI::DPIDialog
{
public:
struct InputInfo
{
wxPoint dialog_pos{wxPoint(400, 200)};
};
struct ResultInfo
{};
SyncNozzleAndAmsDialog(wxWindow *parent, InputInfo &input_info);
~SyncNozzleAndAmsDialog() override;
void on_dpi_changed(const wxRect &suggested_rect) override;
void deal_ok();
void deal_cancel();
//bool Show(bool show) override;
private:
InputInfo &m_input_info;
ResultInfo m_result_info;
wxBoxSizer *m_sizer_main{nullptr};
Button *m_button_ok = nullptr;
Button *m_button_cancel = nullptr;
};
class FinishSyncAmsDialog : public Slic3r::GUI::DPIDialog
{
public:
struct InputInfo
{
wxPoint dialog_pos{wxPoint(400, 200)};
};
struct ResultInfo
{};
FinishSyncAmsDialog(wxWindow *parent, InputInfo &input_info);
~FinishSyncAmsDialog() override;
void on_dpi_changed(const wxRect &suggested_rect) override;
void deal_ok();
void deal_cancel();
// bool Show(bool show) override;
private:
InputInfo &m_input_info;
ResultInfo m_result_info;
wxBoxSizer *m_sizer_main{nullptr};
Button * m_button_ok = nullptr;
Button * m_button_cancel = nullptr;
};
}} // namespace Slic3r::GUI
#endif // _STEP_MESH_DIALOG_H_