plugin.py
Go to the documentation of this file.
1 # Copyright (c) 2011, Dirk Thomas, Dorian Scholz, TU Darmstadt
2 # All rights reserved.
3 #
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions
6 # are met:
7 #
8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above
11 # copyright notice, this list of conditions and the following
12 # disclaimer in the documentation and/or other materials provided
13 # with the distribution.
14 # * Neither the name of the TU Darmstadt nor the names of its
15 # contributors may be used to endorse or promote products derived
16 # from this software without specific prior written permission.
17 #
18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 # POSSIBILITY OF SUCH DAMAGE.
30 
31 from python_qt_binding.QtCore import QObject
32 
33 
34 class Plugin(QObject):
35  """
36  Interface for Python plugins.
37 
38  User-defined plugins may either subclass `qt_gui.plugin.Plugin` or according to duck typing
39  implement only the needed methods.
40  """
41 
42  def __init__(self, context):
43  """Instantiate the plugin and pass the `PluginContext`."""
44  super(Plugin, self).__init__(context)
45  self.setObjectName('Plugin')
46 
47  def shutdown_plugin(self):
48  """Shutdown and clean up the plugin before unloading."""
49  pass
50 
51  def save_settings(self, plugin_settings, instance_settings):
52  """
53  Save the intrinsic state of the plugin to the plugin or instance specific `Settings`.
54 
55  @param plugin_settings: The plugin-specific settings
56  @type plugin_settings: qt_gui.settings.Settings
57  @param instance_settings: The instance-specific settings
58  @type instance_settings: qt_gui.settings.Settings
59  """
60  pass
61 
62  def restore_settings(self, plugin_settings, instance_settings):
63  """
64  Restore the intrinsic state of the plugin from the plugin or instance specific `Settings`.
65 
66  @param plugin_settings: The plugin-specific settings
67  @type plugin_settings: qt_gui.settings.Settings
68  @param instance_settings: The instance-specific settings
69  @type instance_settings: qt_gui.settings.Settings
70  """
71  pass
72 
73  # def trigger_configuration(self):
74  # """
75  # Trigger a configuration request from the title bar of one of the dock widgets.
76  # If this method is available the `DockWidgetTitleBar` will show the configuration action.
77  # """
78  # pass
def restore_settings(self, plugin_settings, instance_settings)
Definition: plugin.py:62
def shutdown_plugin(self)
Definition: plugin.py:47
def save_settings(self, plugin_settings, instance_settings)
Definition: plugin.py:51
def __init__(self, context)
Definition: plugin.py:42


qt_gui
Author(s): Dirk Thomas
autogenerated on Fri Jun 24 2022 02:42:37