ENH:update SyncAmsInfoDialog

jira: none
Change-Id: I7549dd3334fd9bcc4eba5d3b41786516fd879f38
This commit is contained in:
zhou.xu 2025-01-16 09:21:37 +08:00 committed by lane.wei
parent 19e8ab2648
commit 9b1717fa56
8 changed files with 31 additions and 23 deletions

View File

@ -172,7 +172,7 @@ void AppConfig::set_defaults()
if (get("enable_append_color_by_sync_ams").empty()) if (get("enable_append_color_by_sync_ams").empty())
set_bool("enable_append_color_by_sync_ams", false); set_bool("enable_append_color_by_sync_ams", false);
if (get("enable_merge_color_by_sync_ams").empty()) if (get("enable_merge_color_by_sync_ams").empty())
set_bool("enable_merge_color_by_sync_ams", true); set_bool("enable_merge_color_by_sync_ams", false);
if (get("zoom_to_mouse").empty()) if (get("zoom_to_mouse").empty())
set_bool("zoom_to_mouse", false); set_bool("zoom_to_mouse", false);

View File

@ -354,13 +354,13 @@ AmsMapingPopup::AmsMapingPopup(wxWindow *parent)
m_right_extra_slot->SetMinSize(wxSize(FromDIP(48), FromDIP(60))); m_right_extra_slot->SetMinSize(wxSize(FromDIP(48), FromDIP(60)));
m_right_extra_slot->SetMaxSize(wxSize(FromDIP(48), FromDIP(60))); m_right_extra_slot->SetMaxSize(wxSize(FromDIP(48), FromDIP(60)));
m_sizer_ams_left->Add(create_split_sizer(m_left_marea_panel, _L("Left Ams")), 0, wxEXPAND, 0); m_sizer_ams_left->Add(create_split_sizer(m_left_marea_panel, _L("Left AMS")), 0, wxEXPAND, 0);
m_sizer_ams_left->Add(m_sizer_ams_basket_left, 0, wxEXPAND|wxTOP, FromDIP(8)); m_sizer_ams_left->Add(m_sizer_ams_basket_left, 0, wxEXPAND|wxTOP, FromDIP(8));
m_sizer_ams_left->Add(create_split_sizer(m_left_marea_panel, _L("External")), 0, wxEXPAND|wxTOP, FromDIP(8)); m_sizer_ams_left->Add(create_split_sizer(m_left_marea_panel, _L("External")), 0, wxEXPAND|wxTOP, FromDIP(8));
//m_sizer_ams_left->Add(m_left_extra_slot, 0, wxEXPAND|wxTOP, FromDIP(8)); //m_sizer_ams_left->Add(m_left_extra_slot, 0, wxEXPAND|wxTOP, FromDIP(8));
m_sizer_ams_left->Add(sizer_temp, 0, wxEXPAND | wxTOP, FromDIP(8)); m_sizer_ams_left->Add(sizer_temp, 0, wxEXPAND | wxTOP, FromDIP(8));
m_right_split_ams_sizer = create_split_sizer(m_right_marea_panel, _L("Right Ams")); m_right_split_ams_sizer = create_split_sizer(m_right_marea_panel, _L("Right AMS"));
m_sizer_ams_right->Add(m_right_split_ams_sizer, 0, wxEXPAND, 0); m_sizer_ams_right->Add(m_right_split_ams_sizer, 0, wxEXPAND, 0);
m_sizer_ams_right->Add(m_sizer_ams_basket_right, 0, wxEXPAND|wxTOP, FromDIP(8)); m_sizer_ams_right->Add(m_sizer_ams_basket_right, 0, wxEXPAND|wxTOP, FromDIP(8));
m_sizer_ams_right->Add(create_split_sizer(m_right_marea_panel, _L("External")), 0, wxEXPAND|wxTOP, FromDIP(8)); m_sizer_ams_right->Add(create_split_sizer(m_right_marea_panel, _L("External")), 0, wxEXPAND|wxTOP, FromDIP(8));
@ -575,7 +575,7 @@ void AmsMapingPopup::update(MachineObject* obj)
else if (m_show_type == ShowType::RIGHT) else if (m_show_type == ShowType::RIGHT)
{ {
m_right_marea_panel->Show(); m_right_marea_panel->Show();
set_sizer_title(m_right_split_ams_sizer, _L("Right Ams")); set_sizer_title(m_right_split_ams_sizer, _L("Right AMS"));
m_right_extra_slot->Show(); m_right_extra_slot->Show();
} }
else if (m_show_type == ShowType::LEFT_AND_RIGHT) else if (m_show_type == ShowType::LEFT_AND_RIGHT)
@ -585,7 +585,7 @@ void AmsMapingPopup::update(MachineObject* obj)
m_left_marea_panel->Show(); m_left_marea_panel->Show();
m_left_extra_slot->Show(); m_left_extra_slot->Show();
m_right_marea_panel->Show(); m_right_marea_panel->Show();
set_sizer_title(m_right_split_ams_sizer, _L("Right Ams")); set_sizer_title(m_right_split_ams_sizer, _L("Right AMS"));
m_right_extra_slot->Show(); m_right_extra_slot->Show();
} }
} }
@ -1389,7 +1389,7 @@ void AmsIntroducePopup::set_mode(bool enable_ams)
{ {
if (enable_ams) { if (enable_ams) {
m_staticText_top->SetLabelText(_L("Enable AMS")); m_staticText_top->SetLabelText(_L("Enable AMS"));
m_staticText_bottom->SetLabelText(_L("Print with filaments in ams")); m_staticText_bottom->SetLabelText(_L("Print with filaments in AMS"));
m_img_enable_ams->Show(); m_img_enable_ams->Show();
m_img_disable_ams->Hide(); m_img_disable_ams->Hide();
} }

View File

@ -2774,8 +2774,11 @@ void Sidebar::update_sync_status(const MachineObject *obj)
void Sidebar::load_ams_list(std::string const &device, MachineObject* obj) void Sidebar::load_ams_list(std::string const &device, MachineObject* obj)
{ {
std::map<int, DynamicPrintConfig> filament_ams_list = build_filament_ams_list(obj); std::map<int, DynamicPrintConfig> filament_ams_list = build_filament_ams_list(obj);
bool device_change = false;
p->ams_list_device = device; if (p->ams_list_device != device) {
p->ams_list_device = device;
device_change = true;
}
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": %1% items") % filament_ams_list.size(); BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": %1% items") % filament_ams_list.size();
if (wxGetApp().preset_bundle->filament_ams_list == filament_ams_list) if (wxGetApp().preset_bundle->filament_ams_list == filament_ams_list)
return; return;
@ -2783,7 +2786,9 @@ void Sidebar::load_ams_list(std::string const &device, MachineObject* obj)
for (auto c : p->combos_filament){ for (auto c : p->combos_filament){
c->update(); c->update();
c->ShowBadge(false);//change printer,then clear badge if (device_change) {
c->ShowBadge(false);//change printer,then clear badge
}
} }
p->combo_printer->update(); p->combo_printer->update();

View File

@ -1761,7 +1761,7 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt
Enable_Send_Button(false); Enable_Send_Button(false);
Enable_Refresh_Button(true); Enable_Refresh_Button(true);
} else if (status == PrintDialogStatus::PrintStatusAmsMappingMixInvalid) { } else if (status == PrintDialogStatus::PrintStatusAmsMappingMixInvalid) {
wxString msg_text = _L("Please do not mix-use the Ext with Ams"); wxString msg_text = _L("Please do not mix-use the Ext with AMS");
update_print_status_msg(msg_text, true, false); update_print_status_msg(msg_text, true, false);
Enable_Send_Button(false); Enable_Send_Button(false);
Enable_Refresh_Button(true); Enable_Refresh_Button(true);

View File

@ -1241,13 +1241,13 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) :
bSizer_button->AddStretchSpacer(1); 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), 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)); std::pair<wxColour, int>(AMS_CONTROL_BRAND_COLOUR, StateColor::Normal));
m_button_ok = new Button(this, _L("OK")); m_button_ok = new Button(this, _L("Synchronize now"));
m_button_ok->SetBackgroundColor(btn_bg_green); m_button_ok->SetBackgroundColor(btn_bg_green);
m_button_ok->SetBorderColor(*wxWHITE); m_button_ok->SetBorderColor(*wxWHITE);
m_button_ok->SetTextColor(wxColour(0xFFFFFE)); m_button_ok->SetTextColor(wxColour(0xFFFFFE));
m_button_ok->SetFont(Label::Body_12); m_button_ok->SetFont(Label::Body_12);
m_button_ok->SetSize(BUTTON_SIZE); m_button_ok->SetSize(wxSize(FromDIP(90), FromDIP(24)));
m_button_ok->SetMinSize(BUTTON_SIZE); m_button_ok->SetMinSize(wxSize(FromDIP(90), FromDIP(24)));
m_button_ok->SetCornerRadius(FromDIP(12)); m_button_ok->SetCornerRadius(FromDIP(12));
bSizer_button->Add(m_button_ok, 0, wxALIGN_RIGHT | wxLEFT | wxTOP, FromDIP(10)); bSizer_button->Add(m_button_ok, 0, wxALIGN_RIGHT | wxLEFT | wxTOP, FromDIP(10));
@ -1260,7 +1260,7 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) :
StateColor btn_bg_white(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Pressed), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered), 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)); std::pair<wxColour, int>(*wxWHITE, StateColor::Normal));
m_button_cancel = new Button(this, _L("Cancel")); m_button_cancel = new Button(this, m_input_info.cancel_text_to_later ? _L("Later") :_L("Cancel"));
m_button_cancel->SetBackgroundColor(btn_bg_white); m_button_cancel->SetBackgroundColor(btn_bg_white);
m_button_cancel->SetBorderColor(wxColour(38, 46, 48)); m_button_cancel->SetBorderColor(wxColour(38, 46, 48));
m_button_cancel->SetFont(Label::Body_12); m_button_cancel->SetFont(Label::Body_12);
@ -2105,7 +2105,7 @@ void SyncAmsInfoDialog::show_status(PrintDialogStatus status, std::vector<wxStri
Enable_Send_Button(false); Enable_Send_Button(false);
Enable_Refresh_Button(true); Enable_Refresh_Button(true);
} else if (status == PrintDialogStatus::PrintStatusAmsMappingMixInvalid) { } else if (status == PrintDialogStatus::PrintStatusAmsMappingMixInvalid) {
wxString msg_text = _L("Please do not mix-use the Ext with Ams"); wxString msg_text = _L("Please do not mix-use the Ext with AMS");
update_print_status_msg(msg_text, true, false); update_print_status_msg(msg_text, true, false);
Enable_Send_Button(false); Enable_Send_Button(false);
Enable_Refresh_Button(true); Enable_Refresh_Button(true);

View File

@ -229,6 +229,7 @@ public:
{ {
bool connected_printer = false; bool connected_printer = false;
bool first_sync = false; bool first_sync = false;
bool cancel_text_to_later = false;
}; };
struct SyncResult struct SyncResult
{ {

View File

@ -122,14 +122,15 @@ void ComboBox::SetLabel(const wxString &value)
else { else {
if (is_replace_text_to_image) { if (is_replace_text_to_image) {
auto new_value = value; auto new_value = value;
new_value.Replace(replace_text, "", false);//replace first text if (new_value.starts_with(replace_text)) {
TextInput::SetIcon_1(image_for_text); new_value.Replace(replace_text, "", false); // replace first text
TextInput::SetLabel(new_value); TextInput::SetIcon_1(image_for_text);
} TextInput::SetLabel(new_value);
else { return;
TextInput::SetIcon_1(""); }
TextInput::SetLabel(value);
} }
TextInput::SetIcon_1("");
TextInput::SetLabel(value);
} }
} }

View File

@ -117,7 +117,7 @@ void TextInput::SetIcon_1(const wxString &icon) {
this->icon_1 = ScalableBitmap(); this->icon_1 = ScalableBitmap();
return; return;
} }
this->icon_1 = ScalableBitmap(this, icon.ToStdString(), 16); this->icon_1 = ScalableBitmap(this, icon.ToStdString(), 14);
Rescale(); Rescale();
} }
@ -237,6 +237,7 @@ void TextInput::render(wxDC& dc)
if (pt.x * 2 + szIcon.x + 0 + labelSize.x < size.x) if (pt.x * 2 + szIcon.x + 0 + labelSize.x < size.x)
pt.x = (size.x - (szIcon.x + 0 + labelSize.x)) / 2; pt.x = (size.x - (szIcon.x + 0 + labelSize.x)) / 2;
} }
pt.x += szIcon.x / 4.f;
dc.DrawBitmap(icon_1.bmp(), pt); dc.DrawBitmap(icon_1.bmp(), pt);
pt.x += szIcon.x + 0; pt.x += szIcon.x + 0;
} }