| 33 | # Class to handle UI context notifications. This will be used to listen for view and address |
| 34 | # changes and update the pane accordingly. |
| 35 | class HelloNotifications(UIContextNotification): |
| 36 | def __init__(self, widget): |
| 37 | UIContextNotification.__init__(self) |
| 38 | self.widget = widget |
| 39 | |
| 40 | # __del__ will not be called because the widget owns a reference to this object. Use |
| 41 | # QWidget.destroyed event to know when to stop listening for notifications. |
| 42 | self.widget.destroyed.connect(self.destroyed) |
| 43 | |
| 44 | UIContext.registerNotification(self) |
| 45 | |
| 46 | def destroyed(self): |
| 47 | UIContext.unregisterNotification(self) |
| 48 | |
| 49 | def OnViewChange(self, context, frame, type): |
| 50 | self.widget.updateState() |
| 51 | |
| 52 | def OnAddressChange(self, context, frame, view, location): |
| 53 | self.widget.updateState() |
| 54 | |
| 55 | |
| 56 | # Pane widget itself. This can be any QWidget. |