Python PyQt5.QtWidgets.QSlider() Examples

The following are 27 code examples of PyQt5.QtWidgets.QSlider(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PyQt5.QtWidgets , or try the search function .
Example #1
Source File: audio_pan.py    From linux-show-player with GNU General Public License v3.0 7 votes vote down vote up
def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.setLayout(QVBoxLayout())
        self.layout().setAlignment(Qt.AlignTop)

        self.panBox = QGroupBox(self)
        self.panBox.setGeometry(0, 0, self.width(), 80)
        self.panBox.setLayout(QHBoxLayout(self.panBox))
        self.layout().addWidget(self.panBox)

        self.panSlider = QSlider(self.panBox)
        self.panSlider.setRange(-10, 10)
        self.panSlider.setPageStep(1)
        self.panSlider.setOrientation(Qt.Horizontal)
        self.panSlider.valueChanged.connect(self.pan_changed)
        self.panBox.layout().addWidget(self.panSlider)

        self.panLabel = QLabel(self.panBox)
        self.panLabel.setAlignment(Qt.AlignCenter)
        self.panBox.layout().addWidget(self.panLabel)

        self.panBox.layout().setStretch(0, 5)
        self.panBox.layout().setStretch(1, 1)

        self.retransaleUi() 
Example #2
Source File: demo_label.py    From openpose-pytorch with GNU Lesser General Public License v3.0 6 votes vote down vote up
def __init__(self, name, image, feature, alpha=0.5):
        super(Visualizer, self).__init__()
        self.name = name
        self.image = image
        self.feature = feature
        self.draw_feature = utils.visualize.DrawFeature(alpha)
        
        layout = QtWidgets.QVBoxLayout(self)
        fig = plt.Figure()
        self.ax = fig.gca()
        self.canvas = qtagg.FigureCanvasQTAgg(fig)
        layout.addWidget(self.canvas)
        toolbar = qtagg.NavigationToolbar2QT(self.canvas, self)
        layout.addWidget(toolbar)
        self.slider = QtWidgets.QSlider(QtCore.Qt.Horizontal, self)
        self.slider.setRange(0, feature.shape[0] - 1)
        layout.addWidget(self.slider)
        self.slider.valueChanged[int].connect(self.on_progress)
        
        self.ax.imshow(self.image)
        self.ax.set_xticks([])
        self.ax.set_yticks([])
        self.on_progress(0) 
Example #3
Source File: optionwidgets.py    From kawaii-player with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent, uiwidget, name):
        super(GSBCSlider, self).__init__(parent)
        global ui
        self.parent = parent
        ui = uiwidget
        self.setObjectName(name)
        self.setOrientation(QtCore.Qt.Horizontal)
        if name == 'zoom':
            self.setRange(-2000, 2000)
            self.setSingleStep(10)
            self.setPageStep(10)
        elif name == 'speed':
            self.setRange(-100, 900)
            self.setSingleStep(10)
            self.setPageStep(10)
        else:
            self.setRange(-100, 100)
            self.setSingleStep(1)
            self.setPageStep(1)
        #self.setTickInterval(5)
        self.setValue(0)
        self.setMouseTracking(True)
        self.valueChanged.connect(self.adjust_gsbc_values)
        self.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        #self.setTickPosition(QtWidgets.QSlider.TicksAbove) 
Example #4
Source File: Test.py    From PyQt with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(Window, self).__init__(*args, **kwargs)
        layout = QVBoxLayout(self)
        self.imgLabel = QLabel(self)
        self.coldSlider = QSlider(Qt.Horizontal, self)
        self.coldSlider.valueChanged.connect(self.doChange)
        self.coldSlider.setRange(0, 255)
        layout.addWidget(self.imgLabel)
        layout.addWidget(self.coldSlider)

        # 加载图片
        self.srcImg = QImage('src.jpg')
        self.imgLabel.setPixmap(QPixmap.fromImage(self.srcImg).scaledToWidth(800, Qt.SmoothTransformation))
        # DLL库
        self.dll = CDLL('Cold.dll')
        print(self.dll) 
Example #5
Source File: rest_settings_wt.py    From mindfulness-at-the-computer with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self):
        super().__init__()

        self.updating_gui_bool = False

        self.toggle_switch = ToggleSwitchWt()
        self.both_qrb = RadioButtonLeft(self.tr("Visual + Audio"))
        self.visual_qrb = RadioButtonMiddle(self.tr("Visual"))
        self.audio_qrb = RadioButtonRight(self.tr("Audio"))
        self.notification_interval_qsb = QtWidgets.QSpinBox()
        self.notif_select_audio_qpb = QtWidgets.QPushButton(self.tr("Select audio"))
        self.notif_volume_qsr = QtWidgets.QSlider()

        self.phrases_qlw = RestActionListWt()

        self._init_ui()
        self._connect_slots_to_signals() 
