當前位置: 首頁>>代碼示例>>Python>>正文


Python QSlider.setMaximum方法代碼示例

本文整理匯總了Python中PySide.QtGui.QSlider.setMaximum方法的典型用法代碼示例。如果您正苦於以下問題:Python QSlider.setMaximum方法的具體用法?Python QSlider.setMaximum怎麽用?Python QSlider.setMaximum使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PySide.QtGui.QSlider的用法示例。


在下文中一共展示了QSlider.setMaximum方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: MultiVolumeVisualizationMIP

# 需要導入模塊: from PySide.QtGui import QSlider [as 別名]
# 或者: from PySide.QtGui.QSlider import setMaximum [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: __init__

# 需要導入模塊: from PySide.QtGui import QSlider [as 別名]
# 或者: from PySide.QtGui.QSlider import setMaximum [as 別名]
 def __init__(self, text, minValue, maxValue, defaultValue ):
     
     QWidget.__init__( self )
     
     validator = QDoubleValidator(minValue, maxValue, 2, self )
     mainLayout = QHBoxLayout( self )
     
     checkBox = QCheckBox()
     checkBox.setFixedWidth( 115 )
     checkBox.setText( text )
     
     lineEdit = QLineEdit()
     lineEdit.setValidator( validator )
     lineEdit.setText( str(defaultValue) )
     
     slider = QSlider( QtCore.Qt.Horizontal )
     slider.setMinimum( minValue*100 )
     slider.setMaximum( maxValue*100 )
     slider.setValue( defaultValue )
     
     mainLayout.addWidget( checkBox )
     mainLayout.addWidget( lineEdit )
     mainLayout.addWidget( slider )
     
     QtCore.QObject.connect( slider, QtCore.SIGNAL( 'valueChanged(int)' ), self.syncWidthLineEdit )
     QtCore.QObject.connect( lineEdit, QtCore.SIGNAL( 'textChanged(QString)' ), self.syncWidthSlider )
     QtCore.QObject.connect( checkBox, QtCore.SIGNAL( "clicked()" ), self.updateEnabled )
     
     self.checkBox = checkBox
     self.slider = slider
     self.lineEdit = lineEdit
     
     self.updateEnabled()
開發者ID:jonntd,項目名稱:mayadev-1,代碼行數:35,代碼來源:__init__.py

示例3: getParameterWidget

# 需要導入模塊: from PySide.QtGui import QSlider [as 別名]
# 或者: from PySide.QtGui.QSlider import setMaximum [as 別名]
	def getParameterWidget(self):
		"""
		Returns a widget with sliders / fields with which properties of this
		volume property can be adjusted.
		:rtype: QWidget
		"""
		layout = QGridLayout()
		layout.setContentsMargins(0, 0, 0, 0)
		layout.setAlignment(Qt.AlignTop)

		self.sliders = []
		for index in range(7):
			slider = QSlider(Qt.Horizontal)
			slider.setMinimum(0)
			slider.setMaximum(1000)
			slider.setValue(int(math.pow(self.sectionsOpacity[index], 1.0/3.0) * slider.maximum()))
			slider.valueChanged.connect(self.valueChanged)
			self.sliders.append(slider)
			label = QLabel(self.sectionNames[index])
			label.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
			layout.addWidget(label, index, 0)
			layout.addWidget(slider, index, 1)

		try:
			from ColumnResizer import ColumnResizer
			columnResizer = ColumnResizer()
			columnResizer.addWidgetsFromLayout(layout, 0)
		except Exception, e:
			print e
開發者ID:berendkleinhaneveld,項目名稱:Registrationshop,代碼行數:31,代碼來源:VolumeVisualizationCT.py

示例4: __init__

