Пример #1
0
 def data(self, index, role=None):
     """get score table from view"""
     if role is None:
         role = Qt.DisplayRole
     if not (index.isValid() and role == Qt.DisplayRole):
         return
     if role == Qt.DisplayRole:
         unformatted = str(
             self._resultRows[index.row()][index.column()]) # TODO: brauche ich str?
         if index.column() == 2:
             # we do not yet use this for listing remote games but if we do
             # this translation is needed for robot players
             names = [i18n(name) for name in unformatted.split('///')]
             return ', '.join(names)
         elif index.column() == 1:
             dateVal = datetime.datetime.strptime(
                 unformatted, '%Y-%m-%dT%H:%M:%S')
             return dateVal.strftime('%c')
         elif index.column() == 0:
             return int(unformatted)
     return QAbstractTableModel.data(self, index, role)
Пример #2
0
 def data(self, index, role=None):
     """get score table from view"""
     if role is None:
         role = Qt.DisplayRole
     if not (index.isValid() and role == Qt.DisplayRole):
         return toQVariant()
     if role == Qt.DisplayRole:
         unformatted = unicode(
             self._resultRows[index.row()][index.column()])
         if index.column() == 2:
             # we do not yet use this for listing remote games but if we do
             # this translation is needed for robot players
             names = [m18n(name) for name in unformatted.split('///')]
             return toQVariant(', '.join(names))
         elif index.column() == 1:
             dateVal = datetime.datetime.strptime(
                 unformatted, '%Y-%m-%dT%H:%M:%S')
             return toQVariant(nativeString(dateVal.strftime('%c')))
         elif index.column() == 0:
             return toQVariant(int(unformatted))
     with RealQVariant():
         return QAbstractTableModel.data(self, index, role)
Пример #3
0
 def __init__(self):
     QAbstractTableModel.__init__(self)
     self._resultRows = []
Пример #4
0
 def __init__(self):
     QAbstractTableModel.__init__(self)
     self._resultRows = []