Ejemplo n.º 1
0
    def __init__(self, parent):
        super(NewTruck, self).__init__(parent)
        self.api = parent.api
        self.ui = Ui_NewTruck()
        self.ui.setupUi(self)

        self.api.get_carriers()

        carrierCompleter = self.ui.carriersComboBox.completer()
        carrierCompleter.setCompletionMode(QtGui.QCompleter.PopupCompletion)

        self.api.createCarrierFinished.connect(self.refreshCarriers)
        self.api.getCarriersFinished.connect(self.getCarriersFinished)
        self.ui.addCarrierButton.clicked.connect(self.newCarrier)
        self.ui.createTruckButton.clicked.connect(self.createTruck)
        self.ui.cancelButton.clicked.connect(self.reject)
Ejemplo n.º 2
0
class NewTruck(QtGui.QDialog):
  def __init__(self, parent):
    super(NewTruck, self).__init__(parent)
    self.api = parent.api
    self.ui = Ui_NewTruck()
    self.ui.setupUi(self)

    self.api.get_carriers()
    
    carrierCompleter = self.ui.carriersComboBox.completer()
    carrierCompleter.setCompletionMode(QtGui.QCompleter.PopupCompletion)
    
    self.api.createCarrierFinished.connect(self.refreshCarriers)
    self.api.getCarriersFinished.connect(self.getCarriersFinished)
    self.ui.addCarrierButton.clicked.connect(self.newCarrier)
    self.ui.createTruckButton.clicked.connect(self.createTruck)
    self.ui.cancelButton.clicked.connect(self.reject)
    
  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()
      
  def getCarriersFinished(self, carriers):
    self.carriersListModel = CarriersListModel(carriers, self)
    self.ui.carriersComboBox.setModel(self.carriersListModel)
    self.ui.carriersComboBox.setCurrentIndex(-1)

  def newCarrier(self):
    newCarrierDialog = NewCarrier(self)
    if newCarrierDialog.exec_() == QtGui.QDialog.Accepted:
      self.api.create_carrier(newCarrierDialog.carrier)
      
  def refreshCarriers(self):
    self.api.get_carriers()
Ejemplo n.º 3
0
class NewTruck(QtGui.QDialog):
    def __init__(self, parent):
        super(NewTruck, self).__init__(parent)
        self.api = parent.api
        self.ui = Ui_NewTruck()
        self.ui.setupUi(self)

        self.api.get_carriers()

        carrierCompleter = self.ui.carriersComboBox.completer()
        carrierCompleter.setCompletionMode(QtGui.QCompleter.PopupCompletion)

        self.api.createCarrierFinished.connect(self.refreshCarriers)
        self.api.getCarriersFinished.connect(self.getCarriersFinished)
        self.ui.addCarrierButton.clicked.connect(self.newCarrier)
        self.ui.createTruckButton.clicked.connect(self.createTruck)
        self.ui.cancelButton.clicked.connect(self.reject)

    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()

    def getCarriersFinished(self, carriers):
        self.carriersListModel = CarriersListModel(carriers, self)
        self.ui.carriersComboBox.setModel(self.carriersListModel)
        self.ui.carriersComboBox.setCurrentIndex(-1)

    def newCarrier(self):
        newCarrierDialog = NewCarrier(self)
        if newCarrierDialog.exec_() == QtGui.QDialog.Accepted:
            self.api.create_carrier(newCarrierDialog.carrier)

    def refreshCarriers(self):
        self.api.get_carriers()
Ejemplo n.º 4
0
  def __init__(self, parent):
    super(NewTruck, self).__init__(parent)
    self.api = parent.api
    self.ui = Ui_NewTruck()
    self.ui.setupUi(self)

    self.api.get_carriers()
    
    carrierCompleter = self.ui.carriersComboBox.completer()
    carrierCompleter.setCompletionMode(QtGui.QCompleter.PopupCompletion)
    
    self.api.createCarrierFinished.connect(self.refreshCarriers)
    self.api.getCarriersFinished.connect(self.getCarriersFinished)
    self.ui.addCarrierButton.clicked.connect(self.newCarrier)
    self.ui.createTruckButton.clicked.connect(self.createTruck)
    self.ui.cancelButton.clicked.connect(self.reject)