# 需要導入模塊: from PySide.QtGui import QSlider [as 別名]
# 或者: from PySide.QtGui.QSlider import setMaximum [as 別名]
 def __init__(self, *args, **kwargs ):
     
     self.minimum = 1
     self.maximum = 100
     self.lineEditMaximum = 10000
     
     QMainWindow.__init__( self, *args, **kwargs )
     self.installEventFilter( self )
     #self.setWindowFlags( QtCore.Qt.Drawer )
     self.setWindowTitle( Window_global.title )
     
     widgetMain = QWidget()
     layoutVertical = QVBoxLayout( widgetMain )
     self.setCentralWidget( widgetMain )
     
     layoutSlider = QHBoxLayout()
     lineEdit     = QLineEdit(); lineEdit.setFixedWidth( 100 )
     lineEdit.setText( str( 1 ) )
     validator    = QIntValidator(self.minimum, self.lineEditMaximum, self)
     lineEdit.setValidator( validator )
     slider       = QSlider(); slider.setOrientation( QtCore.Qt.Horizontal )
     slider.setMinimum( self.minimum )
     slider.setMaximum( self.maximum )
     layoutSlider.addWidget( lineEdit )
     layoutSlider.addWidget( slider )
     layoutAngle = QVBoxLayout()
     checkBox = QCheckBox( 'Connect Angle By Tangent' )
     layoutVector = QHBoxLayout()
     leVx = QLineEdit(); leVx.setText( str( 1.000 ) ); leVx.setEnabled( False )
     leVx.setValidator( QDoubleValidator( -100, 100, 5, self ) )
     leVy = QLineEdit(); leVy.setText( str( 0.000 ) ); leVy.setEnabled( False )
     leVy.setValidator( QDoubleValidator( -100, 100, 5, self ) )
     leVz = QLineEdit(); leVz.setText( str( 0.000 ) ); leVz.setEnabled( False )
     leVz.setValidator( QDoubleValidator( -100, 100, 5, self ) )
     layoutAngle.addWidget( checkBox )
     layoutAngle.addLayout( layoutVector )
     layoutVector.addWidget( leVx ); layoutVector.addWidget( leVy ); layoutVector.addWidget( leVz )
     button       = QPushButton( 'Create' )
     
     layoutVertical.addLayout( layoutSlider )
     layoutVertical.addLayout( layoutAngle )
     layoutVertical.addWidget( button )
     
     QtCore.QObject.connect( slider, QtCore.SIGNAL('valueChanged(int)'),   self.sliderValueChanged )
     QtCore.QObject.connect( lineEdit, QtCore.SIGNAL('textEdited(QString)'), self.lineEditValueChanged )
     QtCore.QObject.connect( button, QtCore.SIGNAL('clicked()'), Functions.createPointOnCurve )
     QtCore.QObject.connect( checkBox, QtCore.SIGNAL( 'clicked()'), Functions.setAngleEnabled )
     self.slider = slider
     self.lineEdit = lineEdit
     
     Window_global.slider = slider
     Window_global.button = button
     Window_global.checkBox = checkBox
     Window_global.leVx = leVx
     Window_global.leVy = leVy
     Window_global.leVz = leVz
開發者ID:jonntd,項目名稱:mayadev-1,代碼行數:58,代碼來源:createPointOnCurve.py

示例5: SliderWidget

# 需要導入模塊: from PySide.QtGui import QSlider [as 別名]
# 或者: from PySide.QtGui.QSlider import setMaximum [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

示例6: MainWindow

# 需要導入模塊: from PySide.QtGui import QSlider [as 別名]
# 或者: from PySide.QtGui.QSlider import setMaximum [as 別名]

#.........這裏部分代碼省略.........
            msgBox = QMessageBox(self.parent())
            msgBox.setText('Out of range of network')
            msgBox.setInformativeText('Move back into range and press Retry, or press Cancel to quit the application')
            msgBox.setStandardButtons(QMessageBox.Retry | QMessageBox.Cancel)
            msgBox.setIcon(QMessageBox.Information)
            msgBox.setDefaultButton(QMessageBox.Retry)
            ret = msgBox.exec_()
            if ret == QMessageBox.Retry:
                QTimer.singleShot(0, self.session.open)
            elif ret == QMessageBox.Cancel:
                self.close()


    def setupUi(self):

        scene = QGraphicsScene(self)
        self.view = QGraphicsView(scene, self)
        self.view.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.view.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.view.setVisible(True)
        self.view.setInteractive(True)

        self.createPixmapIcon()

        self.mapWidget = MapWidget(self.mapManager)
        scene.addItem(self.mapWidget)
        self.mapWidget.setCenter(QGeoCoordinate(-8.1, -34.95))
        self.mapWidget.setZoomLevel(5)

        #...
        self.slider = QSlider(Qt.Vertical, self)
        self.slider.setTickInterval(1)
        self.slider.setTickPosition(QSlider.TicksBothSides)
        self.slider.setMaximum(self.mapManager.maximumZoomLevel())
        self.slider.setMinimum(self.mapManager.minimumZoomLevel())

        self.slider.valueChanged[int].connect(self.sliderValueChanged)
        self.mapWidget.zoomLevelChanged[float].connect(self.mapZoomLevelChanged)

        mapControlLayout = QVBoxLayout()

        self.mapWidget.mapTypeChanged.connect(self.mapTypeChanged)

        for mapType in self.mapWidget.supportedMapTypes():
            radio = QRadioButton(self)
            if mapType == QGraphicsGeoMap.StreetMap:
                radio.setText('Street')
            elif mapType == QGraphicsGeoMap.SatelliteMapDay:
                radio.setText('Sattelite')
            elif mapType == QGraphicsGeoMap.SatelliteMapNight:
                radio.setText('Sattelite - Night')
            elif mapType == QGraphicsGeoMap.TerrainMap:
                radio.setText('Terrain')

            if mapType == self.mapWidget.mapType():
                radio.setChecked(True)

            radio.toggled[bool].connect(self.mapTypeToggled)

            self.mapControlButtons.append(radio)
            self.mapControlTypes.append(mapType)
            mapControlLayout.addWidget(radio)

        self.latitudeEdit = QLineEdit()
        self.longitudeEdit = QLineEdit()
