Ejemplo n.º 1
0
 def _standingsUpdate(self, standings):
     for pilot, newpos in standings:
         for oldpos, oldpilot in self.__positions.iteritems():
             if oldpilot == pilot:
                 if newpos > oldpos:
                     PilotInfo.get(pilot).setIcon(self.__arrowDown)
                 elif newpos < oldpos:
                     PilotInfo.get(pilot).setIcon(self.__arrowUp)
                 break
     for pilot, newpos in standings:
         self.__positions[newpos] = pilot
     self.reset()
Ejemplo n.º 2
0
 def data(self, index, role):
     if role == Qt.DisplayRole:
         try:
             i = self.__positions[index.row() + 1]
             if index.column() == 0:
                 return QVariant(i)
             elif index.column() == 1:
                 return QVariant(PilotInfo.get(i).name())
             elif index.column() == 2:
                 return QVariant(PilotInfo.get(i).state())
         except KeyError:
             pass
     elif role == Qt.TextAlignmentRole:
         if index.column() == 0 or index.column() == 2:
             return QVariant(Qt.AlignCenter)
     return QVariant()
Ejemplo n.º 3
0
 def data(self, index, role):
     if role == Qt.DisplayRole:
         try:
             t = self.__data[self.__lap][self.__intermediate][index.row()]
             if index.column() == 0:
                 return QVariant(PilotInfo.get(t[0]).name())
             elif index.column() == 1:
                 return QVariant(PilotInfo.get(t[0]).teamName())
             elif index.column() == 2:
                 if index.row() == 0:
                     return QVariant("%s (%s)" % (secondsToString(t[1]),
                                                  secondsToString(t[2])))
                 else:
                     return QVariant("+ " + secondsToString(t[1]))
         except KeyError:
             pass
     elif role == Qt.TextAlignmentRole:
         if index.column() == 2:
             return QVariant(Qt.AlignRight | Qt.AlignVCenter)
     return QVariant()
Ejemplo n.º 4
0
Archivo: Car.py Proyecto: Pesa/forse
 def refreshState(self):
     p = PilotInfo.get(self._id)
     if p.state() != self._state:
         self._state = p.state()
         self._outside = self._state == "ended" or self._state == "retired"
         self._pen = QPen(self.colorMap[self._state], self.carSize, Qt.SolidLine, Qt.RoundCap)
         self._translateToNewPos()
         self.update()
     tooltip = "Car %i\n" % self._id
     tooltip += "%s - %s\n" % (p.name(), p.teamName())
     tooltip += "State: %s" % self._state
     if self._state == "retired":
         tooltip += "\nReason for retirement: %s" % p.retireReason()
     self.setToolTip(tooltip)
Ejemplo n.º 5
0
 def headerData(self, section, orientation, role):
     if role == Qt.DisplayRole:
         if orientation == Qt.Horizontal:
             if section == 0:
                 return QVariant("ID")
             elif section == 1:
                 return QVariant("Pilot")
             elif section == 2:
                 return QVariant("State")
         else:
             return QVariant(section + 1)
     elif role == Qt.DecorationRole:
         if orientation == Qt.Vertical:
             try:
                 return QVariant(PilotInfo.get(self.__positions[section + 1]).icon())
             except KeyError:
                 pass
     elif role == Qt.TextAlignmentRole:
         if orientation == Qt.Vertical:
             return QVariant(Qt.AlignCenter)
     return QVariant()
Ejemplo n.º 6
0
 def _updateBestSpeedLabel(self, car, intermediate, lap, speed):
     s = "%s (%s in intermediate %i of lap %i)" % (mpsToString(speed),
                                                   PilotInfo.get(car).name(),
                                                   intermediate,
                                                   lap)
     self.bestSpeedLabel.setText(s)
Ejemplo n.º 7
0
 def _updateBestLapLabel(self, car, lap, time):
     self.bestLapLabel.setText("%s (%s in lap %i)" % (secondsToString(time),
                                                      PilotInfo.get(car).name(),
                                                      lap))