View Single Post
Old 07-13-2015, 07:41 PM   #5
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,904
Karma: 22666668
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Since S&R runs in the GUI thread, as you discovered, you can show any GUI you like in your replace function. However, this is accidental and is not really something S&R was designed for, so dont be surprised if it breaks someday.

And as @eschwartz said, you should use Qt dialog boxes, that way your code will work everywhere, something like

from PyQt5.Qt import QInputDialog
from calibre.gui2.tweak_book.boss import get_boss

ok, answer = QInputDialog.getText(get_boss().gui, ...)

See the documentation for QInputDialog for the details
kovidgoyal is offline   Reply With Quote