code formatting fixes

This commit is contained in:
Gregory Lee
2014-09-12 19:37:09 -07:00
parent 026fc8eef1
commit 3f1b8a4468
2 changed files with 12 additions and 12 deletions
+8 -9
View File
@@ -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
# 0 = unchecked, 2 = checked
+4 -3
View File
@@ -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()