Add smart window-layout for multi-viewer display

This commit is contained in:
Tony S Yu
2013-05-30 22:37:36 -05:00
parent 16b6411059
commit 55386ec785
2 changed files with 6 additions and 17 deletions
+4 -2
View File
@@ -76,7 +76,7 @@ class Plugin(QtGui.QDialog):
# Signals used when viewers are linked to the Plugin output.
image_updated = pyqtSignal(np.ndarray)
_started = pyqtSignal()
_started = pyqtSignal(int)
def __init__(self, image_filter=None, height=0, width=400, useblit=True,
dock='bottom'):
@@ -201,7 +201,9 @@ class Plugin(QtGui.QDialog):
def show(self, main_window=True):
"""Show plugin."""
super(Plugin, self).show()
self._started.emit()
size = self.frameGeometry()
x_hint = size.x() + size.width()
self._started.emit(x_hint)
def closeEvent(self, event):
"""On close disconnect all artists and events from ImageViewer.
+2 -15
View File
@@ -190,21 +190,8 @@ class ImageViewer(QtGui.QMainWindow):
def closeEvent(self, event):
self.close()
def auto_layout(self):
"""Move viewer to top-left and align plugin on right edge of viewer."""
size = self.frameGeometry()
self.move(0, 0)
# w = size.width()
# h = size.height()
# x = 0
# y = h
# #TODO: Layout isn't quite correct for multiple plugins (overlaps).
# for p in self.plugins:
# p.move(x, y)
# y += p.frameGeometry().height()
def _show(self):
self.auto_layout()
def _show(self, x=0):
self.move(x, 0)
for p in self.plugins:
p.show()
super(ImageViewer, self).show()