def initialize(self):
        self.status = self.STATUS_IDLE
        self.currentObject = None # Set this to a string

        self.output = []
        n = DownloadManager.NEW_OUTPUT_NOTIFICATION
        Notification.addObserver(self, n)
    def __downloadNextItem(self):
        with self.__lock:
            if self.__shouldStop == True:
                self.__shouldStop = False
                self.active = None

                notifName = DownloadThread.DONE_NOTIFICATION
                Notification.removeObserver(self, notifName)
                self.__notifyStopped()
                return

            if len(self.queue) == 0:
                self.active = None

                notifName = DownloadThread.DONE_NOTIFICATION
                Notification.removeObserver(self, notifName)
                self.__notifyDone()
                return

            # Start the download-thread
            notifName = DownloadThread.DONE_NOTIFICATION
            Notification.addObserver(self, notifName)

            notifName = DownloadThread.NEW_OUTPUT_NOTIFICATION
            Notification.addObserver(self, notifName)

            self.active = self.queue[0]
            del self.queue[0]
            self.__downloadThread = DownloadThread(self.active)
            self.__downloadThread.start()

            self.__notifyNextDownload()
    def initialize(self):
        self.queueBox = QueueBox.QueueBox(self, (1, 1))
        self.queueBox.downloadManager = self.downloadManager
        self.queueBoxDetails = QueueBox.DetailsScreen(self, self.queueBox)
        self.addChild(self.queueBox)
        self.addChild(self.queueBoxDetails)

        self.statusBox = StatusBox(self, (1, 1))
        self.addChild(self.statusBox)

        self.doneBox = DoneBox.DoneBox(self, (1, 1))
        self.doneBox.downloadManager = self.downloadManager
        self.doneBoxDetails = DoneBox.DetailsScreen(self, self.doneBox)
        self.addChild(self.doneBox)
        self.addChild(self.doneBoxDetails)

        self.automaticallyCycleThroughChildren = True

        self.__pendingAlert = None
        try:
            self.downloadManager.load()
        except FileNotFoundError:
            pass
        except Exception as e:
            self.__handleException(e)

        ns = [DownloadManager.NEXT_DOWNLOAD_NOTIFICATION,
             DownloadManager.DONE_NOTIFICATION,
             DownloadManager.STOPPED_NOTIFICATION]
        for n in ns:
            Notification.addObserver(self, n)