当前位置: 首页>>代码示例>>Python>>正文


Python QSlider.value方法代码示例

本文整理汇总了Python中PySide.QtGui.QSlider.value方法的典型用法代码示例。如果您正苦于以下问题:Python QSlider.value方法的具体用法?Python QSlider.value怎么用?Python QSlider.value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PySide.QtGui.QSlider的用法示例。


在下文中一共展示了QSlider.value方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: MultiVolumeVisualizationMIP

# 需要导入模块: from PySide.QtGui import QSlider [as 别名]
# 或者: from PySide.QtGui.QSlider import value [as 别名]
class MultiVolumeVisualizationMIP(MultiVolumeVisualization):
	"""
	MultiVolumeVisualizationMIP is a visualization that shows
	MIP visualizations of both datasets and adds them
	together. It uses complementary colors for the datasets
	so that the visualization is white in the spots where
	they are the same.
	"""
	def __init__(self):
		super(MultiVolumeVisualizationMIP, self).__init__()

		self.fixedHue = 0

	@overrides(MultiVolumeVisualization)
	def getParameterWidget(self):
		self.hueSlider = QSlider(Qt.Horizontal)
		self.hueSlider.setMaximum(360)
		self.hueSlider.setValue(self.fixedHue)
		self.hueSlider.valueChanged.connect(self.valueChanged)

		layout = QGridLayout()
		layout.setAlignment(Qt.AlignTop)
		layout.addWidget(QLabel("Base hue"), 0, 0)
		layout.addWidget(self.hueSlider, 0, 1)

		widget = QWidget()
		widget.setLayout(layout)
		return widget

	@overrides(MultiVolumeVisualization)
	def setImageData(self, fixedImageData, movingImageData):
		self.fixedImageData = fixedImageData
		self.movingImageData = movingImageData

	@overrides(MultiVolumeVisualization)
	def updateTransferFunctions(self):
		self.fixedVolProp = self._createVolPropFromImageData(self.fixedImageData)
		self.movingVolProp = self._createVolPropFromImageData(self.movingImageData)

		self.updatedTransferFunction.emit()

	@overrides(MultiVolumeVisualization)
	def valueChanged(self, value):
		self.fixedHue = self.hueSlider.value()
		self.updateTransferFunctions()

	@overrides(MultiVolumeVisualization)
	def setMapper(self, mapper):
		self.mapper = mapper

	def _createVolPropFromImageData(self, imageData):
		volProp = vtkVolumeProperty()
		if imageData is not None:
			color, opacityFunction = CreateRangeFunctions(imageData)
		else:
			color, opacityFunction = CreateEmptyFunctions()
		volProp.SetColor(color)
		volProp.SetScalarOpacity(opacityFunction)

		return volProp
开发者ID:berendkleinhaneveld,项目名称:Registrationshop,代码行数:62,代码来源:MultiVolumeVisualizationMIP.py

示例2: initUi

# 需要导入模块: from PySide.QtGui import QSlider [as 别名]
# 或者: from PySide.QtGui.QSlider import value [as 别名]
    def initUi(self):

        #slider
        slider = QSlider(PySide.QtCore.Qt.Orientation.Horizontal, self)
        slider.setRange(0,2)
        slider.setTickInterval(1)
        slider.setValue(2)
        self.slider = slider

        #.. and corresponding label element
        label = QLabel(self)
        label.setText(self.activation_states[slider.value()])
        self.label = label
        
        #connections
        #PySide.QtCore.QObject.connect(slider, slider.valueChanged, self, self.update_label)
        #self.connect(slider.valueChanged, self.update_label())
        slider.valueChanged[int].connect(self.update_label)
        
        # layout
        lo = QVBoxLayout() 
        lo.addWidget( slider )
        lo.addWidget( label )


        self.setLayout(lo)
开发者ID:socialdevices,项目名称:manager,代码行数:28,代码来源:base.py

示例3: SliderWidget

