Exemplo n.º 1
0
 def registerNewVehicle(self, registration_number, rented, model_year,
                        brand, price, car_type):
     newVehicle = Vehicle(registration_number, model_year, rented, brand,
                          price, car_type)
     self.__Vehicles.append(newVehicle)
     self.Save()  #Save-a í hvert sinn sem við bætum við nýjum bíl
     return newVehicle
Exemplo n.º 2
0
 def loadVehicles(self):
     for line in self.__Vehicles_Data:
         regnum = line[REGISTRATION_NUMBER]
         rented = line[RENTED]
         model_year = line[MODEL_YEAR]
         brand = line[BRAND]
         price = line[PRICE]
         car_type = line[CAR_TYPE]
         car = Vehicle(regnum, model_year, rented, brand, price, car_type)
         self.__Vehicles.append(car)
Exemplo n.º 3
0
def vehicle():
    """Returns vehicle with random data in it from Dummy()"""
    return Vehicle(
        D.make_type(),
        D.make_manufacturer(),
        D.make_yom(),
        D.make_color(),
        D.make_licence(),
        D.make_airport(),
        D.make_vehicle_state(),
        D.make_vehicle_status(),
        randint(100, 300),
        D.make_model(),
        D.make_vehicle_id(),
    )
 def loadVehicles(self):
     self.__Vehicles_Data = GetData(VEHICLE_FILE).readData()
     self.__Vehicles.clear()
     for line in self.__Vehicles_Data:
         regnum = line[REGISTRATION_NUMBER]
         if line[RENTED] == 'True':
             rented = True
         else:
             rented = False
         model_year = int(line[MODEL_YEAR])
         brand = line[BRAND]
         price = int(line[PRICE])
         car_type = int(line[CAR_TYPE])
         car = Vehicle(regnum, model_year, rented, brand, price, car_type)
         self.__Vehicles.append(car)
Exemplo n.º 5
0
    def __init__(self, lapi, ui):
        self.logicAPI = lapi
        self.ui = ui
        self.verify = Input_Verifiers(lapi)

        # Get the number of required parameters to the init method of the class
        self.contract = [
            Contract(
                *[None for i in range(len(signature(Contract).parameters))]),
            lapi.contract
        ]
        self.customer = [
            Customer(
                *[None for i in range(len(signature(Customer).parameters))]),
            lapi.customer
        ]
        self.destination = [
            Destination(
                *[None
                  for i in range(len(signature(Destination).parameters))]),
            lapi.destination
        ]
        self.employee = [
            Employee(
                *[None for i in range(len(signature(Employee).parameters))]),
            lapi.employee
        ]
        self.vehicle = [
            Vehicle(*[None
                      for i in range(len(signature(Vehicle).parameters))]),
            lapi.vehicle
        ]
        self.vehicle_type = [
            Vehicle_Type(
                *
                [None
                 for i in range(len(signature(Vehicle_Type).parameters))]),
            lapi.vehicle_type
        ]
        self.display = Display()
Exemplo n.º 6
0
 def edit(self, form, id):
     """Passes an edited vehicle through a form editor before passing it
     onto the data API"""
     new_form = vehicle_editor(form)
     new_vehicle = Vehicle(**new_form)
     self.dataAPI.edit_vehicle(new_vehicle, id)
Exemplo n.º 7
0
 def register(self, form):
     """Passes a new vehicle through a form filler before passing it
     onto the data API"""
     new_form = vehicle_filler(form)
     new_vehicle = Vehicle(**new_form)
     self.dataAPI.append_vehicle(new_vehicle)