Exemplo n.º 1
0
 def create_driver_finished(self):
   error = self.createDriverReply.error()
   if error == QtNetwork.QNetworkReply.NoError:
     driver = Driver.fromJSON((self.createDriverReply.readAll().data()))
     self.createDriverFinished.emit(driver)
   else:
     errors = self._parse_errors(self.createDriverReply.readAll().data())
     self.createDriverFailed.emit(errors)
Exemplo n.º 2
0
 def create_driver_finished(self):
     error = self.createDriverReply.error()
     if error == QtNetwork.QNetworkReply.NoError:
         driver = Driver.fromJSON((self.createDriverReply.readAll().data()))
         self.createDriverFinished.emit(driver)
     else:
         errors = self._parse_errors(
             self.createDriverReply.readAll().data())
         self.createDriverFailed.emit(errors)
Exemplo n.º 3
0
    def addDriver(self):
        if self.ui.newButton.isChecked():
            name = self.ui.nameLineEdit.text()
            ci = self.ui.ciLineEdit.text()
            frequent = self.ui.saveAsFrequentBox.isChecked()
            driver = Driver(ci, name, frequent)

            self.api.create_driver(driver)
        else:
            errors = []
            driverFilteredIndex = self.ui.driversTableView.currentIndex()
            if driverFilteredIndex.row() == -1:
                errors.append("Debe seleccionar un chofer")
            if not errors:
                driverIndex = self.filterDriversProxyModel.mapToSource(
                    driverFilteredIndex)
                self.driver = self.driversTableModel.getDriver(
                    driverIndex.row())
                self.accept()
            else:
                ErrorMessageBox(errors).exec_()
Exemplo n.º 4
0
 def get_drivers_finished(self):
     drivers = Driver.fromJSON(self.getDriversReply.readAll().data())
     self.getDriversFinished.emit(drivers)
Exemplo n.º 5
0
 def get_drivers_finished(self):
   drivers = Driver.fromJSON(self.getDriversReply.readAll().data())
   self.getDriversFinished.emit(drivers)