View Single Post
Old 09-03-2012, 12:52 PM   #10
Pepin33
Zealot
Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.
 
Posts: 109
Karma: 419
Join Date: Aug 2012
Location: Spain
Device: Kindle Touch
jackie_w, I do the same way than you do (I also look at kiwidude's code).

The only difference is that I don't have a cancel button, so I never had a self.wasCanceled() true value.

But the problem is when the user doesn't cancel, but closes the window. Try with your code, when the bar is on screen, if you press "ESC" or push the X button, the window closes, but it doesn't produces a "Cancel" event (maybe because you're not canceling, but closing). I found the way to hide the close button, but the "ESC" key still closes it.

In my case, the code in the function "do_book_action" (in your example), continues executing when the progress bar window is closed at this way, and the execution at the main window continues.

The process I was doing is to uncompress a ZIP file to a temporary folder, then the progress bar shows when adding some books to the library, and at last it closes, and I delete the temporary files from the main window. When the user closes the progress bar window before the process is finished, the function who add books continues, but the code at the main window deletes the files, so I get lots of errors.

Last edited by Pepin33; 09-03-2012 at 12:56 PM.
Pepin33 is offline   Reply With Quote