Exemplo n.º 1
0
class Window(QWidget):
    def __init__(self):
        super().__init__()
        self.title = "PyQt5 Scroll Bar"
        self.top = 200
        self.left = 500
        self.width = 400
        self.height = 300

        self.setWindowIcon(QtGui.QIcon("avatar.png"))
        self.setWindowTitle(self.title)
        self.setGeometry(self.left, self.top, self.width, self.height)

        vbox = QVBoxLayout()
        self.label = QLabel(self)
        self.label.setFont(QtGui.QFont("Sanserif", 15))
        self.dial = QDial()
        self.dial.setMaximum(0)
        self.dial.setMaximum(100)
        self.dial.setValue(30)
        self.dial.valueChanged.connect(self.dialer_changed)
        vbox.addWidget(self.dial)
        vbox.addWidget(self.label)
        self.setLayout(vbox)
        self.show()

    def dialer_changed(self):
        getValue = self.dial.value()
        self.label.setText(" Dialer Value : " + str(getValue))
Exemplo n.º 2
0
    def setValue(self, value, emitSignal=False):
        if self.fRealValue == value or isnan(value):
            return

        if value <= self.fMinimum:
            qtValue = 0
            self.fRealValue = self.fMinimum

        elif value >= self.fMaximum:
            qtValue = self.fPrecision
            self.fRealValue = self.fMaximum

        else:
            qtValue = round(
                float(value - self.fMinimum) /
                float(self.fMaximum - self.fMinimum) * self.fPrecision)
            self.fRealValue = value

        # Block change signal, we'll handle it ourselves
        self.blockSignals(True)
        QDial.setValue(self, qtValue)
        self.blockSignals(False)

        if emitSignal:
            self.realValueChanged.emit(self.fRealValue)
