mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 23:23:43 +02:00
Plugin config: Allow config widget to indicate that configuration cannot be carried out
This commit is contained in:
parent
fa7f9fed9e
commit
6f99e31f81
1 changed files with 11 additions and 0 deletions
|
|
@ -90,6 +90,11 @@ def config_widget(self):
|
|||
an optional method validate() that takes no arguments and is called
|
||||
immediately after the user clicks OK. Changes are applied if and only
|
||||
if the method returns True.
|
||||
|
||||
If for some reason you cannot perform the configuration at this time,
|
||||
return a tuple of two strings (message, details), these will be
|
||||
displayed as a warning dialog to the user and the process will be
|
||||
aborted.
|
||||
'''
|
||||
raise NotImplementedError()
|
||||
|
||||
|
|
@ -133,6 +138,12 @@ def size_dialog():
|
|||
except NotImplementedError:
|
||||
config_widget = None
|
||||
|
||||
if isinstance(config_widget, tuple):
|
||||
from calibre.gui2 import warning_dialog
|
||||
warning_dialog(parent, _('Cannot configure'), config_widget[0],
|
||||
det_msg=config_widget[1], show=True)
|
||||
return False
|
||||
|
||||
if config_widget is not None:
|
||||
v.addWidget(config_widget)
|
||||
v.addWidget(button_box)
|
||||
|
|
|
|||
Loading…
Reference in a new issue