ENH:add "only_external_material" logic

jira: STUDIO-9985
Change-Id: Iac15989bea39d1571eab66199737472381832017
This commit is contained in:
zhou.xu 2025-01-18 18:21:53 +08:00 committed by lane.wei
parent 36322e7cdb
commit d317055f42
3 changed files with 13 additions and 7 deletions

View File

@ -485,7 +485,7 @@ struct Sidebar::priv
void jump_to_object(ObjectDataViewModelNode* item);
void can_search();
bool sync_extruder_list();
bool sync_extruder_list(bool &only_external_material);
bool switch_diameter(bool single);
void update_sync_status(const MachineObject* obj);
@ -1124,7 +1124,7 @@ bool Sidebar::priv::switch_diameter(bool single)
return wxGetApp().get_tab(Preset::TYPE_PRINTER)->select_preset(preset->name);
}
bool Sidebar::priv::sync_extruder_list()
bool Sidebar::priv::sync_extruder_list(bool &only_external_material)
{
MachineObject *obj = wxGetApp().getDeviceManager()->get_selected_machine();
if (obj == nullptr) {
@ -1205,7 +1205,10 @@ bool Sidebar::priv::sync_extruder_list()
++deputy_4;
}
}
only_external_material = false;
if (obj->amsList.size() == 0) {
only_external_material = true;
}
int main_index = obj->is_main_extruder_on_left() ? 0 : 1;
int deputy_index = obj->is_main_extruder_on_left() ? 1 : 0;
@ -2763,7 +2766,8 @@ std::map<int, DynamicPrintConfig> Sidebar::build_filament_ams_list(MachineObject
bool Sidebar::sync_extruder_list()
{
return p->sync_extruder_list();
bool only_external_material;
return p->sync_extruder_list(only_external_material);
}
bool Sidebar::need_auto_sync_extruder_list_after_connect_priner(const MachineObject *obj)
@ -3090,7 +3094,8 @@ bool Sidebar::is_multifilament()
}
void Sidebar::deal_btn_sync() {
auto ok = p->sync_extruder_list();
bool only_external_material;
auto ok = p->sync_extruder_list(only_external_material);
if (ok) {
SyncNozzleAndAmsDialog::InputInfo temp_na_info;
wxPoint big_btn_pt;
@ -3104,7 +3109,7 @@ void Sidebar::deal_btn_sync() {
auto cur_dialog_pos = small_btn_pt + wxPoint(small_btn_size.x * 3.6 + 5, 0);
temp_na_info.dialog_pos.x = cur_dialog_pos.x;
temp_na_info.dialog_pos.y += FromDIP(2);
temp_na_info.only_external_material = only_external_material;
if (m_sna_dialog) {
m_sna_dialog.reset();
}

View File

@ -4384,7 +4384,7 @@ SyncNozzleAndAmsDialog::SyncNozzleAndAmsDialog(wxWindow *parent, InputInfo &inpu
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 = new Button(this, m_input_info.only_external_material ? _L("Sync filament") : _L("Sync AMS filament"));
m_button_ok->SetBackgroundColor(btn_bg_green);
m_button_ok->SetBorderWidth(0);
m_button_ok->SetTextColor(wxColour(0xFEFEFE));

View File

@ -355,6 +355,7 @@ public:
struct InputInfo
{
wxPoint dialog_pos{wxPoint(400, 200)};
bool only_external_material = false;
};
struct ResultInfo
{};