Exemplo n.º 3
0
class MyApp(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()
    
    def initUI(self):
        self.slider = QSlider(Qt.Horizontal, self)
        self.slider.move(30, 30) # 슬라이더 위치는 x축 30, y축 30 떨어진 곳에
        self.slider.setRange(0, 50) # 슬라이더 범위
        self.slider.setSingleStep(2) # 슬라이더는 하나로만 잡고(SingleStep) 2씩 증가!
        
        self.dial = QDial(self)
        self.dial.move(30, 50) # 슬라이더 보다 아래쪽에 위치 
        self.dial.setRange(0, 50) # 슬라이더와 동일한 범위

        btn = QPushButton('Default', self)
        btn.move(35, 160) 
        
        self.slider.valueChanged.connect(self.dial.setValue)
        # 슬라이더 쪽에 변화가 일어난 후, 다이얼값이 슬라이더와 동일하게 발생할 수 있도록!
        # => 슬라이더가 움직이면 다이얼도 움직이도록 하는 것!
        # valueChanged() : 슬라이더 값이 변할 때 발생!
        self.dial.valueChanged.connect(self.slider.setValue)
        btn.clicked.connect(self.button_clicked)
        
        self.setWindowTitle('QSlider and QDial')
        self.setGeometry(300, 300, 400, 200)
        self.show()
        
    def button_clicked(self):
        self.slider.setValue(0)
        self.dial.setValue(0) #버튼 누르면 초기화 시키려고 값을 0으로 줌!
Exemplo n.º 4
0
class Window(QWidget):
    def __init__(self, val):
        super().__init__()

        self.title = "QDial"
        self.top = 100
        self.left = 100
        self.width = 400
        self.height = 120
        self.iconName = "logo.png"

        self.setWindowTitle(self.title)
        self.setWindowIcon(QtGui.QIcon(self.iconName))
        self.setGeometry(self.left, self.top, self.width, self.height)

        vbox = QVBoxLayout()

        self.label = QLabel(self)
        self.label.setFont(QtGui.QFont("Elephant", 10))

        self.dial = QDial()
        self.dial.setMinimum(0)
        self.dial.setMaximum(100)
        self.dial.setValue(30)
        self.dial.valueChanged.connect(self.dial_change)

        vbox.addWidget(self.dial)
        vbox.addWidget(self.label)
        self.setLayout(vbox)

        self.show()

    def dial_change(self):
        getvalue = self.dial.value()
        self.label.setText("Dial is changed to " + str(getvalue))
Exemplo n.º 5
0
class Window(QWidget):
    def __init__(self):
        super().__init__()
        self.title = "Pyqt5 QDial"
        self.top = 500
        self.left = 500
        self.width = 600
        self.height = 200
        self.iconName = "transistor.jpg"
        self.setWindowIcon(QtGui.QIcon(self.iconName))
        self.setWindowTitle(self.title)
        self.setGeometry(self.left, self.top, self.width, self.height)
        vbox = QVBoxLayout()

        self.label = QLabel(self)
        self.label.setFont(QtGui.QFont("Sanserif", 15))
        self.dial = QDial()
        self.dial.setMinimum(0)
        self.dial.setMaximum(1000)
        self.dial.setValue(30)
        self.dial.valueChanged.connect(self.dial_changed)
        vbox.addWidget(self.label)
        vbox.addWidget(self.dial)
        self.setLayout(vbox)

        self.show()

    def dial_changed(self):
        getValue = self.dial.value()
        self.label.setText(f'Dial is Changing: {getValue}')
class MyApp(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()
        pass

    def initUI(self):
        self.slider = QSlider(Qt.Horizontal, self)
        self.slider.move(30, 30)
        self.slider.setRange(0, 50)
        self.slider.setSingleStep(2)

        self.dial = QDial(self)
        self.dial.move(30, 50)
        self.dial.setRange(0, 50)

        button = QPushButton('Default', self)
        button.move(35, 160)

        self.slider.valueChanged.connect(self.dial.setValue)
        self.dial.valueChanged.connect(self.slider.setValue)
        button.clicked.connect(self.button_clicked)

        self.setWindowTitle('QSlider and QDial')
        self.setGeometry(300, 300, 400, 200)
        self.show()
        pass

    def button_clicked(self):
        self.slider.setValue(0)
        self.dial.setValue(0)
        pass

    pass
Exemplo n.º 7
0
    def createBottomRightGroupBox(self):
        self.bottomRightGroupBox = QGroupBox("Group 3")
        self.bottomRightGroupBox.setCheckable(True)
        self.bottomRightGroupBox.setChecked(True)

        lineEdit = QLineEdit('s3cRe7')
        lineEdit.setEchoMode(QLineEdit.Password)

        spinBox = QSpinBox(self.bottomRightGroupBox)
        spinBox.setValue(50)

        dateTimeEdit = QDateTimeEdit(self.bottomRightGroupBox)
        dateTimeEdit.setDateTime(QDateTime.currentDateTime())

        slider = QSlider(Qt.Horizontal, self.bottomRightGroupBox)
        slider.setValue(40)

        scrollBar = QScrollBar(Qt.Horizontal, self.bottomRightGroupBox)
        scrollBar.setValue(60)

        dial = QDial(self.bottomRightGroupBox)
        dial.setValue(30)
        dial.setNotchesVisible(True)

        layout = QGridLayout()
        layout.addWidget(lineEdit, 0, 0, 1, 2)
        layout.addWidget(spinBox, 1, 0, 1, 2)
        layout.addWidget(dateTimeEdit, 2, 0, 1, 2)
        layout.addWidget(slider, 3, 0)
        layout.addWidget(scrollBar, 4, 0)
        layout.addWidget(dial, 3, 1, 2, 1)
        layout.setRowStretch(5, 1)
        self.bottomRightGroupBox.setLayout(layout)
Exemplo n.º 8
0
def group4(window):
    groupbox = QGroupBox("Group 3")
    groupbox.setCheckable(True)
    groupbox.setChecked(True)

    input = QLineEdit("firmanslur", window)
    input.setEchoMode(QLineEdit.Password)

    spin = QSpinBox(window)
    spin.setValue(50)

    tanggal = QDateTimeEdit(window)
    tanggal.setDateTime(QDateTime.currentDateTime())

    slider = QSlider(Qt.Horizontal, window)
    slider.setValue(50)

    scrollBar = QScrollBar(Qt.Horizontal, window)
    scrollBar.setValue(60)

    dial = QDial(window)
    dial.setValue(30)
    dial.setNotchesVisible(True)

    layout = QGridLayout()
    layout.addWidget(input, 0, 0, 1, 2)
    layout.addWidget(spin, 1, 0, 1, 2)
    layout.addWidget(tanggal, 2, 0, 1, 2)
    layout.addWidget(slider, 3, 0)
    layout.addWidget(scrollBar, 4, 0)
    layout.addWidget(dial, 3, 1, 2, 1)
    layout.setRowStretch(5, 1)
    groupbox.setLayout(layout)
    return groupbox
class Form(QWidget):
    def __init__(self):
        QWidget.__init__(self, flags=Qt.Widget)
        self.le = QLineEdit()
        self.dial = QDial()
        self.sld = CustomSlider(Qt.Horizontal)

        self.init_widget()

    def init_widget(self):
        self.setWindowTitle("Custom Slot")
        form_lbx = QBoxLayout(QBoxLayout.TopToBottom, parent=self)
        control_lbx = QBoxLayout(QBoxLayout.LeftToRight, parent=self)
        self.setLayout(form_lbx)

        self.le.setMaximumWidth(40)

        # 시그널 슬롯 연결
        self.sld.valueChanged.connect(self.valueChanged)
        self.le.textChanged.connect(self.sld.setValue)
        self.dial.valueChanged.connect(self.sld.setValue)

        form_lbx.addWidget(self.dial)
        form_lbx.addLayout(control_lbx)
        control_lbx.addWidget(self.sld)
        control_lbx.addWidget(self.le)

    @pyqtSlot(int, name="valueChanged")
    def value_changed(self, value):
        self.le.setText(str(value))
        self.dial.setValue(value)
Exemplo n.º 10
0
class KnobsLedpanel(QWidget):
    def __init__(self, parent=None, device=None):
        super(KnobsLedpanel, self).__init__(parent)

        layout = QHBoxLayout()
        self.knob_yellow_led = QDial()
        self.knob_blue_led = QDial()

        self.knob_yellow_led.setMinimum(0)
        self.knob_yellow_led.setMaximum(255)
        self.knob_yellow_led.setValue(0)
        self.knob_yellow_led.sliderReleased.connect(self.yellow_sliderMoved)

        self.knob_blue_led.setMinimum(0)
        self.knob_blue_led.setMaximum(255)
        self.knob_blue_led.setValue(0)
        self.knob_blue_led.sliderReleased.connect(self.blue_sliderMoved)

        layout.addSpacing(15)
        layout.addWidget(self.knob_yellow_led)
        layout.addWidget(self.knob_blue_led)
        self.setLayout(layout)
        # self.setGeometry(10, 10, 350, 250)

        self.device = device

    def yellow_sliderMoved(self):
        self.device.wr_cmd(f"yled.intensity({self.knob_yellow_led.value()})")
        print(f"Yellow Led intensity: {self.knob_yellow_led.value()}")

    def blue_sliderMoved(self):
        self.device.wr_cmd(f"bled.intensity({self.knob_blue_led.value()})")
        print(f"Blue Led intensity: {self.knob_blue_led.value()}")
Exemplo n.º 11
0
class MyApp(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):
        self.slider = QSlider(Qt.Horizontal, self)
        #수평 슬라이더 생성, 생성시킬때 수평, 수직 설정. 상수는 Qt가 갖고있으니 임포트 해옴
        self.slider.move(30, 30)
        self.slider.setRange(0, 50)
        self.slider.setSingleStep(2)
        # 싱글스탭 으로 하고 간격은 2

        self.dial = QDial(self)  #다이얼 객체 생성
        self.dial.move(30, 50)
        self.dial.setRange(0, 50)  #다이얼 범위 지적

        btn = QPushButton('Default', self)
        btn.move(35, 160)

        self.slider.valueChanged.connect(
            self.dial.setValue)  #슬라이더 값 변화 일어난 후 다이얼 값도 동일하게(내장함수임)
        self.dial.valueChanged.connect(
            self.slider.setValue)  #다이얼의 값 변화가 일어난 후 슬라이더값도 동일하게(내장함수, 직접설정)
        btn.clicked.connect(self.button_clicked)

        self.setWindowTitle('QSlider and QDial')
        self.setGeometry(300, 300, 400, 200)
        self.show()

    def button_clicked(self):
        self.slider.setValue(0)
        self.dial.setValue(0)
Exemplo n.º 12
0
class Window(QWidget):
    def __init__(self):
        super().__init__()

        self.title = "PyQt5 - QDial"
        self.left = 500
        self.top = 200
        self.width = 200
        self.height = 200
        self.iconName = "_imagens/mouse.ico"

        self.setWindowTitle(self.title)
        self.setWindowIcon(QtGui.QIcon(self.iconName))
        self.setGeometry(self.left, self.top, self.width, self.height)

        vbox = QVBoxLayout()

        self.label = QLabel()
        self.label.setFont(QtGui.QFont("Sanserif", 15))

        self.dial = QDial()
        self.dial.setMinimum(0)
        self.dial.setMaximum(100)
        self.dial.setValue(30)
        self.dial.valueChanged.connect(self.dial_changed)

        vbox.addWidget(self.dial)
        vbox.addWidget(self.label)
        self.setLayout(vbox)

        self.show()

    def dial_changed(self):
        getValue = self.dial.value()
        self.label.setText("Dial changed to " + str(getValue))
Exemplo n.º 13
0
    def createTopRightGroupBox(self):
        self.topRightGroupBox = QGroupBox("Group 2")
        togglePushButton = QPushButton("Toggle Push Button")
        togglePushButton.setCheckable(True)
        togglePushButton.setChecked(True)

        slider = QSlider(Qt.Horizontal, self.RadiiScaleGroupBox)
        slider.setValue(40)

        scrollBar = QScrollBar(Qt.Horizontal, self.RadiiScaleGroupBox)
        scrollBar.setValue(60)

        dial = QDial(self.RadiiScaleGroupBox)
        dial.setValue(30)
        dial.setNotchesVisible(True)

        layout = QVBoxLayout()
        layout.addWidget(self.openFileNameButton)
        layout.addWidget(togglePushButton)
        layout.addWidget(self.flatPushButton)

        layout.addWidget(slider)
        layout.addWidget(scrollBar)
        layout.addWidget(dial)

        layout.addStretch(1)
        self.topRightGroupBox.setLayout(layout)
class MyMainWindow(QMainWindow):
    def __init__(self, ch=0, parent=None, name="Temperatur Simulation"):
        super().__init__(parent)
        self.setWindowTitle(name)
        self.__channel = ch

        cw = QWidget(self)
        layout = QVBoxLayout(cw)

        self.setCentralWidget(cw)
        self.__label = QLabel("Temperatur:        ", self)
        self.__dial = QDial(self)
        self.__dial.setRange(100, 400)
        self.__dial.setSingleStep(1)
        self.__dial.setPageStep(10)
        self.__dial.setTracking(False)

        layout.addWidget(QLabel("Channel: {}".format(ch), self))
        layout.addWidget(self.__label)
        layout.addWidget(self.__dial)
        self.__dial.valueChanged.connect(self.__sliderChanged)
        self.__dial.setValue(200)
        self.__sliderChanged()

    def __sliderChanged(self):
        temp = self.__dial.value() / 10
        self.__label.setText("Temperatur: {:.1f}°".format(temp))
        temp = temp * 4096.0 / 330
        with open('/tmp/wiringPiSPI_{}'.format(self.__channel), 'w') as f:
            fcntl.flock(f, fcntl.LOCK_EX)
            f.write("{} {} {}".format(6, int(temp // 256), int(temp % 256)))
            fcntl.flock(f, fcntl.LOCK_UN)
Exemplo n.º 15
0
    def createBottomRightGroupBox(self):
        self.bottomRightGroupBox = QGroupBox("Audio Speed")

        lineEdit = QLineEdit('s3cRe7')
        lineEdit.setEchoMode(QLineEdit.Password)

        spinBox = QSpinBox(self.bottomRightGroupBox)
        spinBox.setValue(50)

        slider = QSlider(Qt.Horizontal, self.bottomRightGroupBox)
        slider.setValue(40)

        scrollBar = QScrollBar(Qt.Horizontal, self.bottomRightGroupBox)
        scrollBar.setValue(60)

        dial = QDial(self.bottomRightGroupBox)
        dial.setValue(30)
        dial.setNotchesVisible(True)

        layout = QGridLayout()
        layout.addWidget(spinBox, 1, 0, 1, 2)
        layout.addWidget(slider, 3, 0)
        layout.addWidget(scrollBar, 4, 0)
        layout.addWidget(dial, 3, 1, 2, 1)
        self.bottomRightGroupBox.setLayout(layout)
Exemplo n.º 16
0
class MySliderDial(QGroupBox):

    def __init__(self):
        super().__init__()
        self.setTitle('QSlider & QDial')
        self.init_ui()

    def init_ui(self):
        # Qt.Horizontal, Qt.Vertical 수평 또는 수직 방향 설정
        self.slider = QSlider(Qt.Horizontal, self)
        self.slider.setRange(0, 50)   # setRange() 메서드로 값의 범위를 0에서 50까지로 설정
        self.slider.setSingleStep(2)  # setSingleStep() 메서드는 조절 가능하는 최소 단위를 설정

        self.dial = QDial(self)
        self.dial.setRange(0, 50)

        btn = QPushButton('Default', self)

        # 슬라이더와 다이얼의 값이 변할 때 발생하는 시그널을 각각 다이얼과 슬라이더의 값을 조절해주는
        # 메서드 (setValue)에 서로 연결함으로써 두 위젯의 값이 언제나 일치하도록 해줍니다.
        self.slider.valueChanged.connect(self.dial.setValue)
        self.dial.valueChanged.connect(self.slider.setValue)

        btn.clicked.connect(self.button_clicked)

        layout = QVBoxLayout()
        layout.addWidget(self.slider)
        layout.addWidget(self.dial)
        layout.addWidget(btn)

        self.setLayout(layout)

    def button_clicked(self):
        self.slider.setValue(0)
        self.dial.setValue(0)
Exemplo n.º 17
0
    def createBottomRightGroupBox(self):
        self.bottomRightGroupBox = QGroupBox("Group 3")
        self.bottomRightGroupBox.setCheckable(True)
        self.bottomRightGroupBox.setChecked(True)

        lineEdit = QLineEdit('s3cRe7')
        lineEdit.setEchoMode(QLineEdit.Password)

        spinBox = QSpinBox(self.bottomRightGroupBox)
        spinBox.setValue(50)

        dateTimeEdit = QDateTimeEdit(self.bottomRightGroupBox)
        dateTimeEdit.setDateTime(QDateTime.currentDateTime())

        slider = QSlider(Qt.Horizontal, self.bottomRightGroupBox)
        slider.setValue(40)

        scrollBar = QScrollBar(Qt.Horizontal, self.bottomRightGroupBox)
        scrollBar.setValue(60)

        dial = QDial(self.bottomRightGroupBox)
        dial.setValue(30)
        dial.setNotchesVisible(True)

        layout = QGridLayout()
        layout.addWidget(lineEdit, 0, 0, 1, 2)
        layout.addWidget(spinBox, 1, 0, 1, 2)
        layout.addWidget(dateTimeEdit, 2, 0, 1, 2)
        layout.addWidget(slider, 3, 0)
        layout.addWidget(scrollBar, 4, 0)
        layout.addWidget(dial, 3, 1, 2, 1)
        layout.setRowStretch(5, 1)
        self.bottomRightGroupBox.setLayout(layout)
Exemplo n.º 18
0
    def setValue(self, value):
        if self.fRealValue == value:
            return

        self.fRealValue = value
        normValue = float(value - self.fMinimum) / float(self.fMaximum - self.fMinimum)
        QDial.setValue(self, int(normValue * 10000))
class Window(QWidget):
    def __init__(self):
        super().__init__()
        self.title = "PyQt5 Dial"
        self.left = 500
        self.top = 200
        self.width = 300
        self.height = 250
        self.iconName = "icon.png"

        self.setWindowIcon(QtGui.QIcon(self.iconName))
        self.setWindowTitle(self.title)
        self.setGeometry(self.left, self.top, self.width, self.height)
        vbox = QVBoxLayout()

        self.dial = QDial()
        self.dial.setMinimum(0)
        self.dial.setMaximum(100)
        self.dial.setValue(30)
        self.dial.valueChanged.connect(self.dial_changed)
        vbox.addWidget(self.dial)

        self.label = QLabel()
        self.label.setAlignment(Qt.AlignCenter)
        self.label.setFont(QtGui.QFont('Sanserif', 14))
        vbox.addWidget(self.label)

        self.setLayout(vbox)
        self.show()

    def dial_changed(self):
        dialValue = self.dial.value()
        self.label.setText("Currerent Value is : {}".format(dialValue))
Exemplo n.º 20
0
    def __init__(self, parent, index=0):
        QDial.__init__(self, parent)

        self.fMinimum = 0.0
        self.fMaximum = 1.0
        self.fRealValue = 0.0

        self.fIsHovered = False
        self.fHoverStep = self.HOVER_MIN

        self.fIndex = index
        self.fPixmap = QPixmap(":/bitmaps/dial_01d.png")
        self.fPixmapNum = "01"

        if self.fPixmap.width() > self.fPixmap.height():
            self.fPixmapOrientation = self.HORIZONTAL
        else:
            self.fPixmapOrientation = self.VERTICAL

        self.fLabel = ""
        self.fLabelPos = QPointF(0.0, 0.0)
        self.fLabelFont = QFont(self.font())
        self.fLabelFont.setPointSize(6)
        self.fLabelWidth = 0
        self.fLabelHeight = 0

        if self.palette().window().color().lightness() > 100:
            # Light background
            c = self.palette().dark().color()
            self.fLabelGradientColor1 = c
            self.fLabelGradientColor2 = QColor(c.red(), c.green(), c.blue(), 0)
            self.fLabelGradientColorT = [
                self.palette().buttonText().color(),
                self.palette().mid().color()
            ]
        else:
            # Dark background
            self.fLabelGradientColor1 = QColor(0, 0, 0, 255)
            self.fLabelGradientColor2 = QColor(0, 0, 0, 0)
            self.fLabelGradientColorT = [Qt.white, Qt.darkGray]

        self.fLabelGradient = QLinearGradient(0, 0, 0, 1)
        self.fLabelGradient.setColorAt(0.0, self.fLabelGradientColor1)
        self.fLabelGradient.setColorAt(0.6, self.fLabelGradientColor1)
        self.fLabelGradient.setColorAt(1.0, self.fLabelGradientColor2)

        self.fLabelGradientRect = QRectF(0.0, 0.0, 0.0, 0.0)

        self.fCustomPaintMode = self.CUSTOM_PAINT_MODE_NULL
        self.fCustomPaintColor = QColor(0xff, 0xff, 0xff)

        self.updateSizes()

        # Fake internal value, 10'000 precision
        QDial.setMinimum(self, 0)
        QDial.setMaximum(self, 10000)
        QDial.setValue(self, 0)

        self.valueChanged.connect(self.slot_valueChanged)
Exemplo n.º 21
0
class PlaneSetter(QWidget):
    """
    Class for plane setter with dial, this update using setPlaneShift and
    incrementPlaneShift

    """
    def __init__(self,
                 scale=0.01,
                 parent=None,
                 closeAction=None,
                 changedAction=None):
        super(PlaneSetter, self).__init__(parent)

        self.closeAction = closeAction
        self.changedAction = changedAction
        self.setAutoFillBackground(True)
        p = self.palette()
        p.setColor(self.backgroundRole(), Qt.white)
        self.setPalette(p)

        self.shift = getPlaneShift()
        self.scale = scale

        self.planeLabel = QLabel("Plane : " + "{0:5.3f}".format(self.shift))
        self.planeDial = QDial()
        self.planeDial.setRange(-100, 100)
        self.planeDial.setValue(int(self.shift / self.scale))
        self.planeDial.valueChanged.connect(self.valueChange)
        closeButton = QPushButton("Close")
        closeButton.clicked.connect(self.closeButtonClicked)
        resetButton = QPushButton("Reset")
        resetButton.clicked.connect(self.resetButtonClicked)

        layout = QGridLayout()
        layout.addWidget(self.planeLabel, 0, 1)
        layout.addWidget(self.planeDial, 1, 0, 1, 2)
        layout.addWidget(resetButton, 2, 0)
        layout.addWidget(closeButton, 2, 1)
        self.setLayout(layout)

    def valueChange(self):
        global PlaneShift
        self.shift = self.planeDial.value() * self.scale
        self.planeLabel.setText("Plane : " + "{0:5.3f}".format(self.shift))
        setPlaneShift(self.shift)
        if self.changedAction != None:
            self.changedAction()

    def resetButtonClicked(self):
        self.shift = 0.0
        self.planeDial.setValue(0)
        self.valueChange()

    def closeButtonClicked(self):  # Close the frame
        self.close()
        if self.closeAction != None:
            self.closeAction()
Exemplo n.º 22
0
    def __init__(self, parent, index=0):
        QDial.__init__(self, parent)

        self.fMinimum   = 0.0
        self.fMaximum   = 1.0
        self.fRealValue = 0.0

        self.fIsHovered = False
        self.fHoverStep = self.HOVER_MIN

        self.fIndex     = index
        self.fPixmap    = QPixmap(":/bitmaps/dial_01d.png")
        self.fPixmapNum = "01"

        if self.fPixmap.width() > self.fPixmap.height():
            self.fPixmapOrientation = self.HORIZONTAL
        else:
            self.fPixmapOrientation = self.VERTICAL

        self.fLabel     = ""
        self.fLabelPos  = QPointF(0.0, 0.0)
        self.fLabelFont = QFont(self.font())
        self.fLabelFont.setPointSize(6)
        self.fLabelWidth  = 0
        self.fLabelHeight = 0

        if self.palette().window().color().lightness() > 100:
            # Light background
            c = self.palette().dark().color()
            self.fLabelGradientColor1 = c
            self.fLabelGradientColor2 = QColor(c.red(), c.green(), c.blue(), 0)
            self.fLabelGradientColorT = [self.palette().buttonText().color(), self.palette().mid().color()]
        else:
            # Dark background
            self.fLabelGradientColor1 = QColor(0, 0, 0, 255)
            self.fLabelGradientColor2 = QColor(0, 0, 0, 0)
            self.fLabelGradientColorT = [Qt.white, Qt.darkGray]

        self.fLabelGradient = QLinearGradient(0, 0, 0, 1)
        self.fLabelGradient.setColorAt(0.0, self.fLabelGradientColor1)
        self.fLabelGradient.setColorAt(0.6, self.fLabelGradientColor1)
        self.fLabelGradient.setColorAt(1.0, self.fLabelGradientColor2)

        self.fLabelGradientRect = QRectF(0.0, 0.0, 0.0, 0.0)

        self.fCustomPaintMode  = self.CUSTOM_PAINT_MODE_NULL
        self.fCustomPaintColor = QColor(0xff, 0xff, 0xff)

        self.updateSizes()

        # Fake internal value, 10'000 precision
        QDial.setMinimum(self, 0)
        QDial.setMaximum(self, 10000)
        QDial.setValue(self, 0)

        self.valueChanged.connect(self.slot_valueChanged)
Exemplo n.º 23
0
class MouseTracker(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()
        self.setMouseTracking(True)

    def initUI(self):
        self.setGeometry(300, 300, 700, 700)
        self.setWindowTitle('Mouse Tracker')
        self.label = QLabel(self)
        self.label.resize(200, 40)
        self.label.move(100, 40)

        self.laabel = QLabel(self)
        self.laabel.resize(200, 40)
        self.laabel.move(200, 300)

        self.laabel1 = QLabel(self)
        self.laabel1.resize(200, 40)
        self.laabel1.move(300, 100)

        self.dial = QDial(self)
        self.dial.move(xmove - 50, ymove - 50)
        self.dial.setValue(30)
        self.dial.resize(100, 100)
        self.dial.setWrapping(True)
        self.dial.setMinimum(0)
        self.dial.setMaximum(360)
        self.show()

    def mouseMoveEvent(self, event):
        x = event.x()
        y = event.y()
        if x < xmove and y < ymove: q = 1
        elif x > xmove and y < ymove: q = 2
        elif x > xmove and y > ymove: q = 3
        elif x < xmove and y > ymove: q = 4
        self.label.setText('Mouse coords: ( %d : %d )' % (x, y))
        if y != ymove and x != xmove:
            a = math.degrees(
                math.atan((ymove - event.y()) / (xmove - event.x())))
            if q == 1: a = a
            elif q == 2: a = 180 + a
            elif q == 3: a = 180 + a
            elif q == 4: a = a
        else:
            if x < xmove and y == ymove: a = 0
            elif x == xmove and y < ymove: a = 90
            elif x > xmove and y == ymove: a = 180
            elif x == xmove and y > ymove: a = 270

        self.dial.setValue(int(a) + 90)
        self.laabel1.setText(str(a))
Exemplo n.º 24
0
class TimerGB(QGroupBox):

    grab_timeout = pyqtSignal()
    gb_closed = pyqtSignal()

    def __init__(self, boxwidth, boxheight, parent=None):
        super(TimerGB, self).__init__(parent)
        QGroupBox("Set Interval")

        self.resize(boxwidth, boxheight)

        self.setWindowTitle("Timer")
        self.setFlat(True)

        self.timer_dial = QDial()
        self.timer_dial.setNotchesVisible(True)
        self.timer_dial.setMinimum(1)
        self.timer_dial.setMaximum(30)
        self.timer_dial.setValue(15)
        self.timer_dial.valueChanged.connect(self.on_dial_new_value)
        self.timer_dial.sliderReleased.connect(self.on_dial_released)

        self.value_display = QLabel()
        self.gbvlayout = QVBoxLayout()
        self.gbvlayout.addWidget(self.value_display)
        self.gbvlayout.addWidget(self.timer_dial)
        self.setLayout(self.gbvlayout)
        self.value_display.setText(str(self.timer_dial.value()) + " s")

        self.grab_timer = QTimer()

    def on_dial_new_value(self):
        self.value_display.setText(str(self.timer_dial.value()) + " s")

    def on_dial_released(self):
        self.timer_rate = self.timer_dial.value()
        #print("Timer rate is ", self.timer_rate)
        self.grab_timer = QTimer()
        #        self.grab_timer.timeout.connect(self.on_grab_button)
        self.grab_timer.timeout.connect(self.on_grab_timer_timeout)
        self.grab_timer.start(self.timer_rate * 1000.0)

    def on_grab_timer_timeout(self):
        self.grab_timeout.emit()

    def closeEvent(self, event):
        self.gb_closed.emit()

    def get_width(self):
        return self.width()

    def get_height(self):
        return self.height()
Exemplo n.º 25
0
class SlidersGroup(QGroupBox):

    valueChanged = QtCore.pyqtSignal(int)

    def __init__(self, orientation, name, title, parent=None):
        super(SlidersGroup, self).__init__(title, parent)

        self.name = name
        self.value = 0.0

        valueLabel = QLabel("Current value:")
        #self.valueSpinBox = QDoubleSpinBox ()
        self.valueSpinBox = QSpinBox()
        self.valueSpinBox.setSingleStep(1)
        self.valueSpinBox.setFocusPolicy(QtCore.Qt.StrongFocus)

        self.slider = QSlider(orientation)
        self.slider.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.slider.setTickPosition(QSlider.TicksBothSides)
        self.slider.setTickInterval(10)
        self.slider.setSingleStep(1)

        self.dial = QDial()
        self.dial.setFocusPolicy(QtCore.Qt.StrongFocus)

        self.slider.valueChanged.connect(self.setValue)
        self.dial.valueChanged.connect(self.setValue)

        direction = QBoxLayout.TopToBottom

        slidersLayout = QBoxLayout(direction)
        slidersLayout.addWidget(valueLabel)
        slidersLayout.addWidget(self.valueSpinBox)
        slidersLayout.addWidget(self.slider)
        #slidersLayout.addWidget(self.dial)
        self.setLayout(slidersLayout)

    def setValue(self, value):
        self.valueSpinBox.setValue(value)
        self.slider.setValue(value)
        self.dial.setValue(value)
        self.value = value

    def setMinimum(self, value):
        self.slider.setMinimum(value)
        self.dial.setMinimum(value)

    def setMaximum(self, value):
        self.valueSpinBox.setRange(0, value)
        self.slider.setMaximum(value)
        self.dial.setMaximum(value)
Exemplo n.º 26
0
class DialWidget(QWidget):
    valueChanged = pyqtSignal(float)

    def __init__(self, manometer: AnalogItemType, parent=None):
        super().__init__(parent=parent)
        self.setFont(QFont('Segoi UI', FONT_SIZE))
        self.setFixedWidth(DIAL_WIDTH)
        self.setFixedHeight(DIAL_HEIGHT)
        self.vbox = QVBoxLayout()
        self.vbox.setContentsMargins(0, 0, 0, 0)
        self.setLayout(self.vbox)
        self.caption = QLabel(manometer.name)
        self.caption.setFont(QFont('Segoi UI', FONT_SIZE))
        self.caption.setAlignment(Qt.AlignCenter)
        self.vbox.addWidget(self.caption)
        self.dial = QDial()
        self.vbox.addWidget(self.dial)
        self.dial.setMinimum(0)
        self.dial.setMaximum(round(manometer.eu_range.high * 100))
        self.dial.setValue(0)
        self.dial.setNotchTarget(2)
        self.dial.setNotchesVisible(True)
        self.spin_box = QDoubleSpinBox()
        self.vbox.addWidget(self.spin_box)
        self.spin_box.setMinimum(0)
        self.spin_box.setMaximum(manometer.eu_range.high)
        self.spin_box.setValue(0)
        self.spin_box.setDecimals(2)
        self.spin_box.setSingleStep(0.01)
        self.spin_box.valueChanged.connect(self.on_spin_box_value_changed)
        self.dial.valueChanged.connect(self.on_dial_value_changed)
        self.valueChanged.connect(manometer.set_value)

    @pyqtSlot(float)
    def on_spin_box_value_changed(self, value: float):
        v = round(value * 100)
        self.dial.setValue(v)
        self.emit_signal(value)

    @pyqtSlot(int)
    def on_dial_value_changed(self, value: int):
        v = value / 100
        self.spin_box.setValue(v)
        self.emit_signal(v)

    def emit_signal(self, value: float):
        value_ofset = value - self.spin_box.minimum()
        value_range = self.spin_box.maximum() - self.spin_box.minimum()
        value_percent = value_ofset / value_range
        signal = round(value_percent * 16000 + 4000)
        self.valueChanged.emit(signal)
Exemplo n.º 27
0
class ServoControls(QGroupBox):

    valueChanged = pyqtSignal(int)

    def __init__(self, title, parent=None):
        super(ServoControls, self).__init__(title, parent)

        self.slider = QSlider(Qt.Horizontal)
        self.slider.setFocusPolicy(Qt.StrongFocus)
        self.slider.setTickPosition(QSlider.TicksBothSides)
        self.slider.setTickInterval(10)
        self.slider.setSingleStep(1)

        self.dial = QDial()
        self.dial.setFocusPolicy(Qt.StrongFocus)
        self.dial.setNotchesVisible(True)

        self.lcd_display = QLCDNumber()
        self.lcd_display.display(22)

        self.slider.valueChanged.connect(self.dial.setValue)
        self.dial.valueChanged.connect(self.lcd_display.display)
        self.dial.valueChanged.connect(self.slider.setValue)
        self.dial.valueChanged.connect(self.valueChanged)

        boxLayout = QBoxLayout(QBoxLayout.TopToBottom)
        boxLayout.addWidget(self.slider)
        boxLayout.addWidget(self.dial)
        boxLayout.addWidget(self.lcd_display)
        boxLayout.setStretchFactor(self.dial, 20)
        self.setLayout(boxLayout)

        self.setMinimum(0)
        self.setMaximum(100)
        self.dial.setWrapping(True)

    # This shit isnt even getting called
    def setValue(self, value):
        print("Slider Value: " + str(value))
        self.slider.setValue(value)
        self.dial.setValue(value)
        self.lcd_display.display(value)

    def setMinimum(self, value):
        self.slider.setMinimum(value)
        self.dial.setMinimum(value)

    def setMaximum(self, value):
        self.slider.setMaximum(value)
        self.dial.setMaximum(value)
Exemplo n.º 28
0
class IrisSetter(QWidget):
    """
    Class to set default direction in degress with spinners
    """
    def __init__(self, parent=None, closeAction=None):
        super(IrisSetter, self).__init__(parent)

        global IrisRatio

        self.closeAction = closeAction
        self.setAutoFillBackground(True)
        p = self.palette()
        p.setColor(self.backgroundRole(), Qt.white)
        self.setPalette(p)

        self.irisRatio = IrisRatio
        self.irisLabel = QLabel("Iris : " + str(self.irisRatio))
        self.irisDial = QDial()
        self.irisDial.setRange(0, 100)
        self.irisDial.setValue(int(100 * self.irisRatio))
        self.irisDial.valueChanged.connect(self.valueChange)
        closeButton = QPushButton("Close")
        closeButton.clicked.connect(self.closeButtonClicked)
        resetButton = QPushButton("Reset")
        resetButton.clicked.connect(self.resetButtonClicked)

        layout = QGridLayout()
        layout.addWidget(self.irisLabel, 0, 1)
        layout.addWidget(self.irisDial, 1, 0, 1, 2)
        layout.addWidget(resetButton, 2, 0)
        layout.addWidget(closeButton, 2, 1)
        self.setLayout(layout)

    def valueChange(self):
        global IrisRatio
        self.irisRatio = self.irisDial.value() / 100.0
        self.irisLabel.setText("Iris : " + str(self.irisRatio))
        IrisRatio = self.irisRatio
        getCurrentLens().setIris(self.irisRatio)

    def resetButtonClicked(self):
        self.iris = 1.0
        self.irisDial.setValue(100)
        self.valueChange()

    def closeButtonClicked(self):  # Close the frame
        self.close()
        if self.closeAction != None:
            self.closeAction()
    def createBottomRightGroupBox(self):
        '''Create a checkable group widget useful in the case of form login etc'''
        self.bottomRightGroupBox = QGroupBox("Group 3")
        self.bottomRightGroupBox.setCheckable(
            True)  # sets the state aware mode
        self.bottomRightGroupBox.setChecked(
            True)  # sets the default state to active
        #
        # create the required widgets
        # a lineEdit Widget for password entry. Activate the security by setEchoMode()
        # a spinBox Widget which lets the field change using scroll
        # a Date Time Edit Widget
        # a Slider Widget responsive to scroll as well as press and move
        # a Scroll Widget responsive to scroll as well as press and move
        # a Dial Widget responsive to scroll as well as press and move
        #
        lineEdit = QLineEdit('s3cRe7')
        lineEdit.setEchoMode(QLineEdit.Password)

        spinBox = QSpinBox(self.bottomRightGroupBox)
        spinBox.setValue(25)

        dateTimeEdit = QDateTimeEdit(self.bottomRightGroupBox)
        dateTimeEdit.setDateTime(QDateTime.currentDateTime())

        slider = QSlider(Qt.Horizontal, self.bottomRightGroupBox)
        slider.setValue(40)

        scrollBar = QScrollBar(Qt.Horizontal, self.bottomRightGroupBox)
        scrollBar.setValue(60)

        dial = QDial(self.bottomRightGroupBox)
        dial.setValue(30)
        dial.setNotchesVisible(True)
        #
        # create the internal layout of the group Widget
        #
        layout = QGridLayout()
        layout.addWidget(lineEdit, 0, 0, 1, 3)
        layout.addWidget(spinBox, 1, 0, 1, 2)
        layout.addWidget(dateTimeEdit, 2, 0, 1, 2)
        layout.addWidget(slider, 3, 0)
        layout.addWidget(scrollBar, 4, 0)
        layout.addWidget(dial, 3, 1, 2, 2)
        layout.setRowStretch(50, 1)  # ?? whatdoes RowStretch do?
        self.bottomRightGroupBox.setLayout(layout)
Exemplo n.º 30
0
class MyWindow(QWidget):
    def __init__(self):
        super(MyWindow, self).__init__()
        self.initGUI("PyQt5 学习 QDial")

        mainLayout = QGridLayout()
        self.setLayout(mainLayout)

        self.dial = QDial()
        self.dial.setMinimum(0)
        self.dial.setMaximum(100)
        self.dial.setValue(50)
        # 最好不要启用 setNotchTarget(),因为默认样式就挺好的
        # self.dial.setNotchTarget(10)
        self.dial.setNotchesVisible(True)
        self.dial.setWrapping(False)

        self.dial.sliderPressed.connect(self.on_slider_pressed_func)
        self.dial.sliderReleased.connect(self.on_slider_released_func)
        self.dial.sliderMoved.connect(self.on_slider_moved_func)
        self.dial.valueChanged.connect(self.on_value_changed)

        mainLayout.addWidget(self.dial, 0, 0, 1, 1)

    def on_slider_pressed_func(self):
        print("Dial --- Pressed")

    def on_slider_released_func(self):
        print("Dial --- Released @ %d" % (self.dial.value()))

    def on_slider_moved_func(self, value):
        print("Dial move to value = %d" % (value))

    def on_value_changed(self):
        print("Current dial value: %i" % (self.dial.value()))

    def initGUI(self, title):
        """
        设置窗口大小和位置,以及标题
        """
        startx = 800
        starty = 400
        width = 480
        height = 320
        self.setGeometry(startx, starty, width, height)
        self.setWindowTitle(title)
Exemplo n.º 31
0
class Window(QDialog):
    def __init__(self, val):
        super().__init__()

        self.title = "QDial"
        self.left = 300
        self.top = 100
        self.width = 500
        self.height = 500
        self.IconName = "Icon/python.png"
        self.color = 'red'
        self.val = val

        self.InitWindow()

    def InitWindow(self):
        self.setWindowIcon(QtGui.QIcon(self.IconName))
        self.setWindowTitle(self.title)
        self.setGeometry(self.left, self.top, self.width, self.height)
        #self.setStyleSheet('background-color:green')

        vbox = QVBoxLayout()

        self.dial = QDial()
        self.dial.setMinimum(0)
        self.dial.setMaximum(100)
        self.dial.setValue(30)
        self.dial.valueChanged.connect(self.DialChange)

        self.label = QLabel(self)
        self.label.setFont(QtGui.QFont("Sanserif", 15))

        vbox.addWidget(self.dial)
        vbox.addWidget(self.label)

        self.setLayout(vbox)
        self.show()

    def DialChange(self):
        getValue = self.dial.value()
        self.label.setText("Dial Value : " + str(getValue))
Exemplo n.º 32
0
    def initUI(self):
        grid = QGridLayout()

        enabled = QCheckBox('Enabled')
        enabled.setObjectName(f"enabled{self.id}")
        enabled.toggle()
        enabled.stateChanged.connect(self.checkbox_update)
        grid.addWidget(enabled, 0, 0)

        amplitude = QDial()
        amplitude.setObjectName(f"amplitude{self.id}")
        amplitude.setMinimum(0)
        amplitude.setMaximum(100)
        amplitude.setValue(100)
        amplitude.setNotchesVisible(True)
        amplitude.setMaximumSize(80, 80)
        amplitude.valueChanged.connect(self.dial_update)
        # amplitude.setEnabled(False)
        grid.addWidget(amplitude, 1, 0)
        #grid.addWidget(amplitude, 0, 0, 2, 1)

        waveform = QComboBox(self)
        waveform.setObjectName(f"waveform{self.id}")
        waveform.addItem("Sine")
        waveform.addItem("Square")
        waveform.addItem("Sawtooth")
        waveform.addItem("Triangle")
        waveform.addItem("Random")
        waveform.currentTextChanged.connect(self.combobox_update)
        
        transpose = QLineEdit(self)
        transpose.setObjectName(f"transpose{self.id}")
        transpose.setValidator(QIntValidator())
        transpose.setMaxLength(3)
        transpose.setText("0")
        transpose.textChanged.connect(self.lineedit_update)
        
        grid.addWidget(waveform, 0, 1)
        grid.addWidget(transpose, 0, 2)
        grid.addWidget(Envelope(self.id), 1, 1)
        self.setLayout(grid)
Exemplo n.º 33
0
    def setValue(self, value, emitSignal=False):
        if self.fRealValue == value:
            return

        if value <= self.fMinimum:
            qtValue = 0
            self.fRealValue = self.fMinimum

        elif value >= self.fMaximum:
            qtValue = self.fPrecision
            self.fRealValue = self.fMaximum

        else:
            qtValue = round(float(value - self.fMinimum) / float(self.fMaximum - self.fMinimum) * self.fPrecision)
            self.fRealValue = value

        # Block change signal, we'll handle it ourselves
        self.blockSignals(True)
        QDial.setValue(self, qtValue)
        self.blockSignals(False)

        if emitSignal:
            self.realValueChanged.emit(self.fRealValue)
Exemplo n.º 34
0
from PyQt5.QtWidgets import QApplication, QDial


def printValue(value):
    print(value, dial.value())

app = QApplication(sys.argv)

dial = QDial()

#dial.setMinimum(-15)
#dial.setMaximum(15)

dial.setRange(-15, 15)

dial.setNotchesVisible(True)

dial.setValue(5)   # Initial value

dial.valueChanged.connect(printValue)

dial.show()

# The mainloop of the application. The event handling starts from this point.
# The exec_() method has an underscore. It is because the exec is a Python keyword. And thus, exec_() was used instead.
exit_code = app.exec_()

# The sys.exit() method ensures a clean exit.
# The environment will be informed, how the application ended.
sys.exit(exit_code)
Exemplo n.º 35
0
class MainWindow(QMainWindow):

    """Voice Changer main window."""

    def __init__(self, parent=None):
        super(MainWindow, self).__init__()
        self.statusBar().showMessage("Move Dial to Deform Microphone Voice !.")
        self.setWindowTitle(__doc__)
        self.setMinimumSize(240, 240)
        self.setMaximumSize(480, 480)
        self.resize(self.minimumSize())
        self.setWindowIcon(QIcon.fromTheme("audio-input-microphone"))
        self.tray = QSystemTrayIcon(self)
        self.center()
        QShortcut("Ctrl+q", self, activated=lambda: self.close())
        self.menuBar().addMenu("&File").addAction("Quit", lambda: exit())
        self.menuBar().addMenu("Sound").addAction(
            "STOP !", lambda: call('killall rec', shell=True))
        windowMenu = self.menuBar().addMenu("&Window")
        windowMenu.addAction("Hide", lambda: self.hide())
        windowMenu.addAction("Minimize", lambda: self.showMinimized())
        windowMenu.addAction("Maximize", lambda: self.showMaximized())
        windowMenu.addAction("Restore", lambda: self.showNormal())
        windowMenu.addAction("FullScreen", lambda: self.showFullScreen())
        windowMenu.addAction("Center", lambda: self.center())
        windowMenu.addAction("Top-Left", lambda: self.move(0, 0))
        windowMenu.addAction("To Mouse", lambda: self.move_to_mouse_position())
        # widgets
        group0 = QGroupBox("Voice Deformation")
        self.setCentralWidget(group0)
        self.process = QProcess(self)
        self.process.error.connect(
            lambda: self.statusBar().showMessage("Info: Process Killed", 5000))
        self.control = QDial()
        self.control.setRange(-10, 20)
        self.control.setSingleStep(5)
        self.control.setValue(0)
        self.control.setCursor(QCursor(Qt.OpenHandCursor))
        self.control.sliderPressed.connect(
            lambda: self.control.setCursor(QCursor(Qt.ClosedHandCursor)))
        self.control.sliderReleased.connect(
            lambda: self.control.setCursor(QCursor(Qt.OpenHandCursor)))
        self.control.valueChanged.connect(
            lambda: self.control.setToolTip(f"<b>{self.control.value()}"))
        self.control.valueChanged.connect(
            lambda: self.statusBar().showMessage(
                f"Voice deformation: {self.control.value()}", 5000))
        self.control.valueChanged.connect(self.run)
        self.control.valueChanged.connect(lambda: self.process.kill())
        # Graphic effect
        self.glow = QGraphicsDropShadowEffect(self)
        self.glow.setOffset(0)
        self.glow.setBlurRadius(99)
        self.glow.setColor(QColor(99, 255, 255))
        self.control.setGraphicsEffect(self.glow)
        self.glow.setEnabled(False)
        # Timer to start
        self.slider_timer = QTimer(self)
        self.slider_timer.setSingleShot(True)
        self.slider_timer.timeout.connect(self.on_slider_timer_timeout)
        # an icon and set focus
        QLabel(self.control).setPixmap(
            QIcon.fromTheme("audio-input-microphone").pixmap(32))
        self.control.setFocus()
        QVBoxLayout(group0).addWidget(self.control)
        self.menu = QMenu(__doc__)
        self.menu.addAction(__doc__).setDisabled(True)
        self.menu.setIcon(self.windowIcon())
        self.menu.addSeparator()
        self.menu.addAction(
            "Show / Hide",
            lambda: self.hide() if self.isVisible() else self.showNormal())
        self.menu.addAction("STOP !", lambda: call('killall rec', shell=True))
        self.menu.addSeparator()
        self.menu.addAction("Quit", lambda: exit())
        self.tray.setContextMenu(self.menu)
        self.make_trayicon()

    def run(self):
        """Run/Stop the QTimer."""
        if self.slider_timer.isActive():
            self.slider_timer.stop()
        self.glow.setEnabled(True)
        call('killall rec ; killall play', shell=True)
        self.slider_timer.start(3000)

    def on_slider_timer_timeout(self):
        """Run subprocess to deform voice."""
        self.glow.setEnabled(False)
        value = int(self.control.value()) * 100
        command = f'play -q -V0 "|rec -q -V0 -n -d -R riaa bend pitch {value} "'
        print(f"Voice Deformation Value: {value}")
        print(f"Voice Deformation Command: {command}")
        self.process.start(command)
        if self.isVisible():
            self.statusBar().showMessage("Minimizing to System TrayIcon", 3000)
            print("Minimizing Main Window to System TrayIcon now...")
            sleep(3)
            self.hide()

    def center(self):
        """Center Window on the Current Screen,with Multi-Monitor support."""
        window_geometry = self.frameGeometry()
        mousepointer_position = QApplication.desktop().cursor().pos()
        screen = QApplication.desktop().screenNumber(mousepointer_position)
        centerPoint = QApplication.desktop().screenGeometry(screen).center()
        window_geometry.moveCenter(centerPoint)
        self.move(window_geometry.topLeft())

    def move_to_mouse_position(self):
        """Center the Window on the Current Mouse position."""
        window_geometry = self.frameGeometry()
        window_geometry.moveCenter(QApplication.desktop().cursor().pos())
        self.move(window_geometry.topLeft())

    def make_trayicon(self):
        """Make a Tray Icon."""
        if self.windowIcon() and __doc__:
            self.tray.setIcon(self.windowIcon())
            self.tray.setToolTip(__doc__)
            self.tray.activated.connect(
                lambda: self.hide() if self.isVisible()
                else self.showNormal())
            return self.tray.show()