示例#1
0
 def create_truck_finished(self):
     error = self.createTruckReply.error()
     if error == QtNetwork.QNetworkReply.NoError:
         truck = Truck.fromJSON(self.createTruckReply.readAll().data())
         self.createTruckFinished.emit(truck)
     else:
         errors = self._parse_errors(self.createTruckReply.readAll().data())
         self.createTruckFailed.emit(errors)
示例#2
0
 def createTruck(self):
     license_plate = self.ui.licensePlateLineEdit.text()
     carrierIndex = self.ui.carriersComboBox.currentIndex()
     if carrierIndex != -1:
         license_plate = self.ui.licensePlateLineEdit.text()
         carrier = self.ui.carriersComboBox.model().getCarrier(carrierIndex)
         self.truck = Truck(carrier.id, license_plate)
         self.accept()
示例#3
0
文件: api.py 项目: elshaka/Romano
 def create_truck_finished(self):
   error = self.createTruckReply.error()
   if error == QtNetwork.QNetworkReply.NoError:
     truck = Truck.fromJSON(self.createTruckReply.readAll().data())
     self.createTruckFinished.emit(truck)
   else:
     errors = self._parse_errors(self.createTruckReply.readAll().data())
     self.createTruckFailed.emit(errors)
示例#4
0
    def addTruck(self):
        if self.ui.newButton.isChecked():
            errors = []
            license_plate = self.ui.licensePlateLineEdit.text()
            carrier_id = self.carrier.id if self.carrier else None
            frequent = self.ui.saveAsFrequentBox.isChecked()
            truck = Truck(carrier_id, license_plate, frequent)

            self.api.create_truck(truck)
        else:
            errors = []
            truckFilteredIndex = self.ui.trucksTableView.currentIndex()
            if truckFilteredIndex.row() == -1:
                errors.append("Debe seleccionar un camión")
            if not errors:
                self.new = False
                truckIndex = self.filterTrucksProxyModel.mapToSource(
                    truckFilteredIndex)
                self.truck = self.trucksTableModel.getTruck(truckIndex.row())
                self.accept()
            else:
                ErrorMessageBox(errors).exec_()
示例#5
0
 def get_trucks_finished(self):
     trucks = Truck.fromJSON(self.getTrucksReply.readAll().data())
     self.getTrucksFinished.emit(trucks)
示例#6
0
文件: api.py 项目: elshaka/Romano
 def get_trucks_finished(self):
   trucks = Truck.fromJSON(self.getTrucksReply.readAll().data())
   self.getTrucksFinished.emit(trucks)