Thread: Exit GUI Plugin
View Single Post
Old 05-01-2024, 09:06 AM   #1
feuille
Connoisseur
feuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enoughfeuille will become famous soon enough
 
Posts: 55
Karma: 666
Join Date: May 2020
Location: Germany
Device: android smartphone + tablet
Exit GUI Plugin

Sorry if this is a stupid question: But how do I exit a GUI plugin without starting the main dialog if an error occurs during initialization?

Example: If the user has not selected a book, I print the following message in the __init__ method of class MyGuiPluginDialog(QDialog):

Code:
d = error_dialog(self.gui, 'MyGuiPlugin', _('No book selected!'))
d.exec()
This will display the Calibre error dialog. So good so far...

But how do I stop executing the plugin at this point?

"return" shows the error dialog again, after "OK" the main dialog of the plugin is shown.
"sys.exit()" closes Calibre itself.
feuille is offline   Reply With Quote