Example #6
Source File: question_5_example_code.py    From Mastering-GUI-Programming-with-Python with MIT License 5 votes vote down vote up
def __init__(self):
        super().__init__()
        self.setLayout(qtw.QVBoxLayout())

        # camera
        self.camera = qtmm.QCamera()

        # viewfinder
        cvf = qtmmw.QCameraViewfinder()
        self.camera.setViewfinder(cvf)
        self.layout().addWidget(cvf)

        # Form
        form = qtw.QFormLayout()
        self.layout().addLayout(form)

        # zoom
        zoomslider = qtw.QSlider(
            minimum=1,
            maximum=10,
            sliderMoved=self.on_slider_moved,
            orientation=qtc.Qt.Horizontal
        )
        form.addRow('Zoom', zoomslider)

        self.camera.start()
        self.show() 
Example #7
Source File: ui_dialog_view_image.py    From QualCoder with MIT License 5 votes vote down vote up
def setupUi(self, Dialog_view_image):
        Dialog_view_image.setObjectName("Dialog_view_image")
        Dialog_view_image.resize(1021, 715)
        self.gridLayout = QtWidgets.QGridLayout(Dialog_view_image)
        self.gridLayout.setObjectName("gridLayout")
        self.horizontalSlider = QtWidgets.QSlider(Dialog_view_image)
        self.horizontalSlider.setMinimum(9)
        self.horizontalSlider.setSingleStep(3)
        self.horizontalSlider.setProperty("value", 99)
        self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal)
        self.horizontalSlider.setTickPosition(QtWidgets.QSlider.TicksBelow)
        self.horizontalSlider.setTickInterval(10)
        self.horizontalSlider.setObjectName("horizontalSlider")
        self.gridLayout.addWidget(self.horizontalSlider, 3, 0, 1, 1)
        self.groupBox = QtWidgets.QGroupBox(Dialog_view_image)
        self.groupBox.setTitle("")
        self.groupBox.setObjectName("groupBox")
        self.gridLayout_2 = QtWidgets.QGridLayout(self.groupBox)
        self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
        self.gridLayout_2.setSpacing(0)
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.splitter = QtWidgets.QSplitter(self.groupBox)
        self.splitter.setOrientation(QtCore.Qt.Horizontal)
        self.splitter.setObjectName("splitter")
        self.scrollArea = QtWidgets.QScrollArea(self.splitter)
        self.scrollArea.setWidgetResizable(True)
        self.scrollArea.setObjectName("scrollArea")
        self.scrollAreaWidgetContents = QtWidgets.QWidget()
        self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 993, 562))
        self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
        self.scrollArea.setWidget(self.scrollAreaWidgetContents)
        self.gridLayout_2.addWidget(self.splitter, 0, 0, 1, 1)
        self.gridLayout.addWidget(self.groupBox, 2, 0, 1, 1)
        self.textEdit = QtWidgets.QTextEdit(Dialog_view_image)
        self.textEdit.setMaximumSize(QtCore.QSize(16777215, 80))
        self.textEdit.setObjectName("textEdit")
        self.gridLayout.addWidget(self.textEdit, 4, 0, 1, 1)

        self.retranslateUi(Dialog_view_image)
        QtCore.QMetaObject.connectSlotsByName(Dialog_view_image) 
Example #8
Source File: maya_widget.py    From 3D-Human-Body-Shape with MIT License 5 votes vote down vote up
def __init__(self, sliderID, orientation, parent=None):
    QtWidgets.QSlider.__init__(self, orientation, parent)
    self.sliderID = sliderID
    self.valueChanged.connect(self.valueChangeForwarder) 
Example #9
Source File: wavelet_gui.py    From wavelet_prosody_toolkit with MIT License 5 votes vote down vote up
def weight(self):
        groupBox = QtWidgets.QGroupBox("frequency / time resolution")
        groupBox.setToolTip("Interpolation between Mexican Hat wavelet (left) and Gaussian filter / scale-space (right).")
        self.weight = QtWidgets.QSlider(QtCore.Qt.Horizontal)
        self.weight.sliderReleased.connect(self.onWeightChanged)

        hbox = QtWidgets.QVBoxLayout()
        hbox.addWidget(self.weight)
        groupBox.setLayout(hbox)
        groupBox.setVisible(False)
        return groupBox 
