View Single Post
Old 06-13-2013, 01:09 PM   #1
hakan42
Zealot
hakan42 is on a distinguished road
 
hakan42's Avatar
 
Posts: 136
Karma: 60
Join Date: Jul 2009
Location: Munich, Germany
Device: Nook Classic rooted; Galaxy S IV with Aldiko, other older devices
Long-running tasks and updating dialogs

I am in the process of writing an OPDS Client plugin for Beam Ebooks. The source is at github.

Following the examples in the development manual, I created a dialog (in gui.py), in which I launch my OPDS client.

Code:
class DownloadDialog(QDialog):

    def __init__(self, gui, icon, do_user_config):
        QDialog.__init__(self, gui)
        self.gui = gui
        self.do_user_config = do_user_config
...
        self.download_button = QPushButton('Download books', self)
        self.download_button.clicked.connect(self.download)
        self.layout.addWidget(self.download_button)
...
    def download(self):
        # My OPDS stuff is called here...
...
What I am observing is that the GUI of calibre hangs until I return from the download task. Is there something I should do, perhaps somehow periodically yield control back to a GUI thread or something? I must admit that I am not really clueful concerning PyQT
hakan42 is offline   Reply With Quote