mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-08-07 07:59:01 +08:00
FIX:update SyncAmsInfoDialog
jira: none Change-Id: I8c34d47e799c56e2b1887794dc8a7bfaf8904d77
This commit is contained in:
parent
a111b3ae42
commit
e06aed7cbf
@ -360,7 +360,8 @@ AmsMapingPopup::AmsMapingPopup(wxWindow *parent)
|
||||
//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_right->Add(create_split_sizer(m_right_marea_panel, _L("Right Ams")), 0, wxEXPAND, 0);
|
||||
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_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(m_right_extra_slot, 0, wxEXPAND|wxTOP, FromDIP(8));
|
||||
@ -402,7 +403,20 @@ AmsMapingPopup::AmsMapingPopup(wxWindow *parent)
|
||||
});
|
||||
}
|
||||
|
||||
wxBoxSizer* AmsMapingPopup::create_split_sizer(wxWindow* parent, wxString text)
|
||||
void AmsMapingPopup::set_sizer_title(wxBoxSizer *sizer, wxString text) {
|
||||
if (!sizer) { return; }
|
||||
wxSizerItemList items = sizer->GetChildren();
|
||||
for (wxSizerItemList::iterator it = items.begin(); it != items.end(); ++it) {
|
||||
wxSizerItem *item = *it;
|
||||
auto temp_label = dynamic_cast<Label *>((item->GetWindow()));
|
||||
if (temp_label) {
|
||||
temp_label->SetLabel(text);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wxBoxSizer *AmsMapingPopup::create_split_sizer(wxWindow *parent, wxString text)
|
||||
{
|
||||
wxBoxSizer* sizer_split_ams = new wxBoxSizer(wxHORIZONTAL);
|
||||
auto ams_title_text = new Label(parent, text);
|
||||
@ -540,6 +554,7 @@ void AmsMapingPopup::update(MachineObject* obj)
|
||||
m_left_extra_slot->Hide();
|
||||
//m_left_marea_panel->Show();
|
||||
m_right_marea_panel->Show();
|
||||
set_sizer_title(m_right_split_ams_sizer, _L("Ams"));
|
||||
m_right_extra_slot->Show();
|
||||
}
|
||||
else if (nozzle_nums > 1) {
|
||||
@ -560,6 +575,7 @@ void AmsMapingPopup::update(MachineObject* obj)
|
||||
else if (m_show_type == ShowType::RIGHT)
|
||||
{
|
||||
m_right_marea_panel->Show();
|
||||
set_sizer_title(m_right_split_ams_sizer, _L("Right Ams"));
|
||||
m_right_extra_slot->Show();
|
||||
}
|
||||
else if (m_show_type == ShowType::LEFT_AND_RIGHT)
|
||||
@ -569,9 +585,9 @@ void AmsMapingPopup::update(MachineObject* obj)
|
||||
m_left_marea_panel->Show();
|
||||
m_left_extra_slot->Show();
|
||||
m_right_marea_panel->Show();
|
||||
set_sizer_title(m_right_split_ams_sizer, _L("Right Ams"));
|
||||
m_right_extra_slot->Show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (int i = 0; i < obj->vt_slot.size(); i++) {
|
||||
|
@ -179,10 +179,12 @@ public:
|
||||
|
||||
wxPanel* m_left_marea_panel;
|
||||
wxPanel* m_right_marea_panel;
|
||||
wxBoxSizer * m_right_split_ams_sizer{nullptr};
|
||||
|
||||
wxBoxSizer* m_sizer_split_ams_left;
|
||||
wxBoxSizer* m_sizer_split_ams_right;
|
||||
|
||||
void set_sizer_title(wxBoxSizer *sizer, wxString text);
|
||||
wxBoxSizer* create_split_sizer(wxWindow* parent, wxString text);
|
||||
wxString format_text(wxString &m_msg);
|
||||
void set_send_win(wxWindow* win) {send_win = win;};
|
||||
|
@ -2858,6 +2858,22 @@ void Sidebar::sync_ams_list()
|
||||
}
|
||||
}
|
||||
}
|
||||
auto badge_combox_filament = [](PlaterPresetComboBox *c) {
|
||||
auto cur_tip = c->GetToolTip()->GetTip();
|
||||
auto tip = _L("\nMaterial and color information have been synchronized, but slot information is not included.");
|
||||
c->SetToolTip(cur_tip + tip);
|
||||
c->ShowBadge(true);
|
||||
};
|
||||
{ // badge ams filament
|
||||
for (auto &c : p->combos_filament) {//clear flag
|
||||
c->ShowBadge(false);
|
||||
}
|
||||
if (sync_result.direct_sync) {
|
||||
for (auto &c : p->combos_filament) {
|
||||
badge_combox_filament(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!merge_info.is_empty() && wxGetApp().app_config->get_bool("enable_merge_color_by_sync_ams")) { // merge same color and preset filament//use same ams
|
||||
auto reduce_index = [](MergeFilamentInfo &merge_info,int value) {
|
||||
for (size_t i = 0; i < merge_info.merges.size(); i++) {
|
||||
@ -2869,14 +2885,42 @@ void Sidebar::sync_ams_list()
|
||||
}
|
||||
}
|
||||
};
|
||||
std::vector<bool> sync_ams_badges;
|
||||
for (auto iter : sync_result.sync_maps) {
|
||||
sync_ams_badges.push_back(false);
|
||||
if (iter.second.ams_id == "" || iter.second.slot_id == "") {
|
||||
continue;
|
||||
}
|
||||
sync_ams_badges.back() = true;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < merge_info.merges.size(); i++) {
|
||||
auto& cur = merge_info.merges[i];
|
||||
for (size_t j = cur.size() -1; j >= 1 ; j--) {
|
||||
change_filament(cur[j], cur[0]);
|
||||
auto last_index = cur[j];
|
||||
change_filament(last_index, cur[0]);
|
||||
cur.erase(cur.begin() + j);
|
||||
sync_ams_badges.erase(sync_ams_badges.begin() + last_index);
|
||||
reduce_index(merge_info, cur[j]);
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; i < sync_ams_badges.size(); i++) {
|
||||
if (sync_ams_badges[i] == true) {
|
||||
auto &c = p->combos_filament[i];
|
||||
badge_combox_filament(c);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (auto iter : sync_result.sync_maps) {
|
||||
if (iter.second.ams_id == "" || iter.second.slot_id == "") {
|
||||
continue;
|
||||
}
|
||||
auto temp_index = iter.first;
|
||||
if (temp_index < p->combos_filament.size() && temp_index >= 0) {
|
||||
auto &c = p->combos_filament[temp_index];
|
||||
badge_combox_filament(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
Layout();
|
||||
|
||||
@ -7735,6 +7779,8 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt)
|
||||
if (flag != flag_is_change) {
|
||||
sidebar->auto_calc_flushing_volumes(idx);
|
||||
}
|
||||
auto select_flag = combo->GetFlag(selection);
|
||||
combo->ShowBadge(select_flag == (int)PresetComboBox::FilamentAMSType::FROM_AMS);
|
||||
}
|
||||
bool select_preset = !combo->selection_is_changed_according_to_physical_printers();
|
||||
// TODO: ?
|
||||
|
@ -518,7 +518,8 @@ void PresetComboBox::add_ams_filaments(std::string selected, bool alias_name)
|
||||
}
|
||||
auto & tray = entry.second;
|
||||
std::string filament_id = tray.opt_string("filament_id", 0u);
|
||||
if (filament_id.empty()) continue;
|
||||
if (filament_id.empty())
|
||||
continue;
|
||||
auto iter = std::find_if(filaments.begin(), filaments.end(),
|
||||
[&filament_id, this](auto &f) { return f.is_compatible && m_collection->get_preset_base(f) == &f && f.filament_id == filament_id; });
|
||||
if (iter == filaments.end()) {
|
||||
@ -538,6 +539,7 @@ void PresetComboBox::add_ams_filaments(std::string selected, bool alias_name)
|
||||
auto name = tray.opt_string("tray_name", 0u);
|
||||
wxBitmap bmp(*get_extruder_color_icon(color, name, icon_width, 16));
|
||||
int item_id = Append(get_preset_name(*iter), bmp.ConvertToImage(), &m_first_ams_filament + entry.first);
|
||||
SetFlag(GetCount() - 1, (int) FilamentAMSType::FROM_AMS);
|
||||
//validate_selection(id->value == selected); // can not select
|
||||
}
|
||||
m_last_ams_filament = GetCount();
|
||||
|
@ -52,6 +52,11 @@ public:
|
||||
LABEL_ITEM_MAX,
|
||||
};
|
||||
|
||||
enum FilamentAMSType :unsigned int {
|
||||
ORIGINAL ,
|
||||
FROM_AMS,
|
||||
};
|
||||
|
||||
void set_label_marker(int item, LabelItemType label_item_type = LABEL_ITEM_MARKER);
|
||||
bool set_printer_technology(PrinterTechnology pt);
|
||||
|
||||
|
@ -14,12 +14,13 @@
|
||||
#include "Notebook.hpp"
|
||||
#include <chrono>
|
||||
#include "Widgets/Button.hpp"
|
||||
#include "Widgets/CheckBox.hpp"
|
||||
#include "CapsuleButton.hpp"
|
||||
using namespace Slic3r;
|
||||
using namespace Slic3r::GUI;
|
||||
|
||||
#define BUTTON_SIZE wxSize(FromDIP(58), FromDIP(24))
|
||||
#define SyncAmsInfoDialogWidth FromDIP(620)
|
||||
#define SyncAmsInfoDialogWidth FromDIP(675)
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
wxDEFINE_EVENT(EVT_CLEAR_IPADDRESS, wxCommandEvent);
|
||||
@ -353,7 +354,7 @@ wxBoxSizer *SyncAmsInfoDialog::create_sizer_thumbnail(wxButton *image_button, bo
|
||||
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, _L("Original"));
|
||||
auto sync_text = new wxStaticText(this, wxID_ANY, L_CONTEXT("Original", "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));
|
||||
@ -430,8 +431,8 @@ void SyncAmsInfoDialog::show_color_panel(bool flag) {
|
||||
m_more_setting_tips->Show(flag);
|
||||
|
||||
if (!flag) {
|
||||
m_append_color_checkbox->Show(false);
|
||||
m_merge_color_checkbox->Show(false);
|
||||
show_sizer(m_append_color_sizer, false);
|
||||
show_sizer(m_merge_color_sizer, false);
|
||||
}
|
||||
else {
|
||||
update_more_setting();
|
||||
@ -452,9 +453,8 @@ void SyncAmsInfoDialog::show_color_panel(bool flag) {
|
||||
|
||||
void SyncAmsInfoDialog::update_more_setting(bool layout)
|
||||
{
|
||||
m_append_color_checkbox->Show(m_expand_more_settings);
|
||||
m_merge_color_checkbox->Show(m_expand_more_settings);
|
||||
|
||||
show_sizer(m_append_color_sizer, m_expand_more_settings);
|
||||
show_sizer(m_merge_color_sizer, m_expand_more_settings);
|
||||
if (layout) {
|
||||
Layout();
|
||||
Fit();
|
||||
@ -1161,8 +1161,9 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) :
|
||||
wxBoxSizer *tip_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_attention_text = new wxStaticText(this, wxID_ANY, _L("Attention") + ": ");
|
||||
tip_sizer->Add(m_attention_text, 0, wxALIGN_LEFT | wxTOP, FromDIP(2));
|
||||
m_tip_text = new wxStaticText(this, wxID_ANY, _L("Only synchronize filament type and color, not included AMS slot info."));
|
||||
m_tip_text = new wxStaticText(this, wxID_ANY, _L("Only synchronize filament type and color, not including AMS slot information."));
|
||||
m_tip_text->SetForegroundColour(wxColour(107, 107, 107, 100));
|
||||
tip_sizer->AddSpacer(FromDIP(25));
|
||||
tip_sizer->Add(m_tip_text, 0, wxALIGN_LEFT | wxTOP, FromDIP(2));
|
||||
|
||||
bSizer->Add(tip_sizer, 0, wxEXPAND | wxLEFT, FromDIP(25));
|
||||
@ -1178,7 +1179,8 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) :
|
||||
});
|
||||
more_setting_sizer->Add(m_more_setting_tips, 0, wxALIGN_LEFT | wxTOP, FromDIP(4));
|
||||
|
||||
m_append_color_checkbox = new wxCheckBox(this, wxID_ANY, _L("Unused AMS filaments should also be added to the filament list."), wxDefaultPosition, wxDefaultSize, 0);
|
||||
m_append_color_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
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"));
|
||||
@ -1187,9 +1189,17 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) :
|
||||
wxGetApp().app_config->set_bool("enable_append_color_by_sync_ams",!flag);
|
||||
});
|
||||
m_append_color_checkbox->Hide();
|
||||
more_setting_sizer->Add(m_append_color_checkbox, 0, wxALIGN_LEFT | wxTOP, FromDIP(4));
|
||||
m_append_color_sizer->Add(m_append_color_checkbox, 0, wxALIGN_LEFT | wxTOP, FromDIP(4));
|
||||
const int gap_between_checebox_and_text = 2;
|
||||
m_append_color_text = new wxStaticText(this, wxID_ANY, _L("Unused AMS filaments should also be added to the filament list."));
|
||||
m_append_color_text->Hide();
|
||||
m_append_color_sizer->AddSpacer(FromDIP(gap_between_checebox_and_text));
|
||||
m_append_color_sizer->Add(m_append_color_text, 0, wxALIGN_LEFT | wxTOP, FromDIP(4));
|
||||
|
||||
m_merge_color_checkbox = new wxCheckBox(this, wxID_ANY, _L("Automatically merge the same colors in the model after mapping."), wxDefaultPosition, wxDefaultSize, 0);
|
||||
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->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"));
|
||||
@ -1198,7 +1208,14 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) :
|
||||
wxGetApp().app_config->set_bool("enable_merge_color_by_sync_ams",!flag);
|
||||
});
|
||||
m_merge_color_checkbox->Hide();
|
||||
more_setting_sizer->Add(m_merge_color_checkbox, 0, wxALIGN_LEFT | wxTOP, FromDIP(2));
|
||||
m_merge_color_sizer->Add(m_merge_color_checkbox, 0, wxALIGN_LEFT | wxTOP, FromDIP(2));
|
||||
|
||||
m_merge_color_text = new wxStaticText(this, wxID_ANY, _L("Automatically merge the same colors in the model after mapping."));
|
||||
m_merge_color_text->Hide();
|
||||
m_merge_color_sizer->AddSpacer(FromDIP(gap_between_checebox_and_text));
|
||||
m_merge_color_sizer->Add(m_merge_color_text, 0, wxALIGN_LEFT | wxTOP, FromDIP(2));
|
||||
|
||||
more_setting_sizer->Add(m_merge_color_sizer, 0, wxALIGN_LEFT | wxTOP, FromDIP(2));
|
||||
|
||||
bSizer->Add(more_setting_sizer, 0, wxEXPAND | wxLEFT, FromDIP(25));
|
||||
|
||||
@ -3820,7 +3837,7 @@ void SyncAmsInfoDialog::reset_and_sync_ams_list()
|
||||
wxBoxSizer *ams_tip_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
if (is_first_row) {
|
||||
is_first_row = false;
|
||||
auto tip0_text = new wxStaticText(m_filament_panel, wxID_ANY, _L("Original"));
|
||||
auto tip0_text = new wxStaticText(m_filament_panel, wxID_ANY, L_CONTEXT("Original", "Sync_AMS"));
|
||||
tip0_text->SetForegroundColour(wxColour(107, 107, 107, 100));
|
||||
ams_tip_sizer->Add(tip0_text, 0, wxALIGN_LEFT | wxTOP, FromDIP(2));
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "SelectMachine.hpp"
|
||||
#include "DeviceManager.hpp"
|
||||
class Button;
|
||||
|
||||
class CheckBox;
|
||||
namespace Slic3r { namespace GUI {
|
||||
class CapsuleButton;
|
||||
class SyncAmsInfoDialog : public DPIDialog
|
||||
@ -299,8 +299,12 @@ private:
|
||||
CapsuleButton * m_colormap_btn = nullptr;
|
||||
CapsuleButton * m_override_btn = nullptr;
|
||||
wxStaticText * m_more_setting_tips = nullptr;
|
||||
wxCheckBox* m_append_color_checkbox = nullptr;
|
||||
wxCheckBox* m_merge_color_checkbox = nullptr;
|
||||
wxBoxSizer * m_append_color_sizer = nullptr;
|
||||
CheckBox* m_append_color_checkbox = nullptr;
|
||||
wxStaticText * m_append_color_text = nullptr;
|
||||
wxBoxSizer * m_merge_color_sizer = nullptr;
|
||||
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;
|
||||
|
@ -131,6 +131,19 @@ wxString ComboBox::GetLabel() const
|
||||
return TextInput::GetLabel();
|
||||
}
|
||||
|
||||
int ComboBox::GetFlag(unsigned int n)
|
||||
{
|
||||
if (n >= items.size())
|
||||
return -1;
|
||||
return items[n].flag;
|
||||
}
|
||||
|
||||
void ComboBox::SetFlag(unsigned int n, int value) {
|
||||
if (n >= items.size()) return;
|
||||
items[n].flag = value;
|
||||
drop.Invalidate();
|
||||
}
|
||||
|
||||
void ComboBox::SetTextLabel(const wxString& label)
|
||||
{
|
||||
TextInput::SetLabel(label);
|
||||
|
@ -53,6 +53,9 @@ public:
|
||||
void SetLabel(const wxString &label) override;
|
||||
wxString GetLabel() const override;
|
||||
|
||||
int GetFlag(unsigned int n);
|
||||
void SetFlag(unsigned int n, int value);
|
||||
|
||||
void SetTextLabel(const wxString &label);
|
||||
wxString GetTextLabel() const;
|
||||
|
||||
|
@ -24,6 +24,7 @@ public:
|
||||
wxString group{};
|
||||
wxString alias{};
|
||||
wxString tip{};
|
||||
int flag{0};
|
||||
};
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user