# 需要导入模块: from PySide.QtGui import QSlider [as 别名]
# 或者: from PySide.QtGui.QSlider import value [as 别名]
class SliderWidget(QWidget):
	"""
	SliderWidget
	"""
	valueChanged = Signal(int)

	def __init__(self):
		super(SliderWidget, self).__init__()

		self.label = QLabel()
		self.slider = QSlider(Qt.Horizontal)
		self.spinbox = QSpinBox()

		self.slider.valueChanged.connect(self.changedValue)
		self.spinbox.valueChanged.connect(self.changedValue)

		layout = QGridLayout()
		layout.setContentsMargins(0, 0, 0, 0)
		layout.setVerticalSpacing(0)
		layout.addWidget(self.label, 0, 0)
		layout.addWidget(self.slider, 0, 1)
		layout.addWidget(self.spinbox, 0, 2)
		self.setLayout(layout)

	def setName(self, name):
		"""
		Set the name for the slider
		"""
		self.label.setText(name)

	def setRange(self, range):
		"""
		Set the range for the value
		"""
		self.slider.setMinimum(range[0])
		self.spinbox.setMinimum(range[0])
		self.slider.setMaximum(range[1])
		self.spinbox.setMaximum(range[1])

	def setValue(self, value):
		"""
		Set the value for the slider and the spinbox
		"""
		self.slider.setValue(value)
		self.spinbox.setValue(value)

	def value(self):
		return self.slider.value()

	@Slot(int)
	def changedValue(self, value):
		self.setValue(value)
		self.valueChanged.emit(value)
开发者ID:berendkleinhaneveld,项目名称:Registrationshop,代码行数:55,代码来源:SliderWidget.py

示例4: __init__

# 需要导入模块: from PySide.QtGui import QSlider [as 别名]
# 或者: from PySide.QtGui.QSlider import value [as 别名]
    def __init__(self, parent, North="Up", East="Right", South="Down", West="Left",BoxLabel='Power', valueName='Position'):
        QWidget.__init__(self)
        self.North = North
        self.East= East
        self.South = South
        self.West = West
        self.boxLabel = BoxLabel
        buttonLayout = QGridLayout(self)
        northButton = QPushButton(self.North, self)
#        northbutton.click(actionscript)
        
        eastButton = QPushButton(self.East, self)

        southButton = QPushButton(self.South, self)
        
        westButton = QPushButton(self.West, self)
        
        speedSlider = QSlider()
        speedSlider.setTickPosition(QSlider.TicksRight)
        speedSlider.setTickInterval(10)
        speedSlider.TicksRight
        sliderPosition = QSpinBox()
        sliderPosition.setRange(0,101)
        sliderLabel = QLabel(self.boxLabel)
        speedSlider.valueChanged.connect(sliderPosition.setValue)
        sliderPosition.valueChanged.connect(speedSlider.setValue)
        SliderValue = speedSlider.value()
        speedSlider.valueChanged.connect(self.printValue)
        
        #Needs work to fix the layout issues......
        buttonLayout.addWidget(northButton, 1, 1)
        buttonLayout.addWidget(eastButton, 2, 2)
        buttonLayout.addWidget(westButton, 2, 0)
        buttonLayout.addWidget(southButton, 3, 1)
        buttonLayout.addWidget(sliderPosition,1, 3)
        buttonLayout.addWidget(sliderLabel, 0, 3)
        buttonLayout.addWidget(speedSlider, 2, 3, 3,3)
        
        self.setLayout(buttonLayout)
开发者ID:CandidCypher,项目名称:SparkControl0.2.0,代码行数:41,代码来源:FourDirectionButtonWidget.py

示例5: PlotMainWindow

