summaryrefslogtreecommitdiffstats
path: root/module/gui/Accounts.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-03-28 22:32:14 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-06-28 02:47:08 +0200
commitb1fffc3a1b2dbbb807213b85f538e59251b9bf35 (patch)
treec373d3234dcb474bb424371a3d89341bed8a9e07 /module/gui/Accounts.py
parentPlugins licensing doc (diff)
downloadpyload-b1fffc3a1b2dbbb807213b85f538e59251b9bf35.tar.xz
Remove bad whitespaces
Merged vuolter/pyload@00288e6
Diffstat (limited to 'module/gui/Accounts.py')
-rw-r--r--module/gui/Accounts.py44
1 files changed, 22 insertions, 22 deletions
diff --git a/module/gui/Accounts.py b/module/gui/Accounts.py
index 8db04dfa9..d6bd442f1 100644
--- a/module/gui/Accounts.py
+++ b/module/gui/Accounts.py
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
-
+
@author: mkaay
"""
@@ -25,7 +25,7 @@ class AccountModel(QAbstractItemModel):
"""
model for account view
"""
-
+
def __init__(self, view, connector):
QAbstractItemModel.__init__(self)
self.connector = connector
@@ -33,7 +33,7 @@ class AccountModel(QAbstractItemModel):
self._data = []
self.cols = 4
self.mutex = QMutex()
-
+
def reloadData(self, force=False):
"""
reload account list
@@ -42,23 +42,23 @@ class AccountModel(QAbstractItemModel):
if self._data == accounts:
return
-
+
if len(self._data) > 0:
self.beginRemoveRows(QModelIndex(), 0, len(self._data)-1)
self._data = []
self.endRemoveRows()
-
+
if len(accounts) > 0:
self.beginInsertRows(QModelIndex(), 0, len(accounts)-1)
self._data = accounts
self.endInsertRows()
-
+
def toData(self, index):
"""
return index pointer
"""
return index.internalPointer()
-
+
def data(self, index, role=Qt.DisplayRole):
"""
return cell data
@@ -85,7 +85,7 @@ class AccountModel(QAbstractItemModel):
# if index.column() == 0:
# return QVariant(index.internalPointer().data["name"])
return QVariant()
-
+
def index(self, row, column, parent=QModelIndex()):
"""
create index with data pointer
@@ -99,13 +99,13 @@ class AccountModel(QAbstractItemModel):
else:
index = QModelIndex()
return index
-
+
def parent(self, index):
"""
no parents, everything on top level
"""
return QModelIndex()
-
+
def rowCount(self, parent=QModelIndex()):
"""
account count
@@ -113,10 +113,10 @@ class AccountModel(QAbstractItemModel):
if parent == QModelIndex():
return len(self._data)
return 0
-
+
def columnCount(self, parent=QModelIndex()):
return self.cols
-
+
def hasChildren(self, parent=QModelIndex()):
"""
everything on top level
@@ -125,10 +125,10 @@ class AccountModel(QAbstractItemModel):
return True
else:
return False
-
+
def canFetchMore(self, parent):
return False
-
+
def headerData(self, section, orientation, role=Qt.DisplayRole):
"""
returns column heading
@@ -143,29 +143,29 @@ class AccountModel(QAbstractItemModel):
elif section == 3:
return QVariant(_("Traffic left"))
return QVariant()
-
+
def flags(self, index):
"""
cell flags
"""
return Qt.ItemIsSelectable | Qt.ItemIsEnabled
-
+
class AccountView(QTreeView):
"""
view component for accounts
"""
-
+
def __init__(self, connector):
QTreeView.__init__(self)
self.setModel(AccountModel(self, connector))
-
+
self.setColumnWidth(0, 150)
self.setColumnWidth(1, 150)
self.setColumnWidth(2, 150)
self.setColumnWidth(3, 150)
-
+
self.setEditTriggers(QAbstractItemView.NoEditTriggers)
-
+
self.delegate = AccountDelegate(self, self.model())
self.setItemDelegateForColumn(3, self.delegate)
@@ -173,7 +173,7 @@ class AccountDelegate(QItemDelegate):
"""
used to display a progressbar for the traffic in the traffic cell
"""
-
+
def __init__(self, parent, model):
QItemDelegate.__init__(self, parent)
self.model = model
@@ -195,7 +195,7 @@ class AccountDelegate(QItemDelegate):
opts.maximum = opts.progress = data.trafficleft
if data.maxtraffic:
opts.maximum = data.maxtraffic
-
+
opts.rect = option.rect
opts.rect.setRight(option.rect.right()-1)
opts.rect.setHeight(option.rect.height()-1)