Reordered some lines, changed some paint events in components.py to stick more closely to conventions
merged conflicts