From e6d148a4df99aa74ef89f650c0873032f9a588ea Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Thu, 31 Aug 2023 12:49:30 -0500 Subject: [PATCH] Assembly: Apply pre-commit to Assembly files --- src/Mod/Assembly/AssemblyGlobal.h | 12 ++++++------ src/Mod/Assembly/Commands.py | 32 ++++++++----------------------- src/Mod/Assembly/InitGui.py | 7 ++----- 3 files changed, 16 insertions(+), 35 deletions(-) diff --git a/src/Mod/Assembly/AssemblyGlobal.h b/src/Mod/Assembly/AssemblyGlobal.h index 6f0eef6d39..3822f9bb0c 100644 --- a/src/Mod/Assembly/AssemblyGlobal.h +++ b/src/Mod/Assembly/AssemblyGlobal.h @@ -27,22 +27,22 @@ #define ASSEMBLY_GLOBAL_H - // Assembly +// Assembly #ifndef AssemblyExport #ifdef Assembly_EXPORTS -# define AssemblyExport FREECAD_DECL_EXPORT +#define AssemblyExport FREECAD_DECL_EXPORT #else -# define AssemblyExport FREECAD_DECL_IMPORT +#define AssemblyExport FREECAD_DECL_IMPORT #endif #endif // AssemblyGui #ifndef AssemblyGuiExport #ifdef AssemblyGui_EXPORTS -# define AssemblyGuiExport FREECAD_DECL_EXPORT +#define AssemblyGuiExport FREECAD_DECL_EXPORT #else -# define AssemblyGuiExport FREECAD_DECL_IMPORT +#define AssemblyGuiExport FREECAD_DECL_IMPORT #endif #endif -#endif //ASSEMBLY_GLOBAL_H +#endif// ASSEMBLY_GLOBAL_H diff --git a/src/Mod/Assembly/Commands.py b/src/Mod/Assembly/Commands.py index 0fd18cbf37..3a3d9179d0 100644 --- a/src/Mod/Assembly/Commands.py +++ b/src/Mod/Assembly/Commands.py @@ -104,9 +104,7 @@ class CommandInsertLink: def GetResources(self): tooltip = "

Insert a Link into the assembly. " - tooltip += ( - "This will create dynamic links to parts/bodies/primitives/assemblies, " - ) + tooltip += "This will create dynamic links to parts/bodies/primitives/assemblies, " tooltip += "which can be in this document or in another document " tooltip += "that is open in the current session

" tooltip += "

Press shift to add several links while clicking on the view." @@ -221,9 +219,7 @@ class TaskAssemblyInsertLink(QtCore.QObject): "Select FreeCAD document to import part from", ) - dialog.setNameFilter( - "Supported Formats *.FCStd *.fcstd (*.FCStd *.fcstd);;All files (*.*)" - ) + dialog.setNameFilter("Supported Formats *.FCStd *.fcstd (*.FCStd *.fcstd);;All files (*.*)") if dialog.exec_(): filename = str(dialog.selectedFiles()[0]) # look only for filenames, not paths, as there are problems on WIN10 (Address-translation??) @@ -253,9 +249,7 @@ class TaskAssemblyInsertLink(QtCore.QObject): # check that the current document had been saved or that it's the same document as that of the selected part if not self.doc.FileName != "" and not self.doc == selectedPart.Document: - print( - "The current document must be saved before inserting an external part" - ) + print("The current document must be saved before inserting an external part") return self.createdLink = self.assembly.newObject("App::Link", selectedPart.Name) @@ -267,23 +261,15 @@ class TaskAssemblyInsertLink(QtCore.QObject): # highlight the link Gui.Selection.clearSelection() - Gui.Selection.addSelection( - self.doc.Name, self.assembly.Name, self.createdLink.Name + "." - ) + Gui.Selection.addSelection(self.doc.Name, self.assembly.Name, self.createdLink.Name + ".") # Start moving the part if user brings mouse on view self.initMove() def initMove(self): - self.callbackMove = self.view.addEventCallback( - "SoLocation2Event", self.moveMouse - ) - self.callbackClick = self.view.addEventCallback( - "SoMouseButtonEvent", self.clickMouse - ) - self.callbackKey = self.view.addEventCallback( - "SoKeyboardEvent", self.KeyboardEvent - ) + self.callbackMove = self.view.addEventCallback("SoLocation2Event", self.moveMouse) + self.callbackClick = self.view.addEventCallback("SoMouseButtonEvent", self.clickMouse) + self.callbackKey = self.view.addEventCallback("SoKeyboardEvent", self.KeyboardEvent) self.partMoving = True # Selection filter to avoid selecting the part while it's moving @@ -308,9 +294,7 @@ class TaskAssemblyInsertLink(QtCore.QObject): # Create a new link and moves this one now currentPos = self.createdLink.Placement.Base selectedPart = self.createdLink.LinkedObject - self.createdLink = self.assembly.newObject( - "App::Link", selectedPart.Name - ) + self.createdLink = self.assembly.newObject("App::Link", selectedPart.Name) self.createdLink.LinkedObject = selectedPart self.createdLink.Placement.Base = currentPos else: diff --git a/src/Mod/Assembly/InitGui.py b/src/Mod/Assembly/InitGui.py index aa9af54504..0e63a6d653 100644 --- a/src/Mod/Assembly/InitGui.py +++ b/src/Mod/Assembly/InitGui.py @@ -51,8 +51,7 @@ class AssemblyWorkbench(Workbench): def __init__(self): print("Loading Assembly workbench...") self.__class__.Icon = ( - FreeCAD.getResourceDir() - + "Mod/Assembly/Resources/icons/AssemblyWorkbench.svg" + FreeCAD.getResourceDir() + "Mod/Assembly/Resources/icons/AssemblyWorkbench.svg" ) self.__class__.MenuText = "Assembly" self.__class__.ToolTip = "Assembly workbench" @@ -74,9 +73,7 @@ class AssemblyWorkbench(Workbench): FreeCADGui.addLanguagePath(":/translations") FreeCADGui.addIconPath(":/icons") - FreeCADGui.addPreferencePage( - PreferencesPage, QT_TRANSLATE_NOOP("QObject", "Assembly") - ) + FreeCADGui.addPreferencePage(PreferencesPage, QT_TRANSLATE_NOOP("QObject", "Assembly")) # build commands list cmdlist = ["Assembly_CreateAssembly", "Assembly_InsertLink"]