# 需要导入模块: from PySide.QtGui import QSlider [as 别名]
# 或者: from PySide.QtGui.QSlider import value [as 别名]
    class PlotMainWindow(QWidget):
        """Base class for plot main windows."""

        def __init__(self, U, plot, length=1, title=None):
            super(PlotMainWindow, self).__init__()

            layout = QVBoxLayout()

            if title:
                title = QLabel('<b>' + title + '</b>')
                title.setAlignment(Qt.AlignHCenter)
                layout.addWidget(title)
            layout.addWidget(plot)

            plot.set(U, 0)

            if length > 1:
                hlayout = QHBoxLayout()

                self.slider = QSlider(Qt.Horizontal)
                self.slider.setMinimum(0)
                self.slider.setMaximum(length - 1)
                self.slider.setTickPosition(QSlider.TicksBelow)
                hlayout.addWidget(self.slider)

                lcd = QLCDNumber(m.ceil(m.log10(length)))
                lcd.setDecMode()
                lcd.setSegmentStyle(QLCDNumber.Flat)
                hlayout.addWidget(lcd)

                layout.addLayout(hlayout)

                hlayout = QHBoxLayout()

                toolbar = QToolBar()
                self.a_play = QAction(self.style().standardIcon(QStyle.SP_MediaPlay), 'Play', self)
                self.a_play.setCheckable(True)
                self.a_rewind = QAction(self.style().standardIcon(QStyle.SP_MediaSeekBackward), 'Rewind', self)
                self.a_toend = QAction(self.style().standardIcon(QStyle.SP_MediaSeekForward), 'End', self)
                self.a_step_backward = QAction(self.style().standardIcon(QStyle.SP_MediaSkipBackward),
                                               'Step Back', self)
                self.a_step_forward = QAction(self.style().standardIcon(QStyle.SP_MediaSkipForward), 'Step', self)
                self.a_loop = QAction(self.style().standardIcon(QStyle.SP_BrowserReload), 'Loop', self)
                self.a_loop.setCheckable(True)
                toolbar.addAction(self.a_play)
                toolbar.addAction(self.a_rewind)
                toolbar.addAction(self.a_toend)
                toolbar.addAction(self.a_step_backward)
                toolbar.addAction(self.a_step_forward)
                toolbar.addAction(self.a_loop)
                if hasattr(self, 'save'):
                    self.a_save = QAction(self.style().standardIcon(QStyle.SP_DialogSaveButton), 'Save', self)
                    toolbar.addAction(self.a_save)
                    self.a_save.triggered.connect(self.save)
                hlayout.addWidget(toolbar)

                self.speed = QSlider(Qt.Horizontal)
                self.speed.setMinimum(0)
                self.speed.setMaximum(100)
                hlayout.addWidget(QLabel('Speed:'))
                hlayout.addWidget(self.speed)

                layout.addLayout(hlayout)

                self.timer = QTimer()
                self.timer.timeout.connect(self.update_solution)

                self.slider.valueChanged.connect(self.slider_changed)
                self.slider.valueChanged.connect(lcd.display)
                self.speed.valueChanged.connect(self.speed_changed)
                self.a_play.toggled.connect(self.toggle_play)
                self.a_rewind.triggered.connect(self.rewind)
                self.a_toend.triggered.connect(self.to_end)
                self.a_step_forward.triggered.connect(self.step_forward)
                self.a_step_backward.triggered.connect(self.step_backward)

                self.speed.setValue(50)

            elif hasattr(self, 'save'):
                hlayout = QHBoxLayout()
                toolbar = QToolBar()
                self.a_save = QAction(self.style().standardIcon(QStyle.SP_DialogSaveButton), 'Save', self)
                toolbar.addAction(self.a_save)
                hlayout.addWidget(toolbar)
                layout.addLayout(hlayout)
                self.a_save.triggered.connect(self.save)

            self.setLayout(layout)
            self.plot = plot
            self.U = U
            self.length = length

        def slider_changed(self, ind):
            self.plot.set(self.U, ind)

        def speed_changed(self, val):
            self.timer.setInterval(val * 20)

        def update_solution(self):
            ind = self.slider.value() + 1
