Commit Graph

2387 Commits

Author SHA1 Message Date
github-actions
68cb0a3270 Update translations from Crowdin 2025-11-25 21:20:42 -06:00
Furgo
b571889ab5 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
bad2989b7b #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
e802aa1821 Removed sys in 'from os import sys, path' 2025-11-20 20:13:16 -06:00
David Carter
f4e78e3163 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
4d0c35dd2d 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
0083364dbe Doc: Improve the documentation of transactions (#21494) 2025-11-14 12:52:13 -06:00
github-actions
8432fab0a9 Update translations from Crowdin 2025-11-11 23:44:18 -06:00
Florian Foinant-Willig
ee34d09f7a Core: add a check on object deletion 2025-11-09 16:44:40 -06:00
Max Wilfinger
aeb83b3c05 App: Apply code review suggestions 2025-11-02 17:38:06 +01:00
wwmayer
1844fdd443 PD: Toggling transparency doesn't reset colors 2025-11-01 09:05:03 +01:00
github-actions
11fecb1558 Update translations from Crowdin 2025-10-27 21:06:54 -05:00
Kevin Martin
0334c145d0 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
50d1dec4e0 Update translations from Crowdin 2025-10-20 09:57:05 -05:00
PaddleStroke
6e090a2dad 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
e187e696b5 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
9c1454385e 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
9ff4a40bc2 Fixing repr for App/Document and Gui/Document 2025-10-02 04:22:24 -04:00
Chris Hennes
60c8c51d49 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
05707c61fb Fix Refine in Cut Compound test 2025-09-26 16:12:56 -05:00
marioalexis
014edacf1b App: Fix GroupExtension finding wrong group for objects 2025-09-25 15:52:43 -05:00
Chris Hennes
39d39f34c3 Update translations 2025-09-25 2025-09-25 17:25:13 +02:00
PaddleStroke
001bab4439 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
9fdbbe44ee Merge pull request #23803 from 3x380V/py
Py3.13: fix warnings
2025-09-24 22:16:30 -05:00
Florian Foinant-Willig
d15d9948bc Core: set properties of frozen object read-only 2025-09-23 22:42:14 +02:00
drwho495
9f2d212b12 Toponaming: Don't add empty tags past the threshold 2025-09-22 10:35:13 -05:00
Chris Hennes
6a8cfed1d6 App: Fix the Python wrapper for isVersionedPath 2025-09-20 11:46:11 -05:00
sliptonic
636bd90d4d Merge pull request #23585 from chennes/extractVersionMigrator
Gui: Improve version migration UX
2025-09-20 10:01:40 -05:00
PaddleStroke
6e4d2a94d5 Core: GeoFeature::getPlacementFromProp prevent potential crash 2025-09-19 08:40:06 -05:00
Chris Hennes
929bd5090b 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
79640fd18a Merge pull request #23885 from chennes/pythonInterfaceToApplicationDirectories
App: Add Python interface to ApplicationDirectories
2025-09-17 18:11:41 -05:00
Chris Hennes
a6c5e9f08e App: Remove manual PCH entries 2025-09-17 16:18:10 -05:00
Chris Hennes
b64b0f528b App: Address reviewer comments 2025-09-17 16:08:07 -05:00
Chris Hennes
3dd12e5da1 Gui: Improve version migration UX 2025-09-17 10:43:16 -05:00
Chris Hennes
29c69a4689 Update translations 2025-09-15 2025-09-16 09:55:13 +02:00
Markus Reitböck
d05e2a0431 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
0dcbac7b30 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
749ac36615 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
965109dd73 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
3d65ae46d5 Merge pull request #23746 from 3x380V/cmake
CMake: Use scoped include and library directories
2025-09-10 21:54:51 -05:00
Chris Hennes
58a8d589a7 Update translations 2025-09-09 2025-09-10 08:53:41 +02:00
Ladislav Michl
ea9cdfd962 Py3.13: Initialize field tp_versions_used 2025-09-10 08:49:31 +02:00
wmayer
93db4c7d8a CMake: Replace include_directories with target_include_directories 2025-09-08 19:04:34 +02:00
drwho495
55b3ab0489 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
325730dd9c Merge pull request #23384 from 3x380V/units
Base: Units update
2025-09-07 20:22:54 -05:00
Weston Schmidt
140c9febc4 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
e7cd72b2e0 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
fd20bdd6d8 Update translations 2025-09-03 2025-09-04 11:37:11 +02:00
Chris Hennes
62ec6f773c App: Fix safe mode and home directory 2025-09-02 21:39:09 +02:00
luzpaz
e1dcb21165 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