From 729685316e5bcf156886d8597dd094bbfed6f4a1 Mon Sep 17 00:00:00 2001 From: luzpaz Date: Sun, 22 Jan 2023 17:57:12 +0000 Subject: [PATCH] Fix trailing whitespace, typos, headers Fix trailing whitespace, typos, and header uniformity. --- package/fedora/freecad.spec | 4 +- src/Base/CoordinateSystemPy.xml | 18 ++--- src/Base/Quantity.cpp | 4 +- src/Base/RotationPy.xml | 2 +- src/Ext/CMakeLists.txt | 2 +- src/Ext/freecad/CMakeLists.txt | 2 +- src/Ext/freecad/UiTools.py | 2 +- src/Gui/Language/Translator.cpp | 2 +- src/Gui/Language/translation.qrc | 6 +- src/Gui/TreeParams.cpp | 2 +- .../gui/test_update_all_gui.py | 2 +- .../addonmanager_installer_gui.py | 8 +- src/Mod/Arch/importIFC.py | 2 +- src/Mod/Fem/Gui/Resources/Fem.qrc | 2 +- .../Fem/Gui/ViewProviderFemPostPipeline.cpp | 4 +- src/Mod/Idf/Idf.py | 55 +++++++------ src/Mod/Image/Gui/Resources/Image.qrc | 4 +- src/Mod/JtReader/App/TestJtReader.cpp | 2 +- src/Mod/JtReader/CMakeLists.txt | 2 +- src/Mod/Material/CMakeLists.txt | 8 +- src/Mod/Material/FluidMaterial/Readme.md | 21 ++--- src/Mod/Material/Resources/Material.qrc | 4 +- src/Mod/Material/Templatematerial.yml | 2 +- src/Mod/Measure/App/Measurement.cpp | 2 +- src/Mod/Mesh/Gui/Resources/Mesh.qrc | 2 +- .../OpenSCADTest/app/test_importCSG.py | 14 ++-- .../Path/Post/scripts/dynapath_4060_post.py | 6 +- src/Mod/Sandbox/Gui/GLGraphicsView.cpp | 4 +- src/Mod/Sandbox/Gui/Overlay.cpp | 2 +- src/Mod/Sketcher/App/planegcs/GCS.cpp | 2 +- src/Mod/TechDraw/Gui/Resources/TechDraw.qrc | 2 +- src/Mod/TemplatePyMod/CMakeLists.txt | 14 ++-- src/Mod/TemplatePyMod/MengerSponge.py | 4 +- src/Mod/TemplatePyMod/Mesh2Shape.py | 2 +- src/Mod/Test/CMakeLists.txt | 2 +- src/Mod/Web/Gui/CookieJar.cpp | 2 +- src/Mod/mod.dox | 2 +- src/Tools/FCFileTools.py | 10 +-- src/Tools/RegExp/CMakeLists.txt | 2 +- src/Tools/WinVersion.py | 6 +- .../_TEMPLATEPY_/Resources/_TEMPLATEPY_.qrc | 4 +- src/Tools/_TEMPLATE_/Gui/CMakeLists.txt | 2 +- src/Tools/catfiles.py | 4 +- src/Tools/fcbt/CreatePyModule.py | 81 +++++++++---------- src/Tools/makedist.py | 4 +- src/Tools/pythondoc.py | 16 ++-- src/Tools/updatecrowdin.py | 14 ++-- src/Tools/updatets.py | 6 +- 48 files changed, 180 insertions(+), 189 deletions(-) diff --git a/package/fedora/freecad.spec b/package/fedora/freecad.spec index 5b01193347..c701e60bda 100644 --- a/package/fedora/freecad.spec +++ b/package/fedora/freecad.spec @@ -123,10 +123,10 @@ Requires: python3-matplotlib Requires: python3-pivy Requires: python3-pyside2 Requires: qt5-assistant -%if %{bundled_smesh} +%if %{bundled_smesh} Provides: bundled(smesh) = %{bundled_smesh_version} %endif -%if %{bundled_pycxx} +%if %{bundled_pycxx} Provides: bundled(python-pycxx) %endif Recommends: python3-pysolar diff --git a/src/Base/CoordinateSystemPy.xml b/src/Base/CoordinateSystemPy.xml index db153b227d..63c5169d3b 100644 --- a/src/Base/CoordinateSystemPy.xml +++ b/src/Base/CoordinateSystemPy.xml @@ -1,15 +1,15 @@ - diff --git a/src/Base/Quantity.cpp b/src/Base/Quantity.cpp index 4af035e99f..bee9039f35 100644 --- a/src/Base/Quantity.cpp +++ b/src/Base/Quantity.cpp @@ -332,8 +332,8 @@ Quantity Quantity::MegaNewton (1e+9 ,Unit(1,1,-2)); Quantity Quantity::NewtonPerMeter (1.00 ,Unit(0,1,-2)); //Newton per meter (N/m or kg/s^2) Quantity Quantity::MilliNewtonPerMeter (1e-3 ,Unit(0,1,-2)); -Quantity Quantity::KiloNewtonPerMeter (1e3 ,Unit(0,1,-2)); -Quantity Quantity::MegaNewtonPerMeter (1e6 ,Unit(0,1,-2)); +Quantity Quantity::KiloNewtonPerMeter (1e3 ,Unit(0,1,-2)); +Quantity Quantity::MegaNewtonPerMeter (1e6 ,Unit(0,1,-2)); Quantity Quantity::Pascal (0.001 ,Unit(-1,1,-2)); // Pascal (kg/m/s^2 or N/m^2) Quantity Quantity::KiloPascal (1.00 ,Unit(-1,1,-2)); diff --git a/src/Base/RotationPy.xml b/src/Base/RotationPy.xml index 5afd250195..56df46d655 100644 --- a/src/Base/RotationPy.xml +++ b/src/Base/RotationPy.xml @@ -54,7 +54,7 @@ z : float w : float\n Rotation(dir1, dir2, dir3, seq) Define from three vectors that define rotated axes directions plus an optional -3-characher string of capital letters 'X', 'Y', 'Z' that sets the order of +3-characher string of capital letters 'X', 'Y', 'Z' that sets the order of importance of the axes (e.g., 'ZXY' means z direction is followed strictly, x is used but corrected if necessary, y is ignored). dir1 : Base.Vector diff --git a/src/Ext/CMakeLists.txt b/src/Ext/CMakeLists.txt index 7b7a5a13a1..6609da9d40 100644 --- a/src/Ext/CMakeLists.txt +++ b/src/Ext/CMakeLists.txt @@ -1,6 +1,6 @@ # this directory is the entry point for namespace modules. Any package # installed to a directory "freecad" which is in sys.path can be imported -# with "from freecad import package" and is checked for a init_gui.py +# with "from freecad import package" and is checked for a init_gui.py # module, which is imported at startup. (FreeCADGuiInit.py) add_subdirectory(freecad) \ No newline at end of file diff --git a/src/Ext/freecad/CMakeLists.txt b/src/Ext/freecad/CMakeLists.txt index 6803c7b5e8..8efe85b7ca 100644 --- a/src/Ext/freecad/CMakeLists.txt +++ b/src/Ext/freecad/CMakeLists.txt @@ -1,4 +1,4 @@ -EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c +EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(plat_specific=True))" OUTPUT_VARIABLE python_libs OUTPUT_STRIP_TRAILING_WHITESPACE ) SET(PYTHON_MAIN_DIR ${python_libs}) diff --git a/src/Ext/freecad/UiTools.py b/src/Ext/freecad/UiTools.py index e2b852f2bf..0f4a4639d3 100644 --- a/src/Ext/freecad/UiTools.py +++ b/src/Ext/freecad/UiTools.py @@ -11,7 +11,7 @@ class QUiLoader(QtUiTools.QUiLoader): def __init__(self, arg = None): super(QUiLoader, self).__init__(arg) self.ui = Gui.PySideUic - + def createWidget(self, className, parent = None, name = ""): widget = self.ui.createCustomWidget(className, parent, name) if not widget: diff --git a/src/Gui/Language/Translator.cpp b/src/Gui/Language/Translator.cpp index badc26d465..1e272555c9 100644 --- a/src/Gui/Language/Translator.cpp +++ b/src/Gui/Language/Translator.cpp @@ -95,7 +95,7 @@ using namespace Gui; * Q_INIT_RESOURCE(resource); * * \endcode - * + * * where \a resource is the name of the .qrc file. That's all! */ diff --git a/src/Gui/Language/translation.qrc b/src/Gui/Language/translation.qrc index cb1ad2b5c5..c9ad3e0439 100644 --- a/src/Gui/Language/translation.qrc +++ b/src/Gui/Language/translation.qrc @@ -1,5 +1,5 @@ - + qt_de.qm qt_es-ES.qm qt_fr.qm @@ -65,6 +65,6 @@ FreeCAD_ka.qm FreeCAD_sr-CS.qm FreeCAD_be.qm - + - + diff --git a/src/Gui/TreeParams.cpp b/src/Gui/TreeParams.cpp index 54e404e503..a2db6299c2 100644 --- a/src/Gui/TreeParams.cpp +++ b/src/Gui/TreeParams.cpp @@ -170,7 +170,7 @@ public: if(it == funcs.end()) return; it->second(this); - + } diff --git a/src/Mod/AddonManager/AddonManagerTest/gui/test_update_all_gui.py b/src/Mod/AddonManager/AddonManagerTest/gui/test_update_all_gui.py index 89ddff7b8c..575fd5bc16 100644 --- a/src/Mod/AddonManager/AddonManagerTest/gui/test_update_all_gui.py +++ b/src/Mod/AddonManager/AddonManagerTest/gui/test_update_all_gui.py @@ -129,7 +129,7 @@ class TestUpdateAllGui(unittest.TestCase): sleep(0.01) self.limit_reached = True worker = Worker() - self.factory.work_function = worker.run + self.factory.work_function = worker.run self.test_object.run() cancel_timer = QtCore.QTimer() cancel_timer.timeout.connect( diff --git a/src/Mod/AddonManager/addonmanager_installer_gui.py b/src/Mod/AddonManager/addonmanager_installer_gui.py index eae53bb2c9..a0dad3849b 100644 --- a/src/Mod/AddonManager/addonmanager_installer_gui.py +++ b/src/Mod/AddonManager/addonmanager_installer_gui.py @@ -88,13 +88,13 @@ class AddonInstallerGUI(QtCore.QObject): # Dependency check deps = MissingDependencies(self.addon_to_install, self.addons) - + # Python interpreter version check stop_installation = self._check_python_version(deps) if stop_installation: self.finished.emit() return - + # Required Python if hasattr(deps, "python_requires") and deps.python_requires: # Disallowed packages: @@ -107,7 +107,7 @@ class AddonInstallerGUI(QtCore.QObject): # Remove any disallowed packages from the optional list if hasattr(deps, "python_optional") and deps.python_optional: self._clean_up_optional(deps) - + # Missing FreeCAD workbenches if hasattr(deps, "wbs") and deps.wbs: stop_installation = self._report_missing_workbenches(deps.wbs) @@ -529,7 +529,7 @@ class MacroInstallerGUI(QtCore.QObject): "User parameter:BaseApp/Workbench/Global/Toolbar" ) self.macro_dir = FreeCAD.getUserMacroDir(True) - + def __del__(self): if self.worker_thread and hasattr(self.worker_thread, "quit"): self.worker_thread.quit() diff --git a/src/Mod/Arch/importIFC.py b/src/Mod/Arch/importIFC.py index be568755e2..b593fa1e12 100644 --- a/src/Mod/Arch/importIFC.py +++ b/src/Mod/Arch/importIFC.py @@ -1201,7 +1201,7 @@ def insert(srcfile, docname, skip=[], only=[], root=None, preferences=None): "DiffuseColor" not in added_mat.Material and "DiffuseColor" not in mdict ) # there is no color in added mat with the same matname and new mat - # on modell imported from ArchiCAD color was not found for all IFC material objects, + # on model imported from ArchiCAD color was not found for all IFC material objects, # thus DiffuseColor was not set for created materials, workaround to merge these too ): matobj = added_mat diff --git a/src/Mod/Fem/Gui/Resources/Fem.qrc b/src/Mod/Fem/Gui/Resources/Fem.qrc index 32793cc55b..e234b02672 100755 --- a/src/Mod/Fem/Gui/Resources/Fem.qrc +++ b/src/Mod/Fem/Gui/Resources/Fem.qrc @@ -177,4 +177,4 @@ ui/ResultShow.ui ui/SolverCalculix.ui - + diff --git a/src/Mod/Fem/Gui/ViewProviderFemPostPipeline.cpp b/src/Mod/Fem/Gui/ViewProviderFemPostPipeline.cpp index 05750af12f..8943f63432 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemPostPipeline.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemPostPipeline.cpp @@ -131,7 +131,7 @@ void ViewProviderFemPostPipeline::onSelectionChanged(const Gui::SelectionChanges void ViewProviderFemPostPipeline::updateColorBars() { - + // take all visible childs and update its shape coloring auto children = claimChildren(); for (auto& child : children) { @@ -155,7 +155,7 @@ void ViewProviderFemPostPipeline::transformField(char *FieldName, double FieldFa vtkSmartPointer data = obj->Data.getValue(); if (!data || !data->IsA("vtkDataSet")) return; - + vtkDataSet *dset = vtkDataSet::SafeDownCast(data); vtkDataArray *pdata = dset->GetPointData()->GetArray(FieldName); if (!pdata) diff --git a/src/Mod/Idf/Idf.py b/src/Mod/Idf/Idf.py index 8dc71d5c39..a436c848fe 100644 --- a/src/Mod/Idf/Idf.py +++ b/src/Mod/Idf/Idf.py @@ -1,5 +1,5 @@ #*************************************************************************** -#* (c) Milos Koutny (milos.koutny@gmail.com) 2012 * +#* Copyright (c) 2012 Milos Koutny * #* * #* This file is part of the FreeCAD CAx development system. * #* * @@ -19,7 +19,6 @@ #* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * #* USA * #* * -#* Milos Koutny 2010 * #***************************************************************************/ import FreeCAD, Part, os, FreeCADGui @@ -50,7 +49,7 @@ EmpDisplayMode=2 # 0='Flat Lines', 1='Shaded', 2='Wireframe', 3='Points'; recomm IDF_sort=0 # 0-sort per refdes [1 - part number (not preferred)/refdes] 2-sort per footprint/refdes -IDF_diag=0 # 0/1=disabled/enabled output (footprint.lst/missing_models.lst) +IDF_diag=0 # 0/1=disabled/enabled output (footprint.lst/missing_models.lst) IDF_diag_path="/tmp" # path for output of footprint.lst and missing_models.lst @@ -72,7 +71,7 @@ def insert(filename,docname): doc=FreeCAD.getDocument(docname) FreeCAD.Console.PrintMessage('Started import of "'+filename+'" file') process_emn(doc,filename) - + def process_emn(doc,filename): """process_emn(document, filename)-> adds emn geometry from emn file""" emnfile=pythonopen(filename, "r") @@ -84,7 +83,7 @@ def process_emn(doc,filename): placement=[] #no placement place_item=[] #empty place item emnlines=emnfile.readlines() - emnfile.close() + emnfile.close() passed_sections=[] current_section="" section_counter=0 @@ -142,10 +141,10 @@ def Process_board_outline(doc,board_outline,drills,board_thickness): out_shape=[] out_face=[] for point in board_outline: - vertex=Base.Vector(point[1],point[2],0) + vertex=Base.Vector(point[1],point[2],0) vertex_index+=1 if vertex_index==0: - lines=point[0] + lines=point[0] elif lines==point[0]: if point[3]!=0 and point[3]!=360: out_shape.append(Part.Arc(prev_vertex,mid_point(prev_vertex,vertex,point[3]),vertex)) @@ -161,8 +160,8 @@ def Process_board_outline(doc,board_outline,drills,board_thickness): out_shape=Part.Wire(out_shape.Edges) out_face.append(Part.Face(out_shape)) out_shape=[] - vertex_index=0 - lines=point[0] + vertex_index=0 + lines=point[0] prev_vertex=vertex if lines!=-1: out_shape=Part.Shape(out_shape) @@ -180,7 +179,7 @@ def Process_board_outline(doc,board_outline,drills,board_thickness): out_shape=Part.Wire(out_shape.Edges) outline=outline.cut(Part.Face(out_shape)) doc_outline=doc.addObject("Part::Feature","Board_outline") - doc_outline.Shape=outline + doc_outline.Shape=outline #FreeCADGui.Selection.addSelection(doc_outline) #FreeCADGui.runCommand("Draft_Upgrade") #outline=FreeCAD.ActiveDocument.getObject("Union").Shape @@ -194,7 +193,7 @@ def Process_board_outline(doc,board_outline,drills,board_thickness): def mid_point(prev_vertex,vertex,angle): """mid_point(prev_vertex,vertex,angle)-> mid_vertex - + returns mid point on arc of angle between prev_vertex and vertex""" angle=radians(angle/2) basic_angle=atan2(vertex.y-prev_vertex.y,vertex.x-prev_vertex.x)-pi/2 @@ -204,7 +203,7 @@ def mid_point(prev_vertex,vertex,angle): def split_records(line_record): """split_records(line_record)-> list of strings(records) - + standard separator list separator is space, records containing encapsulated by " """ split_result=[] quote_pos=line_record.find('"') @@ -213,18 +212,18 @@ def split_records(line_record): split_result.extend(line_record[ :quote_pos].split()) line_record=line_record[quote_pos: ] quote_pos=line_record.find('"',1) - else: + else: quote_pos=line_record.find('"',1) if quote_pos!=-1: split_result.append(line_record[ :quote_pos+1]) line_record=line_record[quote_pos+1: ] else: - split_result.append(line_record) + split_result.append(line_record) line_record="" quote_pos=line_record.find('"') split_result.extend(line_record.split()) return split_result - + def process_emp(doc,filename,placement,board_thickness): """process_emp(doc,filename,placement,board_thickness) -> place components from emn file to board""" filename=filename.partition(".emn")[0]+".emp" @@ -237,7 +236,7 @@ def process_emp(doc,filename,placement,board_thickness): comp_PartNumber="" # no Part Number comp_height=0 # no Comp Height emplines=empfile.readlines() - empfile.close() + empfile.close() passed_sections=[] current_section="" section_counter=0 @@ -250,7 +249,7 @@ def process_emp(doc,filename,placement,board_thickness): current_section="" if comp_PartNumber!="": if comp_height==0: - comp_height=0.1 + comp_height=0.1 comps.append((comp_PartNumber,[Process_comp_outline(doc,comp_outline,comp_height),comp_GeometryName])) comp_PartNumber="" comp_outline=[] @@ -279,7 +278,7 @@ def process_emp(doc,filename,placement,board_thickness): for compx in comps: empfile.writelines(str(compx[1][1])+"\n") empfile.close() - #End section of list footprint + #End section of list footprint comps=dict(comps) grp=doc.addObject("App::DocumentObjectGroup", "EMP Models") for place_item in placement: @@ -307,7 +306,7 @@ def Process_comp_outline(doc,comp_outline,comp_height): comp_outline.append([0.0,0.0,0.0]) comp_outline.append([0.1,0.0,360.0]) for point in comp_outline: - vertex=Base.Vector(point[0],point[1],0) + vertex=Base.Vector(point[0],point[1],0) vertex_index+=1 if vertex_index>0: if point[2]!=0 and point[2]!=360: @@ -328,13 +327,13 @@ def Process_comp_outline(doc,comp_outline,comp_height): return out_shape def place_steps(doc,placement,board_thickness): - """ place_steps(doc,placement,board_thickness)->place step models on board + """ place_steps(doc,placement,board_thickness)->place step models on board list of models and path to step files is set at start of this script model_tab_filename= "" & step_path="" """ model_file=pythonopen(model_tab_filename, "r") model_lines=model_file.readlines() - model_file.close() + model_file.close() model_dict=[] if IDF_diag==1: model_file=pythonopen(IDF_diag_path+"/missing_models.lst", "w") @@ -342,9 +341,9 @@ def place_steps(doc,placement,board_thickness): #prev_step="*?.*?" #hope nobody will insert this step filename step_dict=[] for model_line in model_lines: - model_records=split_records(model_line) + model_records=split_records(model_line) if len(model_records)>1 and model_records[0] and not model_records[0] in keys: - keys.append(model_records[0]) + keys.append(model_records[0]) model_dict.append((str(model_records[0]).replace('"',''),str(model_records[1]).replace('"',''))) model_dict=dict(model_dict) validkeys=filter(lambda x:x in [place_item[2] for place_item in placement], model_dict.keys()) @@ -380,11 +379,11 @@ def place_steps(doc,placement,board_thickness): placmnt=Base.Placement(Base.Vector(place_item[3],place_item[4],z_pos),toQuaternion(rotateY,place_item[5]*pi/180,0)) step_model.Placement=placmnt grp.addObject(step_model) - else: + else: if IDF_diag==1: model_file.writelines(str(place_item[0])+" "+str(place_item[2])+"\n") - model_file.close() - + model_file.close() + def toQuaternion(heading, attitude,bank): # rotation heading=around Y, attitude =around Z, bank attitude =around X """toQuaternion(heading, attitude,bank)->FreeCAD.Base.Rotation(Quternion)""" c1 = cos(heading/2) @@ -399,7 +398,7 @@ def toQuaternion(heading, attitude,bank): # rotation heading=around Y, attitude x = c1c2*s3 + s1s2*c3 y = s1*c2*c3 + c1*s2*s3 z = c1*s2*c3 - s1*c2*s3 - return FreeCAD.Base.Rotation(x,y,z,w) + return FreeCAD.Base.Rotation(x,y,z,w) def Per_point(prev_vertex,vertex): """Per_point(center,vertex)->per point @@ -411,4 +410,4 @@ def Per_point(prev_vertex,vertex): perpoint=Base.Vector(2*prev_vertex.x-vertex.x,2*prev_vertex.y-vertex.y,0) return perpoint - + diff --git a/src/Mod/Image/Gui/Resources/Image.qrc b/src/Mod/Image/Gui/Resources/Image.qrc index f80b629f00..ead61a753c 100644 --- a/src/Mod/Image/Gui/Resources/Image.qrc +++ b/src/Mod/Image/Gui/Resources/Image.qrc @@ -1,5 +1,5 @@ - + icons/Image_Open.svg icons/Image_CreateImagePlane.svg icons/Image_Scaling.svg @@ -47,4 +47,4 @@ translations/Image_sr-CS.qm translations/Image_be.qm - + diff --git a/src/Mod/JtReader/App/TestJtReader.cpp b/src/Mod/JtReader/App/TestJtReader.cpp index a59efa2595..a06205764c 100644 --- a/src/Mod/JtReader/App/TestJtReader.cpp +++ b/src/Mod/JtReader/App/TestJtReader.cpp @@ -55,7 +55,7 @@ void TestJtReader::read(void) } - + Base::Console().Log(i->toString().c_str()); } diff --git a/src/Mod/JtReader/CMakeLists.txt b/src/Mod/JtReader/CMakeLists.txt index bbc2c82a05..4acc961dfe 100644 --- a/src/Mod/JtReader/CMakeLists.txt +++ b/src/Mod/JtReader/CMakeLists.txt @@ -9,4 +9,4 @@ INSTALL( Init.py DESTINATION Mod/JtReader -) +) diff --git a/src/Mod/Material/CMakeLists.txt b/src/Mod/Material/CMakeLists.txt index 6ecd5d83c8..5bae72506d 100644 --- a/src/Mod/Material/CMakeLists.txt +++ b/src/Mod/Material/CMakeLists.txt @@ -157,7 +157,7 @@ ADD_CUSTOM_TARGET(Material ALL SOURCES ${Material_SRCS} ${Material_QRC_SRCS} ) -fc_target_copy_resource(Material +fc_target_copy_resource(Material ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_BINARY_DIR}/Mod/Material ${Material_SRCS}) @@ -167,7 +167,7 @@ ADD_CUSTOM_TARGET(MaterialToolsLib ALL SOURCES ${MaterialTools_Files} ) -fc_target_copy_resource(MaterialToolsLib +fc_target_copy_resource(MaterialToolsLib ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_BINARY_DIR}/Mod/Material ${MaterialTools_Files}) @@ -191,11 +191,11 @@ ADD_CUSTOM_TARGET(FluidMaterialLib ALL # When a target copies files to different output directories then apparently it always builds the project # which is very annoying. So, the trick is to split this into two targets to avoid this behaviour. -fc_target_copy_resource(MaterialLib +fc_target_copy_resource(MaterialLib ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_DATADIR}/Mod/Material ${MaterialLib_Files}) -fc_target_copy_resource(FluidMaterialLib +fc_target_copy_resource(FluidMaterialLib ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_DATADIR}/Mod/Material ${FluidMaterial_Files}) diff --git a/src/Mod/Material/FluidMaterial/Readme.md b/src/Mod/Material/FluidMaterial/Readme.md index cef5b20422..a50ee6139b 100644 --- a/src/Mod/Material/FluidMaterial/Readme.md +++ b/src/Mod/Material/FluidMaterial/Readme.md @@ -4,33 +4,28 @@ ## User defined material -To prevent the database from becoming inefficiently large it is only limited to commonly used variables at 20 degrees Celsius at 1 atm. +To prevent the database from becoming inefficiently large it is only limited to commonly used variables at 20 degrees Celsius at 1 atm. -Users can defined new material, either in Fem material card editor, or directly generate textual material file, * .FCMat, see example in this folder. +Users can defined new material, either in Fem material card editor, or directly generate textual material file, * .FCMat, see example in this folder. -To enable new material, go to FreeCAD menu "Edit->Preference..." Cfd preference page (select on the left panel) and switch to materiai tab on the right. +To enable new material, go to FreeCAD menu "Edit->Preference..." Cfd preference page (select on the left panel) and switch to materiai tab on the right. -Browse to your material folder, and save/apply this preference, new material will be Material with same name as FreeCAD material has higher priority, - -so user defined` Water` material will not appear in Fem material task panel's dropbox list, just give it a different name! +Browse to your material folder, and save/apply this preference, new material will be Material with same name as FreeCAD material has higher priority, so user defined `Water` material will not appear in Fem material task panel's dropbox list, just give it a different name! ### Edit material value Please verify the fluid material properties before use. It aims to serve as a quick reference and does not aim to be an extended look up table. - ## Add new material to Material module 1. follow examples in material folders to create new material file 2. stick to the meta data definition in `src/Mod/Material/Templatematerial.yml` for property name -3. add the file name into the `src/Mod/Material/CMakeLists.txt` , so the new files can be installed to the properly place during compiling and installation. +3. add the file name into the `src/Mod/Material/CMakeLists.txt` , so the new files can be installed to the properly place during compiling and installation. -## Change log +## Changelog -CfdOF module authored 5 material types, values are taken from FM White (2011) Fluid Mechanics. +CfdOF module authored 5 material types, values are taken from FM White (2011) Fluid Mechanics. - - -Currently, 3 (Water, Air, None) are merged into Fem module and maintained by Cfd module author, Qingfeng Xia +Currently, 3 (Water, Air, None) are merged into Fem module and maintained by Cfd module author, Qingfeng Xia diff --git a/src/Mod/Material/Resources/Material.qrc b/src/Mod/Material/Resources/Material.qrc index 06a6a58d8f..e3cc6f00c1 100644 --- a/src/Mod/Material/Resources/Material.qrc +++ b/src/Mod/Material/Resources/Material.qrc @@ -1,6 +1,6 @@ - + icons/preview-rendered.svg icons/preview-vector.svg - + diff --git a/src/Mod/Material/Templatematerial.yml b/src/Mod/Material/Templatematerial.yml index b180b064d7..75299d4add 100644 --- a/src/Mod/Material/Templatematerial.yml +++ b/src/Mod/Material/Templatematerial.yml @@ -106,7 +106,7 @@ Type: 'Quantity' URL: 'https://en.wikipedia.org/wiki/Compressive_strength' Description: "Compressive strength in [FreeCAD Pressure unit]" - Density: + Density: Type: 'Quantity' URL: 'https://en.wikipedia.org/wiki/Density' Description: "Density in [FreeCAD Density unit]" diff --git a/src/Mod/Measure/App/Measurement.cpp b/src/Mod/Measure/App/Measurement.cpp index 125d6b4ea4..b20b68743b 100644 --- a/src/Mod/Measure/App/Measurement.cpp +++ b/src/Mod/Measure/App/Measurement.cpp @@ -128,7 +128,7 @@ MeasureType Measurement::getType() } catch (Standard_Failure& e) { std::stringstream errorMsg; - + errorMsg << "Measurement - getType - " << e.GetMessageString() << std::endl; throw Base::CADKernelError(e.GetMessageString()); } diff --git a/src/Mod/Mesh/Gui/Resources/Mesh.qrc b/src/Mod/Mesh/Gui/Resources/Mesh.qrc index 8510f44140..7476ed8a51 100644 --- a/src/Mod/Mesh/Gui/Resources/Mesh.qrc +++ b/src/Mod/Mesh/Gui/Resources/Mesh.qrc @@ -88,4 +88,4 @@ translations/Mesh_sr-CS.qm translations/Mesh_be.qm - + diff --git a/src/Mod/OpenSCAD/OpenSCADTest/app/test_importCSG.py b/src/Mod/OpenSCAD/OpenSCADTest/app/test_importCSG.py index d4b6589cd4..e59ba8d996 100644 --- a/src/Mod/OpenSCAD/OpenSCADTest/app/test_importCSG.py +++ b/src/Mod/OpenSCAD/OpenSCADTest/app/test_importCSG.py @@ -154,13 +154,13 @@ class TestImportCSG(unittest.TestCase): self.assertTrue (wire is not None) self.assertAlmostEqual (wire.Shape.Area, 5000.0) FreeCAD.closeDocument(doc.Name) - + def test_import_polyhedron(self): doc = self.utility_create_scad( """ polyhedron( points=[ [10,10,0],[10,-10,0],[-10,-10,0],[-10,10,0], // the four points at base - [0,0,10] ], // the apex point + [0,0,10] ], // the apex point faces=[ [0,1,4],[1,2,4],[2,3,4],[3,0,4], // each triangle side [1,0,3],[2,1,3] ] // two triangles for square base ); @@ -229,7 +229,7 @@ polyhedron( self.assertTrue (object is not None) self.assertAlmostEqual (object.Shape.Volume, 4.5*math.pi, 5) FreeCAD.closeDocument(doc.Name) - + def test_import_linear_extrude(self): doc = self.utility_create_scad("linear_extrude(height = 20) square([20, 10], center = true);", "linear_extrude_simple") object = doc.ActiveObject @@ -291,13 +291,13 @@ polyhedron( self.assertTrue (object is not None) self.assertAlmostEqual (object.Shape.Volume, 8.000000, 6) FreeCAD.closeDocument(doc.Name) - + doc = self.utility_create_scad("resize([2,2,0]) cube();", "resize_with_zero") object = doc.ActiveObject self.assertTrue (object is not None) self.assertAlmostEqual (object.Shape.Volume, 4.000000, 6) FreeCAD.closeDocument(doc.Name) - + doc = self.utility_create_scad("resize([2,0,0], auto=true) cube();", "resize_with_auto") object = doc.ActiveObject self.assertTrue (object is not None) @@ -349,7 +349,7 @@ resize(newsize = [0,0,10], auto = [0,0,0]) { self.assertAlmostEqual (object.Shape.BoundBox.YMin, -4.5, 6) self.assertAlmostEqual (object.Shape.BoundBox.YMax, 4.5, 6) FreeCAD.closeDocument(doc.Name) - + testfile = join(self.test_dir, "Surface.dat").replace('\\','/') doc = self.utility_create_scad(f"surface(file = \"{testfile}\", convexity = 5);", "surface_uncentered_dat") object = doc.ActiveObject @@ -390,7 +390,7 @@ resize(newsize = [0,0,10], auto = [0,0,0]) { self.assertAlmostEqual (object.Shape.Area, 0.75*0.75 - 0.25*0.25, 3) FreeCAD.closeDocument(doc.Name) - # Unimplemented functionality: + # Unimplemented functionality: # With cut=false, the twisted unit square projects to a circle of radius sqrt(0.5) #doc = self.utility_create_scad(f"projection(cut=false) {base_shape}", "projection_circle") diff --git a/src/Mod/Path/Path/Post/scripts/dynapath_4060_post.py b/src/Mod/Path/Path/Post/scripts/dynapath_4060_post.py index 63113b188d..a0de64f569 100644 --- a/src/Mod/Path/Path/Post/scripts/dynapath_4060_post.py +++ b/src/Mod/Path/Path/Post/scripts/dynapath_4060_post.py @@ -20,7 +20,7 @@ # * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * # * USA * # * * -# * This file has been modified from Sliptonic original LinuxCNC post * +# * This file has been modified from Sliptonic original LinuxCNC post * # * for use with Dynapath Delta 40M,50M,60M controllers. All changes * # * and modifications (c) luvtofish (luvtofish@gmail.com) 2022 * # *************************************************************************** @@ -39,8 +39,8 @@ This is a post processor file for the FreeCAD Path workbench. It is used to take a pseudo-gcode fragment outputted by a Path object, and output real GCode suitable for Dynapath Delta 40,50, & 60 Controls. It has been written and tested on FreeCAD Path workbench bundled with FreeCAD v21. -This post processor, once placed in the appropriate PathScripts folder, can be -used directly from inside FreeCAD, via the GUI importer or via python scripts with: +This post processor, once placed in the appropriate PathScripts folder, can be +used directly from inside FreeCAD, via the GUI importer or via python scripts with: import delta_4060_post delta_4060_post.export(object,"/path/to/file.ncc","") diff --git a/src/Mod/Sandbox/Gui/GLGraphicsView.cpp b/src/Mod/Sandbox/Gui/GLGraphicsView.cpp index 537dd65d1b..755aca7161 100644 --- a/src/Mod/Sandbox/Gui/GLGraphicsView.cpp +++ b/src/Mod/Sandbox/Gui/GLGraphicsView.cpp @@ -189,7 +189,7 @@ SceneEventFilter::~SceneEventFilter() /*! Adds a device for event translation */ -void +void SceneEventFilter::registerInputDevice(SIM::Coin3D::Quarter::InputDevice * device) { PRIVATE(this)->devices += device; @@ -198,7 +198,7 @@ SceneEventFilter::registerInputDevice(SIM::Coin3D::Quarter::InputDevice * device /*! Removes a device from event translation */ -void +void SceneEventFilter::unregisterInputDevice(SIM::Coin3D::Quarter::InputDevice * device) { int i = PRIVATE(this)->devices.indexOf(device); diff --git a/src/Mod/Sandbox/Gui/Overlay.cpp b/src/Mod/Sandbox/Gui/Overlay.cpp index d27bdaad78..e7fa9e8f7c 100644 --- a/src/Mod/Sandbox/Gui/Overlay.cpp +++ b/src/Mod/Sandbox/Gui/Overlay.cpp @@ -112,7 +112,7 @@ public: glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor4d(0.0,0.0,1.0,0.0f); glRasterPos2d(0,0); - + //http://wiki.delphigl.com/index.php/Multisampling //glDrawPixels(img.width(),img.height(),GL_RGBA,GL_UNSIGNED_BYTE,img.bits()); /* diff --git a/src/Mod/Sketcher/App/planegcs/GCS.cpp b/src/Mod/Sketcher/App/planegcs/GCS.cpp index 952f0349f8..31310ee212 100644 --- a/src/Mod/Sketcher/App/planegcs/GCS.cpp +++ b/src/Mod/Sketcher/App/planegcs/GCS.cpp @@ -4577,7 +4577,7 @@ void System::identifyConflictingRedundantConstraints( Algorithm alg, } } } - + if (conflictingMap.empty()) break; diff --git a/src/Mod/TechDraw/Gui/Resources/TechDraw.qrc b/src/Mod/TechDraw/Gui/Resources/TechDraw.qrc index 6f6af53a9d..366dd40768 100644 --- a/src/Mod/TechDraw/Gui/Resources/TechDraw.qrc +++ b/src/Mod/TechDraw/Gui/Resources/TechDraw.qrc @@ -3,7 +3,7 @@ icons/actions/section-down.svg icons/actions/section-left.svg icons/actions/section-right.svg - icons/actions/section-up.svg + icons/actions/section-up.svg icons/actions/TechDraw_2LineCenterline.svg icons/actions/TechDraw_2PointCenterline.svg icons/actions/TechDraw_ActiveView.svg diff --git a/src/Mod/TemplatePyMod/CMakeLists.txt b/src/Mod/TemplatePyMod/CMakeLists.txt index 374925ad18..e08ebb051a 100644 --- a/src/Mod/TemplatePyMod/CMakeLists.txt +++ b/src/Mod/TemplatePyMod/CMakeLists.txt @@ -1,12 +1,12 @@ -fc_copy_to_mod_path("TemplatePyMod" - InitGui.py - Init.py - Commands.py - PythonQt.py - Tests.py - DocumentObject.py +fc_copy_to_mod_path("TemplatePyMod" + InitGui.py + Init.py + Commands.py + PythonQt.py + Tests.py + DocumentObject.py ) INSTALL( diff --git a/src/Mod/TemplatePyMod/MengerSponge.py b/src/Mod/TemplatePyMod/MengerSponge.py index 817b639cfd..416c758c1c 100644 --- a/src/Mod/TemplatePyMod/MengerSponge.py +++ b/src/Mod/TemplatePyMod/MengerSponge.py @@ -68,7 +68,7 @@ def makeMengerSponge_mt(level=3,x0=0,y0=0,z0=0): boxnums = pow(3,level) thirds = boxnums / 3 twothirds = thirds * 2 - + rangerx = [ x0, x0 + thirds, x0 + twothirds ] rangery = [ y0, y0 + thirds, y0 + twothirds ] rangerz = [ z0, z0 + thirds, z0 + twothirds ] @@ -104,7 +104,7 @@ def makeMengerSponge_mt(level=3,x0=0,y0=0,z0=0): for thr in threads: mesh.addMesh(thr.mesh) del thr.mesh - + print(mesh) mesh.removeDuplicatedPoints() mesh.removeFacets(mesh.getInternalFacets()) diff --git a/src/Mod/TemplatePyMod/Mesh2Shape.py b/src/Mod/TemplatePyMod/Mesh2Shape.py index 818af4d7d0..5dd57ca6b2 100644 --- a/src/Mod/TemplatePyMod/Mesh2Shape.py +++ b/src/Mod/TemplatePyMod/Mesh2Shape.py @@ -1,4 +1,4 @@ -# FreeCAD TemplatePyMod module +# FreeCAD TemplatePyMod module # (c) 2010 Werner Mayer LGPL diff --git a/src/Mod/Test/CMakeLists.txt b/src/Mod/Test/CMakeLists.txt index f7c6ee2050..67a293c69f 100644 --- a/src/Mod/Test/CMakeLists.txt +++ b/src/Mod/Test/CMakeLists.txt @@ -39,7 +39,7 @@ fc_copy_sources(Test "${CMAKE_BINARY_DIR}/Mod/Test" ${Test_SRCS} ${TestData_SRCS INSTALL( FILES - ${Test_SRCS} + ${Test_SRCS} DESTINATION Mod/Test ) diff --git a/src/Mod/Web/Gui/CookieJar.cpp b/src/Mod/Web/Gui/CookieJar.cpp index 261b01779c..ded5ffeb2e 100644 --- a/src/Mod/Web/Gui/CookieJar.cpp +++ b/src/Mod/Web/Gui/CookieJar.cpp @@ -94,7 +94,7 @@ void FcCookieJar::saveToDisk() if (m_file.open(QIODevice::WriteOnly | QIODevice::Text)) { QTextStream out(&m_file); - for (QList::iterator i = m_rawCookies.begin(); i != m_rawCookies.end(); i++) { + for (QList::iterator i = m_rawCookies.begin(); i != m_rawCookies.end(); i++) { out << (*i) + "\n"; } m_file.close(); diff --git a/src/Mod/mod.dox b/src/Mod/mod.dox index 2fa56a0ef7..8bc47a7ff0 100644 --- a/src/Mod/mod.dox +++ b/src/Mod/mod.dox @@ -13,7 +13,7 @@ in a mix of C++ and Python. */ - + /** \defgroup CWORKBENCHES C++ workbenches * \ingroup WORKBENCHES * \brief These workbenches are programmed primarily in C++, but most provide a Python API as well. diff --git a/src/Tools/FCFileTools.py b/src/Tools/FCFileTools.py index 1d9505e026..c0c4cd013c 100644 --- a/src/Tools/FCFileTools.py +++ b/src/Tools/FCFileTools.py @@ -19,7 +19,7 @@ def cpfile(pathFrom, pathTo, maxfileload=maxfileload): #bytesFrom.close() else: fileFrom = open(pathFrom, 'rb') # read big files in chunks - fileTo = open(pathTo, 'wb') # need b mode here too + fileTo = open(pathTo, 'wb') # need b mode here too while 1: bytesFrom = fileFrom.read(blksize) # get one block, less at end if not bytesFrom: break # empty after last chunk @@ -97,11 +97,11 @@ def cpallWithFilter(dirFrom, dirTo,MatchList): ################################################################ # Use: "python rmall.py directoryPath directoryPath..." -# recursive directory tree deletion: removes all files and +# recursive directory tree deletion: removes all files and # directories at and below directoryPaths; recurs into subdirs -# and removes parent dir last, because os.rmdir requires that -# directory is empty; like a Unix "rm -rf directoryPath" -################################################################ +# and removes parent dir last, because os.rmdir requires that +# directory is empty; like a Unix "rm -rf directoryPath" +################################################################ fcount = dcount = 0 diff --git a/src/Tools/RegExp/CMakeLists.txt b/src/Tools/RegExp/CMakeLists.txt index bb58cea9eb..d896a0e954 100644 --- a/src/Tools/RegExp/CMakeLists.txt +++ b/src/Tools/RegExp/CMakeLists.txt @@ -20,7 +20,7 @@ QT5_WRAP_CPP(RegExp_MOC_SRCS regexpdialog.h ) -QT5_WRAP_UI(RegExp_UIC_HDRS +QT5_WRAP_UI(RegExp_UIC_HDRS regexpdialog.ui ) diff --git a/src/Tools/WinVersion.py b/src/Tools/WinVersion.py index 0e15568759..930219cf2a 100644 --- a/src/Tools/WinVersion.py +++ b/src/Tools/WinVersion.py @@ -11,7 +11,7 @@ def main(): input="" output="." - + try: opts, args = getopt.getopt(sys.argv[1:], "dso:", ["dir=","src=","out="]) except getopt.GetoptError: @@ -25,7 +25,7 @@ def main(): if o in ("-o", "--out"): output = a git = SubWCRev.GitControl() - + if(git.extractInfo(input, "")): print(git.hash) print(git.branch) @@ -34,7 +34,7 @@ def main(): print(git.url) print(input) print(output) - + f = open(input,'r') o = open(output,'w') for line in f.readlines(): diff --git a/src/Tools/_TEMPLATEPY_/Resources/_TEMPLATEPY_.qrc b/src/Tools/_TEMPLATEPY_/Resources/_TEMPLATEPY_.qrc index 1d3ee961fd..bbe793539c 100644 --- a/src/Tools/_TEMPLATEPY_/Resources/_TEMPLATEPY_.qrc +++ b/src/Tools/_TEMPLATEPY_/Resources/_TEMPLATEPY_.qrc @@ -1,5 +1,5 @@ - + icons/_TEMPLATEPY_Workbench.svg - + diff --git a/src/Tools/_TEMPLATE_/Gui/CMakeLists.txt b/src/Tools/_TEMPLATE_/Gui/CMakeLists.txt index 910c33cc4a..ebfbfde36f 100644 --- a/src/Tools/_TEMPLATE_/Gui/CMakeLists.txt +++ b/src/Tools/_TEMPLATE_/Gui/CMakeLists.txt @@ -35,5 +35,5 @@ target_link_libraries(_TEMPLATE_Gui ${_TEMPLATE_Gui_LIBS}) SET_BIN_DIR(_TEMPLATE_Gui _TEMPLATE_Gui /Mod/_TEMPLATE_) SET_PYTHON_PREFIX_SUFFIX(_TEMPLATE_Gui) - + install(TARGETS _TEMPLATE_Gui DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/src/Tools/catfiles.py b/src/Tools/catfiles.py index 1fbac086b8..da48d239f3 100644 --- a/src/Tools/catfiles.py +++ b/src/Tools/catfiles.py @@ -25,11 +25,11 @@ def main(): # if os.path.getmtime(f) > ts: # do_not_create = False # break - # + # # if do_not_create: # print ("Up-to-date file {0}".format(outputfile)) # return - + with open(outputfile,'wb') as wfd: for f in args: with open(f,'rb') as fd: diff --git a/src/Tools/fcbt/CreatePyModule.py b/src/Tools/fcbt/CreatePyModule.py index d8a3058699..c47c9137ae 100644 --- a/src/Tools/fcbt/CreatePyModule.py +++ b/src/Tools/fcbt/CreatePyModule.py @@ -1,10 +1,5 @@ -# FreeCAD MakeNewBuildNbr script -# (c) 2003 Werner Mayer -# -# Creates a new application - #*************************************************************************** -#* (c) Werner Mayer (werner.wm.mayer@gmx.de) 2003 * +#* Copyright (c) 2003 Werner Mayer * #* * #* This file is part of the FreeCAD CAx development system. * #* * @@ -24,9 +19,11 @@ #* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * #* USA * #* * -#* Werner Mayer 2003 * #*************************************************************************** +# FreeCAD MakeNewBuildNbr script +# Creates a new application + import os,sys import MakeAppTools import re @@ -72,47 +69,47 @@ def SetupFilter(MatchList): def createApp(Application): - """ - Create a new application by copying the template - """ - # create directory ../Mod/ - if not os.path.isdir("../Mod/"+Application): - os.mkdir("../Mod/"+Application) - else: - sys.stdout.write(Application + " already exists. Please enter another name.\n") - sys.exit() + """ + Create a new application by copying the template + """ + # create directory ../Mod/ + if not os.path.isdir("../Mod/"+Application): + os.mkdir("../Mod/"+Application) + else: + sys.stdout.write(Application + " already exists. Please enter another name.\n") + sys.exit() - # copying files from _TEMPLATEPY_ to ../Mod/ - sys.stdout.write("Copying files...") - MakeAppTools.copyTemplate("_TEMPLATEPY_","../Mod/"+Application,"_TEMPLATEPY_", Application, SetupFilter(FilFilter),SetupFilter(DirFilter)) - sys.stdout.write("Ok\n") + # copying files from _TEMPLATEPY_ to ../Mod/ + sys.stdout.write("Copying files...") + MakeAppTools.copyTemplate("_TEMPLATEPY_","../Mod/"+Application,"_TEMPLATEPY_", Application, SetupFilter(FilFilter),SetupFilter(DirFilter)) + sys.stdout.write("Ok\n") - # replace the _TEMPLATEPY_ string by - sys.stdout.write("Modifying files...\n") - MakeAppTools.replaceTemplate("../Mod/" + Application,"_TEMPLATEPY_",Application) - MakeAppTools.replaceTemplate("../Mod/" + Application,"${CMAKE_SOURCE_DIR}/src/Tools/","${CMAKE_SOURCE_DIR}/src/Mod/") - # make the configure script executable - #os.chmod("../Mod/" + Application + "/configure", 0777); - sys.stdout.write("Modifying files done.\n") + # replace the _TEMPLATEPY_ string by + sys.stdout.write("Modifying files...\n") + MakeAppTools.replaceTemplate("../Mod/" + Application,"_TEMPLATEPY_",Application) + MakeAppTools.replaceTemplate("../Mod/" + Application,"${CMAKE_SOURCE_DIR}/src/Tools/","${CMAKE_SOURCE_DIR}/src/Mod/") + # make the configure script executable + #os.chmod("../Mod/" + Application + "/configure", 0777); + sys.stdout.write("Modifying files done.\n") - sys.stdout.write(Application + " module created successfully.\n") + sys.stdout.write(Application + " module created successfully.\n") def validateApp(AppName): - """ - Validates the class name - """ - if(len(AppName) < 2): - sys.stdout.write("Too short name: '"+AppName+"'\n") - sys.exit() - # name is long enough - clName="class "+AppName+": self=0" - try: - exec(clName) - except Exception: - # Invalid class name - sys.stdout.write("Invalid name: '"+AppName+"'\n") - sys.exit() + """ + Validates the class name + """ + if(len(AppName) < 2): + sys.stdout.write("Too short name: '"+AppName+"'\n") + sys.exit() + # name is long enough + clName="class "+AppName+": self=0" + try: + exec(clName) + except Exception: + # Invalid class name + sys.stdout.write("Invalid name: '"+AppName+"'\n") + sys.exit() sys.stdout.write("Please enter a name for your application:") sys.stdout.flush() diff --git a/src/Tools/makedist.py b/src/Tools/makedist.py index c054534fe8..1fbcb89c9e 100644 --- a/src/Tools/makedist.py +++ b/src/Tools/makedist.py @@ -33,7 +33,7 @@ def main(): wta = "--worktree-attributes" if o in ("--check"): check = True - + if dfsg: gitattr = open("src/.gitattributes","w") gitattr.write("zipios++ export-ignore\n") @@ -104,7 +104,7 @@ def main(): out = gzip.open(TGZNAME, "wb") out.write(tarstream.getvalue()) out.close() - + if dfsg: os.remove("src/.gitattributes") print(("Created " + TGZNAME)) diff --git a/src/Tools/pythondoc.py b/src/Tools/pythondoc.py index 3fbb5046e0..846f94c99c 100644 --- a/src/Tools/pythondoc.py +++ b/src/Tools/pythondoc.py @@ -27,29 +27,29 @@ def generateDoc(): os.environ['PATH'] = os.environ['PATH'] + ';' + binpath else: os.environ['PATH'] = os.environ['PATH'] + ':' + binpath - + # Import FreeCAD module sys.path.append(binpath) print('Write documentation for module \'FreeCAD\'') pydoc.writedoc('FreeCAD') print('') - + # Module directory ModDirs = dircache.listdir(modpath) - # Search for module paths and append them to Python path + # Search for module paths and append them to Python path #for Dir in ModDirs: # if (Dir != '__init__.py'): # sys.path.append( os.path.join(modpath,Dir) ) - # Walk through the module paths again and try loading the modules to create HTML files + # Walk through the module paths again and try loading the modules to create HTML files for Dir in ModDirs: dest = os.path.join(modpath,Dir) print('Write documentation for module \'' + Dir + '\'') if (Dir != '__init__.py'): writedocs(dest) print('') - + # Now we must create a document and create instances of all Python classes which # cannot be directly created by a module. @@ -61,10 +61,10 @@ def generateDoc(): if file.find('.html') > 0: print(' Adding file ' + file + ' to archive') zip.write(file) - + print('done.') zip.close() - + # Remove all HTML files print('Cleaning up HTML files...') for file in os.listdir('.'): @@ -72,7 +72,7 @@ def generateDoc(): if file.find('.html') > 0: print(' Removing ' + file) os.remove(file) - + os.chdir(cwd) print('done.') diff --git a/src/Tools/updatecrowdin.py b/src/Tools/updatecrowdin.py index ac6bd117d2..bfe63d3d92 100755 --- a/src/Tools/updatecrowdin.py +++ b/src/Tools/updatecrowdin.py @@ -114,7 +114,7 @@ locations = [["AddonManager","../Mod/AddonManager/Resources/translations","../Mo ["Tux","../Mod/Tux/Resources/translations","../Mod/Tux/Resources/Tux.qrc"], ["TechDraw","../Mod/TechDraw/Gui/Resources/translations","../Mod/TechDraw/Gui/Resources/TechDraw.qrc"], ] - + THRESHOLD = 25 # how many % must be translated for the translation to be included in FreeCAD class CrowdinUpdater: @@ -228,7 +228,7 @@ def updateqrc(qrcpath,lncode): "updates a qrc file with the given translation entry" #print("opening " + qrcpath + "...") - + # getting qrc file contents if not os.path.exists(qrcpath): print("ERROR: Resource file " + qrcpath + " doesn't exist") @@ -287,7 +287,7 @@ def updateTranslatorCpp(lncode): cppfile = os.path.join(os.path.dirname(__file__),"..","Gui","Language","Translator.cpp") l = QtCore.QLocale(lncode) lnname = l.languageToString(l.language()) - + # read file contents f = open(cppfile,"r") cppcode = [] @@ -359,9 +359,9 @@ def doLanguage(lncode): qrcpath = os.path.abspath(target[2]) doFile(basefilepath,targetpath,lncode,qrcpath) print(" done") - + def applyTranslations(languages): - + global tempfolder currentfolder = os.getcwd() tempfolder = tempfile.mkdtemp() @@ -469,7 +469,7 @@ if __name__ == "__main__": print("Updating Translator.cpp...") for ln in languages: updateTranslatorCpp(ln) - + elif command == "updateTranslator": print("retrieving list of languages...") status = updater.status() @@ -477,7 +477,7 @@ if __name__ == "__main__": languages = [item['languageId'] for item in status if item['translationProgress'] > THRESHOLD] print("Updating Translator.cpp...") for ln in languages: - updateTranslatorCpp(ln) + updateTranslatorCpp(ln) elif command == "gather": import updatets diff --git a/src/Tools/updatets.py b/src/Tools/updatets.py index 6a5583c0e0..796b7e2a61 100755 --- a/src/Tools/updatets.py +++ b/src/Tools/updatets.py @@ -97,7 +97,7 @@ def find_tools(noobsolete=True): print(Usage + "\nFirst, lets find all necessary tools on your system") global QMAKE, LUPDATE, PYLUPDATE, LCONVERT, QT_VERSION_MAJOR - + p = subprocess.run(["lupdate","-version"],check=True,stdout=subprocess.PIPE) lupdate_version = p.stdout.decode() result = re.search(r'.* ([456])\.([\d]+)\.([\d]+)', lupdate_version) @@ -123,7 +123,7 @@ def find_tools(noobsolete=True): raise Exception("Cannot find lupdate") else: LUPDATE = "lupdate" - + if QT_VERSION_MAJOR < 6: if (os.system("qmake -version") == 0): QMAKE = "qmake" @@ -222,7 +222,7 @@ def update_translation(entry): print(str(e)) os.chdir(cur) return - + with open (f"{cur}/tsupdate_stdout.log","a") as f: f.write(p.stdout.decode()) print(p.stdout.decode())