spyder.api.preferences#
API to create an entry in Spyder Preferences associated to a given plugin.
Module Attributes
Type alias for a set of keys mapping to valid Spyder configuration values. |
Classes
|
A Spyder Preferences page for a single plugin. |
|
Widget that represents a tab on a preference page. |
- spyder.api.preferences.OptionSet#
Type alias for a set of keys mapping to valid Spyder configuration values.
A
setofspyder.config.types.ConfigurationKeys.
- class spyder.api.preferences.SpyderPreferencesTab(parent: SpyderConfigPage)[source]#
Bases:
BaseConfigTabWidget that represents a tab on a preference page.
All calls to
spyder.widgets.config.SpyderConfigPageattributes are resolved via delegation.- __init__(parent: SpyderConfigPage) None[source]#
Create a new tab on the given
parentconfig page.- Parameters:
parent (spyder.widgets.config.SpyderConfigPage) – The config page the tab will live on, to be this widget’s parent.
- Return type:
None
- Raises:
ValueError – If
TITLEhas not been set on the child implementation.
- apply_settings() spyder.api.preferences.OptionSet[source]#
Hook to manually apply settings that cannot be applied automatically.
Reimplement this if the configuration tab has complex widgets that cannot be created with any of the
self.create_*calls. This call should return asetcontaining the configuration options that changed.- Returns:
The
setof SpyderConfigurationKeys that were manually applied.- Return type:
OptionSet
- class spyder.api.preferences.PluginConfigPage(plugin: SpyderPluginV2, parent: spyder.plugins.preferences.widget.ConfigDialog)[source]#
Bases:
SpyderConfigPageA Spyder Preferences page for a single plugin.
This widget exposes the options a plugin offers for configuration as an entry in Spyder’s Preferences dialog.
- __init__(plugin: SpyderPluginV2, parent: spyder.plugins.preferences.widget.ConfigDialog) None[source]#
Create a Spyder Preferences page for a plugin.
- Parameters:
plugin (SpyderPluginV2) – The plugin to create the configuration page for.
parent (spyder.plugins.preferences.widgets.configdialog.ConfigDialog) – The main Spyder Preferences dialog, parent widget to this one.
- Return type:
None
- aggregate_sections_partials(opts: spyder.api.preferences.OptionSet) None[source]#
Aggregate options by sections in order to notify observers.
- Parameters:
opts (OptionSet) – The options to aggregate by section.
- Return type:
None
- get_name() str[source]#
Return plugin name to use in preferences page title and message boxes.
Normally you do not have to reimplement it, as the plugin name in the preferences page will be the same as the plugin title.
- Returns:
The plugin this preference page corresponds to.
- Return type:
- get_icon() QIcon[source]#
Return the plugin icon to use in the preferences page.
Normally you do not have to reimplement it, as the plugin icon in the preferences page will be the same as the main plugin icon.
- Returns:
The plugin’s icon.
- Return type:
- setup_page() None[source]#
Set up the configuration page widget.
You need to implement this method to set the layout of the preferences page.
For example:
layout = QVBoxLayout() layout.addWidget(...) ... self.setLayout(layout)
- Return type:
None
- apply_settings() spyder.api.preferences.OptionSet[source]#
Hook to manually apply settings that cannot be applied automatically.
Reimplement this if the configuration tab has complex widgets that cannot be created with any of the
self.create_*calls. This call should return asetcontaining the configuration options that changed.- Returns:
The
setof SpyderConfigurationKeys that were manually applied.- Return type:
OptionSet