Ejemplo n.º 1
0
    @staticmethod
    def getITEM_DISPLAY(title, list_items, option_string, aux=None):
        output = InterfaceRequest.getLIST_DISPLAY(title, list_items,
                                                  option_string, aux)
        output.setField('type', 'ITEM_DISPLAY')
        return output


if __name__ == '__main__':
    ir = InterfaceRequest.getLIST_DISPLAY('Search results',
                                          [('Bananas ea', '$1.00'),
                                           ('Bananas kg', '$10.00')],
                                          'X to exit, C to continue',
                                          'Total 2 items')
    ir = UserInterface.display(ir)
    print('You said,', ir.getField('single_input'))
    ir2 = InterfaceRequest.getCONFIRM_DISPLAY(
        'Confirm whateer',
        'Please confirm that you wish to proceed with the transaction')
    ir2 = UserInterface.display(ir2)
    print('You said,', ir2.getField('response'))
    ir3 = InterfaceRequest.getFORM_DISPLAY(
        'Registration: Please enter your details', [('Name', 'string'),
                                                    ('Age', 'int')])
    ir3 = UserInterface.display(ir3)
    print('Responses were', ir3.getField('inputs'))
    ir4 = InterfaceRequest.getITEM_DISPLAY('Customer',
                                           [('Name', 'Jamie Hoffmann'),
                                            ('Age', 23), ('Course', 'MIT')],
                                           'X to exit, E to edit')