From 92ca8374711b775364bd5b544b4c7c7a0d0e67a1 Mon Sep 17 00:00:00 2001 From: Tony S Yu Date: Mon, 23 Jul 2012 01:13:03 -0400 Subject: [PATCH] ENH: Let Qt handle most of the window sizing. --- skimage/viewer/plugins/base.py | 9 +++++---- skimage/viewer/plugins/canny.py | 2 -- skimage/viewer/plugins/lineprofile.py | 3 +-- skimage/viewer/plugins/plotplugin.py | 1 + 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/skimage/viewer/plugins/base.py b/skimage/viewer/plugins/base.py index 560eec8c..5a626480 100644 --- a/skimage/viewer/plugins/base.py +++ b/skimage/viewer/plugins/base.py @@ -28,16 +28,17 @@ class Plugin(QtGui.QDialog): name = 'Plugin' draws_on_image = False - def __init__(self, image_filter=None, height=100, width=400, useblit=None): - QtGui.QDialog.__init__(self) + def __init__(self, image_filter=None, height=0, width=400, useblit=None): + super(Plugin, self).__init__() + self.image_viewer = None + if image_filter is not None: + self.image_filter = image_filter self.setWindowTitle(self.name) self.layout = QtGui.QGridLayout(self) self.resize(width, height) self.row = 0 - if image_filter is not None: - self.image_filter = image_filter self.arguments = [] self.keyword_arguments= {} diff --git a/skimage/viewer/plugins/canny.py b/skimage/viewer/plugins/canny.py index 5ec6e415..b161fd87 100644 --- a/skimage/viewer/plugins/canny.py +++ b/skimage/viewer/plugins/canny.py @@ -9,8 +9,6 @@ class CannyPlugin(OverlayPlugin): name = 'Canny Filter' def __init__(self, *args, **kwargs): - kwargs.setdefault('height', 100) - kwargs.setdefault('width', 400) super(CannyPlugin, self).__init__(**kwargs) self.add_widget(Slider('sigma', 0, 5, update_on='release')) diff --git a/skimage/viewer/plugins/lineprofile.py b/skimage/viewer/plugins/lineprofile.py index f41407b3..7b2e1c10 100644 --- a/skimage/viewer/plugins/lineprofile.py +++ b/skimage/viewer/plugins/lineprofile.py @@ -34,8 +34,7 @@ class LineProfile(PlotPlugin): draws_on_image = True def __init__(self, useblit=None, linewidth=1, epsilon=5, limits='image'): - super(LineProfile, self).__init__(height=200, width=600, - useblit=useblit) + super(LineProfile, self).__init__(useblit=useblit) self.linewidth = linewidth self.epsilon = epsilon self._active_pt = None diff --git a/skimage/viewer/plugins/plotplugin.py b/skimage/viewer/plugins/plotplugin.py index 66afa676..5c1ce7bb 100644 --- a/skimage/viewer/plugins/plotplugin.py +++ b/skimage/viewer/plugins/plotplugin.py @@ -23,6 +23,7 @@ class PlotCanvas(FigureCanvasQTAgg): FigureCanvasQTAgg.updateGeometry(self) # Note: `setParent` must be called after `FigureCanvasQTAgg.__init__`. self.setParent(parent) + self.setMinimumHeight(150) class PlotPlugin(Plugin):