Commit Graph

142 Commits

Author SHA1 Message Date
7535a48ec4 feat(gui): add origin abstraction layer for unified file operations
Implements Issue #9: Origin abstraction layer

This commit introduces a foundational abstraction for document origins,
enabling FreeCAD to work with different storage backends (local filesystem,
Silo PLM, future cloud services) through a unified interface.

## Core Components

### FileOrigin Abstract Base Class (FileOrigin.h/cpp)
- Defines interface for document origin handlers
- Identity methods: id(), name(), nickname(), icon(), type()
- Workflow characteristics: tracksExternally(), requiresAuthentication()
- Capability queries: supportsRevisions(), supportsBOM(), supportsPartNumbers()
- Connection state management with fastsignals notifications
- Document identity: documentIdentity() returns UUID, documentDisplayId() for display
- Property sync: syncProperties() for bidirectional database sync
- Core operations: newDocument(), openDocument(), saveDocument(), saveDocumentAs()
- Extended PLM operations: commitDocument(), pullDocument(), pushDocument(), etc.

### LocalFileOrigin Implementation
- Default origin for local filesystem documents
- ownsDocument(): Returns true if document has NO SiloItemId property
- Wraps existing FreeCAD file operations (App::GetApplication())

### OriginManager Singleton (OriginManager.h/cpp)
- Follows WorkbenchManager pattern (instance()/destruct())
- Manages registered FileOrigin instances
- Tracks current origin selection with persistence
- Provides document-to-origin resolution via findOwningOrigin()
- Emits signals: signalOriginRegistered, signalOriginUnregistered,
  signalCurrentOriginChanged
- Preferences stored at: User parameter:BaseApp/Preferences/General/Origin

### Python Bindings (FileOriginPython.h/cpp)
- Adapts Python objects to FileOrigin C++ interface
- Enables Silo addon to implement origins in Python
- Thread-safe with Base::PyGILStateLocker
- Static addOrigin()/removeOrigin() for registration

### Python API (ApplicationPy.cpp)
- FreeCADGui.addOrigin(obj) - Register Python origin
- FreeCADGui.removeOrigin(obj) - Unregister Python origin
- FreeCADGui.getOrigin(id) - Get origin info as dict
- FreeCADGui.listOrigins() - List all registered origin IDs
- FreeCADGui.activeOrigin() - Get current origin info
- FreeCADGui.setActiveOrigin(id) - Set active origin

## Design Decisions

1. **UUID Tracking**: Documents tracked by SiloItemId (immutable UUID),
   SiloPartNumber used for human-readable display only

2. **Ownership by Properties**: Origin ownership determined by document
   properties (SiloItemId), not file path location

3. **Local Storage Always**: All documents saved locally; origins change
   workflow and identity model, not storage location

4. **Property Syncing**: syncProperties() enables bidirectional sync of
   document metadata with database (Description, SourcingType, etc.)

## Files Added
- src/Gui/FileOrigin.h
- src/Gui/FileOrigin.cpp
- src/Gui/FileOriginPython.h
- src/Gui/FileOriginPython.cpp
- src/Gui/OriginManager.h
- src/Gui/OriginManager.cpp

## Files Modified
- src/Gui/CMakeLists.txt - Added new source files
- src/Gui/Application.cpp - Initialize/destruct OriginManager
- src/Gui/ApplicationPy.h - Added Python method declarations
- src/Gui/ApplicationPy.cpp - Added Python method implementations

