This commit is contained in:
Kovid Goyal 2011-03-27 16:38:23 -06:00
parent 8e2ca7681f
commit 157155d774
2 changed files with 11 additions and 1 deletions

View File

@ -142,7 +142,10 @@ Getting resources from the plugin zip file
Enabling user configuration of your plugin Enabling user configuration of your plugin
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To allow users to configure your plugin, you must define a couple of methods in your base plugin class, **config_widget** and **save_settings** as shown below: To allow users to configure your plugin, you must define three methods in your base plugin class, '**is_customizable**, **config_widget** and **save_settings** as shown below:
.. literalinclude:: plugin_examples/interface_demo/__init__.py
:pyobject: InterfacePluginDemo.is_customizable
.. literalinclude:: plugin_examples/interface_demo/__init__.py .. literalinclude:: plugin_examples/interface_demo/__init__.py
:pyobject: InterfacePluginDemo.config_widget :pyobject: InterfacePluginDemo.config_widget

View File

@ -32,6 +32,13 @@ class InterfacePluginDemo(InterfaceActionBase):
#: The specified class must be defined in the specified module. #: The specified class must be defined in the specified module.
actual_plugin = 'calibre_plugins.interface_demo.ui:InterfacePlugin' actual_plugin = 'calibre_plugins.interface_demo.ui:InterfacePlugin'
def is_customizable(self):
'''
This method must return True to enable customization via
Preferences->Plugins
'''
return True
def config_widget(self): def config_widget(self):
''' '''
Implement this method and :meth:`save_settings` in your plugin to Implement this method and :meth:`save_settings` in your plugin to