#.........这里部分代码省略.........
开发者ID:andreasbuhr,项目名称:pymor,代码行数:103,代码来源:qt.py

示例6: MainWindow

# 需要导入模块: from PySide.QtGui import QSlider [as 别名]
# 或者: from PySide.QtGui.QSlider import value [as 别名]
    class MainWindow(QWidget):
        def __init__(self, grid, U):
            assert isinstance(U, Communicable)
            super(MainWindow, self).__init__()

            U = U.data

            layout = QVBoxLayout()

            plotBox = QHBoxLayout()
            plot = GlumpyPatchWidget(self, grid, vmin=np.min(U), vmax=np.max(U), bounding_box=bounding_box, codim=codim)
            bar = ColorBarWidget(self, vmin=np.min(U), vmax=np.max(U))
            plotBox.addWidget(plot)
            plotBox.addWidget(bar)
            layout.addLayout(plotBox)

            if len(U) == 1:
                plot.set(U.ravel())
            else:
                plot.set(U[0])

                hlayout = QHBoxLayout()

                self.slider = QSlider(Qt.Horizontal)
                self.slider.setMinimum(0)
                self.slider.setMaximum(len(U) - 1)
                self.slider.setTickPosition(QSlider.TicksBelow)
                hlayout.addWidget(self.slider)

                lcd = QLCDNumber(m.ceil(m.log10(len(U))))
                lcd.setDecMode()
                lcd.setSegmentStyle(QLCDNumber.Flat)
                hlayout.addWidget(lcd)

                layout.addLayout(hlayout)

                hlayout = QHBoxLayout()

                toolbar = QToolBar()
                self.a_play = QAction(self.style().standardIcon(QStyle.SP_MediaPlay), 'Play', self)
                self.a_play.setCheckable(True)
                self.a_rewind = QAction(self.style().standardIcon(QStyle.SP_MediaSeekBackward), 'Rewind', self)
                self.a_toend = QAction(self.style().standardIcon(QStyle.SP_MediaSeekForward), 'End', self)
                self.a_step_backward = QAction(self.style().standardIcon(QStyle.SP_MediaSkipBackward), 'Step Back', self)
                self.a_step_forward = QAction(self.style().standardIcon(QStyle.SP_MediaSkipForward), 'Step', self)
                self.a_loop = QAction(self.style().standardIcon(QStyle.SP_BrowserReload), 'Loop', self)
                self.a_loop.setCheckable(True)
                toolbar.addAction(self.a_play)
                toolbar.addAction(self.a_rewind)
                toolbar.addAction(self.a_toend)
                toolbar.addAction(self.a_step_backward)
                toolbar.addAction(self.a_step_forward)
                toolbar.addAction(self.a_loop)
                hlayout.addWidget(toolbar)

                self.speed = QSlider(Qt.Horizontal)
                self.speed.setMinimum(0)
                self.speed.setMaximum(100)
                hlayout.addWidget(QLabel('Speed:'))
                hlayout.addWidget(self.speed)

                layout.addLayout(hlayout)

                self.timer = QTimer()
                self.timer.timeout.connect(self.update_solution)

                self.slider.valueChanged.connect(self.slider_changed)
                self.slider.valueChanged.connect(lcd.display)
                self.speed.valueChanged.connect(self.speed_changed)
                self.a_play.toggled.connect(self.toggle_play)
                self.a_rewind.triggered.connect(self.rewind)
                self.a_toend.triggered.connect(self.to_end)
                self.a_step_forward.triggered.connect(self.step_forward)
                self.a_step_backward.triggered.connect(self.step_backward)

                self.speed.setValue(50)

            self.setLayout(layout)
            self.plot = plot
            self.U = U

        def slider_changed(self, ind):
            self.plot.set(self.U[ind])

        def speed_changed(self, val):
            self.timer.setInterval(val * 20)

        def update_solution(self):
            ind = self.slider.value() + 1
            if ind >= len(self.U):
                if self.a_loop.isChecked():
                    ind = 0
                else:
                    self.a_play.setChecked(False)
                    return
            self.slider.setValue(ind)

        def toggle_play(self, checked):
            if checked:
                if self.slider.value() + 1 == len(self.U):
