From 25c3d2eb32817c031e3388c952066a20979b378c Mon Sep 17 00:00:00 2001 From: Inso <insomniak.fr@gmail.com> Date: Sat, 7 Feb 2015 18:38:10 +0100 Subject: [PATCH] Remove old unused models --- src/cutecoin/models/received.py | 48 ------------------------- src/cutecoin/models/sent.py | 64 --------------------------------- 2 files changed, 112 deletions(-) delete mode 100644 src/cutecoin/models/received.py delete mode 100644 src/cutecoin/models/sent.py diff --git a/src/cutecoin/models/received.py b/src/cutecoin/models/received.py deleted file mode 100644 index 3325b98d..00000000 --- a/src/cutecoin/models/received.py +++ /dev/null @@ -1,48 +0,0 @@ -''' -Created on 5 févr. 2014 - -@author: inso -''' - -import logging -from ..core.person import Person -from ..tools.exceptions import PersonNotFoundError -from PyQt5.QtCore import QAbstractListModel, Qt - - -class ReceivedListModel(QAbstractListModel): - - ''' - A Qt abstract item model to display communities in a tree - ''' - - def __init__(self, account, community, parent=None): - ''' - Constructor - ''' - super(ReceivedListModel, self).__init__(parent) - self.account = account - self.community = community - - def rowCount(self, parent): - return len(self.account.transactions_received(self.community)) - - def data(self, index, role): - if role == Qt.DisplayRole: - row = index.row() - transactions = self.account.transactions_received(self.community) - amount = 0 - for o in transactions[row].outputs: - pubkeys = [w.pubkey for w in self.account.wallets] - if o.pubkey in pubkeys: - amount += o.amount - pubkey = transactions[row].issuers[0] - try: - sender = Person.lookup(pubkey, self.community) - value = "{0} from {1}".format(amount, sender.name) - except PersonNotFoundError: - value = "{0} from {1}".format(amount, pubkey) - return value - - def flags(self, index): - return Qt.ItemIsSelectable | Qt.ItemIsEnabled diff --git a/src/cutecoin/models/sent.py b/src/cutecoin/models/sent.py deleted file mode 100644 index d13c0b6c..00000000 --- a/src/cutecoin/models/sent.py +++ /dev/null @@ -1,64 +0,0 @@ -''' -Created on 5 févr. 2014 - -@author: inso -''' - -import logging -from ..core.person import Person -from ..tools.exceptions import PersonNotFoundError -from PyQt5.QtCore import QAbstractListModel, Qt -from PyQt5.QtGui import QFont - - -class SentListModel(QAbstractListModel): - - ''' - A Qt abstract item model to display communities in a tree - ''' - - def __init__(self, account, community, parent=None): - ''' - Constructor - ''' - super(SentListModel, self).__init__(parent) - self.account = account - self.community = community - - def rowCount(self, parent): - return len(self.account.transactions_sent(self.community)) \ - + len(self.account.transactions_awaiting(self.community)) - - def data(self, index, role): - row = index.row() - if role == Qt.DisplayRole: - transactions = [] - if row < len(self.account.transactions_sent(self.community)): - transactions = self.account.transactions_sent(self.community) - else: - transactions = self.account.transactions_awaiting(self.community) - row = row - len(self.account.transactions_sent(self.community)) - amount = 0 - outputs = [] - for o in transactions[row].outputs: - pubkeys = [w.pubkey for w in self.account.wallets] - if o.pubkey not in pubkeys: - outputs.append(o) - amount += o.amount - try: - receiver = Person.lookup(outputs[0].pubkey, self.community) - value = "{0} to {1}".format(amount, receiver.name) - except PersonNotFoundError: - value = "{0} to {1}".format(amount, outputs[0].pubkey) - return value - - if role == Qt.FontRole: - font = QFont() - if row < len(self.account.transactions_sent(self.community)): - font.setItalic(False) - else: - font.setItalic(True) - return font - - def flags(self, index): - return Qt.ItemIsSelectable | Qt.ItemIsEnabled -- GitLab