* Fix return from assembly linux
* Tie deferred callback to canvas lifetime and add shutdown guards
Use m_canvas->CallAfter instead of wxGetApp().CallAfter to ensure the callback is only executed if the canvas is still alive.
Add early returns if wxGetApp().is_closing() is true before accessing plater or the 3D canvas, reducing the risk of use-after-free during application shutdown.
Addresses feedback regarding potential UI teardown race conditions.
* copilot suggestion
* Use local reference to wxGetApp() in Return button callback
Replace multiple calls to wxGetApp() with a single local reference
to improve readability and avoid redundant function calls.
* Don't assume 0.4mm nozzle; format as "unknown" if not defined.
* Skip nozzle diameter and hardness checks if nozzle info unknown.
---------
Co-authored-by: SoftFever <softfeverever@gmail.com>
# Description
The Qidi Max 4 and Q2 don't report what they are via /server/info like
the other Qidi printers apparently do. This means that filament matching
is a fool's erand because you'll never actually match anything. this
adds a fallback where we just use the configured machine type. I'm not
sure why we wouldn't just do that all the time, but I wanted to change
as little as possible.
Here's the entirety of the `/server/info` output from a Qidi Max 4:
```
{
"result": {
"klippy_connected": true,
"klippy_state": "ready",
"components": [
"secrets",
"template",
"klippy_connection",
"jsonrpc",
"internal_transport",
"application",
"websockets",
"database",
"dbus_manager",
"file_manager",
"authorization",
"klippy_apis",
"shell_command",
"machine",
"data_store",
"proc_stats",
"job_state",
"job_queue",
"history",
"http_client",
"announcements",
"webcam",
"extensions",
"octoprint_compat",
"timelapse",
"frp_manager",
"mqtt"
],
"failed_components": [],
"registered_directories": [
"config",
"logs",
"gcodes",
"timelapse",
"timelapse_frames",
"config_examples",
"docs"
],
"warnings": [],
"websocket_count": 3,
"moonraker_version": "?",
"missing_klippy_requirements": [],
"api_version": [
1,
4,
0
],
"api_version_string": "1.4.0"
}
}
```
There's no machine name or hostname. This is also what the response
looks like from a Q2, including the exact same API version numbers, so
we cannot match on that either.
In GLCanvas3D::on_mouse, avoid calling SetFocus when the currently focused window is a text input control (wxTextCtrl, wxComboBox or wxSpinCtrl). This prevents deselection bugs when the mouse leaves the window while a text control is focused. Also commented out explicit wx text-control includes near the top of the file.
Only TextCtrl needed
cleaning
Removed unused wxWidgets header includes.
Update GLCanvas3D.cpp
Co-authored-by: yw4z <yw4z@outlook.com>
Co-authored-by: yw4z <ywsyildiz@gmail.com>
The Qidi Max 4 doesn't report that it's a Qidi Max 4 via /server/info
like the other Qidi printers apparently do. This means that filament
matching is a fool's erand because you'll never actually match anything.
this adds a fallback where we just use the configured machine type. I'm
not sure why we wouldn't just do that all the time, but I wanted to
change as little as possible.
Fix: generic locale fallback on all platforms when language is unavailable
Move the locale fallback chain out of the #ifdef __linux__ block so it
applies on macOS and Windows too. Add a base-language fallback step that
strips the region code (e.g. en_IL -> en) before trying the full
fallback chain (current locale, system, best, en_US, en_UK).
Previously, if wxLocale::IsAvailable() failed on non-Linux, the app
would show an error and exit. Now it gracefully falls back to a working
locale.
Co-authored-by: SoftFever <softfeverever@gmail.com>
Commit ed88cbe removed `new WebViewWebKit` on macOS because wx 3.3
dropped the no-arg wxWebViewWebKit constructor, falling through to
wxWebView::New(). That bypassed the WebViewWebKit destructor that calls
RemoveScriptMessageHandler("wx"), reintroducing the WebKit teardown bug
the subclass was added to fix.
Restore the macOS-specific subclass path by adding a constructor that
forwards to the wx 3.3 wxWebViewConfiguration-based ctor.
wxWidgets 3.3.2 changed MSWGetStyle to add WS_CAPTION when
wxMINIMIZE_BOX/wxMAXIMIZE_BOX/wxCLOSE_BOX is set. This caused
DefWindowProc to subtract the caption height in WM_NCCALCSIZE for
maximized windows, shrinking the client area and creating a gap
above the taskbar.
Fix by handling WM_NCCALCSIZE for the maximized case explicitly
(strip only border overshoot, not caption) and removing the now
unnecessary wxEVT_MAXIMIZE workaround.
On Linux/GTK, CheckBox, RadioBox, and SwitchButton set their size to
exactly the bitmap size (18x18 or 16x16), but GTK's internal CSS padding
requires additional space, resulting in negative content width warnings.
Use GetBestSize() on GTK to account for theme padding.
- Plater: use Add() instead of wxArrayString(size_t, wxString) ctor
- Search: change sep from std::wstring to wxString for concatenation
- SendMultiMachinePage: replace wxList::Node* with compatibility_iterator
(Node type removed in wx 3.3 with wxUSE_STD_CONTAINERS=ON)
- PhysicalPrinterDialog: disambiguate set_values() call with explicit
std::vector<std::string> (wxArrayString now also matches initializer list)
- Preferences: use ToStdString() instead of mb_str() for std::string comparison
- Plater: use wxString::FromUTF8() for wxArrayString constructor argument
In wx 3.3 with wxUSE_STD_CONTAINERS=ON, wxString is backed by
std::wstring, so direct concatenation of const char[] with
std::wstring or wxUniCharRef fails. Fix by splitting compound
concatenations into separate += operations on wxString, or by
wrapping the left operand in wxString() to use its operator+.
Files fixed:
- AuxiliaryDataViewModel.cpp: split "\\" + wxString/wstring chains
- AboutDialog.cpp: split std::string("\n") + wxUniCharRef
- Auxiliary.cpp: wrap dir.wstring() in wxString(), split "/" + wstring
In wxWidgets 3.3, wxBitmapComboBoxBase::OnAddBitmap changed its
parameter from const wxBitmap& to const wxBitmapBundle&, and m_bitmaps
was replaced by m_bitmapbundles. Update OnAddBitmap signature and
OnDrawItem to use wxBitmapBundle, extracting wxBitmap via
GetBitmap(GetDefaultSize()) where needed.
- Wrap GetToolTipCtrl() call in GUI_App.cpp with #if wxVERSION_NUMBER < 3300
guard, as this API may not be accessible in wxWidgets 3.3. The dark tooltip
theming is cosmetic and non-critical.
- Add explicit #include <wx/utils.h> to 7 source files that use functions from
that header (wxGetMousePosition, wxLaunchDefaultBrowser, wxGetDisplaySize,
wxBell) but relied on transitive includes. This preempts breakage from
wxWidgets 3.3 reducing transitive includes.
Files with wx/utils.h added: BBLTopbar.cpp, CreatePresetsDialog.cpp,
CameraPopup.cpp, GLCanvas3D.cpp, GCodeViewer.cpp, GUI_ObjectList.cpp,
FilamentMapPanel.cpp.
Skipped BindDialog.cpp and FilamentPickerDialog.cpp as they already include
wx/wx.h which provides wx/utils.h transitively.
Part of wxWidgets 3.1.5 -> 3.3.2 upgrade.
In wxWidgets 3.3, wxWindow::Raise() no longer implies Show(). Add
explicit Show() before Raise() in two event handlers that activate the
main frame from another instance (load model, start download), and swap
the Show/Raise order in bring_instance_forward() so Show() precedes
Raise().
wxTRANSPARENT_WINDOW is removed in wxWidgets 3.3. Remove all 3
occurrences in MainFrame.cpp:
- ResizeEdgePanel constructor: already uses wxBG_STYLE_TRANSPARENT
via SetBackgroundStyle(), so the flag was redundant
- slice_panel and print_panel: drop the style parameter entirely
(defaults to 0)
wxWidgets 3.2+ asserts on invalid sizer flag combinations where
wxEXPAND (which fills the entire space in the secondary direction)
is combined with wxALIGN_* flags (which are meaningless when expanding).
Remove the conflicting wxALIGN_* flags from all 112 occurrences across
21 files, keeping wxEXPAND and any non-conflicting flags intact.
Since we now target wxWidgets 3.3, all wxCHECK_VERSION(3,1,N) checks
are always true. Remove the guards keeping only the true branches:
- I18N.hpp: Remove version guard around _wxGetTranslation_ctx macro
- ExtraRenderers.hpp, GUI_App.hpp: Simplify SUPPORTS_MARKUP to check
only wxUSE_MARKUP (version check always true)
- ConfigWizard.cpp: Remove manual wxArrayInt comparison fallback
- SendSystemInfoDialog.cpp: Simplify display scaling guard to _WIN32 only
- GUI_Utils.cpp: Remove IsDark() fallback using luma approximation
- wxinit.h: Remove legacy wxEVT_BUTTON and wxEVT_HTML_LINK_CLICKED
compat macros (these event names exist natively in wx 3.3)