This PR adds some formalization around the app settings by creating a settings class. The class allows settings access by attribute as in a normal class while maintaining the dictionary-like access needed for the settings keys.
There are actually two settings classes added. The BaseSettings class defines a base class, with no actual settings defined. The KeyAppSettings class extends the former, and adds the expected settings for KeyApps.
Some settings that were previously defined in constants have been moved into the settings; namely, the color scheme and the pixel color timeout. This makes it much easier to customize the colors used in an app.
One approach I considered was making the settings object a singleton, so it could be accessed anywhere at any time. I ultimately decided to abandon this idea because it should be possible to have two apps with two separate settings objects, if that was so desired. Going with a single global settings object enforces consistency, and I would rather maintain flexibility. So settings are still specified for each App individually.
This PR adds some formalization around the app settings by creating a settings class. The class allows settings access by attribute as in a normal class while maintaining the dictionary-like access needed for the settings keys.
There are actually two settings classes added. The
BaseSettings
class defines a base class, with no actual settings defined. TheKeyAppSettings
class extends the former, and adds the expected settings forKeyApps
.Some settings that were previously defined in constants have been moved into the settings; namely, the color scheme and the pixel color timeout. This makes it much easier to customize the colors used in an app.
One approach I considered was making the settings object a singleton, so it could be accessed anywhere at any time. I ultimately decided to abandon this idea because it should be possible to have two apps with two separate settings objects, if that was so desired. Going with a single global settings object enforces consistency, and I would rather maintain flexibility. So settings are still specified for each App individually.