ENH:update SyncAmsInfoDialog

jira: none
Change-Id: Icdfaa85500a0f448b9959923b863e6fbf72b397f
This commit is contained in:
zhou.xu 2025-01-16 16:22:20 +08:00 committed by lane.wei
parent 8e3c82e161
commit baa2282ded
7 changed files with 231 additions and 79 deletions

View File

@ -0,0 +1,3 @@
<svg width="33" height="33" viewBox="0 0 33 33" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M27.1947 16.4647C27.1947 19.3379 26.0534 22.0934 24.0217 24.125C21.9901 26.1566 19.2346 27.298 16.3614 27.298C13.4882 27.298 10.7327 26.1566 8.70109 24.125C6.66944 22.0934 5.52808 19.3379 5.52808 16.4647C5.52808 13.5915 6.66944 10.836 8.70109 8.80436C10.7327 6.77271 13.4882 5.63135 16.3614 5.63135C19.2346 5.63135 21.9901 6.77271 24.0217 8.80436C26.0534 10.836 27.1947 13.5915 27.1947 16.4647ZM3.02808 16.4647C3.02808 20.0009 4.43283 23.3923 6.93332 25.8928C9.4338 28.3933 12.8252 29.798 16.3614 29.798C19.8976 29.798 23.289 28.3933 25.7895 25.8928C28.29 23.3923 29.6947 20.0009 29.6947 16.4647C29.6947 12.9285 28.29 9.53708 25.7895 7.03659C23.289 4.53611 19.8976 3.13135 16.3614 3.13135C12.8252 3.13135 9.4338 4.53611 6.93332 7.03659C4.43283 9.53708 3.02808 12.9285 3.02808 16.4647ZM15.5802 22.7668L20.9968 17.3501C21.4864 16.8605 21.4864 16.0688 20.9968 15.5845L15.5802 10.1626C15.0906 9.67301 14.2989 9.67301 13.8145 10.1626C13.3302 10.6522 13.325 11.4438 13.8145 11.9282L18.3458 16.4595L13.8145 20.9907C13.325 21.4803 13.325 22.272 13.8145 22.7563C14.3041 23.2407 15.0958 23.2459 15.5802 22.7563V22.7668Z" fill="#ACACAC"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,3 @@
<svg width="33" height="32" viewBox="0 0 33 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M27.703 15.9998C27.703 18.873 26.5617 21.6285 24.53 23.6602C22.4984 25.6918 19.7429 26.8332 16.8697 26.8332C13.9965 26.8332 11.241 25.6918 9.20939 23.6602C7.17774 21.6285 6.03638 18.873 6.03638 15.9998C6.03638 13.1267 7.17774 10.3712 9.20939 8.33951C11.241 6.30787 13.9965 5.1665 16.8697 5.1665C19.7429 5.1665 22.4984 6.30787 24.53 8.33951C26.5617 10.3712 27.703 13.1267 27.703 15.9998ZM3.53638 15.9998C3.53638 19.5361 4.94113 22.9274 7.44162 25.4279C9.94211 27.9284 13.3335 29.3332 16.8697 29.3332C20.4059 29.3332 23.7973 27.9284 26.2978 25.4279C28.7983 22.9274 30.203 19.5361 30.203 15.9998C30.203 12.4636 28.7983 9.07223 26.2978 6.57175C23.7973 4.07126 20.4059 2.6665 16.8697 2.6665C13.3335 2.6665 9.94211 4.07126 7.44162 6.57175C4.94113 9.07223 3.53638 12.4636 3.53638 15.9998ZM16.0885 22.3019L21.5051 16.8853C21.9947 16.3957 21.9947 15.604 21.5051 15.1196L16.0885 9.69775C15.5989 9.20817 14.8072 9.20817 14.3228 9.69775C13.8385 10.1873 13.8333 10.979 14.3228 11.4634L18.8541 15.9946L14.3228 20.5259C13.8333 21.0155 13.8333 21.8071 14.3228 22.2915C14.8124 22.7759 15.6041 22.7811 16.0885 22.2915V22.3019Z" fill="#262E30"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,3 @@
<svg width="33" height="33" viewBox="0 0 33 33" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M5.65845 16.5272C5.65845 13.654 6.79981 10.8985 8.83146 8.86686C10.8631 6.83521 13.6186 5.69385 16.4918 5.69385C19.365 5.69385 22.1205 6.83521 24.1521 8.86686C26.1838 10.8985 27.3251 13.654 27.3251 16.5272C27.3251 19.4004 26.1838 22.1559 24.1521 24.1875C22.1205 26.2192 19.365 27.3605 16.4918 27.3605C13.6186 27.3605 10.8631 26.2192 8.83146 24.1875C6.79981 22.1559 5.65845 19.4004 5.65845 16.5272ZM29.8251 16.5272C29.8251 12.991 28.4204 9.59958 25.9199 7.09909C23.4194 4.59861 20.028 3.19385 16.4918 3.19385C12.9556 3.19385 9.56418 4.59861 7.06369 7.09909C4.56321 9.59958 3.15845 12.991 3.15845 16.5272C3.15845 20.0634 4.56321 23.4548 7.06369 25.9553C9.56418 28.4558 12.9556 29.8605 16.4918 29.8605C20.028 29.8605 23.4194 28.4558 25.9199 25.9553C28.4204 23.4548 29.8251 20.0634 29.8251 16.5272ZM17.273 10.2251L11.8564 15.6418C11.3668 16.1313 11.3668 16.923 11.8564 17.4074L17.273 22.8293C17.7626 23.3188 18.5543 23.3188 19.0387 22.8293C19.523 22.3397 19.5282 21.548 19.0387 21.0636L14.5074 16.5324L19.0387 12.0011C19.5282 11.5116 19.5282 10.7199 19.0387 10.2355C18.5491 9.75114 17.7574 9.74593 17.273 10.2355V10.2251Z" fill="#ACACAC"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,3 @@
<svg width="32" height="33" viewBox="0 0 32 33" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M5.16675 16.0623C5.16675 13.1892 6.30811 10.4337 8.33976 8.40201C10.3714 6.37037 13.1269 5.229 16.0001 5.229C18.8733 5.229 21.6288 6.37037 23.6604 8.40201C25.6921 10.4337 26.8334 13.1892 26.8334 16.0623C26.8334 18.9355 25.6921 21.691 23.6604 23.7227C21.6288 25.7543 18.8733 26.8957 16.0001 26.8957C13.1269 26.8957 10.3714 25.7543 8.33976 23.7227C6.30811 21.691 5.16675 18.9355 5.16675 16.0623ZM29.3334 16.0623C29.3334 12.5261 27.9287 9.13473 25.4282 6.63425C22.9277 4.13376 19.5363 2.729 16.0001 2.729C12.4639 2.729 9.07248 4.13376 6.57199 6.63425C4.07151 9.13473 2.66675 12.5261 2.66675 16.0623C2.66675 19.5986 4.07151 22.9899 6.57199 25.4904C9.07248 27.9909 12.4639 29.3957 16.0001 29.3957C19.5363 29.3957 22.9277 27.9909 25.4282 25.4904C27.9287 22.9899 29.3334 19.5986 29.3334 16.0623ZM16.7813 9.76025L11.3647 15.1769C10.8751 15.6665 10.8751 16.4582 11.3647 16.9425L16.7813 22.3644C17.2709 22.854 18.0626 22.854 18.547 22.3644C19.0313 21.8748 19.0365 21.0832 18.547 20.5988L14.0157 16.0675L18.547 11.5363C19.0365 11.0467 19.0365 10.255 18.547 9.77067C18.0574 9.2863 17.2657 9.28109 16.7813 9.77067V9.76025Z" fill="#262E30"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -2837,7 +2837,9 @@ void Sidebar::sync_ams_list()
if (dlg_res == wxID_CANCEL)
return;
auto sync_result = sync_dlg.get_result();
if (!sync_result.is_same_printer) {
return;
}
list2.resize(list.size());
auto iter = list.begin();
for (int i = 0; i < list.size(); ++i, ++iter) {

View File

@ -135,7 +135,7 @@ void SyncAmsInfoDialog::updata_ui_data_after_connected_printer() {
if (is_dirty_filament()) { return; }
show_sizer(m_sizer_line, true);
show_sizer(m_sizer_two_image, true);
m_two_thumbnail_panel->Show(true);
m_attention_text->Show();
m_tip_text->Show();
@ -225,7 +225,7 @@ void SyncAmsInfoDialog::set_default_normal(const ThumbnailData &data)
image.SetAlpha((int) c, (int) r, px[3]);
}
}
image = image.Rescale(FromDIP(THUMBNAIL_SIZE_WIDTH), FromDIP(THUMBNAIL_SIZE_WIDTH));
image = image.Rescale(FromDIP(LEFT_THUMBNAIL_SIZE_WIDTH), FromDIP(LEFT_THUMBNAIL_SIZE_WIDTH));
m_left_image_button->SetBitmap(image);
}
if (data.is_valid() && m_right_image_button) {
@ -239,7 +239,7 @@ void SyncAmsInfoDialog::set_default_normal(const ThumbnailData &data)
image.SetAlpha((int) c, (int) r, px[3]);
}
}
image = image.Rescale(FromDIP(THUMBNAIL_SIZE_WIDTH), FromDIP(THUMBNAIL_SIZE_WIDTH));
image = image.Rescale(FromDIP(RIGHT_THUMBNAIL_SIZE_WIDTH), FromDIP(RIGHT_THUMBNAIL_SIZE_WIDTH));
m_right_image_button->SetBitmap(image);
auto extruders = wxGetApp().plater()->get_partplate_list().get_plate(m_specify_plate_idx)->get_extruders();
if (wxGetApp().plater()->get_extruders_colors().size() == extruders.size()) {
@ -269,7 +269,7 @@ bool SyncAmsInfoDialog::is_must_finish_slice_then_connected_printer() {
void SyncAmsInfoDialog::update_printer_name() {
if (m_printer_title) {
m_printer_device_name->SetLabel(m_printer_name);
if (!m_is_same_printer && m_printer_title->IsShown()) {
if (!m_result.is_same_printer && m_printer_title->IsShown()) {
m_printer_is_map_title->Show();
}
else {
@ -305,7 +305,7 @@ void SyncAmsInfoDialog::show_sizer(wxSizer *sizer, bool show)
void SyncAmsInfoDialog::deal_ok()
{
if (m_input_info.connected_printer && !m_is_empty_project) {
if (m_map_mode == MapModeEnum::Override) {
if (m_map_mode == MapModeEnum::Override || !m_result.is_same_printer) {
m_is_empty_project = true;
return;
}
@ -349,21 +349,21 @@ bool SyncAmsInfoDialog::is_need_show()
wxBoxSizer *SyncAmsInfoDialog::create_sizer_thumbnail(wxButton *image_button, bool left)
{
auto sizer_thumbnail = new wxBoxSizer(wxVERTICAL);
sizer_thumbnail->Add(image_button, 0, wxALIGN_CENTER, 0);
if (left) {
wxBoxSizer *text_sizer = new wxBoxSizer(wxHORIZONTAL);
auto sync_text = new wxStaticText(this, wxID_ANY, _CTX(L_CONTEXT("Original", "Sync_AMS"), "Sync_AMS"));
auto sync_text = new wxStaticText(image_button->GetParent(), wxID_ANY, _CTX(L_CONTEXT("Original", "Sync_AMS"), "Sync_AMS"));
sync_text->SetForegroundColour(wxColour(107, 107, 107, 100));
text_sizer->Add(sync_text, 0, wxALIGN_CENTER | wxALL, 0);
sizer_thumbnail->Add(sync_text, FromDIP(0), wxALIGN_CENTER | wxALL, FromDIP(4));
}
else {
wxBoxSizer *text_sizer = new wxBoxSizer(wxHORIZONTAL);
auto sync_text = new wxStaticText(this, wxID_ANY, _L("After mapping"));
auto sync_text = new wxStaticText(image_button->GetParent(), wxID_ANY, _L("After mapping"));
sync_text->SetForegroundColour(wxColour(107, 107, 107, 100));
text_sizer->Add(sync_text, 0, wxALIGN_CENTER | wxALL, 0);
sizer_thumbnail->Add(sync_text, FromDIP(0), wxALIGN_CENTER | wxALL, FromDIP(4));
}
sizer_thumbnail->Add(image_button, 0, wxALIGN_CENTER, 0);
return sizer_thumbnail;
}
@ -377,6 +377,10 @@ void SyncAmsInfoDialog::update_when_change_plate(int idx) {
wxCommandEvent empty;
on_selection_changed(empty);
update_swipe_button_state();
Layout();
Fit();
}
void SyncAmsInfoDialog::update_when_change_map_mode(int idx)
@ -415,12 +419,13 @@ void SyncAmsInfoDialog::update_panel_status(PageType page)
}
}
void SyncAmsInfoDialog::show_color_panel(bool flag) {
void SyncAmsInfoDialog::show_color_panel(bool flag, bool update_layout)
{
show_sizer(m_plate_combox_sizer, flag);
if (m_sizer_line) {
show_sizer(m_sizer_line, flag);
}
show_sizer(m_sizer_two_image, flag);
m_two_thumbnail_panel->Show(flag);
m_filament_panel->Show(flag); // empty_project
@ -445,8 +450,10 @@ void SyncAmsInfoDialog::show_color_panel(bool flag) {
//m_used_colors_tip_text->Hide();
}
update_printer_name();
Layout();
Fit();
if (update_layout){
Layout();
Fit();
}
}
void SyncAmsInfoDialog::update_more_setting(bool layout)
@ -459,35 +466,158 @@ void SyncAmsInfoDialog::update_more_setting(bool layout)
}
}
void SyncAmsInfoDialog::init_bitmaps()
{
m_swipe_left_bmp_normal = ScalableBitmap(this, "previous_item", m_bmp_pix_cont);
m_swipe_left_bmp_hover = ScalableBitmap(this, "previous_item_hover", m_bmp_pix_cont);
m_swipe_right_bmp_normal = ScalableBitmap(this, "next_item", m_bmp_pix_cont);
m_swipe_right_bmp_hover = ScalableBitmap(this, "next_item_hover", m_bmp_pix_cont);
}
void SyncAmsInfoDialog::add_two_image_control()
{// thumbnail
m_sizer_two_image = new wxBoxSizer(wxHORIZONTAL);
int left_right_gap = 70;
m_sizer_two_image->AddSpacer(FromDIP(left_right_gap));
m_left_image_button = new wxButton(this, wxID_ANY, {}, wxDefaultPosition, wxSize(FromDIP(THUMBNAIL_SIZE_WIDTH), FromDIP(THUMBNAIL_SIZE_WIDTH)), wxBORDER_NONE | wxBU_AUTODRAW);
// m_left_image_button->SetBitmap(image);
m_left_image_button->SetCanFocus(false);
m_right_image_button = new wxButton(this, wxID_ANY, {}, wxDefaultPosition, wxSize(FromDIP(THUMBNAIL_SIZE_WIDTH), FromDIP(THUMBNAIL_SIZE_WIDTH)),
wxBORDER_NONE | wxBU_AUTODRAW);
// m_left_image_button->SetBitmap(image);
m_right_image_button->SetCanFocus(false);
m_two_thumbnail_panel = new StaticBox(this);
// m_two_thumbnail_panel->SetBackgroundColour(wxColour(0xF8F8F8));
m_two_thumbnail_panel->SetBorderWidth(0);
//m_two_thumbnail_panel->SetMinSize(wxSize(FromDIP(637), -1));
//m_two_thumbnail_panel->SetMaxSize(wxSize(FromDIP(637), -1));
m_two_thumbnail_panel_sizer = new wxBoxSizer(wxVERTICAL);
m_left_sizer_thumbnail = create_sizer_thumbnail(m_left_image_button, true);
m_sizer_two_image->Add(m_left_sizer_thumbnail, FromDIP(0), wxALIGN_LEFT | wxEXPAND | wxTOP, FromDIP(2));
auto view_two_thumbnail_sizer = new wxBoxSizer(wxHORIZONTAL);
view_two_thumbnail_sizer->AddSpacer(FromDIP(60));
auto swipe_left__sizer = new wxBoxSizer(wxVERTICAL);
swipe_left__sizer->AddStretchSpacer();
init_bitmaps();
m_swipe_left_button = new ScalableButton(m_two_thumbnail_panel, wxID_ANY, "previous_item", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, true,
m_bmp_pix_cont);
m_swipe_left_button->Bind(wxEVT_ENTER_WINDOW, [this](auto &e) {
m_swipe_left_button->SetBitmap(m_swipe_left_bmp_hover.bmp());
});
m_swipe_left_button->Bind(wxEVT_LEAVE_WINDOW, [this](auto &e) {
m_swipe_left_button->SetBitmap(m_swipe_left_bmp_normal.bmp());
});
m_swipe_left_button->Bind(wxEVT_BUTTON, &SyncAmsInfoDialog::to_previous_plate, this);
swipe_left__sizer->Add(m_swipe_left_button, 0, wxALIGN_CENTER | wxEXPAND | wxALIGN_CENTER_VERTICAL);
swipe_left__sizer->AddStretchSpacer();
view_two_thumbnail_sizer->Add(swipe_left__sizer, 0, wxEXPAND);
view_two_thumbnail_sizer->AddSpacer(FromDIP(20));
{
m_two_image_panel = new StaticBox(m_two_thumbnail_panel);
// m_two_thumbnail_panel->SetBackgroundColour(wxColour(0xF8F8F8));
m_two_image_panel->SetBorderWidth(0);
//m_two_image_panel->SetForegroundColour(wxColour(248, 248, 248, 100));
m_two_image_panel->SetBackgroundColor(wxColour(248, 248, 248, 100));
m_two_image_panel_sizer = new wxBoxSizer(wxHORIZONTAL);
m_left_image_button = new wxButton(m_two_image_panel, wxID_ANY, {}, wxDefaultPosition, wxSize(FromDIP(LEFT_THUMBNAIL_SIZE_WIDTH), FromDIP(LEFT_THUMBNAIL_SIZE_WIDTH)),
wxBORDER_NONE | wxBU_AUTODRAW);
m_left_sizer_thumbnail = create_sizer_thumbnail(m_left_image_button, true);
m_two_image_panel_sizer->Add(m_left_sizer_thumbnail, FromDIP(0), wxALIGN_LEFT | wxEXPAND , FromDIP(0));
m_two_image_panel_sizer->AddSpacer(FromDIP(5));
/* wxBoxSizer *arrow_sizer = new wxBoxSizer(wxVERTICAL);
auto sync_text = new wxStaticText(this, wxID_ANY, _L("Synchronization"));
sync_text->SetForegroundColour(wxColour(107, 107, 107, 100));
arrow_sizer->Add(sync_text, 0, wxALIGN_CENTER | wxALL, 0);
auto arrow_text = new wxStaticText(this, wxID_ANY, _L("--------------->"));
arrow_text->SetForegroundColour(wxColour(107, 107, 107, 100));
arrow_sizer->Add(arrow_text, 0, wxALIGN_CENTER | wxALL, 0);
m_sizer_two_image->Add(arrow_sizer, FromDIP(0), wxALIGN_CENTER | wxLEFT | wxRIGHT, FromDIP(20));*/
m_sizer_two_image->AddStretchSpacer();
m_right_sizer_thumbnail = create_sizer_thumbnail(m_right_image_button, false);
m_sizer_two_image->Add(m_right_sizer_thumbnail, FromDIP(0), wxALIGN_RIGHT | wxEXPAND, FromDIP(0));
m_sizer_two_image->AddSpacer(FromDIP(left_right_gap));
m_sizer_main->Add(m_sizer_two_image, FromDIP(0), wxALIGN_LEFT | wxEXPAND | wxTOP, FromDIP(10));
m_right_image_button = new wxButton(m_two_image_panel, wxID_ANY, {}, wxDefaultPosition,
wxSize(FromDIP(RIGHT_THUMBNAIL_SIZE_WIDTH), FromDIP(RIGHT_THUMBNAIL_SIZE_WIDTH)),
wxBORDER_NONE | wxBU_AUTODRAW);
m_right_sizer_thumbnail = create_sizer_thumbnail(m_right_image_button, false);
m_two_image_panel_sizer->Add(m_right_sizer_thumbnail, FromDIP(0), wxALIGN_LEFT | wxEXPAND , FromDIP(0));
m_two_image_panel->SetSizer(m_two_image_panel_sizer);
m_two_image_panel->Layout();
m_two_image_panel->Fit();
view_two_thumbnail_sizer->Add(m_two_image_panel, FromDIP(0), wxALIGN_LEFT | wxEXPAND | wxTOP, FromDIP(2));
}
view_two_thumbnail_sizer->AddSpacer(FromDIP(20));
auto swipe_right__sizer = new wxBoxSizer(wxVERTICAL);
swipe_right__sizer->AddStretchSpacer();
m_swipe_right_button = new ScalableButton(m_two_thumbnail_panel, wxID_ANY, "next_item", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, true,
m_bmp_pix_cont);
m_swipe_right_button->Bind(wxEVT_ENTER_WINDOW, [this](auto &e) { m_swipe_right_button->SetBitmap(m_swipe_right_bmp_hover.bmp()); });
m_swipe_right_button->Bind(wxEVT_LEAVE_WINDOW, [this](auto &e) { m_swipe_right_button->SetBitmap(m_swipe_right_bmp_normal.bmp()); });
m_swipe_right_button->Bind(wxEVT_BUTTON, &SyncAmsInfoDialog::to_next_plate, this);
swipe_right__sizer->Add(m_swipe_right_button, 0, wxALIGN_CENTER | wxEXPAND | wxALIGN_CENTER_VERTICAL);
swipe_right__sizer->AddStretchSpacer();
view_two_thumbnail_sizer->Add(swipe_right__sizer, 0, wxEXPAND);
view_two_thumbnail_sizer->AddSpacer(FromDIP(60));
m_two_thumbnail_panel_sizer->Add(view_two_thumbnail_sizer, 0, wxEXPAND | wxTOP, FromDIP(5));
m_choose_plate_sizer = new wxBoxSizer(wxHORIZONTAL);
m_choose_plate_sizer->AddStretchSpacer();
wxStaticText *chose_combox_title = new wxStaticText(m_two_thumbnail_panel, wxID_ANY, _CTX(L_CONTEXT("Plate", "Sync_AMS"), "Sync_AMS"));
m_choose_plate_sizer->Add(chose_combox_title, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxEXPAND | wxTOP, FromDIP(6));
m_choose_plate_sizer->AddSpacer(FromDIP(10));
m_combobox_plate = new ComboBox(m_two_thumbnail_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(50), -1), 0, NULL, wxCB_READONLY);
for (size_t i = 0; i < m_plate_number_choices_str.size(); i++) {
m_combobox_plate->Append(m_plate_number_choices_str[i]);
}
auto iter = std::find(m_plate_choices.begin(), m_plate_choices.end(), m_specify_plate_idx);
if (iter != m_plate_choices.end()) {
auto index = iter - m_plate_choices.begin();
m_combobox_plate->SetSelection(index);
}
m_combobox_plate->Bind(wxEVT_COMBOBOX, [this](auto &e) {
if (e.GetSelection() < m_plate_choices.size()) {
update_when_change_plate(m_plate_choices[e.GetSelection()]);
}
});
m_choose_plate_sizer->Add(m_combobox_plate, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM, FromDIP(3));
m_choose_plate_sizer->AddStretchSpacer();
m_two_thumbnail_panel_sizer->Add(m_choose_plate_sizer, 0, wxEXPAND |wxTOP, FromDIP(4));
m_two_thumbnail_panel->SetSizer(m_two_thumbnail_panel_sizer);
m_two_thumbnail_panel->Layout();
m_two_thumbnail_panel->Fit();
m_sizer_main->Add(m_two_thumbnail_panel, FromDIP(0), wxALIGN_CENTER | wxEXPAND | wxLEFT | wxRIGHT, FromDIP(25));
update_swipe_button_state();
}
void SyncAmsInfoDialog::to_next_plate(wxCommandEvent &event) {
auto cobox_idx = m_combobox_plate->GetSelection();
cobox_idx++;
m_combobox_plate->SetSelection(cobox_idx);
update_when_change_plate(m_plate_choices[cobox_idx]);
}
void SyncAmsInfoDialog::to_previous_plate(wxCommandEvent &event) {
auto cobox_idx = m_combobox_plate->GetSelection();
cobox_idx--;
m_combobox_plate->SetSelection(cobox_idx);
update_when_change_plate(m_plate_choices[cobox_idx]);
}
void SyncAmsInfoDialog::update_swipe_button_state()
{
m_swipe_left_button->Enable();
m_swipe_left_button->SetToolTip("");
m_swipe_right_button->Enable();
m_swipe_right_button->SetToolTip("");
if (m_combobox_plate->GetSelection() == 0) { // auto plate_index = m_plate_choices[m_combobox_plate->GetSelection()];
m_swipe_left_button->Disable();
}
if (m_combobox_plate->GetSelection() == m_combobox_plate->GetCount() - 1) {
m_swipe_right_button->Disable();
}
}
void SyncAmsInfoDialog::updata_ui_when_priner_not_same() {
show_color_panel(false);
m_are_you_sure_title->Show(false);
if (m_mode_combox_sizer)
m_mode_combox_sizer->Show(false);
m_button_cancel->Hide();
m_button_ok->Show();
m_button_ok->SetLabel(_L("OK"));
m_confirm_title->Show();
m_confirm_title->SetLabel(_L("The connected printer does not match the currently selected printer. Please change the selected printer."));
SetMinSize(wxSize(FromDIP(800), -1));
SetMaxSize(wxSize(FromDIP(800), -1));
Layout();
Fit();
}
SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) :
@ -539,14 +669,14 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) :
GUI::PartPlateList &plate_list = wxGetApp().plater()->get_partplate_list();
GUI::PartPlate * curr_plate = GUI::wxGetApp().plater()->get_partplate_list().get_selected_plate();
m_is_empty_project = true;
wxArrayString choices;
m_plate_number_choices_str.clear();
for (size_t i = 0; i < plate_list.get_plate_count(); i++) {
auto temp_plate = GUI::wxGetApp().plater()->get_partplate_list().get_plate(i);
if (!temp_plate->get_objects_on_this_plate().empty()) {
if (m_is_empty_project) {
m_is_empty_project = false;
}
choices.Add(i < 10 ? ("0"+std::to_wstring(i + 1)) : std::to_wstring(i));
m_plate_number_choices_str.Add(i < 10 ? ("0" + std::to_wstring(i + 1)) : std::to_wstring(i));
m_plate_choices.emplace_back(i);
}
}
@ -570,29 +700,6 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) :
{ // choose camera view angle type
m_plate_combox_sizer = new wxBoxSizer(wxHORIZONTAL);
m_plate_combox_sizer->AddSpacer(FromDIP(25));
wxStaticText *chose_combox_title = new wxStaticText(this, wxID_ANY, _L("Plate"));
m_plate_combox_sizer->Add(chose_combox_title, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxEXPAND | wxTOP, FromDIP(6));
wxStaticText *space_title = new wxStaticText(this, wxID_ANY, " ");
m_plate_combox_sizer->Add(space_title, FromDIP(0), wxALIGN_LEFT | wxALL, FromDIP(0));
auto cur_combox = new ComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(50), -1), 0, NULL, wxCB_READONLY);
for (size_t i = 0; i < choices.size(); i++) {
cur_combox->Append(choices[i]);
}
auto iter = std::find(m_plate_choices.begin(), m_plate_choices.end(), m_specify_plate_idx);
if (iter != m_plate_choices.end()) {
auto index = iter - m_plate_choices.begin();
cur_combox->SetSelection(index);
}
cur_combox->Bind(wxEVT_COMBOBOX, [this](auto &e) {
if (e.GetSelection() < m_plate_choices.size()) {
update_when_change_plate(m_plate_choices[e.GetSelection()]);
Layout();
Fit();
}
});
m_plate_combox_sizer->Add(cur_combox, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM, FromDIP(3));
m_plate_combox_sizer->AddStretchSpacer(1); // m_plate_combox_sizer->AddSpacer(FromDIP(230));
m_printer_title = new wxStaticText(this, wxID_ANY, _L("Printer") + ": ");
@ -1217,7 +1324,7 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) :
bSizer->Add(more_setting_sizer, 0, wxEXPAND | wxLEFT, FromDIP(25));
wxBoxSizer *confirm_boxsizer = new wxBoxSizer(wxVERTICAL);
m_confirm_title = new wxStaticText(this, wxID_ANY, "After sync, all currently configured filament presets and colors will be discarded.",
m_confirm_title = new wxStaticText(this, wxID_ANY, _L("After sync, all currently configured filament presets and colors will be discarded."),
wxDefaultPosition, wxDefaultSize);
//m_confirm_title->Wrap(FromDIP(SyncAmsInfoDialogWidth - 50));
//m_confirm_title->SetFont(Label::Head_14);
@ -1241,7 +1348,7 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) :
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));
m_button_ok = new Button(this, _L("Synchronize now"));
m_button_ok = new Button(this, m_input_info.connected_printer ? _L("Synchronize now") : _L("OK"));
m_button_ok->SetBackgroundColor(btn_bg_green);
m_button_ok->SetBorderColor(*wxWHITE);
m_button_ok->SetTextColor(wxColour(0xFFFFFE));
@ -2021,7 +2128,7 @@ bool SyncAmsInfoDialog::has_tips(MachineObject *obj)
void SyncAmsInfoDialog::show_status(PrintDialogStatus status, std::vector<wxString> params)
{
if (m_print_status != status) {
m_is_same_printer = true;
m_result.is_same_printer = true;
update_printer_name();
BOOST_LOG_TRIVIAL(info) << "select_machine_dialog: show_status = " << status << "(" << get_print_status_info(status) << ")";
}
@ -2189,9 +2296,13 @@ void SyncAmsInfoDialog::show_status(PrintDialogStatus status, std::vector<wxStri
target_print_name.Replace(wxT("Bambu Lab "), wxEmptyString);
msg_text = wxString::Format(_L("The selected printer (%s) is incompatible with the chosen printer profile in the slicer (%s)."), sourcet_print_name,
target_print_name);
m_is_same_printer = false;
update_printer_name();
update_print_status_msg(msg_text, true, true);
if (m_result.is_same_printer) {
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 (...) {}
Enable_Send_Button(false);
@ -3867,7 +3978,7 @@ void SyncAmsInfoDialog::reset_and_sync_ams_list()
m_sizer_ams_mapping->Add(item, 0, wxALL, FromDIP(5));
}
contronal_index++;
item->SetToolTip(_L("Top half of combobox: Original\nDown half of combobox: Filament of AMS\nAnd you can click it to modify"));
item->SetToolTip(_L("Up: Original\nDown: filament in AMS\nAnd you can click it to modify it."));
item->Bind(wxEVT_LEFT_UP, [this, item, materials, extruder](wxMouseEvent &e) {});
item->Bind(wxEVT_LEFT_DOWN, [this, item, materials, extruder](wxMouseEvent &e) {
MaterialHash::iterator iter = m_materialList.begin();
@ -4342,7 +4453,11 @@ wxString SyncAmsInfoDialog::format_bed_name(std::string plate_name)
return name;
}
SyncAmsInfoDialog::~SyncAmsInfoDialog() { delete m_refresh_timer; }
SyncAmsInfoDialog::~SyncAmsInfoDialog() {
if (m_refresh_timer) {
delete m_refresh_timer;
}
}
void SyncAmsInfoDialog::update_lan_machine_list()
{

View File

@ -127,9 +127,26 @@ protected:
std::vector<wxColour> m_cur_colors_in_thumbnail;
std::vector<bool> m_edge_pixels;
StaticBox *m_filament_panel;
StaticBox *m_filament_left_panel;
StaticBox *m_filament_right_panel;
StaticBox * m_two_image_panel{nullptr};
wxBoxSizer *m_two_image_panel_sizer{nullptr};
StaticBox *m_two_thumbnail_panel{nullptr};
wxBoxSizer *m_two_thumbnail_panel_sizer{nullptr};
wxBoxSizer *m_choose_plate_sizer{nullptr};
ComboBox * m_combobox_plate{nullptr};
//TextInput *m_plate_number{nullptr};
wxArrayString m_plate_number_choices_str;
std::vector<int> m_plate_choices;
ScalableButton * m_swipe_left_button{nullptr};
ScalableButton * m_swipe_right_button{nullptr};
int m_bmp_pix_cont = 32;
ScalableBitmap m_swipe_left_bmp_normal;
ScalableBitmap m_swipe_left_bmp_hover;
ScalableBitmap m_swipe_right_bmp_normal;
ScalableBitmap m_swipe_right_bmp_hover;
StaticBox *m_filament_panel{nullptr};
StaticBox *m_filament_left_panel{nullptr};
StaticBox *m_filament_right_panel{nullptr};
wxBoxSizer *m_filament_panel_sizer;
wxBoxSizer *m_filament_panel_left_sizer;
@ -234,6 +251,7 @@ public:
struct SyncResult
{
bool direct_sync = true;
bool is_same_printer = true;
std::map<int, AMSMapInfo> sync_maps;
};
SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info);
@ -264,9 +282,14 @@ private:
void update_when_change_map_mode(int);
void update_when_change_map_mode(wxCommandEvent &e);
void update_panel_status(PageType page);
void show_color_panel(bool);
void show_color_panel(bool,bool update_layout = true);
void update_more_setting(bool layout = true);
void add_two_image_control();
void to_next_plate(wxCommandEvent &event);
void to_previous_plate(wxCommandEvent &event);
void update_swipe_button_state();
void updata_ui_when_priner_not_same();
void init_bitmaps();
private:
SyncInfo & m_input_info;
@ -291,7 +314,6 @@ private:
wxBoxSizer * m_plate_combox_sizer = nullptr;
wxBoxSizer * m_mode_combox_sizer = nullptr;
wxBoxSizer * m_sizer_two_image = nullptr;
wxBoxSizer * m_sizer_line = nullptr;
wxStaticText * m_printer_title = nullptr;
wxStaticText * m_printer_device_name = nullptr;
@ -307,12 +329,13 @@ private:
CheckBox* m_merge_color_checkbox = nullptr;
wxStaticText * m_merge_color_text = nullptr;
bool m_is_empty_project = true;
bool m_is_same_printer = true;
bool m_check_dirty_fialment = true;
bool m_expand_more_settings = false;
bool m_image_is_top = false;
std::vector<int> m_plate_choices;
const int THUMBNAIL_SIZE_WIDTH = 200;
const int LEFT_THUMBNAIL_SIZE_WIDTH = 100;
const int RIGHT_THUMBNAIL_SIZE_WIDTH = 300;
int m_specify_plate_idx{0};
wxString m_printer_name;