#.........这里部分代码省略.........
开发者ID:NikolaiGraeber,项目名称:pyMor,代码行数:103,代码来源:qt.py

示例7: Layer

# 需要导入模块: from PySide.QtGui import QSlider [as 别名]
# 或者: from PySide.QtGui.QSlider import value [as 别名]
class Layer(object):

    def __init__(self):
        super(Layer, self).__init__()
        self.orientation = Quaternion()
        self.picked = None
        self.show = QCheckBox()
        self.show.setChecked(True)
        self.alpha_slider = QSlider(QtCore.Qt.Orientation.Horizontal)
        self.alpha_slider.setRange(0, 1024)
        self.alpha_slider.setValue(1024)
        self.alpha_number = QDoubleSpinBox()
        self.alpha_number.setDecimals(3)
        self.alpha_number.setSingleStep(0.01)
        self.alpha_number.setRange(0, 1)
        self.alpha_number.setValue(1)
        self.alpha_slider.valueChanged.connect(self._alphaSliderChanged)
        self.alpha_number.valueChanged.connect(self._alphaNumberChanged)
        self.move = QCheckBox()
        self.move.setChecked(True)
        self.quat = QLineEdit()
        font = QFont('monospace')
        font.setStyleHint(QFont.TypeWriter)
        self.quat.setFont(font)
        default_quat = '+0.000, +1.000, +0.000, +0.000'
        margins = self.quat.textMargins()
        self.quat.setFixedWidth(
            # HACK -------------------------------------------v
            QFontMetrics(self.quat.font()).width(default_quat + '  ') +
            margins.left() + margins.right()
        )
        self.quat.setInputMask('#0.000, #0.000, #0.000, #0.000')
        self.quat.setMaxLength(30)
        self.quat.setText(default_quat)
        self.quat.editingFinished.connect(self._orientationChanged)
        self.nbytes = QLabel()
        self.nbytes.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
        self.nbytes.setText('0')
        self.label = QLabel()
        self.label.setText('<empty>')

    def multiplyOrientation(self, quat):
        self.setOrientation(quat * self.orientation)

    def setOrientation(self, quat):
        self.orientation = quat
        self.quat.setText(
            '%+1.3f, %+1.3f, %+1.3f, %+1.3f' % (
                self.orientation.w,
                self.orientation.x,
                self.orientation.y,
                self.orientation.z,
            )
        )

    def _orientationChanged(self):
        text = self.quat.text()

    def alpha(self):
        return self.alpha_number.value() if self.show.isChecked() else 0.0

    def _alphaSliderChanged(self):
        self.alpha_number.setValue(self.alpha_slider.value() / 1024.0)

    def _alphaNumberChanged(self):
        self.alpha_slider.setValue(1024 * self.alpha_number.value())

    def setup_ui(self, table, row):
        widgets = [
            None,
            CenterH(self.show),
            self.alpha_slider,
            self.alpha_number,
            CenterH(self.move),
            self.quat,
            self.nbytes,
            self.label,
        ]
        for (column, widget) in enumerate(widgets):
            if widget is not None:
                table.setCellWidget(row, column, widget)

    def load_file(self, file_name, in_format):
        self.sphere = proj.load_sphere(file_name, projection=in_format)
        in_format = self.sphere.__class__
        print('Loaded input %s from %s.' % (in_format.__name__, file_name))
        self.texture_id = glGenTextures(1)
        self.sphere.to_gl(self.texture_id)
        self.shader = Shader(
            vert=VERTEX_SHADER,
            frag=FRAGMENT_SHADER + self.sphere.get_glsl_sampler(),
        )
        self.label.setText(file_name)
        self.nbytes.setText(read_bsize(self.sphere.array.nbytes))
