FEM: App and Gui init script:

- improve imports
- add comments
- some code formating
This commit is contained in:
Bernd Hahnebach
2020-05-12 08:46:28 +02:00
parent 4fa967b240
commit 8796d7bc11
2 changed files with 47 additions and 9 deletions

View File

@@ -20,13 +20,34 @@
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
# * USA *
# * *
# ***************************************************************************/
# ***************************************************************************
"""FEM module App init script
# FreeCAD init script of the Fem module
Gathering all the information to start FreeCAD.
This is the first one of three init scripts.
The third one runs when the gui is up.
The script is executed using exec().
This happens inside srd/Gui/FreeCADGuiInit.py
All imports made there are available here too.
Thus no need to import them here.
But the import code line is used anyway to get flake8 quired.
Since they are cached they will not be imported twice.
"""
__title__ = "FEM module App init script"
__author__ = "Juergen Riegel, Bernd Hahnebach"
__url__ = "http://www.freecadweb.org"
# imports to get flake8 quired
import FreeCAD
# add FEM unit tests
FreeCAD.__unit_test__ += ["TestFem"]
# add import and export file types
FreeCAD.addExportType("FEM mesh Python (*.meshpy)", "feminout.importPyMesh")
FreeCAD.addExportType("FEM mesh TetGen (*.poly)", "feminout.convert2TetGen")
@@ -55,5 +76,3 @@ FreeCAD.addImportType("FEM result Z88 displacements (*o2.txt)", "feminout.import
if "BUILD_FEM_VTK" in FreeCAD.__cmake__:
FreeCAD.addImportType("FEM result VTK (*.vtk *.vtu)", "feminout.importVTKResults")
FreeCAD.addExportType("FEM result VTK (*.vtk *.vtu)", "feminout.importVTKResults")
FreeCAD.__unit_test__ += ["TestFem"]

View File

@@ -1,5 +1,6 @@
# ***************************************************************************
# * Copyright (c) 2009 Juergen Riegel <juergen.riegel@web.de> *
# * Copyright (c) 2020 Bernd Hahnebach <bernd@bimstatik.org> *
# * *
# * This program is free software; you can redistribute it and/or modify *
# * it under the terms of the GNU Lesser General Public License (LGPL) *
@@ -17,15 +18,29 @@
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
# * USA *
# * *
# ***************************************************************************/
# ***************************************************************************
"""FEM module Gui init script
# Fem gui init module
# Gathering all the information to start FreeCAD
# This is the second one of three init scripts
# the third one runs when the gui is up
Gathering all the information to start FreeCAD.
This is the second one of three init scripts.
The third one runs when the gui is up.
The script is executed using exec().
This happens inside srd/Gui/FreeCADGuiInit.py
All imports made there are available here too.
Thus no need to import them here.
But the import code line is used anyway to get flake8 quired.
Since they are cached they will not be imported twice.
"""
__title__ = "FEM module Gui init script"
__author__ = "Juergen Riegel, Bernd Hahnebach"
__url__ = "http://www.freecadweb.org"
# imports to get flake8 quired
import FreeCAD
import FreeCADGui
from FreeCADGui import Workbench
class FemWorkbench(Workbench):
@@ -41,6 +56,10 @@ class FemWorkbench(Workbench):
import Fem
import FemGui
import femcommands.commands
# dummy usage to get flake8 and lgtm quiet
False if Fem.__name__ else True
False if FemGui.__name__ else True
False if femcommands.commands.__name__ else True
def GetClassName(self):
# see https://forum.freecadweb.org/viewtopic.php?f=10&t=43300