Commit Graph

2387 Commits

Author SHA1 Message Date
github-actions
914b34cc1a Update translations from Crowdin 2025-11-25 21:20:42 -06:00
Furgo
b72f635bb2 App: Handle uncleared Python exceptions during object restoration
When a Python-based object throws an exception during the restoration
process (e.g. inside `onDocumentRestored`), the error is caught by a
generic `catch(...)` block in `Document::afterRestore`.

Previously, this block swallowed the C++ exception wrapper but failed to
clear the underlying Python error state. Leaving the interpreter in this
"dirty" state caused a segmentation fault or `SystemError` later in the
loading process when C++ attempted to interact with the Python API
(specifically in `App::Application::setActiveDocument`).

This commit adds a check for `PyErr_Occurred()` inside the catch block.
If an error is detected, the traceback is printed to the console for
debugging, and `PyErr_Clear()` is called to reset the interpreter state,
allowing the application to continue loading the document without
crashing.
2025-11-24 17:26:46 +01:00
Andrew Burks
b32c224f09 #25474 Added read-only warnings when saving documents (#25532)
* #25474 Added read-only warnings when saving documents

Block saving a file and notify user if windows is unable to save to the file for any reason, or the read-only attribute is checked. Also check std::filesystem::perms for write permission and other checks in FileInfo::isWritable(), although it doesn't seem to matter on windows.

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
2025-11-23 05:09:32 +00:00
Logstor
3d24580646 Removed sys in 'from os import sys, path' 2025-11-20 20:13:16 -06:00
David Carter
31929cb4e5 Materials: Assigning material without appearance
Assigning a material without an appearance reset the appearance to the
default appearance.

There were two main problems. One was the comparison function for
App::Material objects. It would return false when the UUID or MatType
values were different although there are many circumstances where this
could be true and the appearance be the same. It also incorrectly
compared the imagePath.

