def data(self, index, role): if role == Qt.TextAlignmentRole: return Qt.AlignRight | Qt.AlignVCenter if (not index.isValid()) or (role != Qt.DisplayRole): return QVariant() row = index.row() col = index.column() if col == 0: return QVariant(money.to_string( self.get_price(row), self._get_quote_currency())) if col == 1: return QVariant(money.to_string( self.get_size(row), self._get_base_currency()))
def data(self, index, role): if role == Qt.TextAlignmentRole: return Qt.AlignRight | Qt.AlignVCenter if (not index.isValid()) or (role != Qt.DisplayRole): return QVariant() (value, currency) = self.__getters[index.column()](index.row()) return QVariant(money.to_string(value, currency))
def test_to_string(self): self.assertEquals('7,000.00000', money.to_string(700000000000, Currency('USD')))