Merge branch 'main' into feature/mcp

This commit is contained in:
SoftFever committed 2026-11-03 16:28:57 +08:00
commit ee0314dee2
103 files changed
+5410 -1038

No files matched your search

+13 -35
View File
@@ -163,6 +163,7 @@
#include <cassert>
#include <wx/display.h>
#include <wx/window.h>
#include <wx/wupdlock.h>
using json = nlohmann::json;
@@ -1218,7 +1219,11 @@ void MainFrame::update_layout()
wxBusyCursor busy;
Freeze();
// While the main frame is being created nothing is on screen, and a freeze would only walk
// every child window to block redraws that cannot happen.
wxWindowUpdateLocker no_updates;
if (IsShownOnScreen())
no_updates.Lock(this);
// Remove old settings
if (m_layout != ESettingsLayout::Unknown)
@@ -1310,7 +1315,6 @@ void MainFrame::update_layout()
#endif
Layout();
Thaw();
}
#ifdef __WXGTK__
@@ -1680,14 +1684,6 @@ void MainFrame::show_device(bool should_use_native) {
// get it — otherwise a Bambu user sees two Device tabs, one of them permanently empty.
const bool want_web_device_tab = use_printer_agents && wxGetApp().preset_bundle != nullptr &&
!wxGetApp().preset_bundle->use_bbl_device_tab();
// An agent whose printers have nothing for the native Device and Calibration tabs leaves the web page as the only Device tab
bool want_native_device_tabs = true;
if (want_web_device_tab) {
const std::string agent_id = wxGetApp().resolve_printer_agent_id(
wxGetApp().preset_bundle->printers.get_edited_preset().config.opt_string("printer_agent"));
const PrinterAgentInfo* agent_info = NetworkAgentFactory::get_printer_agent_info(agent_id);
want_native_device_tabs = agent_info == nullptr || agent_info->native_device_tab;
}
// Remove the extra page before switching to any layout that shouldn't have it.
if (!want_web_device_tab) {
@@ -1698,16 +1694,7 @@ void MainFrame::show_device(bool should_use_native) {
}
if (use_printer_agents) {
if (!want_native_device_tabs) {
if ((idx = m_tabpanel->FindPage(m_monitor_page)) != wxNOT_FOUND) {
m_monitor_page->Show(false);
m_tabpanel->RemovePage(idx);
}
if ((idx = m_tabpanel->FindPage(m_calibration_page)) != wxNOT_FOUND) {
m_calibration_page->Show(false);
m_tabpanel->RemovePage(idx);
}
} else if (!m_monitor_page->in_book()) {
if (!m_monitor_page->in_book()) {
if ((idx = m_tabpanel->FindPage(m_printer_view_page)) != wxNOT_FOUND) {
m_printer_view_page->Show(false);
m_tabpanel->RemovePage(idx);
@@ -1727,29 +1714,20 @@ void MainFrame::show_device(bool should_use_native) {
TAB_ID_MULTI_DEVICE, m_multi_machine_page, _L("Multi-device"), "tab_multi_active");
}
}
if (want_native_device_tabs && !m_calibration_page->in_book()) {
if (!m_calibration_page->in_book()) {
m_calibration_page->Show(false);
m_tabpanel->InsertPage(m_tabpanel->PositionAfter({TAB_ID_PROJECT}), TAB_ID_CALIBRATION, m_calibration_page,
_L("Calibration"), "tab_calibration_active");
}
if (want_web_device_tab) {
// Without the native Device tab the web page takes its id, so every way to the Device tab leads here
const char* id = want_native_device_tabs ? TAB_ID_MONITOR_WEB : TAB_ID_MONITOR;
const wxString label = want_native_device_tabs ? _L("Device (Web)") : _L("Device");
idx = m_tabpanel->FindPage(m_printer_view_page);
if (idx != wxNOT_FOUND && m_tabpanel->FindPageByName(id) != idx) {
if ((idx = m_tabpanel->FindPage(m_printer_view_page)) == wxNOT_FOUND) {
m_printer_view_page->Show(false);
m_tabpanel->RemovePage(idx);
idx = wxNOT_FOUND;
}
if (idx == wxNOT_FOUND) {
m_printer_view_page->Show(false);
// Immediately right of the native Device tab, or of Preview without it, not at the end of the tab bar.
m_tabpanel->InsertPage(m_tabpanel->PositionAfter({TAB_ID_MONITOR, TAB_ID_PREVIEW}), id, m_printer_view_page, label,
"tab_monitor_active");
// Immediately right of the native Device tab, not at the end of the tab bar.
m_tabpanel->InsertPage(m_tabpanel->PositionAfter({TAB_ID_MONITOR}), TAB_ID_MONITOR_WEB,
m_printer_view_page, _L("Device (Web)"), "tab_monitor_active");
} else {
m_tabpanel->SetPageText(idx, label);
m_tabpanel->SetPageText(idx, _L("Device (Web)"));
}
}