summaryrefslogtreecommitdiffstats
path: root/module/gui/Accounts.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/gui/Accounts.py')
-rw-r--r--module/gui/Accounts.py17
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()