View Single Post
Old 06-01-2018, 11:55 AM   #2
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
... continued

These are the specifics of my current "fun project" (audiobook creation) in case it makes any decision-making more obvious:
  • The looping is around each HTML file in an epub/azw3/kepub container spine.
  • The do_something is a 2-step process, neither of which modifies the book.
    • A call to Microsoft SAPI5 Speech interface to create a WAV file by TTS-speaking the container file text content.
    • Run a Windows EXE to convert WAV to MP3.
    Both of these processes could be quite lengthy (minutes not hours) if a book has chapters with a large wordcount.

As part of testing I've already coded Options 1 and 2 above with these observations:

Option 1:
I'm not sure if this is a problem or a feature

Having kicked off the 'Create MP3s' process via button-click it's not obvious how to cancel it. Closing the main dialog looks as if it closes the plugin but the WAV/MP3 creation process seems to keep going in the background. This may be a perfect solution - background running without the coding effort of thread/jobs - but I'm not sure of the technical implications.

Option 2:
Clicking the QProgressDialog Cancel button may happen during the WAV part or the MP3 part. The user wouldn't know which. ATMO the cancel doesn't take effect until both parts are complete. This could be quite a while after the Cancel button was actually clicked. It would be preferable if part 2 could be skipped if the Cancel button was clicked during part 1. I tried checking for self.wasCanceled() before starting part 2 but with no joy. I'm guessing I'm not understanding event processing well enough.

The QProgressDialog pop-up widget is completely empty until the completion of the first do_something cycle. This is a bit unnerving if it's a lengthy first cycle. Is there a way to get self.setLabelText and Cancel button to display immediately?
jackie_w is offline   Reply With Quote