mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-13 17:45:20 +08:00
Change image_viewer to Plugin property.
Raise an error when using Plugin.image_viewer before it is set. This error prevents other, more obscure, errors from getting raised.
This commit is contained in:
@@ -48,6 +48,16 @@ class Plugin(QtGui.QDialog):
|
||||
self.cids = []
|
||||
self.artists = []
|
||||
|
||||
@property
|
||||
def image_viewer(self):
|
||||
if self._image_viewer is None:
|
||||
raise RuntimeError("Plugin is not attached to ImageViewer")
|
||||
return self._image_viewer
|
||||
|
||||
@image_viewer.setter
|
||||
def image_viewer(self, image_viewer):
|
||||
self._image_viewer = image_viewer
|
||||
|
||||
def attach(self, image_viewer):
|
||||
self.setParent(image_viewer)
|
||||
self.setWindowFlags(Qt.Dialog)
|
||||
|
||||
Reference in New Issue
Block a user