The second problem was the logic for detecting if an object has already
been assigned an appearance by assigning a material or manually setting
the appearance. If assigned a material, the appearance should update but
not if it has been set manually. This logic has been corrected.
2025-11-17 17:43:14 +01:00
Chris Hennes
71104a08e7 Core: Convert transparency to alpha (#24891)
* Core: Convert transparency to alpha

Create new `Base::getVersion()` function for extracting a program
version enumeration given a version string.

Convert transparency to alpha value for old project files.

* Base/App: Address review comments

---------

Co-authored-by: wmayer <wmayer@freecad.org>
2025-11-17 17:15:19 +01:00
Pieter Hijma
7e3b2230b9 Doc: Improve the documentation of transactions (#21494) 2025-11-14 12:52:13 -06:00
github-actions
bb748b15ea Update translations from Crowdin 2025-11-11 23:44:18 -06:00
Florian Foinant-Willig
cc6e054c79 Core: add a check on object deletion 2025-11-09 16:44:40 -06:00
Max Wilfinger
e1c4293706 App: Apply code review suggestions 2025-11-02 17:38:06 +01:00
wwmayer
d5ccc4a8d1 PD: Toggling transparency doesn't reset colors 2025-11-01 09:05:03 +01:00
github-actions
a3c2454a61 Update translations from Crowdin 2025-10-27 21:06:54 -05:00
Kevin Martin
c97d1ffed8 Do not use the object's Name as a Label if that Label already exists 2025-10-20 17:07:42 +02:00
github-actions
5ae4bbf837 Update translations from Crowdin 2025-10-20 09:57:05 -05:00
PaddleStroke
a0c28aba75 Assembly: Fix lengths cannot be negative (#24625)
* Assembly: Fix lengths cannot be negative

* Update PropertyUnits.cpp

* Update PropertyUnits.h

* Update JointObject.py
2025-10-14 11:40:10 +02:00
IFo Hancroft
d6acbf5825 Added GPL-3.0-or-later to the list of licenses (#24447)
* Added GPL-3.0-or-later to the list of licenses

* Incremented number of licenses
2025-10-06 11:33:07 -05:00
PaddleStroke
fe534bcf99 Assembly: Isolate joint components during selection and edit. (#23680)
* Core: Add signalBeforeOpenTransaction

* Assembly: Isolate

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update src/App/AutoTransaction.cpp

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
2025-10-02 21:07:06 -05:00
Steven James
84c50f5794 Fixing repr for App/Document and Gui/Document 2025-10-02 04:22:24 -04:00
Chris Hennes
1f986061aa Merge pull request #24178 from FlachyJoe/non-recursive-freeze
Core: Freeze state enhancement
2025-09-30 13:01:15 -05:00
Frank David Martínez M
77b034dc82 Fix Refine in Cut Compound test 2025-09-26 16:12:56 -05:00
marioalexis
c8fb2d1ae0 App: Fix GroupExtension finding wrong group for objects 2025-09-25 15:52:43 -05:00
Chris Hennes
1c6d9c79fb Update translations 2025-09-25 2025-09-25 17:25:13 +02:00
PaddleStroke
725abff6a7 Core: Add signalAboutToOpenTransaction (#24049)
* Core: Add signalAboutToOpenTransaction

* change name to squash

* Update AutoTransaction.cpp

* Update Application.h

* reorder

* Update AutoTransaction.cpp

* Update Application.h
2025-09-24 22:45:57 -05:00
Chris Hennes
8c66c91ef4 Merge pull request #23803 from 3x380V/py
Py3.13: fix warnings
2025-09-24 22:16:30 -05:00
Florian Foinant-Willig
7531334637 Core: set properties of frozen object read-only 2025-09-23 22:42:14 +02:00
drwho495
08cbc5cffa Toponaming: Don't add empty tags past the threshold 2025-09-22 10:35:13 -05:00
Chris Hennes
b262f4b17c App: Fix the Python wrapper for isVersionedPath 2025-09-20 11:46:11 -05:00
sliptonic
975a4b65d2 Merge pull request #23585 from chennes/extractVersionMigrator
Gui: Improve version migration UX
2025-09-20 10:01:40 -05:00
PaddleStroke
a24747bcb8 Core: GeoFeature::getPlacementFromProp prevent potential crash 2025-09-19 08:40:06 -05:00
Chris Hennes
cc48a08f46 App: Sanitize all paths for null characters (#23821)
* App: Sanitize all paths for null characters

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Apply suggestions from code review

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kacper Donat <kadet1090@gmail.com>
2025-09-18 17:37:33 +00:00
sliptonic
524526ac5a Merge pull request #23885 from chennes/pythonInterfaceToApplicationDirectories
App: Add Python interface to ApplicationDirectories
2025-09-17 18:11:41 -05:00
Chris Hennes
4aa01bb948 App: Remove manual PCH entries 2025-09-17 16:18:10 -05:00
Chris Hennes
5f30da529a App: Address reviewer comments 2025-09-17 16:08:07 -05:00
Chris Hennes
d9e6ee8fa1 Gui: Improve version migration UX 2025-09-17 10:43:16 -05:00
Chris Hennes
02721eec37 Update translations 2025-09-15 2025-09-16 09:55:13 +02:00
Markus Reitböck
73c97bc90f App: use CMake to generate precompiled headers on all platforms
"Professional CMake" book suggest the following:

"Targets should build successfully with or without compiler support for precompiled headers. It
should be considered an optimization, not a requirement. In particular, do not explicitly include a
precompile header (e.g. stdafx.h) in the source code, let CMake force-include an automatically
generated precompile header on the compiler command line instead. This is more portable across
the major compilers and is likely to be easier to maintain. It will also avoid warnings being
generated from certain code checking tools like iwyu (include what you use)."

Therefore, removed the "#include <PreCompiled.h>" from sources, also
there is no need for the "#ifdef _PreComp_" anymore
2025-09-14 09:47:02 +02:00
Chris Hennes
641bf0b511 App: Add Python interface to ApplicationDirectories
The Python version of this class is entirely static: no instance is
required. Internally it accesses th pre-constructed instance of the C++
ApplicationDirectories class that is instantiated at program startup by
the Application class.
2025-09-12 15:25:47 -05:00
Markus Reitböck
496b31b087 do not use precompiled header for setting global compiler definitions and to disable compiler warnings
only 4 of these warnings are still relevant, CMake shall be used to disable them

Compiler definitions:

  NOMINMAX:
    * is already globally defined in SetGlobalCompilerAndLinkerSettings.cmake

  WIN32_LEAN_AND_MEAN:
    * use CMake target_compile_options on relevant targets

Warnings that still occur:

  C4251, C4273, C4275: all related to dllimport / export
    * use CMake target_compile_options on relevant targets

  C4661: no suitable definition provied for explicit template instantiation request
    * triggered in Mesh because of Vector3D in Base - not all functions are defined in header
    * use CMake target_compile_options on relevant targets

Warnings that are Currently not triggered (fix code if they appear again):

  C4005: macro redefinition

  C4244: argument conversion, possible loss of data

  C4267: conversion from size_t to type, possible loss of data

  C4305: truncation from type1 to type2
    * only occurrence disabled in Reader.cpp

  C4522: multiple assignment operator specified

  C5208: unnamed class in typedef name

Obsolete Compiler warnings:

  C4181: not mentioned in Microsoft docs anymore

  C4290: C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
    * throw(optional_type_list)  deprecated in C++17

  C4482: nonstandard extension used: enum 'enumeration' used in qualified name
    * not generated for compilers that support C++11

  C4503: 'identifier': decorated name length exceeded, name was truncated
    * obsolete since Visual Studio 2017

  C4786: not mentioned in Microsoft docs anymore
2025-09-11 20:21:04 -05:00
Markus Reitböck
be6b957929 missing includes in Base, App and Gui headers (#23854)
* missing includes in Base, App and Gui headers

header should be self contained

* use cstddef header instead of stddef.h

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>

---------

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
2025-09-11 18:58:44 -05:00
Chris Hennes
ff349c81d6 Merge pull request #23746 from 3x380V/cmake
CMake: Use scoped include and library directories
2025-09-10 21:54:51 -05:00
Chris Hennes
23bcfd12ff Update translations 2025-09-09 2025-09-10 08:53:41 +02:00
Ladislav Michl
175454b78c Py3.13: Initialize field tp_versions_used 2025-09-10 08:49:31 +02:00
wmayer
ac51455a0a CMake: Replace include_directories with target_include_directories 2025-09-08 19:04:34 +02:00
drwho495
edb046d48e Toponaming: Remove updateElementReferences call in getLinks methods. (#23525)
* remove calls to updateElementReferences in getLinks

* add description of the bug for future developers' sake
2025-09-07 20:40:47 -05:00
Chris Hennes
c00bf075e5 Merge pull request #23384 from 3x380V/units
Base: Units update
2025-09-07 20:22:54 -05:00
Weston Schmidt
87a4ce2e8d Add test causing crash and fix map sorting function. (#22889)
* Add test causing crash and fix map sorting function.

When opening a model from FreeCAD 0.7, the model would crash when I
changed some of the parameters.  This turned out to be due to the
ElementNameComparator::operator() not correctly sorting the items going
into the map, which caused the map to be invalid.

This change adds a test that represented the exact names causing the
crash as well as a fix for the problem.  Names are now sorted:

1. Empty names first
2. Identifier based names second.
3. Hex based names last.

Identifiers are sorted lexicographically for the name portion and
numerically for the number portion, smallest to largest.

Hex based names are sorted by the value of the hex number, smallest to
largest.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix lint issues.

* Add another test form to the mix.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-09-05 14:07:02 -05:00
Ladislav Michl
0278a1298d Base: refactor unit formatting defaults
Defaults for both precision (number of digits after decimal point)
and denominator (number of fractions) are defined on various places
making difficult to find which default is used for various tasks.
Store these values at one central place: UnitsApi. Unless overriden
by user, default values are defined by unitSchemasDataPack.
2025-09-05 17:31:54 +02:00
Chris Hennes
c0d1151633 Update translations 2025-09-03 2025-09-04 11:37:11 +02:00
Chris Hennes
4fbe8e1773 App: Fix safe mode and home directory 2025-09-02 21:39:09 +02:00
luzpaz
b7959450f2 AddonManager: ignore everything but dirs in getVerboseAddOnsInfo
Before this PR addon manager was displaying manifest.json files along with backup files. Now those are ignored.
Fixes #23545
2025-09-01 22:32:23 -05:00