From 3f1b8a44685e118cadc5aa60ba01b137d81cb735 Mon Sep 17 00:00:00 2001 From: Gregory Lee Date: Fri, 12 Sep 2014 19:37:09 -0700 Subject: [PATCH] code formatting fixes --- skimage/viewer/widgets/core.py | 17 ++++++++--------- viewer_examples/plugins/tv_denoise.py | 7 ++++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/skimage/viewer/widgets/core.py b/skimage/viewer/widgets/core.py index 85302aaa..9a99d7e8 100644 --- a/skimage/viewer/widgets/core.py +++ b/skimage/viewer/widgets/core.py @@ -254,6 +254,7 @@ class ComboBox(BaseWidget): def index(self, i): self._combo_box.setCurrentIndex(i) + class CheckBox(BaseWidget): """CheckBox widget @@ -265,17 +266,18 @@ class CheckBox(BaseWidget): replaced with underscores). In addition, this name is displayed as the name of the CheckBox. value: {False, True} - Initial state of the CheckBox. + Initial state of the CheckBox. alignment: {'center','left','right'} - Checkbox alignment + Checkbox alignment ptype : {'arg' | 'kwarg' | 'plugin'} - Parameter type. + Parameter type callback : function Callback function called in response to CheckBox changes. This function is typically set when the widget is added to a plugin. """ - def __init__(self, name, value=False, alignment='center', ptype='kwarg', callback=None): + def __init__(self, name, value=False, alignment='center', ptype='kwarg', + callback=None): super(CheckBox, self).__init__(name, ptype, callback) self._check_box = QtGui.QCheckBox() @@ -298,13 +300,10 @@ class CheckBox(BaseWidget): @property def val(self): - #return self._check_box.checkState() return self._check_box.isChecked() - @val.setter def val(self, i): - #self._check_box.setCheckState(i) # setCheckState has 3 states: - # 0=unchecked, 1=partial, 2=checked self._check_box.setChecked(i) # setChecked has only two states: - # 0 = unchecked, 2 = checked \ No newline at end of file + # 0 = unchecked, 2 = checked + \ No newline at end of file diff --git a/viewer_examples/plugins/tv_denoise.py b/viewer_examples/plugins/tv_denoise.py index 370efea3..e4d06fb2 100644 --- a/viewer_examples/plugins/tv_denoise.py +++ b/viewer_examples/plugins/tv_denoise.py @@ -4,7 +4,8 @@ from skimage.util import img_as_float from numpy import random, clip from skimage.viewer import ImageViewer -from skimage.viewer.widgets import Slider, CheckBox, OKCancelButtons, SaveButtons +from skimage.viewer.widgets import (Slider, CheckBox, OKCancelButtons, + SaveButtons) from skimage.viewer.plugins.base import Plugin @@ -12,13 +13,13 @@ image = img_as_float(data.chelsea()) sigma = 30/255. image = image + random.normal(loc=0, scale=sigma, size=image.shape) -image = clip(image,0,1) +image = clip(image, 0, 1) viewer = ImageViewer(image) plugin = Plugin(image_filter=denoise_tv_chambolle) plugin += Slider('weight', 0.01, 5, value=0.3, value_type='float') plugin += Slider('n_iter_max', 1, 100, value=20, value_type='int') -plugin += CheckBox('multichannel',value=True) +plugin += CheckBox('multichannel', value=True) plugin += SaveButtons() plugin += OKCancelButtons()