Commit Graph

106 Commits

Author SHA1 Message Date
luzpaz
b9e74f564b Fix typos
Fixes various documentation/source-comment typos
2025-12-12 13:59:38 +01:00
Frank David Martínez M
da43de8ae0 [Core] FreeCADInit and FreeCADGuiInit refactoring (#23413) 2025-12-04 11:10:53 -06:00
Chris Hennes
a429931abd Core: Record module failure information during startup 2025-09-01 18:10:04 +02:00
Syres916
eaf49f82ee [App] Use consistent unit schema names (#21355)
* [Start] ensure user's preferred unit schema is retained after restart of application

* [App] use consistent schema names throughout the application

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

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

* [Start] Revert commit 2eea421

in preference to PR #21466

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-05-26 17:33:45 +02:00
Yury Shvedov
bc4cddcd04 Macro: allow to specify extra system paths for macro
This introduce new option `-E [ --macro-path]` to specify extra system
paths of macros. The macro found in this paths will appear in `Macros`
dialog at `System macros` tab.

Change-Id: Ic21631ec0ebe8af5c7f42b4fe95400cfb67807d5
2025-01-06 18:14:15 +01:00
Benjamin Nauck
518e6b2c51 Add two options to disable addons
Addons can be disabled in two ways:
 * by adding a command line argument `--disable-addon <addon>`
 * and by creating a `ALL_ADDONS_DISABLED` file in the mod root of the addons to disable
2024-11-25 12:16:43 -05:00
Jonas Bähr
1ec0802fb0 App: add readline-based tab-completion
When executing FreeCAD in interactive console-mode, the init-script tries
to load readline for a better input experience and enables tab-completion.
This code is neither executed when running in GUI mode, nor when the
console is not itneractive, e.g. when reading a script from stdin.

Note that readline is not available on Windows, so we ignore import errors
for now. With pyreadline3 there may be an alternative for Windows, but I
cannot verify this on my setup.
2024-06-06 21:56:18 -05:00
wmayer
effbe1e873 App: Prepare for clang-format 2024-06-03 12:52:30 +02:00
luzpaz
d584643a05 Fix typos 2023-12-06 14:53:48 -05:00
bdieterm
c9a802418a Core, Gui: allow breakpoints in Init.py and InitGui.py of mods 2023-09-18 10:27:51 +02:00
wmayer
03b58bb289 Core: make the init scripts more robust against invalid package.xml files
See also: https://forum.freecad.org/viewtopic.php?t=77170
2023-03-28 10:49:21 +02:00
wmayer
adf1651938 App: fixes #7833: Python2/3 FIXME code in App/FreeCADInit.py to be reviewed
The workaround was needed for Py2 on Windows. Since with Py3 it works as expected the workaround can be removed
2023-03-13 14:07:59 +01:00
Abdullah Tahiri
ee0c3ad5c1 Console/ILogger: Refactor and extension
=======================================

Refactor:
 - Substitute the use of variadic templates with parameter packs.
 - Use recently incorporated external library "fmt" to handle printf like formating.
 - Extensive cleaning of pragmas and unnecessary forward declarations.
 - Parameter packs and libfmt provide a much stronger type checking now, so
   conversions that are by standard implicit as bool to int need an explicit static_cast
   to avoid compilation warnings.

Extension:
 - Include a notifier field, so that the originator of the message can be provided. E.g. Document#DocumentObject
 - Include a new type of message called CriticalMessage, this message is intended to have
   special behaviour in the future. Namely, it will be used to notify forward compatilibity issues.
   It will be used to substitute the current signal/slot mechanism.
 - Include two new types of messages for user notifications (Notification and TranslatedNotification). This messages
   will be use to convey UI notifications intended for the user (such as non-intrusive message about the usage of a tool). There
   are two versions to mark whether the string provided as a message is already translated or not. When using the console system for
   notifications, these notifications may originate from the App or the Gui. In the former, it is generally the case that the strings
   of messages are not (yet) translated (but they can be marked with QT_TRANSLATE_NOOP). In the latter, often the messages to be provided
   are already translated.

Python support for CriticalMessage, Notification and TranslatedNofification, including shortcuts:

    Crt = FreeCAD.Console.PrintCritical
    Ntf = FreeCAD.Console.PrintNotification
    Tnf = FreeCAD.Console.PrintTranslatedNotification
2023-03-07 16:13:23 +01:00
Uwe
7b851646e2 [App] sort units in FreeCADInit.py 2023-02-27 00:12:06 +01:00
Oliver Oxtoby
806c47311e [App] [Base] Add missing Property classes for all Units (#6717)
- Add missing Property classes for all Units
- Add missing units to unit calculator, as well as some missing string representations
- also change units used for dynamic viscosity to the customary Pa*s
2023-02-26 15:28:28 +01:00
wmayer
e71386d20d App: define an enum to be used as the retType argument of DocumentObject.getSubObject()
This is to avoid to use magic numbers in client code
2023-02-14 12:02:33 +01:00
Uwe
b3f04f5639 [App] fixes for Magnetization property 2023-02-09 05:32:20 +01:00
Uwe
a58c74c556 [Core] disable the the unit Oersted
- is not feasible for practical usage and (was up to now not used, thus no consequence)
  moreover, Oersted is a cgs unit while we use SI units, thus also not suitable for FEM, only makes problems for magnetization
2023-02-08 19:59:36 +01:00
Uwe
a9b8be3e00 [Core] add current density
- necessary to implement electromagnetic features to the FEM WB
2023-02-04 03:22:24 -06:00
Chris Hennes
fa8e0a6865 Remove various sys.version_info >= 3 checks 2022-11-09 14:08:54 +01:00
Chris Hennes
48307b91f5 Addon Manager: use versioned Python package dirs 2022-11-05 11:45:02 -05:00
luz paz
7b10713d6f Fix typos and whitespace
Found via `codespell -q 3 -L aci,ake,aline,alle,alledges,alocation,als,ang,anid,anormal,apoints,ba,beginn,behaviour,bloaded,bottome,byteorder,calculater,cancelled,cancelling,cas,cascade,centimetre,childrens,childs,colour,colours,commen,connexion,currenty,dof,doubleclick,dum,eiter,elemente,ende,feld,finde,findf,freez,hist,iff,indicies,initialisation,initialise,initialised,initialises,initialisiert,inout,ist,itsel,kilometre,lod,mantatory,methode,metres,millimetre,modell,nd,noe,normale,normaly,nto,numer,oce,oder,ontop,orgin,orginx,orginy,ot,pard,parm,parms,pres,programm,que,rady,recurrance,ro,rougly,seperator,serie,sinc,siz,strack,substraction,te,technic,thist,thru,tread,uint,unter,uptodate,vertexes,wallthickness,whitespaces -S ./.git,*.po,*.ts,./ChangeLog.txt,./src/3rdParty,./src/Mod/Assembly/App/opendcm,./src/CXX,./src/zipios++,./src/Base/swig*,./src/Mod/Robot/App/kdl_cp,./src/Mod/Import/App/SCL,./src/WindowsInstaller,./src/Doc/FreeCAD.uml,./src/Base/StackWalker.cpp,./build/doc/SourceDocu`
2022-08-23 18:49:47 +02:00
wmayer
b485f7943c Base: expose enum NumberFormat to Python 2022-08-15 11:12:53 +02:00
Uwe
1f0181cdcc [App] remove check for Python 2 2022-07-27 01:55:52 +02:00
wmayer
1bf56a9999 App: add default macro directory to sys.path 2022-06-01 11:21:51 +02:00
wmayer
108810b57b App: expose PropertyType enum to Python 2022-05-03 11:24:23 +02:00
wmayer
d98aaecbfe Mod: issue #6274: Source code installation failed 2022-04-18 12:27:09 +02:00
wmayer
0b2c73cf32 Gui: clean-up Selection API
Replace the int of the 'resolve' argument of several functions with a proper enum class.
* This avoids the inconsistencies in client code where often true/false is passed when an int is expected
* This avoids the use of magic numbers like 0, 1, 2 or the undocumented 3
2022-04-09 17:03:43 +02:00
wmayer
1a62c2024d lgtm: removes unused imports in Python scripts 2022-03-20 23:00:55 +01:00
Chris Hennes
0c85c16932 Core: Support disabling Addon by FreeCAD version
If package.xml metadata file exists, it is scanned for FreeCAD version
compatibility before the Addon is loaded. If the Addon specifies that it is
explicitly not compatible with the current version of FreeCAD, the Addon is
not loaded.
2022-03-08 23:19:04 -06:00
Chris Hennes
6dd6c3168d Core: Remove Init.py stop file check from inner package loop
Check was unused, only stop files located at the top-level should halt loading.
2022-03-02 10:00:52 -06:00
Chris Hennes
ec90b7f954 Core: Add mechanism to disable addon 2022-02-20 22:09:57 -06:00
wmayer
0208608b9e Base: fix Matrix4D::hasScale
* If all column vectors of the 3x3 sub-matrix are equal the function incorrectly claims that it's uniform scaling.
* Detect also non-uniform scaling and if was applied from the left or right side
* Replace the int with an enum and expose it to Python
* Add several new unit tests
2022-02-15 21:05:11 +01:00
Chris Hennes
8d96cadb69 Addon manager: install dependencies (#5376)
Addon Manager: Dependency Installation

The Addon Manager can now attempt to use pip directly to install
required packages as specified in either metadata.txt or
requirements.txt files provided by AddOns. The packages are installed
into FreeCAD.getUserAppDataDir()/AdditionalPythonPackages directory.
Only simplified requirements.txt data is supported: any version
information is stripped out, and only packages are supported (that is,
no pip arguments, included files, etc.). Further, packages are checked
against a list of allowed packages prior to being suggested for
installation. Addon authors should submit a PR to the FreeCAD repo
adding their requirements to the allowed list, for packages that are not
already on the list (this is a malware-prevention mechanism).
2022-01-21 10:19:21 -06:00
Chris Hennes
12e3f9f222 Core: Fix installation conflict with pkgutils 2021-12-18 20:29:42 -06:00
Chris Hennes
3aebf0aead GUI: Handle packaged Workbenches and their icons 2021-12-18 20:29:42 -06:00
Yorik van Havre
ae84229ebc App: Added warning at startup if user mods are found in older location 2021-11-26 16:01:23 +01:00
Preslav
5030d8bb6d Added stiffness units to FreeCAD [mN/m, N/m, kN/m, MN/m] 2021-08-16 12:27:41 +01:00
wmayer
7eaf08063e App: add system32 to Python's search paths 2021-03-27 13:05:03 +01:00
donovaly
6c67300d62 [Base] add electrical conductivity
- this is necessary to perform electrodynamics simulations. Since the typical values are in the range of 1e6 S/m, we need the new units kS and MS

- since this is for simulations, also add electrical conductivity to the FEM material cards
2021-03-25 17:13:52 +01:00
Chris Hennes
6b11d45e7a LGTM: Minor fixes to FreeCADApp.py
LGTM flagged several redundant imports, and was confused by the else
clause of one loop. This commit removes those imports, and because of
the loop's construction, removes the else entirely and lets the loop
fall through to the error state if it fails to find what it's looking
for.
2021-02-11 11:54:24 +01:00
wmayer
a0de713ca2 Py2: do not open Init[Gui].py files with utf-8 encoding 2020-11-26 00:48:28 +01:00
wmayer
c3b147a5c9 Init: [skip ci] do explicitly open Init[Gui].py files with utf-8 encoding 2020-11-24 14:15:26 +01:00
luz paz
84553bf191 App: Fix header uniformity, trailing whitespace, and doxygen headers 2020-11-19 13:38:37 +01:00
wmayer
7a3097586d Win32: [skip ci] DLL resolution in Python 3.8 on Windows has changed 2020-11-14 16:38:02 +01:00
wmayer
b161bdb78f Base: [skip ci] add an enum for unit schemes in Python to avoid to work with numbers 2020-08-07 23:02:25 +02:00
qingfengxia
768b1e718a FEM: fix unit for volumetric thermal exapnsion coefficient 2020-05-23 00:03:12 +02:00
luz.paz
ebe194a9e9 Fix typos
Found via  
```
codespell -q 3 -L aci,ake,aline,alle,alledges,alocation,als,ang,anid,ba,beginn,behaviour,bloaded,byteorder,calculater,cancelled,cancelling,cas,cascade,centimetre,childs,colour,colours,commen,connexion,currenty,dof,doubleclick,dum,eiter,elemente,ende,feld,finde,findf,freez,hist,iff,indicies,initialisation,initialise,initialised,initialises,initialisiert,ist,kilometre,lod,mantatory,methode,metres,millimetre,modell,nd,noe,normale,normaly,nto,numer,oder,orgin,orginx,orginy,ot,pard,pres,programm,que,recurrance,rougly,seperator,serie,sinc,strack,substraction,te,thist,thru,tread,uint,unter,vertexes,wallthickness,whitespaces -S ./.git,*.po,*.ts,./ChangeLog.txt,./src/3rdParty,./src/Mod/Assembly/App/opendcm,./src/CXX,./src/zipios++,./src/Base/swig*,./src/Mod/Robot/App/kdl_cp,./src/Mod/Import/App/SCL,./src/WindowsInstaller,./src/Doc/FreeCAD.uml
```
2020-03-06 14:50:35 +01:00
wmayer
0b9626cf61 Py2: [skip ci] provide time._process_time 2020-01-18 12:21:00 +01:00
donovaly
d1b354fc6b add units Gauss, Weber and Oersted 2020-01-07 07:36:22 -03:00