plugin_handler_container.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 qt_gui.dock_widget_container import DockWidgetContainer
32 from qt_gui.plugin_handler import PluginHandler
33 from qt_gui.window_changed_signaler import WindowChangedSignaler
34 
35 
37  """Handler for creating a container."""
38 
39  def __init__(self, parent, main_window, instance_id, application_context, container_manager):
40  super(PluginHandlerContainer, self).__init__(
41  parent, main_window, instance_id, application_context, container_manager)
42  self.setObjectName('PluginHandlerContainer')
43  self._container = None
44 
45  def _load(self):
47  self._container_manager, self._instance_id.serial_number)
48  self._container.setObjectName(self._instance_id.tidy_str())
49  title = self.tr('Container')
50  if self._instance_id.serial_number > 1:
51  title += ' (%d)' % self._instance_id.serial_number
52  self._container.setWindowTitle(title)
55  self._update_title_bar(self._container, True, True)
56  signaler2 = WindowChangedSignaler(self._container, self._container)
57  signaler2.hide_signal.connect(self._on_dock_widget_hide)
58  signaler2.show_signal.connect(self._on_dock_widget_show)
59  signaler2.window_title_changed_signal.connect(self._on_dock_widget_title_changed)
60  # trigger to update initial window state
61  signaler2.emit_all()
62  self._widgets[self._container.main_window] = [self._container, None, signaler2]
63  self._container_manager.add_container(self._container)
65 
66  def remove_widget(self, widget):
67  self._container_manager.move_container_children_to_parent(self._container)
68  self._container_manager.remove_container(self._container)
69  super(PluginHandlerContainer, self).remove_widget(widget)
70  self._container = None
71 
72  def _shutdown_plugin(self):
74 
75  def _unload(self):
77 
78  def _save_settings(self, plugin_settings, instance_settings):
80 
81  def _restore_settings(self, plugin_settings, instance_settings):
83 
84  def _close_dock_widget(self, dock_widget):
85  self._emit_close_plugin()
qt_gui.plugin_handler_container.PluginHandlerContainer._container
_container
Definition: plugin_handler_container.py:43
qt_gui.plugin_handler_container.PluginHandlerContainer._save_settings
def _save_settings(self, plugin_settings, instance_settings)
Definition: plugin_handler_container.py:78
qt_gui.plugin_handler.PluginHandler._instance_id
_instance_id
Definition: plugin_handler.py:61
qt_gui.plugin_handler.PluginHandler._on_dock_widget_title_changed
def _on_dock_widget_title_changed(self, dock_widget)
Definition: plugin_handler.py:363
qt_gui.plugin_handler_container.PluginHandlerContainer._shutdown_plugin
def _shutdown_plugin(self)
Definition: plugin_handler_container.py:72
qt_gui.plugin_handler_container.PluginHandlerContainer
Definition: plugin_handler_container.py:36
qt_gui.plugin_handler_container.PluginHandlerContainer.remove_widget
def remove_widget(self, widget)
Definition: plugin_handler_container.py:66
qt_gui.plugin_handler.PluginHandler._on_dock_widget_hide
def _on_dock_widget_hide(self, dock_widget)
Definition: plugin_handler.py:355
qt_gui.plugin_handler.PluginHandler._widgets
_widgets
Definition: plugin_handler.py:76
qt_gui.plugin_handler_container.PluginHandlerContainer._unload
def _unload(self)
Definition: plugin_handler_container.py:75
qt_gui.plugin_handler_container.PluginHandlerContainer._restore_settings
def _restore_settings(self, plugin_settings, instance_settings)
Definition: plugin_handler_container.py:81
qt_gui.plugin_handler.PluginHandler._emit_close_plugin
def _emit_close_plugin(self)
Definition: plugin_handler.py:428
qt_gui.plugin_handler.PluginHandler
Definition: plugin_handler.py:42
qt_gui.plugin_handler.PluginHandler.emit_restore_settings_completed
def emit_restore_settings_completed(self)
Definition: plugin_handler.py:240
qt_gui.window_changed_signaler
Definition: window_changed_signaler.py:1
qt_gui.plugin_handler.PluginHandler._container_manager
_container_manager
Definition: plugin_handler.py:63
qt_gui.plugin_handler.PluginHandler._emit_load_completed
def _emit_load_completed(self, exception=None)
Definition: plugin_handler.py:109
qt_gui.plugin_handler.PluginHandler._update_title_bar
def _update_title_bar(self, dock_widget, hide_help=False, hide_reload=False)
Definition: plugin_handler.py:271
qt_gui.plugin_handler_container.PluginHandlerContainer.__init__
def __init__(self, parent, main_window, instance_id, application_context, container_manager)
Definition: plugin_handler_container.py:39
qt_gui.plugin_handler.PluginHandler._add_dock_widget_to_main_window
def _add_dock_widget_to_main_window(self, dock_widget)
Definition: plugin_handler.py:336
qt_gui.window_changed_signaler.WindowChangedSignaler
Definition: window_changed_signaler.py:36
qt_gui.dock_widget_container.DockWidgetContainer
Definition: dock_widget_container.py:37
qt_gui.plugin_handler.PluginHandler._update_dock_widget_features
def _update_dock_widget_features(self, dock_widget)
Definition: plugin_handler.py:257
qt_gui.plugin_handler
Definition: plugin_handler.py:1
qt_gui.plugin_handler.PluginHandler.emit_save_settings_completed
def emit_save_settings_completed(self)
Definition: plugin_handler.py:200
qt_gui.plugin_handler_container.PluginHandlerContainer._load
def _load(self)
Definition: plugin_handler_container.py:45
qt_gui.plugin_handler.PluginHandler._on_dock_widget_show
def _on_dock_widget_show(self, dock_widget)
Definition: plugin_handler.py:359
qt_gui.plugin_handler_container.PluginHandlerContainer._close_dock_widget
def _close_dock_widget(self, dock_widget)
Definition: plugin_handler_container.py:84
qt_gui.plugin_handler.PluginHandler.emit_shutdown_plugin_completed
def emit_shutdown_plugin_completed(self)
Definition: plugin_handler.py:145
qt_gui.dock_widget_container
Definition: dock_widget_container.py:1
qt_gui.plugin_handler.PluginHandler._emit_unload_completed
def _emit_unload_completed(self)
Definition: plugin_handler.py:175


qt_gui
Author(s): Dirk Thomas
autogenerated on Sat Jun 25 2022 02:15:05