Fix thumbnail download blocking events

This commit is contained in:
Ken Roberts 2015-02-19 07:34:09 -08:00
parent 33d8dcfa50
commit fd81d2d80a

View File

@ -62,6 +62,7 @@ class ThemeScreenshotWorker(QtCore.QObject):
self.filename = filename self.filename = filename
self.sha256 = sha256 self.sha256 = sha256
self.screenshot = screenshot self.screenshot = screenshot
socket.setdefaulttimeout(CONNECTION_TIMEOUT)
super(ThemeScreenshotWorker, self).__init__() super(ThemeScreenshotWorker, self).__init__()
def run(self): def run(self):
@ -251,7 +252,6 @@ class FirstTimeForm(QtGui.QWizard, UiFirstTimeWizard, RegistryProperties):
# Download the theme screenshots # Download the theme screenshots
themes = self.config.get('themes', 'files').split(',') themes = self.config.get('themes', 'files').split(',')
for theme in themes: for theme in themes:
self.application.process_events()
title = self.config.get('theme_%s' % theme, 'title') title = self.config.get('theme_%s' % theme, 'title')
filename = self.config.get('theme_%s' % theme, 'filename') filename = self.config.get('theme_%s' % theme, 'filename')
sha256 = self.config.get('theme_%s' % theme, 'sha256', fallback='') sha256 = self.config.get('theme_%s' % theme, 'sha256', fallback='')
@ -265,6 +265,7 @@ class FirstTimeForm(QtGui.QWizard, UiFirstTimeWizard, RegistryProperties):
worker.finished.connect(thread.quit) worker.finished.connect(thread.quit)
worker.moveToThread(thread) worker.moveToThread(thread)
thread.start() thread.start()
self.application.process_events()
def set_defaults(self): def set_defaults(self):
""" """
@ -448,7 +449,7 @@ class FirstTimeForm(QtGui.QWizard, UiFirstTimeWizard, RegistryProperties):
for index, theme in enumerate(themes): for index, theme in enumerate(themes):
screenshot = self.config.get('theme_%s' % theme, 'screenshot') screenshot = self.config.get('theme_%s' % theme, 'screenshot')
item = self.themes_list_widget.item(index) item = self.themes_list_widget.item(index)
# if item: if item:
item.setIcon(build_icon(os.path.join(gettempdir(), 'openlp', screenshot))) item.setIcon(build_icon(os.path.join(gettempdir(), 'openlp', screenshot)))
def _get_file_size(self, url): def _get_file_size(self, url):