plugin_descriptor.py
Go to the documentation of this file.
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 
00032 class PluginDescriptor(object):
00033 
00034     """Information about one Plugin."""
00035 
00036     def __init__(self, plugin_id, attributes=None):
00037         self._dict = {}
00038         self._dict['plugin_id'] = plugin_id
00039         self._dict['attributes'] = attributes or {}
00040 
00041     def plugin_id(self):
00042         return self._dict['plugin_id']
00043 
00044     def attributes(self):
00045         return self._dict['attributes']
00046 
00047     def action_attributes(self):
00048         return self._dict.get('action', {})
00049 
00050     def set_action_attributes(self, label, statustip=None, icon=None, icontype=None):
00051         self._dict['action'] = {
00052             'label': label,
00053             'statustip': statustip,
00054             'icon': icon,
00055             'icontype': icontype,
00056         }
00057 
00058     def groups(self):
00059         return self._dict.get('groups', [])
00060 
00061     def add_group_attributes(self, label, statustip=None, icon=None, icontype=None):
00062         if 'groups' not in self._dict:
00063             self._dict['groups'] = []
00064         self._dict['groups'].append({
00065             'label': label,
00066             'statustip': statustip,
00067             'icon': icon,
00068             'icontype': icontype,
00069         })


qt_gui
Author(s): Dirk Thomas
autogenerated on Fri Feb 3 2017 03:42:12