def __init__(self): self._view = View()
class Boat(object): def __init__(self): self._view = View() def run(self, boats, runcode=None): """Controls all things boat related. Parameters --------- boats : models.BoatList """ if boats is None: return if runcode is RunCode.display_verbose_list: self._view.list(boats) return self._view.display_boats(boats) choice = self._view.get_main_menu_choice( has_boats=len(boats) is not 0) if choice is RunCode.create: boats.add(self._view.create()) elif choice is RunCode.edit: self._view.edit(self._view.get_boat(boats)) elif choice is RunCode.delete: boat = self._view.get_boat(boats) self._view.display_boat(boat) if self._view.remove_prompt(boat): boats.remove(boat)