Browse Source

Fix active urls report

doc-issue-template
MrS0m30n3 9 years ago
parent
commit
d142867886
2 changed files with 10 additions and 8 deletions
  1. 4
      youtube_dl_gui/downloadmanager.py
  2. 14
      youtube_dl_gui/mainframe.py

4
youtube_dl_gui/downloadmanager.py

@ -108,6 +108,8 @@ class DownloadManager(Thread):
if not self.urls_list and self._jobs_done():
break
self._talk_to_gui('report_active')
# Close all the workers
for worker in self._workers:
worker.close()
@ -176,6 +178,8 @@ class DownloadManager(Thread):
1) closing: The download process is closing.
2) closed: The download process has closed.
3) finished: The download process was completed normally.
4) report_active: Signal the gui to read the number of active
downloads using the active() method.
"""
CallAfter(Publisher.sendMessage, MANAGER_PUB_TOPIC, data)

14
youtube_dl_gui/mainframe.py

@ -335,13 +335,7 @@ class MainFrame(wx.Frame):
See downloadmanager.Worker _talk_to_gui() method.
"""
data = msg.data
self._status_list.write(data)
# Report number of urls been downloaded
msg = self.URL_REPORT_MSG.format(self.download_manager.active())
self._status_bar_write(msg)
self._status_list.write(msg.data)
def _download_manager_handler(self, msg):
"""downloadmanager.DownloadManager thread handler.
@ -363,8 +357,12 @@ class MainFrame(wx.Frame):
self._status_bar_write(self.CLOSED_MSG)
self._reset_widgets()
self.download_manager = None
else:
elif data == 'closing':
self._status_bar_write(self.CLOSING_MSG)
elif data == 'report_active':
# Report number of urls been downloaded
msg = self.URL_REPORT_MSG.format(self.download_manager.active())
self._status_bar_write(msg)
def _update_handler(self, msg):
"""updatemanager.UpdateThread thread handler.

Loading…
Cancel
Save