| | |
- abc.ABC(builtins.object)
-
- ApplicationForm
-
- CreditAccountApplicationForm
- LongTermSavingsAccountApplicationForm
- SavingsAccountApplicationForm
- builtins.object
-
- AccountCreationWidget
class AccountCreationWidget(builtins.object) |
| |
AccountCreationWidget(root, receiver)
Provides a basic widget for Account Creation
This widget is designed to by contained in a separate dialog window. It displays
a button for creating account, and logic for creating the account on click.
The widget uses dependency injection and has a specific workflow,
1. Create the AccountCreationWidget assigning its `root` as the dialog
and a `receiver` to accept the `account_created(account)` message
2. Create a widget to display to the user, to accept any required information.
This widget should have the `AccountCreationWidget` as the parent, and be
placed into the frame of the widget at `row=0, column=0` on the grid
3. Define a function, that takes no arguments and creates an account. This function
must use `ValueError` to indicate any failure conditions. The design intent
is that this accesses any required input from the widget supplied in step 2
4. Register the function by calling `register_account_creation_factory` and
passing the function
5. Accounts will now be created when the button is clicked, the call to
`create_account` will defer to the registered function for account creation
This allows the same generic window and user input validation logic to be
used to display different account application forms. See the `ApplicationForm`
class for an example widget designed to work with this class
Attributes
----------
frame
the frame containing this component. The user should hook a widget onto
this frame using the grid position `row=0, column=0`
receiver
object to receive the `account_created(account)` message |
| |
Methods defined here:
- __init__(self, root, receiver)
- Create a new `AccountCreationWidget`
Parameters
----------
root
parent widget
receiver
object to receive the `account_created(account)` message
- create_account(self)
- Create a new account
Defers to the registered factory function to create the account.
Inform the user of the result and close the dialog box on success
Returns
-------
None
- register_account_creation_factory(self, account_creation_factory)
- Register a function for `Account` creation
The function should take no arguments and return an `Account` object
when called, else raise `ValueError` if an object cannot be created
Parameters
----------
account_creation_factory : callable[None,Account.Account]
factory function to create accounts. Must take no arguments and
return an `Account` subclass on call. May raise `ValueError` to
indicate failures
Returns
-------
None
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|
class ApplicationForm(abc.ABC) |
| |
ApplicationForm(root)
Abstract class representing an account application form
This class should be overwritten with the required fields to get
the information required from the user to apply for an account.
The information should be accessed via the `get` method which should
be overwritten by a class
Attributes
----------
frame
frame containing the elements of the widget |
| |
- Method resolution order:
- ApplicationForm
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, root)
- create a new `ApplicationForm`
This is an abstract class and the constructor should not be
called directly
Parameters
----------
root
parent widget
- get(self)
- Return the details of an account application
The details should be returned in the format of a dictionary
containing key : value pairs where the key's are strings describing
required attributes and the values are the associated values
Returns
-------
dict[str, Any]
key : value pairs describing an account application
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- __abstractmethods__ = frozenset({'get'})
|
|