* BIM: Fix Site view provider initialization and constraints This commit fixes bugs in the `_ViewProviderSite` lifecycle, ensuring that sun path properties are correctly initialized with valid defaults and that their constraints are reliably restored when a document is opened. Previously, two main problems existed: 1. New Objects: When a new `Site` object was created, its sun path properties (e.g., `SunDateMonth`) would default to 0, which is an invalid value. The property editor in the GUI would also lack the appropriate min/max constraints. 2. Restored Objects: When a document containing a `Site` was opened, the property constraints were not reapplied. This happened because the view provider's initialization logic was not being reliably triggered due to race conditions during the document deserialization process. These issues are addressed now by a deferred initialization sequence: - For New Objects: In `_ViewProviderSite.__init__`, constraint and default value setup is deferred using `QTimer.singleShot(0)`. The `restoreConstraints` method also now sets sensible defaults (e.g., month 6, day 21) when it detects a new object. - For Restored Objects: The data object's `_Site.onDocumentRestored` hook is now used as a trigger to start the view provider's initialization. This is a necessary workaround, as the `ViewProvider` lacks its own restoration hook. This method now ensures the view provider's properties are present and then schedules `restoreConstraints` to run via `QTimer`. * BIM: add ArchSite GUI tests and fixtures - Additionally clean up and document the CMakeLists.txt file for better maintainability and readability * BIM: Enable GUI tests on CI - The line to enable the BIM workbench has been commented out, as previously it occasioned a timeout error on CI - The BIM GUI tests have been uncommented out to enable them
31 lines
1.9 KiB
Python
31 lines
1.9 KiB
Python
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
# ***************************************************************************
|
|
# * *
|
|
# * Copyright (c) 2013 Yorik van Havre <yorik@uncreated.net> *
|
|
# * *
|
|
# * This file is part of FreeCAD. *
|
|
# * *
|
|
# * FreeCAD is free software: you can redistribute it and/or modify it *
|
|
# * under the terms of the GNU Lesser General Public License as *
|
|
# * published by the Free Software Foundation, either version 2.1 of the *
|
|
# * License, or (at your option) any later version. *
|
|
# * *
|
|
# * FreeCAD is distributed in the hope that it will be useful, but *
|
|
# * WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
|
# * Lesser General Public License for more details. *
|
|
# * *
|
|
# * You should have received a copy of the GNU Lesser General Public *
|
|
# * License along with FreeCAD. If not, see *
|
|
# * <https://www.gnu.org/licenses/>. *
|
|
# * *
|
|
# ***************************************************************************
|
|
|
|
"""Import all Arch module unit tests in GUI mode."""
|
|
|
|
from bimtests.TestArchImportersGui import TestArchImportersGui
|
|
from bimtests.TestArchBuildingPartGui import TestArchBuildingPartGui
|
|
from bimtests.TestArchSiteGui import TestArchSiteGui
|
|
from bimtests.TestWebGLExportGui import TestWebGLExportGui
|