開發者ID:AmerGit,項目名稱:Examples,代碼行數:69,代碼來源:mapviewer.py

示例7: PlotMainWindow

# 需要導入模塊: from PySide.QtGui import QSlider [as 別名]
# 或者: from PySide.QtGui.QSlider import setMaximum [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

示例8: StepperWindow

# 需要導入模塊: from PySide.QtGui import QSlider [as 別名]
# 或者: from PySide.QtGui.QSlider import setMaximum [as 別名]
class StepperWindow(QMainWindow):


    def __init__(self):
        QMainWindow.__init__(self)
        # filename = QFileDialog.getOpenFileName(self, "Open File")[0]
        # self.setWindowTitle(os.path.basename(filename))
        # self.transcript = StepperTranscript(filename)
        self.transcript = None
        self.outer_widget = QWidget()
        self.setCentralWidget(self.outer_widget)
        outer_layout = QHBoxLayout()
        self.outer_widget.setLayout(outer_layout)
        self.setLayout(outer_layout)
        left_layout = QVBoxLayout()
        outer_layout.addLayout(left_layout)

        display_widget = QWidget()
        left_layout.addWidget(display_widget)
        self.display_layout = QHBoxLayout()

        # self.turn = self.transcript.current_turn()
        self.time_field = qHotField("time", str, "00:00:00", min_size=75, max_size=75, pos="top", handler=self.update_time)
        self.display_layout.addWidget(self.time_field)
        self.speaker_field = qHotField("speaker", str, " ", min_size=75, max_size=75, pos="top", handler=self.update_speaker)
        self.display_layout.addWidget(self.speaker_field)
        self.utt_field = qHotField("utterance", str, " ", min_size=350, pos="top", handler=self.update_utterance, multiline=True)
        self.utt_field.setStyleSheet("font: 14pt \"Courier\";")
        # self.utt_field.efield.setFont(QFont('SansSerif', 12))
        self.display_layout.addWidget(self.utt_field)

        display_widget.setLayout(self.display_layout)
        self.display_layout.setStretchFactor(self.speaker_field, 0)
        self.display_layout.setStretchFactor(self.utt_field, 1)

        self.transcript_slider = QSlider(QtCore.Qt.Horizontal, self)
        self.display_layout.addWidget(self.transcript_slider)
        self.transcript_slider.setMaximum(100)
        self.connect(self.transcript_slider,
                     QtCore.SIGNAL("sliderMoved(int)"), self.position_transcript)
        left_layout.addWidget(self.transcript_slider)

        button_widget = TranscriptButtons(self)

        left_layout.addWidget(button_widget)
        left_layout.addWidget(QWidget())
        left_layout.setStretch(0, 0)
        left_layout.setStretch(1, 0)
        left_layout.setStretch(2, 0)
        left_layout.setStretch(3, 1)

        # video_buttons = VideoButtons(self)
        # outer_layout.addWidget(video_buttons)

        self.createKeypadButtons(self)
        left_layout.addWidget(self.keypadWidget)

        self.player = Player()
        outer_layout.addWidget(self.player)

        outer_layout.setStretch(0, 0)
        outer_layout.setStretch(1, 1)
        self.save_file_name = None

        command_list = [
            [self.open_video, "Open Video", {}, "Ctrl+o"],
            [self.open_transcript, "Open Transcript", {}, "Ctrl+t"],
            [self.play_or_pause, "Play/Pause", {}, Qt.CTRL + Qt.Key_P],
            [self.save_file, "Save", {}, "Ctrl+s"],
            [self.player.jump_video_backward, "Jump Back", {}, Qt.CTRL + Qt.Key_4],
            [self.player.jump_video_forward, "Jump Forward", {}, Qt.CTRL + Qt.Key_6],
            [self.go_to_previous_turn, "Previous", {}, "Ctrl+["],
            [self.go_to_next_turn, "Next", {}, "Ctrl+]"],
            ]

        menubar = self.menuBar()
        create_menu(self, menubar, "Stepper", command_list)

        QShortcut(QKeySequence(Qt.CTRL + Qt.Key_0), self, self.play_or_pause)
        QShortcut(QKeySequence(Qt.CTRL + Qt.Key_5), self, self.play_or_pause)
        QShortcut(QKeySequence(Qt.CTRL + Qt.Key_7), self, self.go_to_previous_turn)
        QShortcut(QKeySequence(Qt.CTRL + Qt.Key_9), self, self.go_to_next_turn)
        QShortcut(QKeySequence(Qt.CTRL + Qt.Key_4), self, self.player.jump_video_backward)
        QShortcut(QKeySequence(Qt.CTRL + Qt.Key_6), self, self.player.jump_video_forward)
        QShortcut(QKeySequence(Qt.CTRL + Qt.Key_2), self, self.player.reset_rate)
        QShortcut(QKeySequence(Qt.CTRL + Qt.Key_1), self, self.player.decrease_rate)
        QShortcut(QKeySequence(Qt.CTRL + Qt.Key_3), self, self.player.increase_rate)
        QShortcut(QKeySequence(Qt.CTRL + Qt.Key_G), self, self.sync_video_and_play)

    def createKeypadButtons(self, stepperWindow):

        self.keypadWidget = QtGui.QWidget()
        self.keypadWidget.setGeometry(QtCore.QRect(0, 0, 191, 101))
        self.keypadWidget.setMinimumSize(QtCore.QSize(191, 101))
        self.keypadWidget.setMaximumSize(QtCore.QSize(191, 101))
        self.keypadWidget.setObjectName("gridLayoutWidget")
        self.keypadGridLayout = QtGui.QGridLayout(self.keypadWidget)
        self.keypadGridLayout.setContentsMargins(0, 0, 0, 0)
        self.keypadGridLayout.setObjectName("keypadGridLayout")
        self.fasterbutton = QtGui.QPushButton(self.keypadWidget)
