Code Improvements
Ideas on how to improve the codebase.
Keep all the style in a single file
We have CSS code sparkled throughout the code and copy/pasted functions to load them (some of those are my fault :D). It would be better if we gathered all that in a single pitivi.css
file and loaded it in MainWindow
. It would be easier for new contributors, we could have proper syntax highlighting, share more rules and maybe find a useful linter to use in the Git hooks.
The exception to this would be plugins which bring their own css.
Use resources
We could bundle .ui, .css and other files as resources to get a performance improvement: https://lazka.github.io/pgi-docs/index.html#Gio-2.0/classes/Resource.html#Gio.Resource
Use more CSS
There are several tidbits like this in the code:
title_label.props.margin_left = PADDING * 3
title_label.props.margin_right = PADDING * 3
title_label.props.margin_top = PADDING * 2
title_label.props.margin_bottom = PADDING * 2
We could move them to CSS and have a cleaner separation of design and logic. Plus we can define constants and base classes in the CSS file, so maybe we can deduplicate some code too.
CSS Keybindings?
Not sure about this one. But they look really powerful: https://developer.gnome.org/gtk3/stable/gtk3-Bindings.html I don't know how it would work with the custom shortcuts system we have though.
Format()/f-strings
There are a few parts of the code that still use the old %
operator. Using format()
or f-strings everywhere would be better.