Zolko wrote: ↑Sun Jan 05, 2020 10:34 am
Done @v0.7.7. Was already in the development branch (with
Asm4 because all workbenches are like
Draft,
Part...) This is a minor upgrade, but with plenty of small stuff so I decided to upload.
...
There's still tons of small improvements that you could make to support the Python style that we want to push for in Draft, FEM, and other Python workbenches.
https://github.com/Zolko-123/FreeCAD_As ... BodyCmd.py
1. There's a ton of vertical whitespace in your files; you should probably cut some of this space. Only one empty line, or maximum two, should exist between lines of code.
2. There's the copyright missing in each file. As discussed in the other thread, it's best to include the text of the copyright in them. This is the best way to protect yourself against claims. Even if the source file is very basic, it should have the copyright text. See an example,
Draft/drafttests/auxiliary.py
3. I'm not sure if all your files use Tabs for indentation, but I would suggest using 4 spaces instead of a Tab character. It's just more Pythonic this way. Tabs may not give you the right alignment, because in some cases they look like 4 spaces and in others they look like 8. Spaces gives you the most consistent spacing.
4. I would try to place the code in subfolders, which would be sub-modules under the main folder. This is what we are trying to change in Draft, which has a few huge files. We prefer the structure of FEM, which puts several functions under subdirectories and files, making it easier to change specific files.
5. We would prefer if you used Pythonic style, which means your files instead of being called
newBodyCmd.py, had a name like
new_body_cmd.py. Using
CamelCase is mostly the C++ style that was used for historical reasons, but we would like to move gradually to a PEP8 style (see
Python).
6. Take a look at my pull request
#2824 where I show the new structure intended for Draft GUI commands. They are inside submodules. Object classes probably shouldn't be moved, but Gui commands, that is, those you register with
Gui.addCommand() should be moved into directories, in your case, something like
asm4_gui/. More details in
#2823, and the links mentioned there.