-
Notifications
You must be signed in to change notification settings - Fork 3
Controller
Once the graphical code has been generated using wxFormBuilder the functions which are exe- cuted when a user interacts with the graphical interface need to be implemented. This file creates a set of objects which inherit from the graphical objects outlined in /SolarCalculator/GUI.py and implements functionality for button click events and exceptions. Furthermore during this initialisation the data present in the graphical interface is loaded, for instance when the main window is created the controller will load the list of available currencies from /Resources/currencyList.txt into the selection boxes in the GUI.
The main event handler of interest is the evt_runSimulation_clicked() in the SolarFarmCalculator class. This is run when the Run Simulation button is clicked. Within this event handler the input fields are validated and the user receives feedback as to which fields, if any, were invalid. This is done using InputField objects which bind an input field and a label together in a group.
When the two are bound a constraint is placed on what constitutes valid input within the field; upon validation if the input is correct the label is coloured black and if the input is invalid the label is coloured red to indicate to the user that an invalid number was entered.