Coding Standards¶
The following rules and guidelines are used throughout the nodeeditor package:
File naming guidelines¶
- files in the nodeeditor package start with
node_ - files containing graphical representation (PyQt5 overridden classes) start with
node_graphics_ - files for window/widget start with
node_editor_
Coding guidelines¶
- methods use Camel case naming
- variables/properties use Snake case naming
- The constructor
__init__always contains all class variables for the entire class. This is helpful for new users, so they can just look at the constructor and read about all properties that class is using in one place. Nobody wants any surprises hidden in the code later - nodeeditor uses custom callbacks and listeners. Methods for adding callback functions
are usually named
addXYListener - custom events are usually named
onXY - methods named
doXYusually do certain tasks and also take care of low level operations - classes always contain methods in this order:
__init__- python magic methods (i.e.
__str__), setters and getters initXYfunctions- listener functions
- nodeeditor event fuctions
- nodeeditor
doXYandgetXYhelping functions - Qt5 event functions
- other functions
- optionally overridden Qt
paintmethod serializeanddeserializemethods at the end