mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-26 08:01:32 +08:00
25 lines
859 B
Python
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)
|