plugin_handler_container.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 from .dock_widget_container import DockWidgetContainer
00032 from .plugin_handler import PluginHandler
00033 from .window_changed_signaler import WindowChangedSignaler
00034 
00035 
00036 class PluginHandlerContainer(PluginHandler):
00037 
00038     """Handler for creating a container."""
00039 
00040     def __init__(self, parent, main_window, instance_id, application_context, container_manager):
00041         super(PluginHandlerContainer, self).__init__(parent, main_window, instance_id, application_context, container_manager)
00042         self.setObjectName('PluginHandlerContainer')
00043         self._container = None
00044 
00045     def _load(self):
00046         self._container = DockWidgetContainer(self._container_manager, self._instance_id.serial_number)
00047         self._container.setObjectName(self._instance_id.tidy_str())
00048         title = self.tr('Container')
00049         if self._instance_id.serial_number > 1:
00050             title += ' (%d)' % self._instance_id.serial_number
00051         self._container.setWindowTitle(title)
00052         self._update_dock_widget_features(self._container)
00053         self._add_dock_widget_to_main_window(self._container)
00054         self._update_title_bar(self._container, True, True)
00055         signaler2 = WindowChangedSignaler(self._container, self._container)
00056         signaler2.hide_signal.connect(self._on_dock_widget_hide)
00057         signaler2.show_signal.connect(self._on_dock_widget_show)
00058         signaler2.window_title_changed_signal.connect(self._on_dock_widget_title_changed)
00059         # trigger to update initial window state
00060         signaler2.emit_all()
00061         self._widgets[self._container.main_window] = [self._container, None, signaler2]
00062         self._container_manager.add_container(self._container)
00063         self._emit_load_completed()
00064 
00065     def remove_widget(self, widget):
00066         self._container_manager.move_container_children_to_parent(self._container)
00067         self._container_manager.remove_container(self._container)
00068         super(PluginHandlerContainer, self).remove_widget(widget)
00069         self._container = None
00070 
00071     def _shutdown_plugin(self):
00072         self.emit_shutdown_plugin_completed()
00073 
00074     def _unload(self):
00075         self._emit_unload_completed()
00076 
00077     def _save_settings(self, plugin_settings, instance_settings):
00078         self.emit_save_settings_completed()
00079 
00080     def _restore_settings(self, plugin_settings, instance_settings):
00081         self.emit_restore_settings_completed()
00082 
00083     def _close_dock_widget(self, dock_widget):
00084         self._emit_close_plugin()


qt_gui
Author(s): Dirk Thomas
autogenerated on Thu Jun 6 2019 18:07:34