Example #10
Source File: gui.py    From code-jam-5 with MIT License 5 votes vote down vote up
def __init__(self, settings):
        super(MainWindow, self).__init__()
        self.central_widget = QtWidgets.QWidget(self)
        self.main_layout = QtWidgets.QVBoxLayout(self.central_widget)
        self.image_label = QtWidgets.QLabel(self.central_widget)
        self.status_bar = QtWidgets.QStatusBar(self)
        self.image_slider = QtWidgets.QSlider(self.central_widget,
                                              orientation=QtCore.Qt.Horizontal)
        self.bottom_layout = QtWidgets.QHBoxLayout()

        self.move_year_left_button = QtWidgets.QPushButton()
        self.move_year_right_button = QtWidgets.QPushButton()

        self.button_layout = QtWidgets.QVBoxLayout()

        self.plot_button = QtWidgets.QPushButton()
        self.stop_button = QtWidgets.QPushButton(enabled=False)

        self.sdate_animate_layout = QtWidgets.QVBoxLayout()
        self.start_date_layout = QtWidgets.QHBoxLayout()

        self.start_year = QtWidgets.QSpinBox()
        self.start_month = QtWidgets.QComboBox()
        self.animate_button = QtWidgets.QPushButton(enabled=False)

        self.edate_pref_layout = QtWidgets.QVBoxLayout()
        self.end_date_layout = QtWidgets.QHBoxLayout()

        self.end_year = QtWidgets.QSpinBox()
        self.end_month = QtWidgets.QComboBox()
        self.preferences_button = QtWidgets.QPushButton()

        self.animate_timer = QtCore.QTimer()
        self.image_count = 0
        self.settings = settings 
Example #11
Source File: quick.py    From quick with GNU General Public License v3.0 5 votes vote down vote up
def to_widget(self, opt):
        value = QtWidgets.QSlider(QtCore.Qt.Horizontal)
        value.setMinimum(self.min)
        value.setMaximum(self.max)

        default_val = (self.min+self.max)//2
        if isinstance(opt.default, int):
            if self.min <= opt.default <= self.max:
                default_val = opt.default
        value.setValue(default_val)

        def to_command():
            return [opt.opts[0], str(value.value())]
        return [generate_label(opt), value], to_command 
Example #12
Source File: quick.py    From quick with GNU General Public License v3.0 5 votes vote down vote up
def __init_slider(self):
        slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
        slider.setMinimum(self.min)
        slider.setMaximum(self.max)
        default_val = (self.min+self.max)//2
        if isinstance(self.default, int):
            if self.min <= self.default <= self.max:
                default_val = self.default
        self.default = default_val
        slider.setValue(default_val)
        slider.valueChanged.connect(lambda x: self.label.setText(str(x)))
        return slider 
Example #13
Source File: QssQSlider.py    From PyQt with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(Window, self).__init__(*args, **kwargs)
        self.setAttribute(Qt.WA_StyledBackground, True)
        layout = QVBoxLayout(self)
        layout.addWidget(QSlider(Qt.Vertical, self))
        layout.addWidget(QSlider(Qt.Horizontal, self)) 
Example #14
Source File: PercentProgressBar.py    From PyQt with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(Window, self).__init__(*args, **kwargs)
        layout = QHBoxLayout(self)
        self._value = 0
        self._widgets = []
        self._timer = QTimer(self, timeout=self.updateValue)

        self._widgets.append(PercentProgressBar(self))
        layout.addWidget(self._widgets[0])

        self._widgets.append(PercentProgressBar(self, clockwise=False))
        layout.addWidget(self._widgets[1])

        self._widgets.append(PercentProgressBar(self, showPercent=False))
        layout.addWidget(self._widgets[2])

        self._widgets.append(PercentProgressBar(self, showFreeArea=True))
        layout.addWidget(self._widgets[3])

        self._widgets.append(PercentProgressBar(self, showSmallCircle=True))
        layout.addWidget(self._widgets[4])

        self._widgets.append(PercentProgressBar(self, styleSheet="""
            qproperty-textColor: rgb(255, 0, 0);
            qproperty-borderColor: rgb(0, 255, 0);
            qproperty-backgroundColor: rgb(0, 0, 255);
        """))
        layout.addWidget(self._widgets[5])

        rWidget = QWidget(self)
        layout.addWidget(rWidget)
        vlayout = QVBoxLayout(rWidget)
        self.staticPercentProgressBar = PercentProgressBar(self)
        self.staticPercentProgressBar.showFreeArea = True
        self.staticPercentProgressBar.ShowSmallCircle = True
        vlayout.addWidget(self.staticPercentProgressBar)
        vlayout.addWidget(QSlider(self, minimum=0, maximum=100, orientation=Qt.Horizontal,
                                  valueChanged=self.staticPercentProgressBar.setValue))

        self._timer.start(100) 
