def create(name, oname): oname += '-dock' d = QDockWidget(name, self) d.setObjectName(oname) # Needed for saveState ac = d.toggleViewAction() desc = _('Toggle %s') % name.replace('&', '') self.keyboard.register_shortcut( oname, desc, description=desc, action=ac, group=_('Windows')) actions[oname] = ac setattr(self, oname.replace('-', '_'), d) return d
def create_dock(title, name, area, areas=Qt.DockWidgetArea.LeftDockWidgetArea | Qt.DockWidgetArea.RightDockWidgetArea): ans = QDockWidget(title, self) ans.setObjectName(name) self.addDockWidget(area, ans) ans.setVisible(False) ans.visibilityChanged.connect(self.dock_visibility_changed) return ans