'Check for messages communicated from the web app, and update the GUI accordingly.'

def check_for_requests(self):

    self.update()
    if self.new_download:
        self.vbar.setValue(self.vbar.maximum())
        self.new_download = False
    if (self.server_status.status != self.server_status.STATUS_STARTED):
        return
    events = []
    done = False
    while (not done):
        try:
            r = web.q.get(False)
            events.append(r)
        except web.queue.Empty:
            done = True
    for event in events:
        if (event['type'] == web.REQUEST_LOAD):
            self.status_bar.showMessage(strings._('download_page_loaded', True))
        elif (event['type'] == web.REQUEST_DOWNLOAD):
            self.downloads_container.show()
            self.downloads.add_download(event['data']['id'], web.zip_filesize)
            self.new_download = True
            if (self.systemTray.supportsMessages() and self.settings.get('systray_notifications')):
                self.systemTray.showMessage(strings._('systray_download_started_title', True), strings._('systray_download_started_message', True))
        elif (event['type'] == web.REQUEST_RATE_LIMIT):
            self.stop_server()
            Alert(strings._('error_rate_limit'), QtWidgets.QMessageBox.Critical)
        elif (event['type'] == web.REQUEST_PROGRESS):
            self.downloads.update_download(event['data']['id'], event['data']['bytes'])
            if (event['data']['bytes'] == web.zip_filesize):
                if (self.systemTray.supportsMessages() and self.settings.get('systray_notifications')):
                    self.systemTray.showMessage(strings._('systray_download_completed_title', True), strings._('systray_download_completed_message', True))
                if (not web.get_stay_open()):
                    self.server_status.stop_server()
        elif (event['type'] == web.REQUEST_CANCELED):
            self.downloads.cancel_download(event['data']['id'])
            if (self.systemTray.supportsMessages() and self.settings.get('systray_notifications')):
                self.systemTray.showMessage(strings._('systray_download_canceled_title', True), strings._('systray_download_canceled_message', True))
        elif (event['path'] != '/favicon.ico'):
            self.status_bar.showMessage('[#{0:d}]    {1:s}:    {2:s}'.format(web.error404_count, strings._('other_page_loaded', True), event['path']))
