Exemple #1
0
    def uiReturnBook(self, arg):
        self.__rentalController.return_book(arg)

        self.__undoController.newOperation()
        redo = FunctionCall(self.uiReturnBook, arg)
        undo = FunctionCall(self.__rentalController.cancel_rental, arg)
        operation = Operation(undo, redo)
        self.__undoController.recordOperation(operation)
Exemple #2
0
    def uiRentBook(self, arg):
        self.__rentalController.rent_book(arg)

        self.__undoController.newOperation()
        redo = FunctionCall(self.uiRentBook, arg)
        undo = FunctionCall(self.__rentalController.remove_rental, arg[0])
        operation = Operation(undo, redo)
        self.__undoController.recordOperation(operation)
Exemple #3
0
    def uiAddClient(self, arg):
        self.__clientsController.add_client(arg)

        self.__undoController.newOperation()
        redo = FunctionCall(self.uiAddClient, arg)
        undo = FunctionCall(self.uiRemoveClient, arg[0])
        operation = Operation(undo, redo)
        self.__undoController.recordOperation(operation)
Exemple #4
0
    def uiAddBook(self, arg):
        self.__booksController.add_book(arg)

        self.__undoController.newOperation()
        redo = FunctionCall(self.uiAddBook, arg)
        undo = FunctionCall(self.uiRemoveBook, arg[0])
        operation = Operation(undo, redo)
        self.__undoController.recordOperation(operation)
Exemple #5
0
    def uiUpdateClient(self, arg):
        tools.isInt(arg[0])
        c = self.__clientsController.getItem(arg[0])

        self.__clientsController.update_client(arg)

        self.__undoController.newOperation()
        redo = FunctionCall(self.uiUpdateClient, arg)
        undo = FunctionCall(self.uiUpdateClient, [c.getId(), c.getName()])
        operation = Operation(undo, redo)
        self.__undoController.recordOperation(operation)
Exemple #6
0
    def uiUpdateBook(self, arg):
        tools.isInt(arg[0])
        b = self.__booksController.getItem(arg[0])

        self.__booksController.update_book(arg)

        self.__undoController.newOperation()
        redo = FunctionCall(self.uiUpdateBook, arg)
        undo = FunctionCall(self.uiUpdateBook, [b.getId(), b.getTitle(), b.getDescription(), b.getAuthor()])
        operation = Operation(undo, redo)
        self.__undoController.recordOperation(operation)