FIX: ui issues with filament map dialog

jira:STUDIO-10040,STUDIO-10039

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I939df4fc0fe3eb8d287cf1efc7d459c0790d04c7
This commit is contained in:
xun.zhang 2025-01-20 12:26:43 +08:00 committed by lane.wei
parent 7897cd68c9
commit e24a0bc603
3 changed files with 23 additions and 15 deletions

View File

@ -201,10 +201,8 @@ void DragDropPanel::AddColorBlock(const wxColour &color, int filament_id, bool u
m_filament_blocks.push_back(panel);
if (update_ui) {
m_filament_blocks.front()->Refresh(); // FIX BUG: STUDIO-8467
Layout();
Fit();
GetParent()->Layout();
GetParent()->Fit();
GetParent()->GetParent()->Layout();
GetParent()->GetParent()->Fit();
}
}
@ -214,10 +212,8 @@ void DragDropPanel::RemoveColorBlock(ColorPanel *panel, bool update_ui)
panel->Destroy();
m_filament_blocks.erase(std::remove(m_filament_blocks.begin(), m_filament_blocks.end(), panel), m_filament_blocks.end());
if (update_ui) {
Layout();
Fit();
GetParent()->Layout();
GetParent()->Fit();
GetParent()->GetParent()->Layout();
GetParent()->GetParent()->Fit();
}
}

View File

@ -47,18 +47,23 @@ FilamentMapManualPanel::FilamentMapManualPanel(wxWindow *p
m_right_panel->AddColorBlock(color, idx + 1);
}
}
drag_sizer->Add(m_left_panel, 1, wxALIGN_CENTER | wxEXPAND | wxLEFT, FromDIP(20));
m_left_panel->SetMinSize({ FromDIP(220),-1 });
m_right_panel->SetMinSize({ FromDIP(220),-1 });
drag_sizer->AddStretchSpacer();
drag_sizer->Add(m_left_panel, 1, wxALIGN_CENTER | wxEXPAND);
drag_sizer->AddSpacer(FromDIP(7));
drag_sizer->Add(m_switch_btn, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, FromDIP(1));
drag_sizer->AddSpacer(FromDIP(7));
drag_sizer->Add(m_right_panel, 1, wxALIGN_CENTER | wxEXPAND | wxRIGHT, FromDIP(20));
drag_sizer->Add(m_right_panel, 1, wxALIGN_CENTER | wxEXPAND);
drag_sizer->AddStretchSpacer();
top_sizer->Add(drag_sizer, 0, wxALIGN_CENTER | wxEXPAND);
m_tips = new Label(this, _L("Tips: You can drag the filaments to reassign them to different nozzles."));
m_tips->SetFont(Label::Body_14);
m_tips->SetForegroundColour(TextNormalGreyColor);
top_sizer->AddSpacer(FromDIP(8));
top_sizer->AddSpacer(FromDIP(20));
top_sizer->Add(m_tips, 0, wxALIGN_LEFT | wxLEFT, FromDIP(15));
m_switch_btn->Bind(wxEVT_BUTTON, &FilamentMapManualPanel::OnSwitchFilament, this);
@ -83,9 +88,8 @@ void FilamentMapManualPanel::OnSwitchFilament(wxCommandEvent &)
m_left_panel->AddColorBlock(block->GetColor(), block->GetFilamentId(), false);
m_right_panel->RemoveColorBlock(block, false);
}
Layout();
Fit();
this->GetParent()->Layout();
this->GetParent()->Fit();
}
void FilamentMapManualPanel::Hide()
@ -130,9 +134,12 @@ GUI::FilamentMapBtnPanel::FilamentMapBtnPanel(wxWindow *parent, const wxString &
label_sizer->Add(m_label, 0, wxALIGN_CENTER | wxEXPAND| wxALL, FromDIP(3));
label_sizer->AddStretchSpacer();
m_disable_tip = new Label(this, _L("(Sync with printer)"));
sizer->AddSpacer(FromDIP(32));
sizer->Add(label_sizer, 0, wxALIGN_CENTER | wxEXPAND);
sizer->AddSpacer(FromDIP(24));
sizer->Add(m_disable_tip, 0, wxALIGN_CENTER);
sizer->AddSpacer(FromDIP(3));
auto detail_sizer = new wxBoxSizer(wxHORIZONTAL);
m_detail = new Label(this, detail);
@ -204,12 +211,15 @@ void FilamentMapBtnPanel::UpdateStatus()
m_detail->SetBackgroundColour(BgNormalColor);
}
if (!m_enabled) {
m_disable_tip->SetLabel(_L("(Sync with printer)"));
m_disable_tip->SetForegroundColour(TextDisableColor);
m_btn->SetBitmap(icon_disabled);
m_btn->SetForegroundColour(BgDisableColor);
m_label->SetForegroundColour(TextDisableColor);
m_detail->SetForegroundColour(TextDisableColor);
}
else {
m_disable_tip->SetLabel("");
m_btn->SetBitmap(icon_enabled);
m_btn->SetForegroundColour(BgNormalColor);
m_label->SetForegroundColour(TextNormalBlackColor);
@ -346,6 +356,7 @@ FilamentMapDefaultPanel::FilamentMapDefaultPanel(wxWindow *parent) : wxPanel(par
m_label = new Label(this, _L("The filament grouping method for current plate is determined by the dropdown option at the slicing plate button."));
m_label->SetFont(Label::Body_14);
m_label->SetBackgroundColour(*wxWHITE);
m_label->Wrap(FromDIP(500));
sizer->AddStretchSpacer();
sizer->Add(m_label, 1, wxEXPAND | wxALIGN_CENTER);

View File

@ -57,6 +57,7 @@ private:
wxBitmapButton *m_btn;
wxStaticText *m_label;
Label *m_disable_tip;
Label *m_detail;
std::string m_icon_path;
bool m_enabled{ true };