ArchMaterial's view provider has a setTaskValue helper to set values of widgets inside a task panel. While specific to ArchMaterial, the real place where the helper is called is at BIM_Classification. It appears it's not a general but more like an ad-hoc API for a specific purpose and for a specific object.
In any case, this fix allows widgets that expect a numerical value to have their value set. Before, their value was set as text, unexpectedly.
Before this fix, double-clicking on an ArchMultimaterial object opened its task panel as expected. Unexpectedly, its label was selected and set for edit.
- The tree view's double-click handling expects the view-provider to declare whether it handled the double-click.
- The ViewProvider API's doubleClicked() is documented to return bool (True if handled).
- If a view provider's doubleClicked method returns None/False, the tree falls back to the default Qt behavior (which is beginning inline editing of the item label).
- In ArchMaterial.py the view provider calls self.edit() (or FreeCADGui.ActiveDocument.setEdit(...)) but the method that the tree actually calls (the view provider's doubleClicked) does not return True. Because the method returns None, the tree continues and starts inline label-editing.
In summary: setEdit returning True is fine, but doubleClicked is the method the tree checks; it must return True to suppress the default inline rename.
Python 3 combined the former `urllib`, `urllib2`, `urlparse` Python 2 modules into subpackages of `urllib`. FreeCAD is written in Python 3, thus the `urllib2` import fallback will not work and needs to be removed.
As the title says - upon unclone icon is not being removed, but the
cloned item stops mirroring original item which is correct, so this just
aligns the icon removal logic with the correct behavior.
* BIM: Prevent crash when removing a wall's base component
When a user selected a wall's base object in the Tree View and used the
`Arch_Remove` command, a traceback occurred due to an `AttributeError`.
The `removeComponents` function was incorrectly checking for the `.Base`
attribute on a list of subtractions (`s.Base`) instead of on the parent
host object (`h.Base`).
This commit corrects the reference to check against the parent object,
resolving the crash and allowing the component to be removed.
Fixes: https://github.com/FreeCAD/FreeCAD/issues/24532
Authored-by: furgo16 <148809153+furgo16@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: Furgo <148809153+furgo16@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* 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
* [ArchStairs] Fix Blondel Ratio and Winders
Fix#24065Fix#24051
1. Blondel Ratio is not calculated, this if fixed now. Blondel Ratio property is changed to Length following wiki's descripition.
2. Winders is not implemented as commented in wiki. The property is not added at the moment until it is implemented.
* [ArchStairs] Fix Blondel Ratio and Winders - Remove old Property
For existing Stairs object, remove old property which is Float and add new propety which is Length.
* BIM: fix linked document of BIM_Library task panel
Fixes#22437.
The task panel of the BIM_Library command would be linked to the active document, which would to be the temporary Viewer document if that option was checked. Closing that document in the `Insert` function would therefore also close the task panel resulting in errors for following code.
Additionally:
The code to close the temporary Viewer document was moved to the `Reject` function. Otherwise that document would stay open if the task panel was closed without inserting.
* BIM: fix regression in DAE import, support for polylists
The support for non-triangular faces was remove in
commit 346c7581d4.
Now, the support for them is restored, by triangulating them
during the import (with a warning and changing the object name).
Signed-off-by: Gaël Écorchard <gael@km-robotics.cz>
* BIM: Remove translation calls console
Use raw strings for console messages, as they are usually not
translated.
---------
Signed-off-by: Gaël Écorchard <gael@km-robotics.cz>
Co-authored-by: Gaël Écorchard <gael@km-robotics.cz>
Rotating an ArchSectionPlane object caused its cutting effect to flip,
affecting both the live `CutView` and 2D projections. The
`_SectionPlane.execute()` method incorrectly tried to auto-correct the
orientation of a temporary plane before applying the object's final
placement. The fix refactors this to a "transform-then-verify" pattern:
the object's full `Placement` is now applied to the temporary plane
first, and only then is the resulting face's actual normal validated
against the intended normal from the `Placement`. This ensures the
`Shape` is always geometrically consistent with the `Placement`, making
the cut direction predictable at all angles.