From 31c2810dee399c1f9c4dcbb1dd5ac75129e59e6a Mon Sep 17 00:00:00 2001 From: Tony S Yu Date: Sat, 21 Jul 2012 23:27:05 -0400 Subject: [PATCH] ENH: Align image and plugin windows --- skimage/viewer/viewers/core.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/skimage/viewer/viewers/core.py b/skimage/viewer/viewers/core.py index 6ef83d27..f4d3b587 100644 --- a/skimage/viewer/viewers/core.py +++ b/skimage/viewer/viewers/core.py @@ -103,7 +103,19 @@ class ImageViewer(QtGui.QMainWindow): def closeEvent(self, ce): self.close() + def auto_layout(self): + """Move viewer to top-left and align plugin on right edge of viewer.""" + size = self.geometry() + self.move(0, 0) + w = size.width() + y = 0 + #TODO: Layout isn't correct for multiple plots (overlaps). + for p in self.plugins: + p.move(w, y) + y += p.geometry().height() + def show(self): + self.auto_layout() for p in self.plugins: p.show() super(ImageViewer, self).show()