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()
def _restore_settings(self, plugin_settings, instance_settings)
def _on_dock_widget_show(self, dock_widget)
def _on_dock_widget_hide(self, dock_widget)
def _update_dock_widget_features(self, dock_widget)
def _emit_load_completed(self, exception=None)
def _add_dock_widget_to_main_window(self, dock_widget)
def _update_title_bar(self, dock_widget, hide_help=False, hide_reload=False)
def _on_dock_widget_title_changed(self, dock_widget)
def __init__(self, parent, main_window, instance_id, application_context, container_manager)
def _save_settings(self, plugin_settings, instance_settings)


qt_gui
Author(s): Dirk Thomas
autogenerated on Tue Apr 13 2021 03:03:12