diff options
author | Jeix <devnull@localhost> | 2010-11-09 21:15:14 +0100 |
---|---|---|
committer | Jeix <devnull@localhost> | 2010-11-09 21:15:14 +0100 |
commit | 8711bb80a0679c70d12d0b63a76cc91afcbe13fd (patch) | |
tree | 52578029dd4c771cb56b6a27cef5a37670ec6d78 | |
parent | account time fix (diff) | |
download | pyload-8711bb80a0679c70d12d0b63a76cc91afcbe13fd.tar.xz |
account reloadData fix
-rw-r--r-- | module/gui/Accounts.py | 17 |
1 files changed, 11 insertions, 6 deletions
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() |