#.........這裏部分代碼省略.........
開發者ID:bsherin,項目名稱:shared_tools,代碼行數:103,代碼來源:stepper_window.py

示例9: MainWindow

# 需要導入模塊: from PySide.QtGui import QSlider [as 別名]
# 或者: from PySide.QtGui.QSlider import setMaximum [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

示例10: MainWindow

# 需要導入模塊: from PySide.QtGui import QSlider [as 別名]
# 或者: from PySide.QtGui.QSlider import setMaximum [as 別名]
class MainWindow(QWidget):
    # noinspection PyUnresolvedReferences
    def __init__(self, clipboard):
        super().__init__()
        self.clipboard = clipboard
        self.setWindowIcon(QIcon('Logo_rendered_edited.png'))
        self.layout = QBoxLayout(QBoxLayout.TopToBottom, self)
        self.generator = CtSesam()
        self.iterations = 4096
        # Master password
        self.master_password_label = QLabel("&Master-Passwort:")
        self.maser_password_edit = QLineEdit()
        self.maser_password_edit.setEchoMode(QLineEdit.EchoMode.Password)
        self.maser_password_edit.textChanged.connect(self.reset_iterations)
        self.maser_password_edit.returnPressed.connect(self.move_focus)
        self.maser_password_edit.setMaximumHeight(28)
        self.master_password_label.setBuddy(self.maser_password_edit)
        self.layout.addWidget(self.master_password_label)
        self.layout.addWidget(self.maser_password_edit)
        # Domain
        self.domain_label = QLabel("&Domain:")
        self.domain_edit = QLineEdit()
        self.domain_edit.textChanged.connect(self.reset_iterations)
        self.domain_edit.returnPressed.connect(self.move_focus)
        self.domain_edit.setMaximumHeight(28)
        self.domain_label.setBuddy(self.domain_edit)
        self.layout.addWidget(self.domain_label)
        self.layout.addWidget(self.domain_edit)
        # Username
        self.username_label = QLabel("&Username:")
        self.username_edit = QLineEdit()
        self.username_edit.textChanged.connect(self.reset_iterations)
        self.username_edit.returnPressed.connect(self.move_focus)
        self.username_edit.setMaximumHeight(28)
        self.username_label.setBuddy(self.username_edit)
        self.layout.addWidget(self.username_label)
        self.layout.addWidget(self.username_edit)
        # Checkboxes
        self.special_characters_checkbox = QCheckBox("Sonderzeichen")
        self.special_characters_checkbox.setChecked(True)
        self.special_characters_checkbox.stateChanged.connect(self.reset_iterations)
        self.layout.addWidget(self.special_characters_checkbox)
        self.letters_checkbox = QCheckBox("Buchstaben")
        self.letters_checkbox.setChecked(True)
        self.letters_checkbox.stateChanged.connect(self.reset_iterations)
        self.layout.addWidget(self.letters_checkbox)
        self.digits_checkbox = QCheckBox("Zahlen")
        self.digits_checkbox.setChecked(True)
        self.digits_checkbox.stateChanged.connect(self.reset_iterations)
        self.layout.addWidget(self.digits_checkbox)
        # Length slider
        self.length_label = QLabel("&Länge:")
        self.length_display = QLabel()
        self.length_label_layout = QBoxLayout(QBoxLayout.LeftToRight)
        self.length_label_layout.addWidget(self.length_label)
        self.length_label_layout.addWidget(self.length_display)
        self.length_label_layout.addStretch()
        self.length_slider = QSlider(Qt.Horizontal)
        self.length_slider.setMinimum(4)
        self.length_slider.setMaximum(20)
        self.length_slider.setPageStep(1)
        self.length_slider.setValue(10)
        self.length_display.setText(str(self.length_slider.sliderPosition()))
        self.length_slider.valueChanged.connect(self.length_slider_changed)
        self.length_label.setBuddy(self.length_slider)
        self.layout.addLayout(self.length_label_layout)
        self.layout.addWidget(self.length_slider)
        # Button
        self.generate_button = QPushButton("Erzeugen")
        self.generate_button.clicked.connect(self.generate_password)
        self.generate_button.setAutoDefault(True)
        self.layout.addWidget(self.generate_button)
        # Password
        self.password_label = QLabel("&Passwort:")
        self.password = QLabel()
        self.password.setTextFormat(Qt.PlainText)
        self.password.setAlignment(Qt.AlignCenter)
        self.password.setFont(QFont("Helvetica", 18, QFont.Bold))
        self.password_label.setBuddy(self.password)
        self.layout.addWidget(self.password_label)
        self.layout.addWidget(self.password)
        # Iteration display
        self.message_label = QLabel()
        self.message_label.setTextFormat(Qt.RichText)
        self.message_label.setVisible(False)
        self.layout.addWidget(self.message_label)
        # Window layout
        self.layout.addStretch()
        self.setGeometry(0, 30, 300, 400)
        self.setWindowTitle("c't SESAM")
        self.maser_password_edit.setFocus()
        self.show()

    def length_slider_changed(self):
        self.length_display.setText(str(self.length_slider.sliderPosition()))
        self.reset_iterations()

    def reset_iterations(self):
        self.iterations = 4096
        self.message_label.setVisible(False)
