Open LewisGaul opened 4 years ago
Partially addressed by a5cffb780dc7927383ffc73138253e1d2e5c1fa7:
Caller
class to be private (now _Notifier
)Things have moved around, or at least been renamed a fair bit since this issue was created. I don't feel there's an urgent need to tidy things up further, but I'm keeping the issue open for tracking the remaining two points:
The current setup is quite general (good) but also quite confusing (bad!). Things could be simplified a bit, or at least made clearer in docs.
To summarise the current setup:
AbstractController
defines methods that correspond to user-driven eventsAbstractSwitchingController
inherits the above but is intended to contain an active controller instance, with the ability to switch between different controllers (providing different functionality, e.g. 'game' and 'create')AbstractListener
defines notifications that controllers may send for updating the GUI - listeners can be registered on controllersThe concrete implementation is as follows:
api.Caller
is a concrete instance ofAbstractListener
that serves to delegate to all registered listeners (instead of all controllers having to loop over their registered listeners, they just call methods on the 'caller')engine.BaseController
is a switching controller, which is what's referenced by the frontend for passing on user interaction eventsengine.GameController
is the standard game controller, the default active controller referenced by the base controllerengine.CreateController
is the 'create board' controllerfrontend.main_window.MinegaulerGUI
implements the listener interface, and is registered on the base controller in__main__
Problems with the above:
notif: Optional[api.Caller]
init argapi
module feels very wrong