Open lauramurgatroyd opened 2 years ago
possibly similar comments are in #215
I'm now inclined to think that we should mainly adhere to VTK's conventions, with the exception of adopting Qt's conventions when we are dealing with qt stuff.
Possibly this also would mean that we make submodules like
vortex
vortex.qt
vortex.web #trame
vortex.io
vortex.utils
There are basically 3 different conventions we should/could follow:
For each I use example names to show how they are written (case-wise/underscores etc.)
VTK convention:
Class name: vtkCellArray()
Method names: .GetValue()
Qt convention:
Class names: QComboBox
Method names: .addItem()
CIL / Python convention:
Class names: BlockDataContainer
Method names: .get_item()
members: self.voxel_number_y
The question is where do we use each of these?
Readers. These are VTK-like classes so use VTK style. At the moment the prefix used is cil. Should we change this to cilviewer or cilv or cilvie to avoid confusion? https://github.com/vais-ral/CILViewer/blob/c9d8604ef7accd5d6eec68b888f2a4396254270c/Wrappers/Python/ccpi/viewer/utils/conversion.py#L567-L568
At the moment these use the Qt convention of camelCase methods names, even though they are completely separate from Qt. So we should consider a change although it will be a big backwards-compatability break. If we change, what do we change to? VTK-Style? Does that mean we would also change the name of the viewers to have a prefix?
Viewer interactor style Again, Qt/Python style name, but VTK-style methods - i.e. methods are all UpperCase words
Qt windows with viewers embedded Has Qt style as expected: https://github.com/vais-ral/CILViewer/blob/master/Wrappers/Python/ccpi/viewer/QCILViewerWidget.py
But iviewer and other viewer windows in this file, don't follow the Qt style, whereas perhaps they should? https://github.com/vais-ral/CILViewer/blob/master/Wrappers/Python/ccpi/viewer/iviewer.py
Qt Viewer interactor style:
Is currently Qt-style, but I think it should be VTK-like:
https://github.com/vais-ral/CILViewer/blob/master/Wrappers/Python/ccpi/viewer/QCILRenderWindowInteractor.py
Note: vtk's QVTKRenderWindowInteractor
has a Qt-like name, but uses method names like in VTK
What do we do about classes / methods that we use to generate VTK objects: E.g. https://github.com/vais-ral/CILViewer/blob/c9d8604ef7accd5d6eec68b888f2a4396254270c/Wrappers/Python/ccpi/viewer/utils/colormaps.py#L432 Or: https://github.com/vais-ral/CILViewer/blob/c9d8604ef7accd5d6eec68b888f2a4396254270c/Wrappers/Python/ccpi/viewer/utils/example_data.py#L30 Or: when I would like to add new methods to generate vtk objects: https://github.com/vais-ral/CILViewer/blob/1d741ec9b2c1ef3d4dd297405b3d1cda7012ca65/Wrappers/Python/ccpi/viewer/widgets/box_widgets.py#L5
If we are not renaming the package to something different, we could consider: CILV / CILVie instead of CILViewer
See https://github.com/vais-ral/CILViewer/pull/216#issuecomment-1093772185