#.........這裏部分代碼省略.........
開發者ID:LK-Studios,項目名稱:ctSESAM-pyside,代碼行數:103,代碼來源:ctSESAM.py

示例11: ParameterSlider

# 需要導入模塊: from PySide.QtGui import QSlider [as 別名]
# 或者: from PySide.QtGui.QSlider import setMaximum [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

示例12: MainWindow

# 需要導入模塊: from PySide.QtGui import QSlider [as 別名]
# 或者: from PySide.QtGui.QSlider import setMaximum [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

示例13: EegCarDashboardWindow

# 需要導入模塊: from PySide.QtGui import QSlider [as 別名]
# 或者: from PySide.QtGui.QSlider import setMaximum [as 別名]

#.........這裏部分代碼省略.........
        self.power_handle_mode_checkbox = QCheckBox('Power Handle', self)
        self.power_handle_mode_checkbox.stateChanged.connect(self.power_handle_mode_control)

        self.ignore_eeg_input = QCheckBox('Ignore Eeg Input', self)
        self.ignore_eeg_input.stateChanged.connect(self.ignore_eeg_input_control)

        drive_layout = QHBoxLayout(self)
        drive_layout.addWidget(self.rc_mode)
        drive_layout.addWidget(self.rc_stright_mode)
        drive_layout.addWidget(self.keep_mode_checkbox)
        drive_layout.addWidget(self.power_handle_mode_checkbox)
        drive_layout.addWidget(self.ignore_eeg_input)

        drive_groupbox = QtGui.QGroupBox("Drive Status & Setting")
        drive_groupbox.setLayout(drive_layout)

        # Throttle Setting
        self.throttle_slider = QSlider(Qt.Horizontal)
        self.throttle_slider.setFocusPolicy(Qt.StrongFocus)
        self.throttle_slider.setTickPosition(QSlider.TicksBothSides)
        self.throttle_slider.setTickInterval(10)
        self.throttle_slider.setSingleStep(10)
        self.throttle_slider.setValue(DEFAULT_MAX_THROTTLE)

        self.throttle_slider.valueChanged.connect(self.throttle_slider.setValue)
        self.connect(self.throttle_slider, SIGNAL("valueChanged(int)"), self.setSliderMaxThrottle)
        self.throttle_label = QLabel('Max Throttle (%): ', self)


        self.maxThrottle = QLineEdit(str(DEFAULT_MAX_THROTTLE))
        # self.maxThrottle.textChanged[str].connect(self.setMaxThrottle)
        self.maxThrottle.editingFinished.connect(self.setMaxThrottle)
        self.maxThrottle.setMaxLength(2)
        self.maxThrottle.setMaximumWidth(40)

        self.backwardMaxThrottle = QLineEdit(str(DEFAULT_MAX_BACK_THROTTLE))
        # self.maxThrottle.textChanged[str].connect(self.setMaxThrottle)
        self.backwardMaxThrottle.editingFinished.connect(self.setBackwardMaxThrottle)
        self.backwardMaxThrottle.setMaxLength(2)
        self.backwardMaxThrottle.setMaximumWidth(40)

        throttle_layout = QHBoxLayout(self)
        throttle_layout.addWidget(self.throttle_label)
        throttle_layout.addWidget(self.throttle_slider)
        throttle_layout.addWidget(QLabel("Forward Max:"))
        throttle_layout.addWidget(self.maxThrottle)

        throttle_layout.addWidget(QLabel("Backward Max:"))
        throttle_layout.addWidget(self.backwardMaxThrottle)

        throttle_groupbox = QtGui.QGroupBox("Max Throttle Setting (30-99)")
        throttle_groupbox.setLayout(throttle_layout)

        # Steering
        self.steering_label = QLabel('Turn Range', self)
        self.steering_turn_range_slider = QSlider(Qt.Horizontal)
        self.steering_turn_range_slider.setFocusPolicy(Qt.StrongFocus)
        self.steering_turn_range_slider.setTickPosition(QSlider.TicksBothSides)
        self.steering_turn_range_slider.setRange(1, 9)
        # self.steering_slider.setMinimum(2)
        # self.steering_slider.setMaximum(8)
        self.steering_turn_range_slider.setMinimum(4)
        self.steering_turn_range_slider.setMaximum(8)
        self.steering_turn_range_slider.setTickInterval(1)
        self.steering_turn_range_slider.setSingleStep(1)
        self.steering_turn_range_slider.setValue(6)
