35 from __future__
import division
39 from python_qt_binding
import loadUi
40 from python_qt_binding.QtWidgets
import QWidget
48 This widget accommodates a plugin widget that needs an area to show system
49 message. A plugin widget is the pane that provides plugin's main
50 functionalities. PluginContainerWidget visually encapsulates a plugin
53 In order to print msg in the msg pane provided by this class, plugin widget
54 MUST define and emit following signals:
59 Having said that this architecture is based on signals, it is recommended
60 that exceptions raised in classes that are used in a plugin widget be
61 aggregated in it, so that only plugin widget is responsible for emitting
66 on_sys_msg=True, on_sysprogress_bar=True):
68 @param plugin_widget: The main widget of an rqt plugin.
69 @type plugin_widget: QWidget
70 @type on_sys_msg: bool
71 @param on_sys_msg: If True, a pane that accommodates str messages will
72 appear in the plugin's region.
73 @param on_sysprogress_bar: If True, a progress bar will appear in the
76 super(PluginContainerWidget, self).
__init__()
78 ui_file = os.path.join(rospkg.RosPack().get_path(
'rqt_py_common'),
79 'resource',
'plugin_container.ui')
91 self._sysmsg_widget.hide()
93 if on_sysprogress_bar:
96 self._sysprogress_bar.hide()
104 Set system msg that's supposed to be shown in sys msg pane.
107 rospy.loginfo(
'PluginContainerWidget; {}'.format(sysmsg))
109 self._sysmsg_widget.append(sysmsg)
120 instance_settings.set_value(
'_splitter', self._splitter.saveState())
129 if instance_settings.contains(
'_splitter'):
130 self._splitter.restoreState(instance_settings.value(
'_splitter'))
132 self._splitter.setSizes([100, 100, 200])