Merge branch 'main' into dev/save-local-machine

This commit is contained in:
SoftFever 2025-02-04 07:59:30 +08:00 committed by GitHub
commit b18a24920b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
608 changed files with 9926 additions and 23646 deletions

View file

@ -852,7 +852,7 @@ Sidebar::Sidebar(Plater *parent)
p->m_panel_filament_title->SetBackgroundColor2(0xF1F1F1);
p->m_panel_filament_title->Bind(wxEVT_LEFT_UP, [this](wxMouseEvent &e) {
if (e.GetPosition().x > (p->m_flushing_volume_btn->IsShown()
? p->m_flushing_volume_btn->GetPosition().x : p->m_bpButton_add_filament->GetPosition().x))
? p->m_flushing_volume_btn->GetPosition().x : (p->m_bpButton_add_filament->GetPosition().x - FromDIP(30)))) // ORCA exclude area of del button from titlebar collapse/expand feature to fix undesired collapse when user spams del filament button
return;
if (p->m_panel_filament_content->GetMaxHeight() == 0)
p->m_panel_filament_content->SetMaxSize({-1, -1});
@ -957,8 +957,7 @@ Sidebar::Sidebar(Plater *parent)
});
p->m_bpButton_add_filament = add_btn;
bSizer39->Add(add_btn, 0, wxALIGN_CENTER|wxALL, FromDIP(5));
bSizer39->Add(FromDIP(10), 0, 0, 0, 0 );
// ORCA Moved add button after delete button to prevent add button position change when remove icon automatically hidden
ScalableButton* del_btn = new ScalableButton(p->m_panel_filament_title, wxID_ANY, "delete_filament");
del_btn->SetToolTip(_L("Remove last filament"));
@ -983,8 +982,15 @@ Sidebar::Sidebar(Plater *parent)
p->m_bpButton_del_filament = del_btn;
bSizer39->Add(del_btn, 0, wxALIGN_CENTER_VERTICAL, FromDIP(5));
bSizer39->Add(FromDIP(10), 0, 0, 0, 0);
bSizer39->Add(add_btn, 0, wxALIGN_CENTER | wxALL, FromDIP(5)); // ORCA Moved add button after delete button to prevent add button position change when remove icon automatically hidden
bSizer39->Add(FromDIP(20), 0, 0, 0, 0);
if (p->combos_filament.size() <= 1) { // ORCA Fix Flushing button and Delete filament button not hidden on launch while only 1 filament exist
bSizer39->Hide(p->m_flushing_volume_btn);
bSizer39->Hide(p->m_bpButton_del_filament); // ORCA: Hide delete filament button if there is only one filament
}
ams_btn = new ScalableButton(p->m_panel_filament_title, wxID_ANY, "ams_fila_sync", wxEmptyString, wxDefaultSize, wxDefaultPosition,
wxBU_EXACTFIT | wxNO_BORDER, false, 18);
ams_btn->SetToolTip(_L("Synchronize filament list from AMS"));
@ -1632,10 +1638,13 @@ void Sidebar::on_filaments_change(size_t num_filaments)
auto sizer = p->m_panel_filament_title->GetSizer();
if (p->m_flushing_volume_btn != nullptr && sizer != nullptr) {
if (num_filaments > 1)
if (num_filaments > 1) {
sizer->Show(p->m_flushing_volume_btn);
else
sizer->Show(p->m_bpButton_del_filament); // ORCA: Show delete filament button if multiple filaments
} else {
sizer->Hide(p->m_flushing_volume_btn);
sizer->Hide(p->m_bpButton_del_filament); // ORCA: Hide delete filament button if there is only one filament
}
}
Layout();
@ -1856,9 +1865,9 @@ void Sidebar::show_SEMM_buttons(bool bshow)
{
if(p->m_bpButton_add_filament)
p->m_bpButton_add_filament->Show(bshow);
if(p->m_bpButton_del_filament)
if (p->m_bpButton_del_filament && p->combos_filament.size() > 1) // ORCA add filament count as condition to prevent showing Flushing volumes and Del Filament icon visible while only 1 filament exist
p->m_bpButton_del_filament->Show(bshow);
if (p->m_flushing_volume_btn)
if (p->m_flushing_volume_btn && p->combos_filament.size() > 1) // ORCA add filament count as condition to prevent showing Flushing volumes and Del Filament icon visible while only 1 filament exist
p->m_flushing_volume_btn->Show(bshow);
Layout();
}

View file

@ -178,7 +178,11 @@ GuideFrame::GuideFrame(GUI_App *pGUI, long style)
// Bind(wxEVT_IDLE, &GuideFrame::OnIdle, this);
// Bind(wxEVT_CLOSE_WINDOW, &GuideFrame::OnClose, this);
auto start = std::chrono::high_resolution_clock::now();
LoadProfile();
auto end = std::chrono::high_resolution_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end - start);
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << ": LoadProfile() took " << duration.count() << " milliseconds";
// UI
SetStartPage(BBL_REGION);
@ -1112,13 +1116,10 @@ int GuideFrame::LoadProfile()
m_ProfileJson["stealth_mode"] = StealthMode;
}
catch (std::exception &e) {
//wxLogMessage("GUIDE: load_profile_error %s ", e.what());
// wxMessageBox(e.what(), "", MB_OK);
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ", error: "<< e.what() <<std::endl;
}
std::string strAll = m_ProfileJson.dump(-1, ' ', false, json::error_handler_t::ignore);
//wxLogMessage("GUIDE: profile_json_s2 %s ", m_ProfileJson.dump(-1, ' ', false, json::error_handler_t::ignore));
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", finished, json contents: "<< std::endl<<strAll;
return 0;