開發者ID:donghee,項目名稱:tirepilot,代碼行數:70,代碼來源:app.py

示例14: SliderFloatWidget

# 需要導入模塊: from PySide.QtGui import QSlider [as 別名]
# 或者: from PySide.QtGui.QSlider import setMaximum [as 別名]
class SliderFloatWidget(QWidget):
	"""
	SliderFloatWidget
	"""
	valueChanged = Signal(int)

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

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

		self.slider.valueChanged.connect(self.changedValueFromSlider)
		self.spinbox.valueChanged.connect(self.changedValueFromSpinBox)

		layout = QGridLayout()
		layout.setContentsMargins(0, 0, 0, 0)
		layout.setVerticalSpacing(0)
		# layout.setHorizontalSpacing(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.range = range
		self.slider.setMinimum(0)
		self.slider.setMaximum(100)
		self.spinbox.setRange(self.range[0], self.range[1])

		diff = self.range[1] - self.range[0]
		if diff <= 1:
			self.spinbox.setSingleStep(0.1)

	def setValue(self, value):
		"""
		Set the value for the slider and the spinbox
		"""
		ratio = (value - self.range[0]) / (self.range[1] - self.range[0])
		self.slider.setValue(ratio * 100)
		self.spinbox.setValue(value)

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

	@Slot(int)
	def changedValueFromSlider(self, value):
		ratio = value / 100.0
		val = self.range[0] + ratio * (self.range[1] - self.range[0])
		self.spinbox.setValue(val)
		self.valueChanged.emit(val)

	@Slot(float)
	def changedValueFromSpinBox(self, value):
		ratio = (value - self.range[0]) / (self.range[1] - self.range[0])
		self.slider.setValue(ratio * 100)
		self.valueChanged.emit(value)
開發者ID:rcockbur,項目名稱:3DMedicalVisualizationTool,代碼行數:69,代碼來源:SliderFloatWidget.py

示例15: StepperWindow

# 需要導入模塊: from PySide.QtGui import QSlider [as 別名]
# 或者: from PySide.QtGui.QSlider import setMaximum [as 別名]

