Commit Graph

97 Commits

Author SHA1 Message Date
bdieterm
e33c5754d4 Core, Gui: allow breakpoints in Init.py and InitGui.py of mods 2023-09-18 10:27:51 +02:00
wmayer
5c3f361077 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
54009f14ee 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
c604d1741d 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
a000dcf60a [App] sort units in FreeCADInit.py 2023-02-27 00:12:06 +01:00
Oliver Oxtoby
9d5ab79a4c [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
212bbc7fa0 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
c074fe1c95 [App] fixes for Magnetization property 2023-02-09 05:32:20 +01:00
Uwe
b41776d077 [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
2880a5ca2a [Core] add current density
- necessary to implement electromagnetic features to the FEM WB
2023-02-04 03:22:24 -06:00
Chris Hennes
3fe026f3c9 Remove various sys.version_info >= 3 checks 2022-11-09 14:08:54 +01:00
Chris Hennes
9e481f1ac1 Addon Manager: use versioned Python package dirs 2022-11-05 11:45:02 -05:00
luz paz
1a7ddfdc24 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
020bf1789a Base: expose enum NumberFormat to Python 2022-08-15 11:12:53 +02:00
Uwe
2eceb004e0 [App] remove check for Python 2 2022-07-27 01:55:52 +02:00
wmayer
8c123bad50 App: add default macro directory to sys.path 2022-06-01 11:21:51 +02:00
wmayer
95123b3399 App: expose PropertyType enum to Python 2022-05-03 11:24:23 +02:00
wmayer
6bc65bdd99 Mod: issue #6274: Source code installation failed 2022-04-18 12:27:09 +02:00
wmayer
9eac35cf5d 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
cf7fd5d2ac lgtm: removes unused imports in Python scripts 2022-03-20 23:00:55 +01:00
Chris Hennes
f122061424 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
3af20938cd 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
02cfa11c8e Core: Add mechanism to disable addon 2022-02-20 22:09:57 -06:00
wmayer
a5e561b31d 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
d1a94de371 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
5c1655d125 Core: Fix installation conflict with pkgutils 2021-12-18 20:29:42 -06:00
Chris Hennes
2bfcf6af09 GUI: Handle packaged Workbenches and their icons 2021-12-18 20:29:42 -06:00
Yorik van Havre
bca145d8c7 App: Added warning at startup if user mods are found in older location 2021-11-26 16:01:23 +01:00
Preslav
4ab37fc0ca Added stiffness units to FreeCAD [mN/m, N/m, kN/m, MN/m] 2021-08-16 12:27:41 +01:00
wmayer
e825148cf4 App: add system32 to Python's search paths 2021-03-27 13:05:03 +01:00
donovaly
bcc669b930 [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
ebc4cd6700 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
de07c92361 Py2: do not open Init[Gui].py files with utf-8 encoding 2020-11-26 00:48:28 +01:00
wmayer
27ee19c1f7 Init: [skip ci] do explicitly open Init[Gui].py files with utf-8 encoding 2020-11-24 14:15:26 +01:00
luz paz
bfdffb50be App: Fix header uniformity, trailing whitespace, and doxygen headers 2020-11-19 13:38:37 +01:00
wmayer
82beefa98d Win32: [skip ci] DLL resolution in Python 3.8 on Windows has changed 2020-11-14 16:38:02 +01:00
wmayer
40bbe3515c 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
ac46d8c82c FEM: fix unit for volumetric thermal exapnsion coefficient 2020-05-23 00:03:12 +02:00
luz.paz
180805c55e 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
6866397c14 Py2: [skip ci] provide time._process_time 2020-01-18 12:21:00 +01:00
donovaly
66354b3c58 add units Gauss, Weber and Oersted 2020-01-07 07:36:22 -03:00
donovaly
05dadb4c75 add the units Ohm and Siemens 2020-01-05 15:00:46 +01:00
luz.paz
4f308dc03c src/App: [skip ci] fix header uniformity
This PR fixes header uniformity across all `src/App` files
2019-12-25 11:38:43 +01:00
wmayer
72065b0d39 [skip ci] MPH already defined 2019-12-24 13:33:38 +01:00
donovaly
6aeb0910b8 cosmetics to keep the overview 2019-12-24 13:31:00 +01:00
donovaly
cd8b63028c missing parts from from commit d9d903faea
- also add keV and MeV since these are the units used in practice
2019-12-24 13:31:00 +01:00
donovaly
9c707479a6 also add unit THz as requested 2019-12-23 16:49:45 +01:00
donovaly
63bc9c5683 add units Mpsi, cal and kcal
- also ass missing parts from commit d7ca604c
2019-12-23 16:49:45 +01:00
donovaly
2949afb55b add mJ and kW
- also some fixes
- add conversions for forces
2019-12-19 13:31:12 +01:00
donovaly
82dc8e88f5 add the following units:
- mmol
- ml
- bar
- mbar
- kJ
- kWh
- eV
- C
- T
- F (p, n, u, m)
- H (n, u, m)
2019-12-19 13:31:12 +01:00