开发者ID:mkovacs,项目名称:sphaira,代码行数:96,代码来源:layer.py

示例8: ParameterSlider

# 需要导入模块: from PySide.QtGui import QSlider [as 别名]
# 或者: from PySide.QtGui.QSlider import value [as 别名]
class ParameterSlider(QWidget):
    '''ParameterSlider is a QSlider combined with a QLabel to display the 
    current value of the slider
        
    Arguments
    ---------
    parent : QWidget
        parent widget
    name : str
        name of the parameter the slider represents. Will be used as 'name = ' 
        prefix for the label 
    '''
    
    valueChanged = Signal()
    
    def __init__(self, parent=None, name=None):
        QWidget.__init__(self, parent)
        self.name = name
        self.set_format('.3f')

        # create widgets
        self.label = QLabel()
        self.slider = QSlider(QtCore.Qt.Orientation.Horizontal)        
        self.slider.valueChanged.connect(self._update_label)
        
        # set default values
        self.set_range(0, 100)
        self.set_value(50)        

        # create layout for the entire widget
        box = QVBoxLayout()
        box.addWidget(self.label)
        box.addWidget(self.slider)        
        self.setLayout(box)

    def _convert(self, value, inverse=False):
        if inverse == True:
            # slider value -> true value                
            return self.offset + self.delta * float(value) / self.ticks
        else:
            # true value -> slider value
            return (value - self.offset) * self.ticks / self.delta

    @Slot()
    def _update_label(self, value):
        # convert value to external range
        value = self._convert(value, inverse=True)
        
        if self.name is None:
            # no name given -> show just 'value'
            text = self.format_str.format(value)
        else:
            # name given -> show 'name = value'
            text = self.format_str.format(self.name, value)
                        
        self.label.setText(text)
        self.valueChanged.emit()

    def set_format(self, format_str):
        if self.name is None:
            self.format_str = '{:' + format_str + '}'
        else:
            self.format_str = '{} = {:' + format_str + '}'

    def set_range(self, minimum, maximum, step=1):
        # calculate settings
        self.offset = float(minimum)
        self.delta = float(maximum - minimum)
        self.ticks = int(self.delta / step)

        # forward settings to widget
        self.slider.setMinimum(0.0)
        self.slider.setMaximum(self.ticks)
        self.slider.setSingleStep(1.0)

    def set_value(self, value):
        # convert value to internal range
        value = self._convert(float(value))
        
        # set value and emit signal        
        self.slider.setValue(value)
        self.slider.valueChanged.emit(value)
        
    def value(self):
        return self._convert(self.slider.value(), inverse=True)
开发者ID:michaelschaefer,项目名称:grayscott,代码行数:87,代码来源:parameterslider.py

示例9: MainWindow