Example #15
Source File: qt.py    From xrt with MIT License 5 votes vote down vote up
def setValue(self, value):
        QSlider.setValue(self, int(value*self.scale)) 
Example #16
Source File: qt.py    From xrt with MIT License 5 votes vote down vote up
def setRange(self, start, end, step):
        if step == 0:
            return
        self.scale = 1. / step
        QSlider.setRange(self, start / step, end / step) 
Example #17
Source File: equalizer10.py    From linux-show-player with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.setLayout(QVBoxLayout())
        self.layout().setAlignment(Qt.AlignTop)

        self.groupBox = QGroupBox(self)
        self.groupBox.resize(self.size())
        self.groupBox.setTitle(
            translate('Equalizer10Settings', '10 Bands Equalizer (IIR)'))
        self.groupBox.setLayout(QGridLayout())
        self.groupBox.layout().setVerticalSpacing(0)
        self.layout().addWidget(self.groupBox)

        self.sliders = {}

        for n in range(10):
            label = QLabel(self.groupBox)
            label.setMinimumWidth(QFontMetrics(label.font()).width('000'))
            label.setAlignment(QtCore.Qt.AlignCenter)
            label.setNum(0)
            self.groupBox.layout().addWidget(label, 0, n)

            slider = QSlider(self.groupBox)
            slider.setRange(-24, 12)
            slider.setPageStep(1)
            slider.setValue(0)
            slider.setOrientation(QtCore.Qt.Vertical)
            slider.valueChanged.connect(label.setNum)
            self.groupBox.layout().addWidget(slider, 1, n)
            self.groupBox.layout().setAlignment(slider, QtCore.Qt.AlignHCenter)
            self.sliders['band' + str(n)] = slider

            fLabel = QLabel(self.groupBox)
            fLabel.setStyleSheet('font-size: 8pt;')
            fLabel.setAlignment(QtCore.Qt.AlignCenter)
            fLabel.setText(self.FREQ[n])
            self.groupBox.layout().addWidget(fLabel, 2, n) 
Example #18
Source File: QtShim.py    From grap with MIT License 5 votes vote down vote up
def get_QSlider():
    """QSlider getter."""

    try:
        import PySide.QtGui as QtGui
        return QtGui.QSlider
    except ImportError:
        import PyQt5.QtWidgets as QtWidgets
        return QtWidgets.QSlider 
Example #19
Source File: MainWindow.py    From 3d-nii-visualizer with MIT License 5 votes vote down vote up
def add_brain_settings_widget(self):
        brain_group_box = QtWidgets.QGroupBox("Brain Settings")
        brain_group_layout = QtWidgets.QGridLayout()
        brain_group_layout.addWidget(QtWidgets.QLabel("Brain Threshold"), 0, 0)
        brain_group_layout.addWidget(QtWidgets.QLabel("Brain Opacity"), 1, 0)
        brain_group_layout.addWidget(QtWidgets.QLabel("Brain Smoothness"), 2, 0)
        brain_group_layout.addWidget(QtWidgets.QLabel("Image Intensity"), 3, 0)
        brain_group_layout.addWidget(self.brain_threshold_sp, 0, 1, 1, 2)
        brain_group_layout.addWidget(self.brain_opacity_sp, 1, 1, 1, 2)
        brain_group_layout.addWidget(self.brain_smoothness_sp, 2, 1, 1, 2)
        brain_group_layout.addWidget(self.brain_lut_sp, 3, 1, 1, 2)
        brain_group_layout.addWidget(self.brain_projection_cb, 4, 0)
        brain_group_layout.addWidget(self.brain_slicer_cb, 4, 1)
        brain_group_layout.addWidget(self.create_new_separator(), 5, 0, 1, 3)
        brain_group_layout.addWidget(QtWidgets.QLabel("Axial Slice"), 6, 0)
        brain_group_layout.addWidget(QtWidgets.QLabel("Coronal Slice"), 7, 0)
        brain_group_layout.addWidget(QtWidgets.QLabel("Sagittal Slice"), 8, 0)

        # order is important
        slicer_funcs = [self.axial_slice_changed, self.coronal_slice_changed, self.sagittal_slice_changed]
        current_label_row = 6
        # data extent is array [xmin, xmax, ymin, ymax, zmin, zmax)
        # we want all the max values for the range
        extent_index = 5
        for func in slicer_funcs:
            slice_widget = QtWidgets.QSlider(Qt.Qt.Horizontal)
            slice_widget.setDisabled(True)
            self.slicer_widgets.append(slice_widget)
            brain_group_layout.addWidget(slice_widget, current_label_row, 1, 1, 2)
            slice_widget.valueChanged.connect(func)
            slice_widget.setRange(self.brain.extent[extent_index - 1], self.brain.extent[extent_index])
            slice_widget.setValue(self.brain.extent[extent_index] / 2)
            current_label_row += 1
            extent_index -= 2

        brain_group_box.setLayout(brain_group_layout)
        self.grid.addWidget(brain_group_box, 0, 0, 1, 2) 
