Don't queue actions from the main thread.

This commit is contained in:
Lukáš Lalinský
2006-12-30 10:50:48 +01:00
parent 2904e7a973
commit e9f70caa02
2 changed files with 7 additions and 5 deletions

View File

@@ -893,7 +893,6 @@ class Tagger(QtGui.QApplication, ComponentManager, Component):
for album in albums:
self.reload_album(album)
def main(localedir=None):
tagger = Tagger(localedir)
sys.exit(tagger.run())
app = Tagger(localedir)
sys.exit(app.run())

View File

@@ -70,8 +70,11 @@ class ThreadAssist(QtCore.QObject):
def proxy_to_main(self, handler, *args, **kwargs):
"""Invoke ``handler`` with arguments ``args`` in the main thread."""
self.to_main.put((handler, args, kwargs))
self.emit(QtCore.SIGNAL("proxy_to_main()"))
if self.parent().thread() == QtCore.QThread.currentThread():
handler(*args, **kwargs)
else:
self.to_main.put((handler, args, kwargs))
self.emit(QtCore.SIGNAL("proxy_to_main()"))
def allocate(self):
"""Allocate a new thread."""