The UI class houses the curses instance which in turn enables all user-requested actions while displaying relevant information. Only one instance of UI should ever be initialized. Initialization handles all the color constants generation along with defining all subwindows statically.
Parameters: |
|
---|---|
Returns: | UI (self) |
Renders the initial screen and sets up options for curses. Draws the border around the screen and the separators for the various sections with the title.
Parameters: | first (False) – Whether this is the call by the UI initialization. |
---|---|
Returns: | None |
Part of our sleep() function which checks if any of our accepted keys are pressed. It handles the logic for interpreting presses while recording and discarding them. The render of keys in the bottom right of the screen is done by updateKeys().
Parameters: | key – The key to process / store. If it’s +/-, the all recorded keys that are relevant are executed. |
---|---|
Returns: | None |
Handles sleeping while listening for button presses. The hardcoded subsleep (0.01s) amount is an appropriate resolution that allows for seemingly instant button press responses without consuming an entire core (when constantly listening).
Parameters: | amount – Float for amount of seconds to wait while listening to button presses. This is accurately followed to a resolution of 0.01s. |
---|---|
Returns: | None |
Calls several other functions which need to be checked constantly. Includes updateStats(), updateKeys(), and updateMain(). The last one is called every time think is, while the other two are called every self.nextUpdate seconds.
Returns: | None |
---|
Toggles a key display on the right hand side.
Parameters: | key – A key that’s listed on the right hand pane to toggle to an alternate option. |
---|---|
Returns: | None |
Handles rendering any relevant keys recorded from user input. It reads from self.keys to do this.
Returns: | None |
---|
Prints out a number for each of our children with an appropriate color for each corresponding with the last status message they reported. Refreshes the screen when done.
Returns: | None |
---|
Updates the statistics field within our window. Completely clears all of it initally then slowly goes through and reads from each individual pool value to rebuild it. This is called from think() and refreshes several times per second.
Returns: | None |
---|