mirror of
https://github.com/wassname/scikit-image.git
synced 2026-06-30 04:03:27 +08:00
Add smart window-layout for multi-viewer display
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user