Example #20
Source File: preferences.py    From imperialism-remake with GNU General Public License v3.0 5 votes vote down vote up
def _layout_widget_preferences_music(self):
        """
        Create music options widget.
        """
        tab = QtWidgets.QWidget()
        tab_layout = QtWidgets.QVBoxLayout(tab)

        # soundtrack section
        layout = QtWidgets.QVBoxLayout()

        # mute checkbox
        checkbox = QtWidgets.QCheckBox('Mute soundtrack')
        self._register_check_box(checkbox, constants.Option.SOUNDTRACK_MUTE)
        layout.addWidget(checkbox)

        # volume slide
        layout.addWidget(QtWidgets.QLabel('Volume'))
        slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
        slider.setTickInterval(25)
        slider.setTickPosition(QtWidgets.QSlider.TicksBelow)
        slider.setMaximumWidth(100)
        self._register_slider(slider, constants.Option.SOUNDTRACK_VOLUME)
        layout.addWidget(slider)

        # wrap in group box and add to tab
        tab_layout.addWidget(qt.wrap_in_groupbox(layout, 'Soundtrack'))

        # vertical stretch
        tab_layout.addStretch()

        # add tab
        self.tab_music = tab
        self.stacked_layout.addWidget(tab) 
Example #21
Source File: mainwindow.py    From hypers with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1243, 458)
        MainWindow.setStyleSheet("%background: #161616")
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName("gridLayout")
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.imagewin = ImageView(self.centralwidget)
        self.imagewin.setObjectName("imagewin")
        self.horizontalLayout_2.addWidget(self.imagewin)
        self.specwin = PlotWidget(self.centralwidget)
        self.specwin.setObjectName("specwin")
        self.horizontalLayout_2.addWidget(self.specwin)
        self.horizontalLayout_2.setStretch(0, 40)
        self.horizontalLayout_2.setStretch(1, 60)
        self.gridLayout.addLayout(self.horizontalLayout_2, 1, 0, 1, 1)
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.slider = QtWidgets.QSlider(self.centralwidget)
        self.slider.setMaximum(10)
        self.slider.setPageStep(1)
        self.slider.setOrientation(QtCore.Qt.Horizontal)
        self.slider.setObjectName("slider")
        self.horizontalLayout_3.addWidget(self.slider)
        self.updateSpectrum = QtWidgets.QPushButton(self.centralwidget)
        self.updateSpectrum.setObjectName("updateSpectrum")
        self.horizontalLayout_3.addWidget(self.updateSpectrum)
        self.updateImage = QtWidgets.QPushButton(self.centralwidget)
        self.updateImage.setObjectName("updateImage")
        self.horizontalLayout_3.addWidget(self.updateImage)
        self.Reset = QtWidgets.QPushButton(self.centralwidget)
        self.Reset.setObjectName("Reset")
        self.horizontalLayout_3.addWidget(self.Reset)
        self.gridLayout.addLayout(self.horizontalLayout_3, 2, 0, 1, 1)
        self.gridLayout.setRowStretch(1, 95)
        self.gridLayout.setRowStretch(2, 5)
        MainWindow.setCentralWidget(self.centralwidget)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow) 
