FIX: update the text and icon while mapping

jira: [STUDIO-11679]
Change-Id: Ia744c27e3236ffa7c2157867b026e91c210dd5bf
This commit is contained in:
xin.zhang 2025-04-21 15:15:44 +08:00 committed by Lane.Wei
parent 5956cae5b4
commit e685e57839
4 changed files with 38 additions and 17 deletions

View File

@ -1,3 +1,4 @@
<svg width="24" height="25" viewBox="0 0 24 25" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 4.37012C14.1549 4.37012 16.2215 5.22614 17.7452 6.74987C19.269 8.27361 20.125 10.3402 20.125 12.4951C20.125 14.65 19.269 16.7166 17.7452 18.2404C16.2215 19.7641 14.1549 20.6201 12 20.6201C9.84512 20.6201 7.77849 19.7641 6.25476 18.2404C4.73102 16.7166 3.875 14.65 3.875 12.4951C3.875 10.3402 4.73102 8.27361 6.25476 6.74987C7.77849 5.22614 9.84512 4.37012 12 4.37012ZM12 22.4951C14.6522 22.4951 17.1957 21.4415 19.0711 19.5662C20.9464 17.6908 22 15.1473 22 12.4951C22 9.84295 20.9464 7.29941 19.0711 5.42405C17.1957 3.54869 14.6522 2.49512 12 2.49512C9.34784 2.49512 6.8043 3.54869 4.92893 5.42405C3.05357 7.29941 2 9.84295 2 12.4951C2 15.1473 3.05357 17.6908 4.92893 19.5662C6.8043 21.4415 9.34784 22.4951 12 22.4951ZM12 7.49512C11.4805 7.49512 11.0625 7.91309 11.0625 8.43262V12.8076C11.0625 13.3271 11.4805 13.7451 12 13.7451C12.5195 13.7451 12.9375 13.3271 12.9375 12.8076V8.43262C12.9375 7.91309 12.5195 7.49512 12 7.49512ZM13.25 16.2451C13.25 15.9136 13.1183 15.5957 12.8839 15.3612C12.6495 15.1268 12.3315 14.9951 12 14.9951C11.6685 14.9951 11.3505 15.1268 11.1161 15.3612C10.8817 15.5957 10.75 15.9136 10.75 16.2451C10.75 16.5766 10.8817 16.8946 11.1161 17.129C11.3505 17.3634 11.6685 17.4951 12 17.4951C12.3315 17.4951 12.6495 17.3634 12.8839 17.129C13.1183 16.8946 13.25 16.5766 13.25 16.2451Z" fill="#D01B1B"/>
<svg width="35" height="25" viewBox="0 0 35 25" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M26.7876 10.739L29.899 13.8505C30.0943 14.0458 30.4109 14.0458 30.6061 13.8505L33.7177 10.739" stroke="#ACACAC" stroke-linecap="round"/>
<path d="M12 4.34668C14.1549 4.34668 16.2215 5.2027 17.7452 6.72644C19.269 8.25017 20.125 10.3168 20.125 12.4717C20.125 14.6266 19.269 16.6932 17.7452 18.2169C16.2215 19.7407 14.1549 20.5967 12 20.5967C9.84512 20.5967 7.77849 19.7407 6.25476 18.2169C4.73102 16.6932 3.875 14.6266 3.875 12.4717C3.875 10.3168 4.73102 8.25017 6.25476 6.72644C7.77849 5.2027 9.84512 4.34668 12 4.34668ZM12 22.4717C14.6522 22.4717 17.1957 21.4181 19.0711 19.5427C20.9464 17.6674 22 15.1238 22 12.4717C22 9.81951 20.9464 7.27598 19.0711 5.40061C17.1957 3.52525 14.6522 2.47168 12 2.47168C9.34784 2.47168 6.8043 3.52525 4.92893 5.40061C3.05357 7.27598 2 9.81951 2 12.4717C2 15.1238 3.05357 17.6674 4.92893 19.5427C6.8043 21.4181 9.34784 22.4717 12 22.4717ZM12 7.47168C11.4805 7.47168 11.0625 7.88965 11.0625 8.40918V12.7842C11.0625 13.3037 11.4805 13.7217 12 13.7217C12.5195 13.7217 12.9375 13.3037 12.9375 12.7842V8.40918C12.9375 7.88965 12.5195 7.47168 12 7.47168ZM13.25 16.2217C13.25 15.8902 13.1183 15.5722 12.8839 15.3378C12.6495 15.1034 12.3315 14.9717 12 14.9717C11.6685 14.9717 11.3505 15.1034 11.1161 15.3378C10.8817 15.5722 10.75 15.8902 10.75 16.2217C10.75 16.5532 10.8817 16.8711 11.1161 17.1056C11.3505 17.34 11.6685 17.4717 12 17.4717C12.3315 17.4717 12.6495 17.34 12.8839 17.1056C13.1183 16.8711 13.25 16.5532 13.25 16.2217Z" fill="#D01B1B"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -816,7 +816,7 @@ void AmsMapingPopup::set_tag_texture(std::string texture)
}
bool AmsMapingPopup::is_match_material(std::string material)
bool AmsMapingPopup::is_match_material(std::string material) const
{
return m_tag_material == material ? true : false;
}
@ -1300,9 +1300,9 @@ void AmsMapingPopup::add_ams_mapping(std::vector<TrayData> tray_data, bool remai
if (tray_data[i].type == NORMAL) {
if (is_match_material(tray_data[i].filament_type)) {
m_mapping_item->set_data(tray_data[i].colour, tray_data[i].name, remain_detect_flag, tray_data[i]);
m_mapping_item->set_data(m_tag_material, tray_data[i].colour, tray_data[i].name, remain_detect_flag, tray_data[i]);
} else {
m_mapping_item->set_data(wxColour(0xEE, 0xEE, 0xEE), tray_data[i].name, remain_detect_flag, tray_data[i], true);
m_mapping_item->set_data(m_tag_material, wxColour(0xEE, 0xEE, 0xEE), tray_data[i].name, remain_detect_flag, tray_data[i], true);
m_has_unmatch_filament = true;
}
@ -1316,7 +1316,7 @@ void AmsMapingPopup::add_ams_mapping(std::vector<TrayData> tray_data, bool remai
// temp
if (tray_data[i].type == EMPTY) {
m_mapping_item->set_data(wxColour(0xCE, 0xCE, 0xCE), "-", remain_detect_flag, tray_data[i]);
m_mapping_item->set_data(m_tag_material, wxColour(0xCE, 0xCE, 0xCE), "-", remain_detect_flag, tray_data[i]);
m_mapping_item->Bind(wxEVT_LEFT_DOWN, [this, tray_data, i, m_mapping_item](wxMouseEvent &e) {
if (!m_mapping_from_multi_machines) {
@ -1331,7 +1331,7 @@ void AmsMapingPopup::add_ams_mapping(std::vector<TrayData> tray_data, bool remai
// third party
if (tray_data[i].type == THIRD) {
m_mapping_item->set_data(wxColour(0xCE, 0xCE, 0xCE), "?", remain_detect_flag, tray_data[i]);
m_mapping_item->set_data(m_tag_material, wxColour(0xCE, 0xCE, 0xCE), "?", remain_detect_flag, tray_data[i]);
m_mapping_item->Bind(wxEVT_LEFT_DOWN, [this, tray_data, i, m_mapping_item](wxMouseEvent &e) {
m_mapping_item->send_event(m_current_filament_id);
Dismiss();
@ -1351,10 +1351,10 @@ void AmsMapingPopup::add_ext_ams_mapping(TrayData tray_data, MappingItem* item)
// set button
if (tray_data.type == NORMAL) {
if (is_match_material(tray_data.filament_type)) {
item->set_data(tray_data.colour, tray_data.name, false, tray_data);
item->set_data(m_tag_material, tray_data.colour, tray_data.name, false, tray_data);
}
else {
item->set_data(wxColour(0xEE, 0xEE, 0xEE), tray_data.name, false, tray_data, true);
item->set_data(m_tag_material, wxColour(0xEE, 0xEE, 0xEE), tray_data.name, false, tray_data, true);
m_has_unmatch_filament = true;
}
@ -1368,7 +1368,7 @@ void AmsMapingPopup::add_ext_ams_mapping(TrayData tray_data, MappingItem* item)
// temp
if (tray_data.type == EMPTY) {
item->set_data(wxColour(0xCE, 0xCE, 0xCE), "-", false, tray_data);
item->set_data(m_tag_material, wxColour(0xCE, 0xCE, 0xCE), "-", false, tray_data);
item->Bind(wxEVT_LEFT_DOWN, [this, tray_data,item](wxMouseEvent& e) {
item->send_event(m_current_filament_id);
Dismiss();
@ -1377,7 +1377,7 @@ void AmsMapingPopup::add_ext_ams_mapping(TrayData tray_data, MappingItem* item)
// third party
if (tray_data.type == THIRD) {
item->set_data(tray_data.colour, "?", false, tray_data);
item->set_data(m_tag_material, tray_data.colour, "?", false, tray_data);
//item->set_data(wxColour(0xCE, 0xCE, 0xCE), "?", tray_data);
item->Bind(wxEVT_LEFT_DOWN, [this, tray_data, item](wxMouseEvent& e) {
item->send_event(m_current_filament_id);
@ -1541,7 +1541,7 @@ void MappingItem::render(wxDC &dc)
dc.DrawText(m_name, wxPoint((GetSize().x - txt_size.x) / 2, top));
}
void MappingItem::set_data(wxColour colour, wxString name, bool remain_dect, TrayData data, bool unmatch)
void MappingItem::set_data(const wxString &tag_name, wxColour colour, wxString name, bool remain_dect, TrayData data, bool unmatch)
{
m_unmatch = unmatch;
m_tray_data = data;
@ -1556,7 +1556,20 @@ void MappingItem::set_data(wxColour colour, wxString name, bool remain_dect, Tra
if (m_unmatch || (m_name == "-"))
{
SetToolTip(_L("Note: Only the AMS slots loaded with the same material type can be selected."));
if (m_unmatch) {
if (!m_name.IsEmpty() && (m_name != "-")) {
const wxString &msg = wxString::Format(_L("Note: the filament type(%s) does not match with the filament type(%s) in the slicing file. "
"If you want to use this slot, you can install %s instead of %s and change slot information on the 'Device' page."),
m_name, tag_name, m_name, tag_name);
SetToolTip(msg);
} else {
const wxString &msg = wxString::Format(_L("Note: the slot is empty or undefined. If you want to use this slot, you can install %s and change slot information on the 'Device' page."), tag_name);
SetToolTip(msg);
}
} else {
SetToolTip(_L("Note: Only the AMS slots loaded with the same material type can be selected."));
}
}
else
{

View File

@ -162,7 +162,7 @@ public:
public:
void update_data(TrayData data);
void send_event(int fliament_id);
void set_data(wxColour colour, wxString name, bool remain_detect, TrayData data, bool unmatch = false);
void set_data(const wxString& tag_name, wxColour colour, wxString name, bool remain_detect, TrayData data, bool unmatch = false);
void set_checked(bool checked);
void set_tray_index(wxString t_index) { m_tray_index = t_index; };
@ -268,7 +268,7 @@ public:
void add_ext_ams_mapping(TrayData tray_data, MappingItem *item);
void set_current_filament_id(int id) { m_current_filament_id = id; };
int get_current_filament_id(){return m_current_filament_id;};
bool is_match_material(std::string material);
bool is_match_material(std::string material) const;
void on_left_down(wxMouseEvent &evt);
virtual void OnDismiss() wxOVERRIDE;
virtual bool ProcessLeftDown(wxMouseEvent &event) wxOVERRIDE;

View File

@ -3891,8 +3891,15 @@ void SelectMachineDialog::change_materialitem_tip(bool no_ams_only_ext)
item->item->SetToolTip(wxEmptyString);
}
else {
if (item->item->GetToolTipText() != m_ams_tooltip) {
item->item->SetToolTip(m_ams_tooltip);
wxString tip_text;
if (item->item->m_match) {
tip_text = _L("Upper half area: Original\nLower half area: Filament in AMS\nAnd you can click it to modify");
} else {
tip_text = _L("Unable to automatically match to suitable filament. Please click to manually match.");
}
if (item->item->GetToolTipText() != tip_text) {
item->item->SetToolTip(tip_text);
}
}
}