-
Notifications
You must be signed in to change notification settings - Fork 1
Code organization and convention
Fabrice edited this page Mar 9, 2025
·
11 revisions
A modular approach is attempted to get shorter files. The name of the module is the name of the class. These modules are located in src folder. Additional classes are built to reduce the size of objects, especially widgets. An attempt is made to get cleaner code to reduce chances to get lost in my own code.
PEP-8 limits of 80 characters for code or 72 characters for docstrings are not considered.
Always start with a verb followed by nouns and additional information if needed.
Names of instances must not be used, instead the descriptives names of the object should be used -> application
for root window.
- Change message of status ->
set_
- Create widget ->
create_
- Prepare something ->
setup_
ordefine_
- Plot one or several curves or update a plot ->
plot_
- Read or write a file ->
read
/write
- Retrieve or modify a value ->
get
/set
- Tabbed panels in notebook (RH panel) ->
_tab
- Modification of curve out of Curve class ->
_curve
- CSV curves or Curve objects ->
curve
- Class composition links main GUI class to lower level classes. Master class of any widget ->
self.parent
Always with UPPER CASE. Defined in Constants class
- Label ->
lbl
- Entry ->
ent
- Spinbox ->
sbx
- Combobox ->
cbx
- Listbox ->
lbx
- tkMessageBox ->
mbx
- Checkbutton ->
cbn
- Radiobutton ->
rbn
- Button ->
btn
- Menubutton ->
mbn
- text ->
txt
- Frame ->
frm
- Labelframe ->
lfm
- Input ->
inp
- Notebook ->
ntb
- Frame ->
frm
- Canva ->
cva
- Scale ->
scl
- Panedwindow ->
pwn
- Frame ->
frm
- Progressbar ->
pbr
- Scrollbar ->
sbr
- Related to a directory ->
_dir
- Related to a file ->
_file
- Point data read from CSV file ->
input_points
- Point data ready for plotting after a possible processing (offset, shift, etc.) ->
points
- Flag for visibility of curve on plot ->
is_shown
- Line attributes ->
line_color
,line_width
,line_style
,line_marker