Exemple #1
0
    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()))
Exemple #2
0
    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))
Exemple #3
0
 def test_to_string(self):
     self.assertEquals('7,000.00000',
         money.to_string(700000000000, Currency('USD')))