00001 # Copyright (c) 2011, Dirk Thomas, Dorian Scholz, TU Darmstadt 00002 # All rights reserved. 00003 # 00004 # Redistribution and use in source and binary forms, with or without 00005 # modification, are permitted provided that the following conditions 00006 # are met: 00007 # 00008 # * Redistributions of source code must retain the above copyright 00009 # notice, this list of conditions and the following disclaimer. 00010 # * Redistributions in binary form must reproduce the above 00011 # copyright notice, this list of conditions and the following 00012 # disclaimer in the documentation and/or other materials provided 00013 # with the distribution. 00014 # * Neither the name of the TU Darmstadt nor the names of its 00015 # contributors may be used to endorse or promote products derived 00016 # from this software without specific prior written permission. 00017 # 00018 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00019 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00020 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00021 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00022 # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00023 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00024 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00025 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00026 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00027 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00028 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00029 # POSSIBILITY OF SUCH DAMAGE. 00030 00031 from python_qt_binding.QtCore import QObject 00032 00033 00034 class Plugin(QObject): 00035 00036 """ 00037 Interface for Python plugins. 00038 User-defined plugins may either subclass `qt_gui.plugin.Plugin` or according to duck typing implement only the needed methods. 00039 """ 00040 00041 def __init__(self, context): 00042 """Instantiate the plugin and pass the `PluginContext`.""" 00043 super(Plugin, self).__init__(context) 00044 self.setObjectName('Plugin') 00045 00046 def shutdown_plugin(self): 00047 """Shutdown and clean up the plugin before unloading.""" 00048 pass 00049 00050 def save_settings(self, plugin_settings, instance_settings): 00051 """ 00052 Save the intrinsic state of the plugin to the plugin-specific or instance-specific `Settings`. 00053 @param plugin_settings: The plugin-specific settings 00054 @type plugin_settings: qt_gui.settings.Settings 00055 @param instance_settings: The instance-specific settings 00056 @type instance_settings: qt_gui.settings.Settings 00057 """ 00058 pass 00059 00060 def restore_settings(self, plugin_settings, instance_settings): 00061 """ 00062 Restore the intrinsic state of the plugin from the plugin-specific or instance-specific `Settings`. 00063 @param plugin_settings: The plugin-specific settings 00064 @type plugin_settings: qt_gui.settings.Settings 00065 @param instance_settings: The instance-specific settings 00066 @type instance_settings: qt_gui.settings.Settings 00067 """ 00068 pass 00069 00070 #def trigger_configuration(self): 00071 #""" 00072 #Trigger a configuration request from the title bar of one of the dock widgets. 00073 #If this method is available the `DockWidgetTitleBar` will show the configuration action. 00074 #""" 00075 #pass