214 @param itm reference to the download item |
214 @param itm reference to the download item |
215 @type DownloadItem |
215 @type DownloadItem |
216 @param append flag indicating to append the item |
216 @param append flag indicating to append the item |
217 @type bool |
217 @type bool |
218 """ |
218 """ |
219 itm.statusChanged.connect(self.__updateRow) |
219 itm.statusChanged.connect(lambda: self.__updateRow(itm)) |
220 itm.downloadFinished.connect(self.__finished) |
220 itm.downloadFinished.connect(self.__finished) |
221 |
221 |
222 # insert at top of window |
222 # insert at top of window |
223 if append: |
223 if append: |
224 row = len(self.__downloads) |
224 row = len(self.__downloads) |
239 # just in case the download finished before the constructor returned |
239 # just in case the download finished before the constructor returned |
240 self.__updateRow(itm) |
240 self.__updateRow(itm) |
241 self.changeOccurred() |
241 self.changeOccurred() |
242 self.__updateActiveItemCount() |
242 self.__updateActiveItemCount() |
243 |
243 |
244 def __updateRow(self, itm=None): |
244 def __updateRow(self, itm): |
245 """ |
245 """ |
246 Private slot to update a download item. |
246 Private slot to update a download item. |
247 |
247 |
248 @param itm reference to the download item (DownloadItem) |
248 @param itm reference to the download item |
249 """ |
249 @type DownloadItem |
250 if itm is None: |
250 """ |
251 itm = self.sender() |
|
252 |
|
253 if itm not in self.__downloads: |
251 if itm not in self.__downloads: |
254 return |
252 return |
255 |
253 |
256 row = self.__downloads.index(itm) |
254 row = self.__downloads.index(itm) |
257 |
255 |