Qt-Advanced-Docking-System/examples/dockindock/perspectiveactions.py
Nicolas Elie b5b251dffb
Update Python Bindings (#348)
* Update Python bindings

* Add X11Extras to setup.py for Linux builds

* Update Python Bindings

* Update Python bindings

* Update Python Bindings
2021-08-26 13:51:09 +02:00

25 lines
859 B
Python

from PyQt5.QtWidgets import QAction, QMenu
class LoadPerspectiveAction(QAction):
def __init__(self, parent: QMenu, name: str, dock_manager: 'DockInDockWidget'):
super().__init__(name, parent)
self.name = name
self.dock_manager = dock_manager
self.triggered.connect(self.load)
def load(self):
self.dock_manager.getPerspectivesManager().openPerspective(self.name, self.dock_manager)
class RemovePerspectiveAction(QAction):
def __init__(self, parent: QMenu, name: str, dock_manager: 'DockInDockWidget'):
super().__init__(name, parent)
self.name = name
self.dock_manager = dock_manager
self.triggered.connect(self.remove)
def remove(self):
self.dock_manager.getPerspectivesManager().removePerspective(self.name)