#.........這裏部分代碼省略.........
        QtCore.QObject.connect(self.FillButton, QtCore.SIGNAL("clicked()"), stepperWindow.fill_time_code)
        QtCore.QObject.connect(self.NextButton, QtCore.SIGNAL("clicked()"), stepperWindow.go_to_next_turn)
        QtCore.QObject.connect(self.CommitButton, QtCore.SIGNAL("clicked()"), stepperWindow.commit)
        QtCore.QObject.connect(self.InsertBeforeButton, QtCore.SIGNAL("clicked()"), stepperWindow.insert_before)
        QtCore.QObject.connect(self.JumpBackButton, QtCore.SIGNAL("clicked()"), stepperWindow.jump_back)
        QtCore.QObject.connect(self.SlowerButton, QtCore.SIGNAL("clicked()"), stepperWindow.slower)
        QtCore.QObject.connect(self.FasterButton, QtCore.SIGNAL("clicked()"), stepperWindow.faster)
        QtCore.QObject.connect(self.NormalButton, QtCore.SIGNAL("clicked()"), stepperWindow.normal_speed)
        QtCore.QObject.connect(self.PreviousButton, QtCore.SIGNAL("clicked()"), stepperWindow.go_to_previous_turn)
        QtCore.QObject.connect(self.SaveButton, QtCore.SIGNAL("clicked()"), stepperWindow.save_file)
        QtCore.QObject.connect(self.SaveAsButton, QtCore.SIGNAL("clicked()"), stepperWindow.save_file_as)
        QtCore.QObject.connect(self.RevertButton, QtCore.SIGNAL("clicked()"), stepperWindow.revert_current_and_redisplay)
        QtCore.QObject.connect(self.DeleteButton, QtCore.SIGNAL("clicked()"), stepperWindow.delete_current_turn)
        QtCore.QObject.connect(self.InsertAfterButton, QtCore.SIGNAL("clicked()"), stepperWindow.insert_after)
        QtCore.QObject.connect(self.CommitAllButton, QtCore.SIGNAL("clicked()"), stepperWindow.commit_all)

        # Added this line by hand
        QtCore.QObject.connect(self.ExplorerButton, QtCore.SIGNAL("clicked()"), stepperWindow.show_transcript_in_explorer)

        QtCore.QMetaObject.connectSlotsByName(stepperWindow)

        # The following menu and shortcut stuff added by hand
        command_list = [
            [self.open_transcript, "Open Transcript", {}, "Ctrl+t"],
            [self.open_video, "Open Video", {}, "Ctrl+v"],
            [self.play_or_pause, "Play/Pause", {}, Qt.CTRL + Qt.Key_K],
            [self.save_file, "Save", {}, "Ctrl+s"],
            [self.player.jump_video_backward, "Jump Back", {}, Qt.CTRL + Qt.Key_J],
            [self.player.jump_video_forward, "Jump Forward", {}, Qt.CTRL + Qt.Key_L],
            [self.go_to_previous_turn, "Previous Turn", {}, "Ctrl+u"],
            [self.go_to_next_turn, "Next Turn", {}, "Ctrl+o"],
            [self.go_to_previous_word, "Previous Word", {}, "Ctrl+n"],
            [self.go_to_next_word, "Next Word", {}, "Ctrl+m"]
            ]

        menubar = self.menuBar()
        create_menu(self, menubar, "Stepper", command_list)

        QShortcut(QKeySequence(Qt.CTRL + Qt.Key_0), self, self.play_or_pause)
        QShortcut(QKeySequence(Qt.CTRL + Qt.Key_5), self, self.play_or_pause)
        QShortcut(QKeySequence(Qt.CTRL + Qt.Key_7), self, self.go_to_previous_turn)
        QShortcut(QKeySequence(Qt.CTRL + Qt.Key_9), self, self.go_to_next_turn)
        QShortcut(QKeySequence(Qt.CTRL + Qt.Key_4), self, self.player.jump_video_backward)
        QShortcut(QKeySequence(Qt.CTRL + Qt.Key_6), self, self.player.jump_video_forward)
        QShortcut(QKeySequence(Qt.CTRL + Qt.Key_2), self, self.player.reset_rate)
        QShortcut(QKeySequence(Qt.CTRL + Qt.Key_1), self, self.player.decrease_rate)
        QShortcut(QKeySequence(Qt.CTRL + Qt.Key_3), self, self.player.increase_rate)
        QShortcut(QKeySequence(Qt.CTRL + Qt.Key_I), self, self.sync_video_and_play)
        QShortcut(QKeySequence(Qt.CTRL + Qt.Key_8), self, self.sync_video_and_play)

    def retranslateUi(self, stepperWindow):
        stepperWindow.setWindowTitle(QtGui.QApplication.translate("stepperWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8))
        self.DeleteButton.setText(QtGui.QApplication.translate("stepperWindow", "Delete", None, QtGui.QApplication.UnicodeUTF8))
        self.InsertAfterButton.setText(QtGui.QApplication.translate("stepperWindow", "Ins After", None, QtGui.QApplication.UnicodeUTF8))
        self.SaveAsButton.setText(QtGui.QApplication.translate("stepperWindow", "Save As ...", None, QtGui.QApplication.UnicodeUTF8))
        self.CommitAllButton.setText(QtGui.QApplication.translate("stepperWindow", "Commit all", None, QtGui.QApplication.UnicodeUTF8))
        self.CommitButton.setText(QtGui.QApplication.translate("stepperWindow", "Commit", None, QtGui.QApplication.UnicodeUTF8))
        self.InsertBeforeButton.setText(QtGui.QApplication.translate("stepperWindow", "Ins Before", None, QtGui.QApplication.UnicodeUTF8))
        self.SaveButton.setText(QtGui.QApplication.translate("stepperWindow", "Save", None, QtGui.QApplication.UnicodeUTF8))
        self.RevertButton.setText(QtGui.QApplication.translate("stepperWindow", "Revert", None, QtGui.QApplication.UnicodeUTF8))
        self.SlowerButton.setText(QtGui.QApplication.translate("stepperWindow", "Slower", None, QtGui.QApplication.UnicodeUTF8))
        self.FasterButton.setText(QtGui.QApplication.translate("stepperWindow", "Faster", None, QtGui.QApplication.UnicodeUTF8))
        self.NormalButton.setText(QtGui.QApplication.translate("stepperWindow", "Normal", None, QtGui.QApplication.UnicodeUTF8))
        self.JumpBackButton.setText(QtGui.QApplication.translate("stepperWindow", "Jump-", None, QtGui.QApplication.UnicodeUTF8))
        self.NextButton.setText(QtGui.QApplication.translate("stepperWindow", "Next", None, QtGui.QApplication.UnicodeUTF8))
        self.JumpForward.setText(QtGui.QApplication.translate("stepperWindow", "Jump+", None, QtGui.QApplication.UnicodeUTF8))
        self.PlayButton.setText(QtGui.QApplication.translate("stepperWindow", "Play", None, QtGui.QApplication.UnicodeUTF8))
        self.PreviousButton.setText(QtGui.QApplication.translate("stepperWindow", "Prev", None, QtGui.QApplication.UnicodeUTF8))
        self.GotoButton.setText(QtGui.QApplication.translate("stepperWindow", "GoTo", None, QtGui.QApplication.UnicodeUTF8))
        self.SyncButton.setText(QtGui.QApplication.translate("stepperWindow", "Sync Vid", None, QtGui.QApplication.UnicodeUTF8))
        self.FillButton.setText(QtGui.QApplication.translate("stepperWindow", "Fill Time", None, QtGui.QApplication.UnicodeUTF8))

        self.ExplorerButton.setText(QtGui.QApplication.translate("stepperWindow", "Explorer", None, QtGui.QApplication.UnicodeUTF8))

    def createDisplayFields(self):
        display_widget = QFrame()
        display_widget.setFrameStyle(QtGui.QFrame.Panel | QtGui.QFrame.Sunken)
        self.left_layout.addWidget(display_widget)
        self.display_layout = QHBoxLayout()

        # self.turn = self.transcript.current_turn()
        self.time_field = qHotField("time", str, "00:00:00", min_size=75, max_size=75, pos="top", handler=self.update_time)
        self.display_layout.addWidget(self.time_field)
        self.speaker_field = qHotField("speaker", str, " ", min_size=75, max_size=75, pos="top", handler=self.update_speaker)
        self.display_layout.addWidget(self.speaker_field)
        self.utt_field = qHotField("utterance", str, " ", min_size=350, max_size=500, pos="top", handler=self.update_utterance, multiline=True)
        self.utt_field.setStyleSheet("font: 14pt \"Courier\";")
        # self.utt_field.efield.setFont(QFont('SansSerif', 12))
        self.display_layout.addWidget(self.utt_field)

        display_widget.setLayout(self.display_layout)
        self.display_layout.setStretchFactor(self.speaker_field, 0)
        self.display_layout.setStretchFactor(self.utt_field, 1)

        self.transcript_slider = QSlider(QtCore.Qt.Horizontal, self)
        self.display_layout.addWidget(self.transcript_slider)
        self.transcript_slider.setMaximum(100)
        self.connect(self.transcript_slider,
                     QtCore.SIGNAL("sliderMoved(int)"), self.position_transcript)
        self.left_layout.addWidget(self.transcript_slider)
開發者ID:bsherin,項目名稱:shared_tools,代碼行數:104,代碼來源:stepperUI.py


注:本文中的PySide.QtGui.QSlider.setMaximum方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。