Refs: #9
2026-02-05 13:17:23 -06:00
wmayer
6683fdb122 Simplify code using xerces namespace 2026-01-07 14:37:59 +01:00
pre-commit-ci[bot]
9fe130cd73 All: Reformat according to new standard 2025-11-11 13:49:01 +01:00
Markus Reitböck
a72a0d6405 Gui: 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:03 +02:00
Yorik van Havre
512a22d39b Merge pull request #22251 from furgo16/dxf-new-import-ui-and-more
Redesign DXF import UI, add Part primitives and Draft object import modes
2025-07-28 17:49:25 +02:00
theo-vt
987fec7032 Change Py::Int to Py::Long 2025-07-24 19:16:00 -05:00
Chris Hennes
78b0905be0 Gui: Replace use of traceback with sys._getframe() 2025-07-23 21:08:02 -05:00
Furgo
c238be2857 Gui: add WaitCursor API 2025-07-14 10:18:04 +02:00
Samuel Abels
5aaf46aa8b Avoid triggering circular imports by using traceback instead of inspect 2025-06-30 21:30:34 +02:00
bofdahof
ba2c2ca5ad Console: rename PascalCase named methods to camelCase 2025-05-06 17:50:21 +02:00
tetektoza
8fda3b4bd1 Core: Introduce PDF Import-Export dialog (#20860)
* Core: Introduce PDF Import-Export dialog

Currently, we only have hardcoded exporting to one pdf version, which
leads to (as in one of the below issues) to problems, such as
non-transparent layers, which are by default not supported in PDF/A-1b.

So, this patch adds an option to the user to select their preferred PDF
version by introducing new dialog under Import-Export in Preferences,
and allowing to update that version before exporting.

* Core: Add informational messages regarding selected PDF format

* Gui: Handle Qt < 6.8 unsupported PDF format

* Gui: Switch PDF export prefs dialog to use tr()

* Gui: Remove center alignment of PDF version description

---------

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
2025-04-27 19:31:34 -05:00
bofdahof
cb5caf6765 Gui: apply std::ranges 2025-03-16 17:15:14 -05:00
Chris Hennes
d242ac706e Gui: Migrate to using App::Application::getNameWithVersion 2025-02-03 12:05:16 -05:00
Pascal de Bruijn
5ac886fa0e Add proper PDF creator metadata 2025-02-03 12:05:16 -05:00
tritao
4c93a14fea Gui: Reorganize the dialog files into a top Dialogs folder. 2025-01-24 16:28:02 -06:00
wmayer
5302033c76 Gui: Move Python functions from Application to ApplicationPy
This reduces build time when adding new Python functions because only one file must be compiled.
Handles also many linter warnings.
2024-12-20 11:50:07 -05:00
Syres916
a7d122428b [Gui] Show Preferences page by name rather than index 2024-12-16 11:43:13 -05:00
wmayer
2d4049ef52 Core: Check returned pointer of convertSWIGPointerObj 2024-10-10 20:36:03 -05:00
bgbsww
48c65aed76 Support macros and console logs in Assembly 2024-09-23 14:10:55 -05:00
wmayer
0b86976bf4 Gui: simplify Application::sGetMarkerIndex 2023-11-30 15:26:43 +01:00
luzpaz
5c21351608 Fix various typos 2023-11-30 14:58:06 +01:00
Syres916
b00cca788d [Gui] Add HourGlass markers including larger sizes 2023-11-28 23:55:10 +01:00
Chris Hennes
cfd41683a5 Core: Enable compiling with MSVC /permissive- (#11014)
* Base: Fixes for MSVC permissive-

* App: Fixes for MSVC permissive-

* Gui: Fixes for MSVC permissive-

* Main: Fixes for MSVC permissive-

* Fem: Fixes for MSVC permissive-

* Material: Fixes for MSVC permissive-

* Part: Fixes for MSVC permissive-

* Mesh: Fixes for MSVC permissive-

* Points: Fixes for MSVC permissive-

* Robot: Fixes for MSVC permissive-

* TechDraw: Fixes for MSVC permissive-

* Path: Fixes for MSVC permissive-

* Core; Changes per review comments

* TD: Revision from wandererfan

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-11-27 17:37:29 +01:00
wmayer
ec02ef0126 Gui: use MarkerBitmaps::getSupportedSizes to get available sizes 2023-11-25 18:37:26 +01:00
wmayer
cb786fcbcd Gui: expose functions to Python to add and remove a manipulator 2023-10-16 18:13:41 +02:00
Chris Hennes
3d7441c2a5 Gui: Wrap PyArg_ParseTupleAndKeywords 2023-08-25 15:34:26 -05:00
Tobias Falk
529f9401f7 added PDF/A-1b compliancy to all PDF export functions
for more details about this look at: https://www.kdab.com/creating-pdfa-documents-qt/
2023-08-05 14:46:11 -06:00
Paddle
36e59562cf Core: WorkbenchComboBox and WorkbenchGroup simplification. 2023-05-22 10:13:13 +02:00
Chris Hennes
18cae6b903 GUI: Translate the tooltip for EditMode menu
The tip text was extracted from the Wiki.
2023-04-21 16:55:05 -05:00
Paddle
7ea4588499 Pref: Wb: remove args first element on restart.
- isRebootRequired is not public but in accept&reject.
- PreferencePage::isRebootRequired changed to const
- Change 2 warnings to log
- remove useless  c_str()
- Change DlgPreferencesImp::isRebootRequired name + reboot by restart everywhere.
- Sort workbenches so that disabled wb are sorted.
2023-03-31 14:12:27 +02:00
Paddle
2107002ed2 Pref: - add require-reboot capability to PreferencePage.
- Implement this require-reboot in wb pref page
2023-03-28 15:18:23 +02:00
wmayer
771315cfdc Core: use FileHandler in Application::sOpen and Application::sInsert 2023-03-22 15:14:45 +01:00
berniev
ae53c9b0a4 Gui: Use auto and range-based for (#7481)
* On lines where the variable type is obvious from inspection, avoid repeating the type using auto. 
* When possible use a ranged for loop instead of begin() and end() iterators
2022-09-14 13:25:13 -05:00
wmayer
ab6c75fad9 Core: replace PyObject_IsTrue with Base::asBoolean 2022-07-16 14:04:05 +02:00
wmayer
d5340a82ab Gui/Mod: replace several reinterpret_cast with static_cast 2022-06-25 11:36:55 +02:00
marioalexis
ae56fb62a7 Gui: Use PyObject_IsTrue in combination with conditional ternary operator 2022-06-22 19:50:03 -04:00
wmayer
fc9e19aafb Test: [skip ci] add unit tests for PR #6907 2022-05-24 14:17:44 +02:00
wmayer
1178df06b4 Gui: modernize C++11
* use nullptr
2022-03-23 18:41:21 +01:00
wmayer
e4d1ed8366 Base: rename BaseExceptionFreeCADError to PyExc_FC_GeneralError 2022-03-17 14:45:48 +01:00
wmayer
1f12dca2b4 Py: replace BaseExceptionFreeCADError with more suitable exception types 2022-03-17 13:54:23 +01:00
Uwe
d09cb5e49e [Gui] move xerces to precompiled header
as suggested here: https://github.com/FreeCAD/FreeCAD/commit/0235a172#r68066840
2022-03-06 15:53:13 +01:00
Uwe
5d64f43dd6 [Gui] fix when compiling with PCH 2022-03-05 15:01:55 +01:00
wmayer
5e0cfc64ee App: use forward declarations 2022-03-04 21:09:46 +01:00
Uwe
8a0e6dd587 [Gui] compilation fixes for non-PCH
the recent commits were done with PCH, this is the final commit of today's header work for PCH
2022-02-19 06:22:08 +01:00
Uwe
08a43f03ed [Gui] remove unused headers 2022-02-19 03:41:28 +01:00
Maël Kerbiriou
31392a75f7 Gui: replace s# format unit with s* 2022-02-09 19:29:56 +01:00
wmayer
d9016c490a Gui: [skip ci] replace tabs with spaces, replace NULL with nullptr 2022-02-03 09:56:46 +01:00
marioalexis
f89c9f053a Gui: Improve the docstrings and clean up code in ApplicationPy.cpp 2022-02-03 08:21:23 +01:00
wmayer
c8fcb9405e Gui: extend PySide2 wrapper of MainWindow with extra functions 2021-11-19 15:45:56 +01:00
wmayer
f36126770c App: harmonize API of App::Application
* make getHomePath() static and return a std::string
* make getExecutableName() static and return a std::string
2021-11-04 10:50:09 +01:00