31 from python_qt_binding.QtCore
import qDebug, Qt, Signal
32 from python_qt_binding.QtWidgets
import QToolBar
39 """Main window of the application managing the geometry and state of all top-level widgets.""" 41 save_settings_before_close_signal = Signal(Settings, Settings)
45 self.setObjectName(
'MainWindow')
53 qDebug(
'MainWindow.closeEvent()')
58 self.save_settings_before_close_signal.emit(
65 qDebug(
'MainWindow.save_settings()')
68 self.
_settings = self._perspective_settings.get_settings(
'mainwindow')
74 qDebug(
'MainWindow.restore_settings()')
78 self.
_settings = self._perspective_settings.get_settings(
'mainwindow')
83 qDebug(
'MainWindow.save_setup()')
89 qDebug(
'MainWindow.restore_state()')
94 self.setWindowTitle(
'%s - rqt' % str(name))
100 maximized = self.isMaximized()
103 self._settings.set_value(
'geometry', self.saveGeometry())
108 if self._settings.contains(
'geometry'):
109 self.restoreGeometry(self._settings.value(
'geometry'))
113 self._settings.set_value(
'state', self.saveState())
115 toolbar_settings = self._settings.get_settings(
'toolbar_areas')
116 for toolbar
in self.findChildren(QToolBar):
117 area = self.toolBarArea(toolbar)
118 if area
in [Qt.LeftToolBarArea,
121 Qt.BottomToolBarArea]:
122 toolbar_settings.set_value(toolbar.objectName(), area)
125 if self._settings.contains(
'state'):
126 self.restoreState(self._settings.value(
'state'))
128 toolbar_settings = self._settings.get_settings(
'toolbar_areas')
129 for toolbar
in self.findChildren(QToolBar):
130 if not toolbar.objectName():
132 area = Qt.ToolBarArea(
133 int(toolbar_settings.value(toolbar.objectName(), Qt.NoToolBarArea)))
134 if area
in [Qt.LeftToolBarArea,
137 Qt.BottomToolBarArea]:
138 self.addToolBar(area, toolbar)
def perspective_changed(self, name)
def _restore_state_from_perspective(self)
def restore_settings(self, global_settings, perspective_settings)
def _restore_geometry_from_perspective(self)
def _save_state_to_perspective(self)
def _save_geometry_to_perspective(self)
def closeEvent(self, event)
def save_settings(self, global_settings, perspective_settings)