229 @param itm reference to the download item |
229 @param itm reference to the download item |
230 @type DownloadItem |
230 @type DownloadItem |
231 @param append flag indicating to append the item |
231 @param append flag indicating to append the item |
232 @type bool |
232 @type bool |
233 """ |
233 """ |
234 itm.statusChanged.connect(self.__updateRow) |
234 itm.statusChanged.connect(lambda: self.__updateRow(itm)) |
235 itm.downloadFinished.connect(self.__finished) |
235 itm.downloadFinished.connect(self.__finished) |
236 |
236 |
237 # insert at top of window |
237 # insert at top of window |
238 if append: |
238 if append: |
239 row = len(self.__downloads) |
239 row = len(self.__downloads) |
254 # just in case the download finished before the constructor returned |
254 # just in case the download finished before the constructor returned |
255 self.__updateRow(itm) |
255 self.__updateRow(itm) |
256 self.changeOccurred() |
256 self.changeOccurred() |
257 self.__updateActiveItemCount() |
257 self.__updateActiveItemCount() |
258 |
258 |
259 def __updateRow(self, itm=None): |
259 def __updateRow(self, itm): |
260 """ |
260 """ |
261 Private slot to update a download item. |
261 Private slot to update a download item. |
262 |
262 |
263 @param itm reference to the download item (DownloadItem) |
263 @param itm reference to the download item |
264 """ |
264 @type DownloadItem |
265 if itm is None: |
265 """ |
266 itm = self.sender() |
|
267 |
|
268 if itm not in self.__downloads: |
266 if itm not in self.__downloads: |
269 return |
267 return |
270 |
268 |
271 row = self.__downloads.index(itm) |
269 row = self.__downloads.index(itm) |
272 |
270 |