# 需要导入模块: from PySide.QtGui import QSlider [as 别名]
# 或者: from PySide.QtGui.QSlider import value [as 别名]
class MainWindow(object):
    '''
    Contains the implementation for building and displaying the 
    application's main window.
    '''

    def __init__(self, model, alg):
        '''
        Constructs the GUI and initializes internal parameters.
        '''
        self._window = QMainWindow()
        self._window.setWindowTitle("Reverse A*")
        self._worldWidget = WorldWidget(model, alg)
        self._model = model
        self._alg = alg
        self._spdSetting = 0
        self._timer = QTimer()
        #Every time the timer times out, invoke the _onStep method.
        self._timer.timeout.connect(self._onStep)        
        self._buildGUI()
        self._window.show()

    def _buildGUI(self):
        '''
        Construct the GUI widgets and layouts.
        '''
        centerWidget = QWidget()
        self._window.setCentralWidget(centerWidget)
        
        worldLayout = QHBoxLayout()
        worldLayout.addWidget(self._worldWidget)
        grpBx = QGroupBox("2D World")
        grpBx.setLayout(worldLayout)
        grpBx.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        
        ctrlPan = self._buildControlPanel()
        layout = QHBoxLayout()
        layout.addWidget(ctrlPan)
        layout.addWidget(grpBx)
        layout.setAlignment(ctrlPan, Qt.AlignLeft | Qt.AlignTop)
        centerWidget.setLayout(layout)

        
    def _buildControlPanel(self):
        '''
        Create all buttons, labels, etc for the application control elements
        '''
        layout = QVBoxLayout()
        layout.addWidget(self._buildSetupPanel())
        layout.addWidget(self._buildSpeedPanel())
        layout.addWidget(self._buildResultsPanel())
        layout.addWidget(self._buildRenderingOptions())
        layout.setAlignment(Qt.AlignLeft | Qt.AlignTop)
        
        ctrlWidget = QWidget(self._window)
        ctrlWidget.setLayout(layout)
        ctrlWidget.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        return ctrlWidget        
    
    def _buildSetupPanel(self):
        '''
        Creates the sub-panel containing control widgets for re-initializing 
        the world on demand.
        '''
        self._percentLbl = QLabel("%")
        self._setupBtn = QPushButton("Setup", self._window)
        self._setupBtn.clicked.connect(self._onSetup)
        
        self._percentObstacleSldr = QSlider(Qt.Horizontal, self._window)
        self._percentObstacleSldr.setTickPosition(QSlider.TickPosition.TicksBelow)
        self._percentObstacleSldr.setTickInterval(10)
        self._percentObstacleSldr.setMinimum(0)
        self._percentObstacleSldr.setMaximum(100)
        self._percentObstacleSldr.valueChanged.connect(self._onPercentSlideChange)
        self._percentObstacleSldr.setValue(33)
        
        layout = QGridLayout()
        layout.addWidget(self._setupBtn, 0, 0, 1, 2)
        layout.addWidget(QLabel("Percent Occupied:"), 1, 0)
        layout.addWidget(self._percentLbl, 1, 1)
        layout.addWidget(self._percentObstacleSldr, 2, 0, 1, 2)
        
        grpBx = QGroupBox("Setup Controls")
        grpBx.setLayout(layout)
        grpBx.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        return grpBx        
        
    def _buildSpeedPanel(self):
        '''
        Creates the sub-panel containing control widgets for controlling the 
        speed of execution of the algorithm.
        '''
        self._runBtn = QPushButton("Run", self._window)
        self._stepBtn = QPushButton("Step Once", self._window)        
        self._runBtn.clicked.connect(self._onRun)
        self._stepBtn.clicked.connect(self._onStep)        
        
        slowRadio = QRadioButton('Slow', self._window)
        medRadio = QRadioButton('Medium', self._window)
        fastRadio = QRadioButton('Fast', self._window)
#.........这里部分代码省略.........
开发者ID:tansir1,项目名称:ReverseAStar,代码行数:103,代码来源:gui.py

示例10: VolumeVisualizationMIDA

