diff options
| author | KyleMiles <krm504@nyu.edu> | 2022-01-27 22:43:28 -0500 |
|---|---|---|
| committer | KyleMiles <krm504@nyu.edu> | 2022-01-28 00:24:06 -0500 |
| commit | 6812c973c9fa9b4ad642ab81856c05f87bd6fcc4 (patch) | |
| tree | dace4156d03148bcaf02df138ab4e0d93e61bc6f /python/examples/hellopane.py | |
| parent | 519c9db22367f2659d1a54599fab47e6313be06e (diff) | |
Format All Files
Diffstat (limited to 'python/examples/hellopane.py')
| -rw-r--r-- | python/examples/hellopane.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/python/examples/hellopane.py b/python/examples/hellopane.py index 2b9fbe29..06651a6f 100644 --- a/python/examples/hellopane.py +++ b/python/examples/hellopane.py @@ -29,6 +29,7 @@ from PySide6.QtGui import QImage, QPixmap, QPainter, QFont, QColor instance_id = 0 + # Class to handle UI context notifications. This will be used to listen for view and address # changes and update the pane accordingly. class HelloNotifications(UIContextNotification): @@ -51,6 +52,7 @@ class HelloNotifications(UIContextNotification): def OnAddressChange(self, context, frame, view, location): self.widget.updateState() + # Pane widget itself. This can be any QWidget. class HelloPaneWidget(QWidget, UIContextNotification): def __init__(self, data): @@ -120,6 +122,9 @@ class HelloPaneWidget(QWidget, UIContextNotification): def canCreatePane(context): return context.context and context.binaryView + UIAction.registerAction("Hello Pane") -UIActionHandler.globalActions().bindAction("Hello Pane", UIAction(HelloPaneWidget.createPane, HelloPaneWidget.canCreatePane)) +UIActionHandler.globalActions().bindAction( + "Hello Pane", UIAction(HelloPaneWidget.createPane, HelloPaneWidget.canCreatePane) +) Menu.mainMenu("Tools").addAction("Hello Pane", "Hello") |
