From 8711bb80a0679c70d12d0b63a76cc91afcbe13fd Mon Sep 17 00:00:00 2001 From: Jeix Date: Tue, 9 Nov 2010 21:15:14 +0100 Subject: account reloadData fix --- module/gui/Accounts.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'module/gui/Accounts.py') diff --git a/module/gui/Accounts.py b/module/gui/Accounts.py index ca559fcdb..0add1452b 100644 --- a/module/gui/Accounts.py +++ b/module/gui/Accounts.py @@ -32,15 +32,20 @@ class AccountModel(QAbstractItemModel): def reloadData(self, force=True): data = self.connector.proxy.get_accounts(False, force) - self.beginRemoveRows(QModelIndex(), 0, len(self._data)) - self._data = [] - self.endRemoveRows() + + if len(self._data) > 0: + self.beginRemoveRows(QModelIndex(), 0, len(self._data)-1) + self._data = [] + self.endRemoveRows() + accounts = [] for li in data.values(): accounts += li - self.beginInsertRows(QModelIndex(), 0, len(accounts)) - self._data = accounts - self.endInsertRows() + + if len(accounts) > 0: + self.beginInsertRows(QModelIndex(), 0, len(accounts)-1) + self._data = accounts + self.endInsertRows() def toData(self, index): return index.internalPointer() -- cgit v1.2.3