src/eric7/WebBrowser/Download/DownloadModel.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9473
3f23dbf37dbe
--- a/src/eric7/WebBrowser/Download/DownloadModel.py	Wed Jul 13 11:16:20 2022 +0200
+++ b/src/eric7/WebBrowser/Download/DownloadModel.py	Wed Jul 13 14:55:47 2022 +0200
@@ -14,23 +14,24 @@
     """
     Class implementing the download model.
     """
+
     def __init__(self, manager, parent=None):
         """
         Constructor
-        
+
         @param manager reference to the download manager
         @type DownloadManager
         @param parent reference to the parent object
         @type QObject
         """
         super().__init__(parent)
-        
+
         self.__manager = manager
-    
+
     def data(self, index, role):
         """
         Public method to get data from the model.
-        
+
         @param index index to get data for
         @type QModelIndex
         @param role role of the data to retrieve
@@ -40,19 +41,19 @@
         """
         if index.row() < 0 or index.row() >= self.rowCount(index.parent()):
             return None
-        
+
         if (
-            role == Qt.ItemDataRole.ToolTipRole and
-            self.__manager.downloads()[index.row()].downloadedSuccessfully()
+            role == Qt.ItemDataRole.ToolTipRole
+            and self.__manager.downloads()[index.row()].downloadedSuccessfully()
         ):
             return self.__manager.downloads()[index.row()].getInfoData()
-        
+
         return None
-    
+
     def rowCount(self, parent=None):
         """
         Public method to get the number of rows of the model.
-        
+
         @param parent parent index
         @type QModelIndex
         @return number of rows
@@ -60,16 +61,16 @@
         """
         if parent is None:
             parent = QModelIndex()
-        
+
         if parent.isValid():
             return 0
         else:
             return self.__manager.downloadsCount()
-    
+
     def removeRows(self, row, count, parent=None):
         """
         Public method to remove downloads from the model.
-        
+
         @param row row of the first download to remove
         @type int
         @param count number of downloads to remove
@@ -81,13 +82,13 @@
         """
         if parent is None:
             parent = QModelIndex()
-        
+
         if parent.isValid():
             return False
-        
+
         if row < 0 or count <= 0 or row + count > self.rowCount(parent):
             return False
-        
+
         lastRow = row + count - 1
         for i in range(lastRow, row - 1, -1):
             if not self.__manager.downloads()[i].downloading():
@@ -96,11 +97,11 @@
                 self.endRemoveRows()
         self.__manager.changeOccurred()
         return True
-    
+
     def flags(self, index):
         """
         Public method to get flags for an item.
-        
+
         @param index index of the node cell
         @type QModelIndex
         @return flags
@@ -108,19 +109,19 @@
         """
         if index.row() < 0 or index.row() >= self.rowCount(index.parent()):
             return Qt.ItemFlag.NoItemFlags
-        
+
         defaultFlags = QAbstractListModel.flags(self, index)
-        
+
         itm = self.__manager.downloads()[index.row()]
         if itm.downloadedSuccessfully():
             return defaultFlags | Qt.ItemFlag.ItemIsDragEnabled
-        
+
         return defaultFlags
-    
+
     def mimeData(self, indexes):
         """
         Public method to return the mime data.
-        
+
         @param indexes list of indexes
         @type QModelIndexList
         @return mime data

eric ide

mercurial