Example #22
Source File: slice_view.py    From spimagine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
def __init__(self, parent=None, interpolation="linear", **kwargs):
        super(SliceWidget, self).__init__(parent, **kwargs)

        self.myparent = parent

        self.glSliceWidget = GLSliceWidget(self, interpolation=interpolation)

        self.checkSlice = createTristateCheckbox(self, absPath("images/icon_x.png"),
                                                 absPath("images/icon_y.png"),
                                                 absPath("images/icon_z.png"))

        self.sliderSlice = QtWidgets.QSlider(QtCore.Qt.Horizontal, self)
        self.sliderSlice.setTickPosition(QtWidgets.QSlider.TicksBothSides)
        self.sliderSlice.setTickInterval(1)
        self.sliderSlice.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.sliderSlice.setFocusPolicy(QtCore.Qt.WheelFocus)

        self.sliderSlice.setTracking(True)

        self.setFocusPolicy(QtCore.Qt.NoFocus)

        self.spinSlice = QtWidgets.QSpinBox(self)
        self.spinSlice.setStyleSheet("color:white;")
        self.spinSlice.setButtonSymbols(QtWidgets.QAbstractSpinBox.NoButtons)
        self.spinSlice.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.spinSlice.setAttribute(QtCore.Qt.WA_MacShowFocusRect, 0)

        self.sliderSlice.valueChanged.connect(self.spinSlice.setValue)
        self.spinSlice.valueChanged.connect(self.sliderSlice.setValue)

        self.setStyleSheet("""
        background-color:black;
        color:white;
        """)

        hbox = QtWidgets.QHBoxLayout()
        hbox.addWidget(self.checkSlice)

        hbox.addWidget(self.sliderSlice)
        hbox.addWidget(self.spinSlice)

        vbox = QtWidgets.QVBoxLayout()
        vbox.addWidget(self.glSliceWidget)
        vbox.addLayout(hbox)

        vbox.setSpacing(1)
        hbox.setSpacing(11)

        self.setLayout(vbox)

        self.glSliceWidget._dataModelChanged.connect(self.dataModelChanged)

        self.setTransform(TransformModel())
        self.sliderSlice.setFocus()


        # self.refresh() 
Example #23
Source File: ai.py    From crazyflie-clients-python with GNU General Public License v2.0 4 votes vote down vote up
def initUI(self):
            vbox = QtWidgets.QVBoxLayout()

            sld = QtWidgets.QSlider(QtCore.Qt.Horizontal, self)
            sld.setFocusPolicy(QtCore.Qt.NoFocus)
            sld.setRange(0, 3600)
            sld.setValue(1800)
            vbox.addWidget(sld)

            self.wid = AttitudeIndicator()

            sld.valueChanged[int].connect(self.updateRoll)
            vbox.addWidget(self.wid)

            hbox = QtWidgets.QHBoxLayout()
            hbox.addLayout(vbox)

            sldPitch = QtWidgets.QSlider(QtCore.Qt.Vertical, self)
            sldPitch.setFocusPolicy(QtCore.Qt.NoFocus)
            sldPitch.setRange(0, 180)
            sldPitch.setValue(90)
            sldPitch.valueChanged[int].connect(self.updatePitch)
            hbox.addWidget(sldPitch)

            sldHeight = QtWidgets.QSlider(QtCore.Qt.Vertical, self)
            sldHeight.setFocusPolicy(QtCore.Qt.NoFocus)
            sldHeight.setRange(-200, 200)
            sldHeight.setValue(0)
            sldHeight.valueChanged[int].connect(self.updateBaro)

            sldT = QtWidgets.QSlider(QtCore.Qt.Vertical, self)
            sldT.setFocusPolicy(QtCore.Qt.NoFocus)
            sldT.setRange(-200, 200)
            sldT.setValue(0)
            sldT.valueChanged[int].connect(self.updateTarget)

            hbox.addWidget(sldT)
            hbox.addWidget(sldHeight)

            self.setLayout(hbox)

            self.setGeometry(50, 50, 510, 510)
            self.setWindowTitle('Attitude Indicator')
            self.show() 
Example #24
Source File: wavelet_gui.py    From wavelet_prosody_toolkit with MIT License 4 votes vote down vote up
def setF0Limits(self):
        """Setup the F0 limits area

        Parameters
        ----------
        self: SigWindow
            The current window object

        Returns
        -------
        groupBox: QGroupBox
            The groupbox containing all the controls needed for F0 limit definition
        """

        # Min F0
        self.min_f0 = QtWidgets.QLineEdit("min F0")
        self.min_f0.setText(str(self.configuration["f0"]["min_f0"]))
        self.min_f0.setInputMask("000")
        self.min_f0.textChanged.connect(self.onF0Changed)

        # Max F0
        self.max_f0 = QtWidgets.QLineEdit("min F0")
        self.max_f0.setText(str(self.configuration["f0"]["max_f0"]))
        self.max_f0.setInputMask("000")
        self.max_f0.textChanged.connect(self.onF0Changed)

        # Voicing
        self.voicing = QtWidgets.QSlider(QtCore.Qt.Horizontal)
        self.voicing.setSliderPosition(self.configuration["f0"]["voicing_threshold"])
        self.voicing.valueChanged.connect(self.onF0Changed)

        # Harmonics
        self.harmonics = QtWidgets.QSlider(QtCore.Qt.Horizontal)
        self.harmonics.setSliderPosition(50)
        self.harmonics.setVisible(False)
        # self.harmonics.valueChanged.connect(self.onF0Changed)

        # Setup groupbox
        hbox = QtWidgets.QVBoxLayout()
        hbox.addWidget(self.min_f0)
        hbox.addWidget(self.max_f0)
        hbox.addWidget(self.voicing)
        # hbox.addWidget(self.harmonics)

        groupBox = QtWidgets.QGroupBox("minF0, maxF0, voicing threshold")  # , harmonics")
        # groupBox.setMaximumSize(200,200)
        groupBox.setLayout(hbox)
        groupBox.setToolTip("min and max Hz of the speaker's f0 range, voicing threshold")

        return groupBox 