# 需要导入模块: from PySide.QtGui import QSlider [as 别名]
# 或者: from PySide.QtGui.QSlider import value [as 别名]
class VolumeVisualizationMIDA(VolumeVisualization):
	"""
	VolumeVisualization subclass for MIP visualization.
	"""
	def __init__(self):
		super(VolumeVisualizationMIDA, self).__init__()

		self.visualizationType = VisualizationTypeMIDA
		self.mapper = None

		# TODO: add two sliders with which to threshold the data
		# Create property and attach the transfer function
		self.volProp = vtkVolumeProperty()
		self.volProp.SetIndependentComponents(True)
		self.volProp.SetInterpolationTypeToLinear()

	@overrides(VolumeVisualization)
	def getParameterWidget(self):
		"""
		Returns a widget with sliders / fields with which properties of this
		volume property can be adjusted.
		:rtype: QWidget
		"""
		self.brightnessSlider = QSlider(Qt.Horizontal)
		self.brightnessSlider.setMinimum(0)
		self.brightnessSlider.setMaximum(500)
		self.brightnessSlider.setValue(int(self.brightness))
		self.brightnessSlider.valueChanged.connect(self.valueChanged)
		self.brightnessLabel = QLabel(str(self.brightness/100.0))

		self.windowSlider = QSlider(Qt.Horizontal)
		self.windowSlider.setMinimum(0)
		self.windowSlider.setMaximum(int(abs(self.maximum - self.minimum)))
		self.windowSlider.setValue(int(self.window))
		self.windowSlider.valueChanged.connect(self.valueChanged)
		self.windowLabel = QLabel(str(self.window))

		self.levelSlider = QSlider(Qt.Horizontal)
		self.levelSlider.setMinimum(int(self.minimum))
		self.levelSlider.setMaximum(int(self.maximum))
		self.levelSlider.setValue(int(self.level))
		self.levelSlider.valueChanged.connect(self.valueChanged)
		self.levelLabel = QLabel(str(self.level))

		self.lowerBoundSlider = QSlider(Qt.Horizontal)
		self.lowerBoundSlider.setMinimum(int(self.minimum))
		self.lowerBoundSlider.setMaximum(int(self.maximum))
		self.lowerBoundSlider.setValue(int(self.lowerBound))
		self.lowerBoundSlider.valueChanged.connect(self.valueChanged)
		self.lowerBoundLabel = QLabel(str(self.lowerBound))

		self.upperBoundSlider = QSlider(Qt.Horizontal)
		self.upperBoundSlider.setMinimum(int(self.minimum))
		self.upperBoundSlider.setMaximum(int(self.maximum))
		self.upperBoundSlider.setValue(int(self.upperBound))
		self.upperBoundSlider.valueChanged.connect(self.valueChanged)
		self.upperBoundLabel = QLabel(str(self.upperBound))

		layout = QGridLayout()
		layout.setAlignment(Qt.AlignTop)
		layout.setContentsMargins(0, 0, 0, 0)
		layout.addWidget(QLabel("Window"), 0, 0)
		layout.addWidget(self.windowSlider, 0, 1)
		layout.addWidget(self.windowLabel, 0, 2)
		layout.addWidget(QLabel("Level"), 1, 0)
		layout.addWidget(self.levelSlider, 1, 1)
		layout.addWidget(self.levelLabel, 1, 2)
		layout.addWidget(QLabel("Brightness"), 2, 0)
		layout.addWidget(self.brightnessSlider, 2, 1)
		layout.addWidget(self.brightnessLabel, 2, 2)
		layout.addWidget(QLabel("Lower threshold"), 3, 0)
		layout.addWidget(self.lowerBoundSlider, 3, 1)
		layout.addWidget(self.lowerBoundLabel, 3, 2)
		layout.addWidget(QLabel("Upper threshold"), 4, 0)
		layout.addWidget(self.upperBoundSlider, 4, 1)
		layout.addWidget(self.upperBoundLabel, 4, 2)

		widget = QWidget()
		widget.setLayout(layout)
		return widget

	@overrides(VolumeVisualization)
	def setImageData(self, imageData):
		if imageData is None:
			self.minimum = 0.0
			self.maximum = 1.0
			self.lowerBound = self.minimum
			self.upperBound = self.maximum
			return
			
		self.minimum, self.maximum = imageData.GetScalarRange()
		self.lowerBound = self.minimum
		self.upperBound = self.maximum
		self.window = abs(self.maximum - self.minimum)
		self.level = (self.maximum + self.minimum) / 2.0
		self.brightness = 100

	@overrides(VolumeVisualization)
	def setMapper(self, mapper):
		self.mapper = mapper
#.........这里部分代码省略.........
开发者ID:berendkleinhaneveld,项目名称:Registrationshop,代码行数:103,代码来源:VolumeVisualizationMIDA.py


注:本文中的PySide.QtGui.QSlider.value方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。