Example #25
Source File: optionwidgets.py    From kawaii-player with GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, parent, uiwidget, home_dir, mw):
        super(MySlider, self).__init__(parent)
        global home, ui, MainWindow
        ui = uiwidget
        home = home_dir
        MainWindow = mw
        self.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        version = QtCore.QT_VERSION_STR
        self.version = tuple([int(i) for i in version.split('.')])
        if self.version >= (5, 9, 0):
            self.tooltip = MyToolTip(ui)
        else:
            self.tooltip = None
        self.parent = parent
        self.preview_process = QtCore.QProcess()
        self.counter = 0
        self.preview_pending = []
        self.lock = False
        self.preview_counter = 0
        self.mousemove = False
        #self.tooltip_widget = ToolTipWidget(ui, parent)
        self.tooltip_widget = QtWidgets.QWidget(MainWindow)
        self.v = QtWidgets.QVBoxLayout(self.tooltip_widget)
        self.v.setContentsMargins(0, 0, 0, 0)
        self.pic = QLabelPreview(self)
        self.pic.set_globals(ui)
        self.pic.setScaledContents(True)
        self.v.insertWidget(0, self.pic)
        self.txt = QtWidgets.QLabel(self)
        self.v.insertWidget(1, self.txt)
        self.txt.setAlignment(QtCore.Qt.AlignCenter)
        self.tooltip_widget.setMouseTracking(True)
        self.tooltip_widget.hide()
        self.txt.setStyleSheet('color:white;background:black;')
        self.tooltip_timer = QtCore.QTimer()
        self.tooltip_timer.timeout.connect(self.update_tooltip)
        self.tooltip_timer.setSingleShot(True)
        self.final_url = None
        self.half_size = int(ui.label.maximumWidth()/2)
        self.upper_limit = self.parent.x() + self.parent.width()
        self.lower_limit = self.parent.x()
        self.file_type = 'video'
        self.enter = False
        self.empty_preview_dir = False
        self.check_dimension_again = False
        self.preview_dir = None
        self.time_format = lambda val: time.strftime('%H:%M:%S', time.gmtime(int(val)))
        self.preview_lock = Lock()
        #self.setTickPosition(QtWidgets.QSlider.TickPosition.TicksAbove)
        #self.setTickInterval(100)
        self.valueChanged.connect(self.set_value)
        locale.setlocale(locale.LC_NUMERIC, 'C')
        self.mpv = MPV(vo="image", ytdl="no", quiet=True, aid="no", sid="no", frames=1, idle=True)
        self.preview_thread_list = []
        self.final_point = (0, 0)
        self.ui = ui 
Example #26
Source File: ui_dialog_code_image.py    From QualCoder with MIT License 4 votes vote down vote up
def setupUi(self, Dialog_code_image):
        Dialog_code_image.setObjectName("Dialog_code_image")
        Dialog_code_image.resize(1021, 715)
        self.gridLayout = QtWidgets.QGridLayout(Dialog_code_image)
        self.gridLayout.setObjectName("gridLayout")
        self.horizontalSlider = QtWidgets.QSlider(Dialog_code_image)
        self.horizontalSlider.setMinimum(9)
        self.horizontalSlider.setSingleStep(3)
        self.horizontalSlider.setProperty("value", 99)
        self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal)
        self.horizontalSlider.setTickPosition(QtWidgets.QSlider.TicksBelow)
        self.horizontalSlider.setTickInterval(10)
        self.horizontalSlider.setObjectName("horizontalSlider")
        self.gridLayout.addWidget(self.horizontalSlider, 4, 0, 1, 1)
        self.groupBox_2 = QtWidgets.QGroupBox(Dialog_code_image)
        self.groupBox_2.setMinimumSize(QtCore.QSize(0, 80))
        self.groupBox_2.setMaximumSize(QtCore.QSize(16777215, 80))
        self.groupBox_2.setTitle("")
        self.groupBox_2.setObjectName("groupBox_2")
        self.pushButton_memo = QtWidgets.QPushButton(self.groupBox_2)
        self.pushButton_memo.setGeometry(QtCore.QRect(20, 40, 141, 32))
        self.pushButton_memo.setObjectName("pushButton_memo")
        self.pushButton_select = QtWidgets.QPushButton(self.groupBox_2)
        self.pushButton_select.setGeometry(QtCore.QRect(10, 0, 201, 32))
        self.pushButton_select.setObjectName("pushButton_select")
        self.label_coder = QtWidgets.QLabel(self.groupBox_2)
        self.label_coder.setGeometry(QtCore.QRect(360, 10, 301, 21))
        self.label_coder.setObjectName("label_coder")
        self.checkBox_show_coders = QtWidgets.QCheckBox(self.groupBox_2)
        self.checkBox_show_coders.setGeometry(QtCore.QRect(690, 10, 221, 22))
        self.checkBox_show_coders.setObjectName("checkBox_show_coders")
        self.label_code = QtWidgets.QLabel(self.groupBox_2)
        self.label_code.setGeometry(QtCore.QRect(360, 40, 521, 26))
        self.label_code.setObjectName("label_code")
        self.gridLayout.addWidget(self.groupBox_2, 0, 0, 1, 1)
        self.groupBox = QtWidgets.QGroupBox(Dialog_code_image)
        self.groupBox.setTitle("")
        self.groupBox.setObjectName("groupBox")
        self.gridLayout_2 = QtWidgets.QGridLayout(self.groupBox)
        self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
        self.gridLayout_2.setSpacing(0)
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.splitter = QtWidgets.QSplitter(self.groupBox)
        self.splitter.setOrientation(QtCore.Qt.Horizontal)
        self.splitter.setObjectName("splitter")
        self.treeWidget = QtWidgets.QTreeWidget(self.splitter)
        self.treeWidget.setObjectName("treeWidget")
        self.treeWidget.headerItem().setText(0, "1")
        self.scrollArea = QtWidgets.QScrollArea(self.splitter)
        self.scrollArea.setWidgetResizable(True)
        self.scrollArea.setObjectName("scrollArea")
        self.graphicsView = QtWidgets.QGraphicsView()
        self.graphicsView.setGeometry(QtCore.QRect(0, 0, 330, 582))
        self.graphicsView.setObjectName("graphicsView")
        self.scrollArea.setWidget(self.graphicsView)
        self.gridLayout_2.addWidget(self.splitter, 0, 0, 1, 1)
        self.gridLayout.addWidget(self.groupBox, 3, 0, 1, 1)

        self.retranslateUi(Dialog_code_image)
        QtCore.QMetaObject.connectSlotsByName(Dialog_code_image) 
Example #27
Source File: suspend_time_dlg.py    From mindfulness-at-the-computer with GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, i_parent=None):
        super(SuspendTimeDialog, self).__init__(i_parent)

        self.setModal(True)

        self.updating_gui_bool = False

        vbox_l2 = QtWidgets.QVBoxLayout(self)

        self.suspend_time_qsr = QtWidgets.QSlider(self)
        self.suspend_time_qsr.setOrientation(QtCore.Qt.Horizontal)
        self.suspend_time_qsr.setMinimum(SLIDER_MIN_MINUTES_INT)
        self.suspend_time_qsr.setMaximum(SLIDER_MAX_MINUTES_INT)
        self.suspend_time_qsr.setTickPosition(QtWidgets.QSlider.TicksBelow)
        self.suspend_time_qsr.setTickInterval(30)
        self.suspend_time_qsr.setFixedWidth(320)
        # self.suspend_time_qsr.setSingleStep(5)
        self.suspend_time_qsr.setPageStep(30)
        self.suspend_time_qsr.setValue(DEFAULT_SUSPEND_MINUTES_INT)
        self.suspend_time_qsr.valueChanged.connect(self.on_suspend_time_slider_value_changed)
        vbox_l2.addWidget(self.suspend_time_qsr)

        self.suspend_time_qll = QtWidgets.QLabel()
        self.suspend_time_qll.setFont(mc.mc_global.get_font_large())
        self.suspend_time_qll.setWordWrap(True)
        vbox_l2.addWidget(self.suspend_time_qll)

        self.help_qll= QtWidgets.QLabel(
            "To resume after having suspended the application, drag the slider to the far left"
        )
        self.help_qll.setWordWrap(True)
        vbox_l2.addWidget(self.help_qll)

        self.button_box = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel,
            QtCore.Qt.Horizontal,
            self
        )
        vbox_l2.addWidget(self.button_box)
        self.button_box.accepted.connect(self.accept)
        self.button_box.rejected.connect(self.reject)
        # -accept and reject are "slots" built into Qt

        self.update_gui()