コード例 #1
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))
コード例 #2
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}')
コード例 #3
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()}")
コード例 #4
0
ファイル: qt5_QDial.py プロジェクト: stuart-alt/PyQt5
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))
コード例 #5
0
ファイル: dial.py プロジェクト: ara710/TMMT
class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()
        # 윈도우 설정
        self.setGeometry(200, 100, 300, 300)  # x, y, w, h
        self.setWindowTitle('삼인성호')

        # QSliter  추가
        self.dial = QDial(self)
        self.dial.move(10, 10)
        self.dial.setFixedSize(100, 100)
        self.dial.setRange(0, 100)
        self.dial.setMinimum(1)
        self.dial.setMaximum(24)
        self.dial.setNotchesVisible(True)
        self.dial.valueChanged.connect(self.value_changed)

        # QSlider 데이터를 표시할 라벨
        self.label = QLabel(self)
        self.label.setGeometry(10, 120, 200, 100)
        self.label.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        self.label.setStyleSheet("border-radius: 5px;"
                                 "border: 1px solid gray;"
                                 "background-color: #ffffff")

    # 슬라이드 시그널 valueChanged 연결 함수
    def value_changed(self, value):
        self.label.setText(str(value) + "시")
        self.label.setFont(QtGui.QFont("Malgun Gothic", 40))  #폰트,크기 조절
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))
コード例 #7
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))
コード例 #8
0
ファイル: pixmapdial.py プロジェクト: denisfitz57/Carla
    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)
コード例 #9
0
ファイル: sliders.py プロジェクト: death-finger/Scripts
class SlidersGroup(QGroupBox):

    valueChanged = pyqtSignal(int)

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

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

        self.scrollBar = QScrollBar(orientation)
        self.scrollBar.setFocusPolicy(Qt.StrongFocus)

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

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

        if orientation == Qt.Horizontal:
            direction = QBoxLayout.TopToBottom
        else:
            direction = QBoxLayout.LeftToRight

        slidersLayout = QBoxLayout(direction)
        slidersLayout.addWidget(self.slider)
        slidersLayout.addWidget(self.scrollBar)
        slidersLayout.addWidget(self.dial)
        self.setLayout(slidersLayout)    

    def setValue(self, value):    
        self.slider.setValue(value)    

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

    def setMaximum(self, value):    
        self.slider.setMaximum(value)
        self.scrollBar.setMaximum(value)
        self.dial.setMaximum(value)    

    def invertAppearance(self, invert):
        self.slider.setInvertedAppearance(invert)
        self.scrollBar.setInvertedAppearance(invert)
        self.dial.setInvertedAppearance(invert)    

    def invertKeyBindings(self, invert):
        self.slider.setInvertedControls(invert)
        self.scrollBar.setInvertedControls(invert)
        self.dial.setInvertedControls(invert)
コード例 #10
0
class SlidersGroup(QGroupBox):

    valueChanged = pyqtSignal(int)

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

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

        self.scrollBar = QScrollBar(orientation)
        self.scrollBar.setFocusPolicy(Qt.StrongFocus)

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

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

        if orientation == Qt.Horizontal:
            direction = QBoxLayout.TopToBottom
        else:
            direction = QBoxLayout.LeftToRight

        slidersLayout = QBoxLayout(direction)
        slidersLayout.addWidget(self.slider)
        slidersLayout.addWidget(self.scrollBar)
        slidersLayout.addWidget(self.dial)
        self.setLayout(slidersLayout)

    def setValue(self, value):
        self.slider.setValue(value)

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

    def setMaximum(self, value):
        self.slider.setMaximum(value)
        self.scrollBar.setMaximum(value)
        self.dial.setMaximum(value)

    def invertAppearance(self, invert):
        self.slider.setInvertedAppearance(invert)
        self.scrollBar.setInvertedAppearance(invert)
        self.dial.setInvertedAppearance(invert)

    def invertKeyBindings(self, invert):
        self.slider.setInvertedControls(invert)
        self.scrollBar.setInvertedControls(invert)
        self.dial.setInvertedControls(invert)
コード例 #11
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)
コード例 #12
0
ファイル: timergb.py プロジェクト: smccue2019/TIFgrab.old
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()
コード例 #13
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))
コード例 #14
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)
コード例 #15
0
ファイル: control_window.py プロジェクト: Alser69rus/A3135
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)
コード例 #16
0
ファイル: view.py プロジェクト: ryans-git/RySpy
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)
コード例 #17
0
ファイル: study_QDial.py プロジェクト: kingdelee/PyQtStudy
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)
コード例 #18
0
    def addDial(self, title, x, y, w, h, labelX, minimum, maximum, key):

        label = QLabel(self.window)
        label.setText(title)
        label.setGeometry(labelX, y + h, w, 20)

        dial = QDial(self.window)
        dial.setGeometry(x, y, w, h)
        dial.setMinimum(minimum)
        dial.setMaximum(maximum)
        dial.valueChanged.connect(lambda: self.updateDial(dial))

        valueLabel = QLabel(self.window)
        valueLabel.setText(str(dial.value()))
        valueLabel.setGeometry(
            dial.geometry().x() + int(dial.geometry().width() / 2) - 5, y - 35,
            w, h)

        self.dialList.append([key, dial, label, valueLabel])
コード例 #19
0
ファイル: QDial.py プロジェクト: mihirsam/PyQt5-Tutorial
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))
コード例 #20
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)
コード例 #21
0
class QdialWindow(QWidget):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setupUi()

    def setupUi(self):
        layout = QGridLayout()
        self.setLayout(layout)
        self.dial = QDial()
        self.dial.setMinimum(0)
        self.dial.setMaximum(100)
        self.dial.setValue(0)
        self.dial.valueChanged.connect(self.dialerMoved)
        self.label = QLabel("0")

        layout.addWidget(self.dial)
        layout.addWidget(self.label)
        self.show()

    def dialerMoved(self):
        print(f'Dial Value is : {self.dial.value()}')
        self.label.setText(f'Dial Value is : {self.dial.value()}')
コード例 #22
0
class Window(QWidget):
    def __init__(self):
        super().__init__()

        self.title = "This is first thing"
        self.height = 700
        self.width = 1100
        self.top = 100
        self.left = 200
        self.iconName = "plioky.ico"
        self.dial = QDial()
        self.label = QLabel(self)

        self.init_window()

    def init_window(self):

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

        vbox = QVBoxLayout()

        self.label.setFont(QtGui.QFont("Sanserif", 50))
        self.dial.valueChanged.connect(self.dial_changed)
        self.dial.setMinimum(0)
        self.dial.setMaximum(100)
        self.dial.setValue(0)

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

        self.show()

    def dial_changed(self):
        size = self.dial.value()
        self.label.setText(str(size))
コード例 #23
0
ファイル: qdial.py プロジェクト: zyuzyaI/Python
class Demo(QWidget):
    def __init__(self):
        super().__init__()
        self.setWindowTitle("QDial Demo")
        self.setGeometry(300, 300, 500, 500)

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

        self.label = QLabel("Dial Value is " + str(self.dial.value()))
        self.label.setFont(QFont("Open Sans", 20))

        self.layout = QVBoxLayout()
        self.layout.addWidget(self.dial)
        self.layout.addWidget(self.label)

        self.setLayout(self.layout)

    def print_dial_value(self):
        self.label.setText("Dial Value is " + str(self.dial.value()))
コード例 #24
0
class Window(QWidget):
    def __init__(self):
        super().__init__()

        self.title = "PyQt QDial"
        self.top = 100
        self.left = 100
        self.width = 400
        self.height = 300

        self.vbox = QVBoxLayout()
        self.dial = QDial()
        self.label = QLabel(self)

        self.InitWindow()

    def InitWindow(self):
        self.setWindowIcon(QtGui.QIcon("home.png"))
        self.setWindowTitle(self.title)
        self.setGeometry(self.left, self.top, self.width, self.height)

        self.Dial()
        self.setLayout(self.vbox)

        self.show()

    def Dial(self):
        self.dial.setMinimum(0)
        self.dial.setMaximum(100)
        self.dial.setValue(30)
        self.dial.valueChanged.connect(self.dial_changed)
        self.vbox.addWidget(self.dial)
        self.vbox.addWidget(self.label)

    def dial_changed(self):
        val = self.dial.value()
        self.label.setText("Dial value is: " + str(val))
コード例 #25
0
class Window(QWidget):
    def __init__(self):
        super().__init__()

        self.showMaximized()
        self.setWindowTitle('Barbequer')
        self.setWindowIcon(QIcon('BBQ.png'))
        self.init()

    def init(self):

        self.size_policy = (QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.font = QFont()
        self.font.setPointSize(16)

        self.temp_display_label = QLabel(self)
        self.temp_display_label.setText('Current Temperature:')
        self.temp_display_label.setSizePolicy(self.size_policy[0],
                                              self.size_policy[1])
        self.temp_display_label.setFont(self.font)
        #        self.temp_display_label.setAlignment(Qt.AlignRight)

        self.temp_display = QLCDNumber(self)
        self.temp_display.setSizePolicy(self.size_policy[0],
                                        self.size_policy[1])
        self.temp_display.setFont(self.font)

        self.temp_set_label = QLabel(self)
        self.temp_set_label.setText('Set Temperature:')
        self.temp_set_label.setSizePolicy(self.size_policy[0],
                                          self.size_policy[1])
        self.temp_set_label.setFont(self.font)
        #        self.temp_set_label.setAlignment(Qt.AlignRight)

        self.temp_set = QLCDNumber(self)
        self.temp_set.setSizePolicy(self.size_policy[0], self.size_policy[1])
        self.temp_set.setFont(self.font)

        self.temp_dial = QDial(self)
        self.temp_dial.setSizePolicy(self.size_policy[0], self.size_policy[1])
        self.temp_dial.setProperty('value', 0)
        self.temp_dial.setSliderPosition(0)
        self.temp_dial.setNotchesVisible(True)
        self.temp_dial.setMaximum(600)
        self.temp_dial.setToolTip('Set Desired Temperature in Fahrenheit')
        self.temp_dial.valueChanged.connect(self.update_temperature)

        self.exhasut_fan = QRadioButton('&Enable Exhaust Fan')
        self.exhasut_fan.setSizePolicy(self.size_policy[0],
                                       self.size_policy[1])
        self.exhasut_fan.setFont(self.font)
        self.exhasut_fan.setToolTip('Enable exhaust fan')

        self.intake_fan = QRadioButton('&Enable Intake Fan')
        self.intake_fan.setSizePolicy(self.size_policy[0], self.size_policy[1])
        self.intake_fan.setFont(self.font)
        self.intake_fan.setToolTip('Enable intake fan')

        self.start_button = QPushButton('Start', self)
        self.start_button.setSizePolicy(self.size_policy[0],
                                        self.size_policy[1])
        self.start_button.setFont(self.font)
        self.start_button.setToolTip('Start Maintaining Temperature')
        self.start_button.clicked.connect(self.maintain_temperature)

        self.timer_button = QPushButton('Timer', self)
        self.timer_button.setSizePolicy(self.size_policy[0],
                                        self.size_policy[1])
        self.timer_button.setFont(self.font)
        self.timer_button.setToolTip('Cook Time')

        qp = QPainter()
        qp.begin(self)
        qp.setPen(QPen(QColor(255, 80, 0), 3))
        qp.setBrush(QColor(255, 80, 0))
        qp.drawEllipse(QPoint(50, 60), 30, 30)
        qp.end()

        #add the grid layout to the interface
        self.layout = QGridLayout(self)
        self.layout.addWidget(self.temp_dial, 0, 0, 2, 2)
        self.layout.addWidget(self.temp_set_label, 2, 0)
        self.layout.addWidget(self.temp_set, 2, 1, 1, 2)
        self.layout.addWidget(self.temp_display_label, 3, 0)
        self.layout.addWidget(self.temp_display, 3, 1)
        self.layout.addWidget(self.exhasut_fan, 4, 0)
        self.layout.addWidget(self.intake_fan, 4, 1)
        self.layout.addWidget(self.start_button, 5, 0)
        self.layout.addWidget(self.timer_button, 5, 1)


#        self.layout.addWidget(qp,6,1)

    def update_temperature(self):
        self.temp_set.display(str(self.temp_dial.sliderPosition()))
        try:
            self.start_button.setEnabled(True)
            self.Temp.stop()
        except:
            '''do nothing here'''

    def maintain_temperature(self):
        self.Temp = temp_operation(self)
        self.start_button.setDisabled(True)
        self.Temp.isRunning = False
        time.sleep(1)
        if self.Temp.isRunning == False:
            self.Temp.isRunning = True
            self.Temp.set_temp = self.temp_dial.sliderPosition()
            self.Temp.display_update.connect(self.temp_display.display)
            self.Temp.start()
            print(self.Temp.isRunning)
コード例 #26
0
class dial_4vent(QWidget):
    style ='''
    QDial
    {
        background-color: rgb(255,255,255);
        font: 15px Menlo;
        color: rgb(0, 0, 131);
        /*text-align: left;*/
    }
    QLabel {
        /*border: 1px solid white;*/
        border-radius: 5px;
        background-color:  rgb(172, 236, 217);
        font: 15px Verdana, sans-serif;
        color:  rgb(0, 0, 131);
        text-align: center;
    }
    '''
    def __init__(self, title, min, max, **kwargs):
        super().__init__()
        self.title = title
        self.min   = min;self.max = max; self.moved_cbs = []
        self.layout = QGridLayout()
        self.label0 = QLabel(self)
        self.label  = QLabel(self)
        self.dial   = QDial()
        self.bar    = _Bar(["#5e4fa2", "#3288bd", "#66c2a5", "#abdda4",
                            "#e6f598", "#ffffbf", "#fee08b", "#fdae61",
                            "#f46d43", "#d53e4f", "#9e0142"])
        #_Bar(20) for pink ["#49006a", "#7a0177", "#ae017e", "#dd3497", "#f768a1", "#fa9fb5", "#fcc5c0", "#fde0dd", "#fff7f3"]
        self.label0.setStyleSheet(self.style)
        self.dial.setStyleSheet(self.style)
        self.label.setStyleSheet(self.style)
        self.dial.setMinimum(self.min)
        self.dial.setMaximum(self.max)
        self.dial.setValue(self.max)
        self.dial.setNotchesVisible(True)
        self.dial.valueChanged.connect(self.slider_moved)
        self.dial.setWrapping(False)
        self.dial.setGeometry(QtCore.QRect(25,25,100,100))
        self.layout.addWidget(self.label0, 0, 0, 1, 1)
        self.layout.addWidget(self.dial,1,0,1,1)
        self.layout.addWidget(self.bar,1,1,1,1)
        self.layout.addWidget(self.label,2,0, 1, 1)
        self.setLayout(self.layout)
        self.label0.setText(self.title)
        self.label.setStyleSheet("font-family: Impact, Charcoal, sans-serif");
        self.label.setText(str(self.dial.value()))
        #self.dial.installEventFilter(self) ## disables person using mouse
        self.show()
        ## Bar related initalization
        self.add_slider_moved(self.bar._trigger_refresh)
        # Take NO feedback from click events on the meter.
        self.bar.installEventFilter(self)

    def __getattr__(self, name):
        if name in self.__dict__:
            return self[name]
        return getattr(self.dial, name)

    def eventFilter(self, source, event):
        if (source is self.dial and isinstance(event, (
            QtGui.QMouseEvent, QtGui.QWheelEvent, QtGui.QKeyEvent))):
            return True
        return QtGui.QWidget.eventFilter(self, source, event)

    def slider_moved(self):
        self.label.setText(str(self.dial.value()))
        for fn in self.moved_cbs:
            fn()
    def add_slider_moved(self, func):
        self.moved_cbs.append(func)

    def setColor(self, color):
        self.bar.steps = [color] * self.bar.n_steps
        self.bar.update()

    def setColors(self, colors):
        self.bar.n_steps = len(colors)
        self.bar.steps = colors
        self.bar.update()

    def setBarPadding(self, i):
        self.bar._padding = int(i)
        self.bar.update()

    def setBarSolidPercent(self, f):
        self.bar.bar_solid_percent = float(f)
        self.bar.update()

    def setBackgroundColor(self, color):
        self.bar._background_color = QtGui.QColor(color)
        self.bar.update()
コード例 #27
0
ファイル: scalabledial.py プロジェクト: h1z1/Carla
    def __init__(self, parent, index=0):
        QDial.__init__(self, parent)

        self.fDialMode = self.MODE_LINEAR

        self.fMinimum = 0.0
        self.fMaximum = 1.0
        self.fRealValue = 0.0
        self.fPrecision = 10000
        self.fIsInteger = False

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

        self.fLastDragPos = None
        self.fLastDragValue = 0.0

        self.fIndex = index
        self.fImage = QSvgWidget(":/scalable/dial_03.svg")
        self.fImageNum = "01"

        if self.fImage.sizeHint().width() > self.fImage.sizeHint().height():
            self.fImageOrientation = self.HORIZONTAL
        else:
            self.fImageOrientation = self.VERTICAL

        self.fLabel = ""
        self.fLabelPos = QPointF(0.0, 0.0)
        self.fLabelFont = QFont(self.font())
        self.fLabelFont.setPixelSize(8)
        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, custom precision
        QDial.setMinimum(self, 0)
        QDial.setMaximum(self, self.fPrecision)
        QDial.setValue(self, 0)

        self.valueChanged.connect(self.slot_valueChanged)
コード例 #28
0
ファイル: scalabledial.py プロジェクト: h1z1/Carla
 def setPrecision(self, value, isInteger):
     self.fPrecision = value
     self.fIsInteger = isInteger
     QDial.setMaximum(self, value)
コード例 #29
0
ファイル: pixmapdial.py プロジェクト: falkTX/Carla
 def setPrecision(self, value, isInteger):
     self.fPrecision = value
     self.fIsInteger = isInteger
     QDial.setMaximum(self, value)
コード例 #30
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1871, 1200)
        self.centralwidget = QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.transformsGroupBox = QGroupBox(self.centralwidget)
        self.transformsGroupBox.setGeometry(QRect(1500, 170, 240, 500))
        self.transformsGroupBox.setMaximumSize(QSize(240, 600))
        font = QFont()
        font.setFamily("MS Shell Dlg 2")
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.transformsGroupBox.setFont(font)
        self.transformsGroupBox.setToolTip("")
        self.transformsGroupBox.setWhatsThis("")
        self.transformsGroupBox.setObjectName("transformsGroupBox")
        self.edgesButton = QPushButton(self.transformsGroupBox)
        self.edgesButton.setGeometry(QRect(110, 180, 120, 30))
        self.edgesButton.setObjectName("edgesButton")
        self.brightnessButton = QPushButton(self.transformsGroupBox)
        self.brightnessButton.setGeometry(QRect(110, 20, 120, 30))
        font = QFont()
        font.setPointSize(8)
        self.brightnessButton.setFont(font)
        self.brightnessButton.setObjectName("brightnessButton")
        self.getSizeButton = QPushButton(self.transformsGroupBox)
        self.getSizeButton.setGeometry(QRect(0, 470, 75, 23))
        self.getSizeButton.setObjectName("getSizeButton")
        self.paramsGroupBox = QGroupBox(self.transformsGroupBox)
        self.paramsGroupBox.setGeometry(QRect(10, 29, 91, 321))
        font = QFont()
        font.setPointSize(8)
        self.paramsGroupBox.setFont(font)
        self.paramsGroupBox.setObjectName("paramsGroupBox")
        self.leftSlider = QSlider(self.paramsGroupBox)
        self.leftSlider.setGeometry(QRect(10, 50, 20, 240))
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.leftSlider.sizePolicy().hasHeightForWidth())
        self.leftSlider.setSizePolicy(sizePolicy)
        self.leftSlider.setOrientation(Qt.Vertical)
        self.leftSlider.setTickPosition(QSlider.TicksAbove)
        self.leftSlider.setObjectName("leftSlider")
        self.rightSlider = QSlider(self.paramsGroupBox)
        self.rightSlider.setGeometry(QRect(50, 50, 20, 240))
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.rightSlider.sizePolicy().hasHeightForWidth())
        self.rightSlider.setSizePolicy(sizePolicy)
        self.rightSlider.setOrientation(Qt.Vertical)
        self.rightSlider.setTickPosition(QSlider.TicksAbove)
        self.rightSlider.setObjectName("rightSlider")
        self.leftLabel = QLabel(self.paramsGroupBox)
        self.leftLabel.setGeometry(QRect(10, 20, 20, 15))
        self.leftLabel.setTextFormat(Qt.PlainText)
        self.leftLabel.setAlignment(Qt.AlignRight|Qt.AlignTrailing|Qt.AlignVCenter)
        self.leftLabel.setObjectName("leftLabel")
        self.rightLabel = QLabel(self.paramsGroupBox)
        self.rightLabel.setGeometry(QRect(50, 20, 20, 15))
        self.rightLabel.setTextFormat(Qt.PlainText)
        self.rightLabel.setAlignment(Qt.AlignRight|Qt.AlignTrailing|Qt.AlignVCenter)
        self.rightLabel.setObjectName("rightLabel")
        self.adaptiveThresholdButton = QPushButton(self.transformsGroupBox)
        self.adaptiveThresholdButton.setGeometry(QRect(110, 140, 120, 30))
        font = QFont()
        font.setPointSize(8)
        self.adaptiveThresholdButton.setFont(font)
        self.adaptiveThresholdButton.setObjectName("adaptiveThresholdButton")
        self.gray2colSelButton = QPushButton(self.transformsGroupBox)
        self.gray2colSelButton.setGeometry(QRect(110, 100, 120, 30))
        font = QFont()
        font.setPointSize(8)
        self.gray2colSelButton.setFont(font)
        self.gray2colSelButton.setObjectName("gray2colSelButton")
        self.gray2colAllButton = QPushButton(self.transformsGroupBox)
        self.gray2colAllButton.setGeometry(QRect(110, 60, 120, 30))
        font = QFont()
        font.setPointSize(8)
        self.gray2colAllButton.setFont(font)
        self.gray2colAllButton.setObjectName("gray2colAllButton")
        self.fftButton = QPushButton(self.transformsGroupBox)
        self.fftButton.setGeometry(QRect(110, 220, 120, 30))
        self.fftButton.setObjectName("fftButton")
        self.dftButton = QPushButton(self.transformsGroupBox)
        self.dftButton.setGeometry(QRect(110, 260, 120, 30))
        self.dftButton.setObjectName("dftButton")
        self.gaborButton = QPushButton(self.transformsGroupBox)
        self.gaborButton.setGeometry(QRect(110, 300, 120, 30))
        self.gaborButton.setObjectName("gaborButton")
        self.differenceButton = QPushButton(self.transformsGroupBox)
        self.differenceButton.setGeometry(QRect(110, 340, 120, 30))
        self.differenceButton.setObjectName("differenceButton")
        self.RGB2GrayButton = QPushButton(self.transformsGroupBox)
        self.RGB2GrayButton.setGeometry(QRect(110, 380, 120, 30))
        self.RGB2GrayButton.setObjectName("RGB2GrayButton")
        self.invertedCheckBox = QCheckBox(self.transformsGroupBox)
        self.invertedCheckBox.setGeometry(QRect(110, 430, 121, 17))
        self.invertedCheckBox.setObjectName("invertedCheckBox")
        self.angleDial = QDial(self.transformsGroupBox)
        self.angleDial.setGeometry(QRect(20, 360, 81, 64))
        self.angleDial.setMinimum(1)
        self.angleDial.setMaximum(4)
        self.angleDial.setPageStep(1)
        self.angleDial.setSliderPosition(1)
        self.angleDial.setWrapping(False)
        self.angleDial.setNotchesVisible(True)
        self.angleDial.setObjectName("angleDial")
        self.groupButtonsBox = QGroupBox(self.centralwidget)
        self.groupButtonsBox.setGeometry(QRect(1500, 730, 241, 141))
        self.groupButtonsBox.setMaximumSize(QSize(250, 600))
        font = QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.groupButtonsBox.setFont(font)
        self.groupButtonsBox.setObjectName("groupButtonsBox")
        self.addImgButton = QPushButton(self.groupButtonsBox)
        self.addImgButton.setGeometry(QRect(50, 20, 150, 30))
        palette = QPalette()
        brush = QBrush(QColor(180, 146, 66))
        brush.setStyle(Qt.SolidPattern)
        palette.setBrush(QPalette.Active, QPalette.Button, brush)
        brush = QBrush(QColor(180, 146, 66))
        brush.setStyle(Qt.SolidPattern)
        palette.setBrush(QPalette.Inactive, QPalette.Button, brush)
        brush = QBrush(QColor(180, 146, 66))
        brush.setStyle(Qt.SolidPattern)
        palette.setBrush(QPalette.Disabled, QPalette.Button, brush)
        self.addImgButton.setPalette(palette)
        font = QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.addImgButton.setFont(font)
        self.addImgButton.setObjectName("addImgButton")
        self.saveSceneImgButton = QPushButton(self.groupButtonsBox)
        self.saveSceneImgButton.setGeometry(QRect(50, 60, 150, 30))
        font = QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.saveSceneImgButton.setFont(font)
        self.saveSceneImgButton.setObjectName("saveSceneImgButton")
        self.saveImgButton = QPushButton(self.groupButtonsBox)
        self.saveImgButton.setGeometry(QRect(50, 100, 150, 30))
        font = QFont()
        font.setPointSize(9)
        font.setBold(True)
        font.setWeight(75)
        self.saveImgButton.setFont(font)
        self.saveImgButton.setObjectName("saveImgButton")
        self.graphicsView = QGraphicsView(self.centralwidget)
        self.graphicsView.setGeometry(QRect(10, 15, 1471, 900))
        self.graphicsView.setMaximumSize(QSize(4000, 3000))
        self.graphicsView.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
        self.graphicsView.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
        self.graphicsView.setSizeAdjustPolicy(QAbstractScrollArea.AdjustToContents)
        self.graphicsView.setObjectName("graphicsView")
        self.scene = TransformScene()
        self.graphicsView.setScene(self.scene)
        self.scaleEditLabel = QLabel(self.centralwidget)
        self.scaleEditLabel.setGeometry(QRect(1500, 100, 47, 13))
        font = QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.scaleEditLabel.setFont(font)
        self.scaleEditLabel.setObjectName("scaleEditLabel")
        self.scaleBox = QDoubleSpinBox(self.centralwidget)
        self.scaleBox.setGeometry(QRect(1550, 100, 62, 22))
        font = QFont()
        font.setBold(True)
        font.setWeight(75)
        self.scaleBox.setFont(font)
        self.scaleBox.setMinimum(0.1)
        self.scaleBox.setMaximum(10.0)
        self.scaleBox.setSingleStep(0.1)
        self.scaleBox.setProperty("value", 0.5)
        self.scaleBox.setObjectName("scaleBox")
        self.infoLabel = QLabel(self.centralwidget)
        self.infoLabel.setGeometry(QRect(1499, 130, 230, 20))
        self.infoLabel.setFrameShape(QFrame.WinPanel)
        self.infoLabel.setText("")
        self.infoLabel.setAlignment(Qt.AlignCenter)
        self.infoLabel.setObjectName("infoLabel")
        self.infoLabel_2 = QLabel(self.centralwidget)
        self.infoLabel_2.setGeometry(QRect(1500, 20, 230, 20))
        font = QFont()
        font.setBold(True)
        font.setItalic(True)
        font.setWeight(75)
        self.infoLabel_2.setFont(font)
        self.infoLabel_2.setFrameShape(QFrame.WinPanel)
        self.infoLabel_2.setText("")
        self.infoLabel_2.setAlignment(Qt.AlignCenter)
        self.infoLabel_2.setObjectName("infoLabel_2")
        self.infoLabel_3 = QLabel(self.centralwidget)
        self.infoLabel_3.setGeometry(QRect(1500, 60, 230, 20))
        font = QFont()
        font.setBold(True)
        font.setItalic(True)
        font.setWeight(75)
        self.infoLabel_3.setFont(font)
        self.infoLabel_3.setFrameShape(QFrame.Box)
        self.infoLabel_3.setText("")
        self.infoLabel_3.setAlignment(Qt.AlignCenter)
        self.infoLabel_3.setObjectName("infoLabel_3")
        self.clearImgButton = QPushButton(self.centralwidget)
        self.clearImgButton.setGeometry(QRect(1550, 690, 150, 30))
        font = QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.clearImgButton.setFont(font)
        self.clearImgButton.setObjectName("clearImgButton")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QMenuBar(MainWindow)
        self.menubar.setGeometry(QRect(0, 0, 1871, 21))
        self.menubar.setObjectName("menubar")
        self.menuHelp = QMenu(self.menubar)
        self.menuHelp.setObjectName("menuHelp")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.actionExit = QAction(MainWindow)
        self.actionExit.setObjectName("actionExit")
        self.actionHelp = QAction(MainWindow)
        self.actionHelp.setObjectName("actionHelp")
        self.actionAbout = QAction(MainWindow)
        self.actionAbout.setObjectName("actionAbout")
        self.actionDefault_Values = QAction(MainWindow)
        self.actionDefault_Values.setObjectName("actionDefault_Values")
        self.menuHelp.addAction(self.actionHelp)
        self.menuHelp.addAction(self.actionAbout)
        self.menuHelp.addSeparator()
        self.menuHelp.addAction(self.actionDefault_Values)
        self.menubar.addAction(self.menuHelp.menuAction())

        self.retranslateUi(MainWindow)
        QMetaObject.connectSlotsByName(MainWindow)
        self.scene.file_signal.connect(on_file_signal)
        self.scene.info_signal.connect(on_info_signal)
        self.scene.sliders_reset_signal.connect(on_sliders_reset_signal)
        

    def retranslateUi(self, MainWindow):
        _translate = QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "Green Monkey"))
        self.transformsGroupBox.setTitle(_translate("MainWindow", "Transformations"))
        self.edgesButton.setText(_translate("MainWindow", "Edges, Sobel"))
        self.brightnessButton.setToolTip(_translate("MainWindow", "You can change brightness with left slider and blur with rigt one."))
        self.brightnessButton.setWhatsThis(_translate("MainWindow", "You can change brightness with left slider and blur with rigt one."))
        self.brightnessButton.setText(_translate("MainWindow", "Brightness and Blur"))
        self.getSizeButton.setText(_translate("MainWindow", "get Size"))
        self.paramsGroupBox.setTitle(_translate("MainWindow", "Parameters"))
        self.leftSlider.setToolTip(_translate("MainWindow", "Adaptive Threshold\n"
"blockSize – Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on."))
        self.leftSlider.setWhatsThis(_translate("MainWindow", "Adaptive Threshold\n"
"blockSize – Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on."))
        self.rightSlider.setToolTip(_translate("MainWindow", "Adaptive Threshold\n"
"C – Constant subtracted from the mean or weighted mean (see the details below). Normally, it is positive but may be zero or negative as well."))
        self.rightSlider.setWhatsThis(_translate("MainWindow", "Adaptive Threshold\n"
"C – Constant subtracted from the mean or weighted mean (see the details below). Normally, it is positive but may be zero or negative as well."))
        self.leftLabel.setText(_translate("MainWindow", "0"))
        self.rightLabel.setText(_translate("MainWindow", "0"))
        self.adaptiveThresholdButton.setText(_translate("MainWindow", "Adaptive Threshold"))
        self.gray2colSelButton.setToolTip(_translate("MainWindow", "Gray scale 0..255 to color with selected method only.\n"
"Image is converted to gray and finally to color."))
        self.gray2colSelButton.setWhatsThis(_translate("MainWindow", "Gray scale 0..255 to color with selected method only.\n"
"Image is converted to gray and  and finally to color."))
        self.gray2colSelButton.setText(_translate("MainWindow", "Gray2Color Sel."))
        self.gray2colAllButton.setToolTip(_translate("MainWindow", "Gray scale 0..255 to color for all available methods.\n"
"Image resized as per scale window and then  is converted to gray and finally to color."))
        self.gray2colAllButton.setWhatsThis(_translate("MainWindow", "Gray scale 0..255 to color for all available methods.\n"
"Image resized as per scale window and then  is converted to gray and finally to color."))
        self.gray2colAllButton.setText(_translate("MainWindow", "Gray2Color All"))
        self.fftButton.setText(_translate("MainWindow", "FFT"))
        self.dftButton.setText(_translate("MainWindow", "DFT"))
        self.gaborButton.setToolTip(_translate("MainWindow", "Applies Gabor Filter"))
        self.gaborButton.setWhatsThis(_translate("MainWindow", "Applies Gabor Filter"))
        self.gaborButton.setText(_translate("MainWindow", "Gabor Filter"))
        self.differenceButton.setText(_translate("MainWindow", "Difference"))
        self.RGB2GrayButton.setText(_translate("MainWindow", "RGB to Gray"))
        self.invertedCheckBox.setText(_translate("MainWindow", "Inverted Image"))
        self.angleDial.setToolTip(_translate("MainWindow", "GABOR Filter - angle 1..4 ~ 1*np.pi/angle"))
        self.angleDial.setWhatsThis(_translate("MainWindow", "GABOR Filter - angle 1..4 ~ 1*np.pi/angle"))
        self.groupButtonsBox.setTitle(_translate("MainWindow", "Images"))
        self.addImgButton.setText(_translate("MainWindow", "Add Image(s)"))
        self.addImgButton.setShortcut(_translate("MainWindow", "Ctrl+A"))
        self.saveSceneImgButton.setText(_translate("MainWindow", "Save Scene as Image"))
        self.saveImgButton.setText(_translate("MainWindow", "Save Selected as Image"))
        self.scaleEditLabel.setText(_translate("MainWindow", "Scale:"))
        self.clearImgButton.setText(_translate("MainWindow", "Clear Image(s)"))
        self.menuHelp.setTitle(_translate("MainWindow", "Help"))
        self.actionExit.setText(_translate("MainWindow", "Exit"))
        self.actionHelp.setText(_translate("MainWindow", "Help"))
        self.actionAbout.setText(_translate("MainWindow", "About"))
        self.actionDefault_Values.setText(_translate("MainWindow", "Default Values"))

        self.actionHelp.setShortcut('F1')
        self.actionHelp.setStatusTip('Help')  
        self.actionHelp.triggered.connect(self.showHelp)
        self.actionAbout.setStatusTip('About')  
        self.actionAbout.triggered.connect(self.showAbout)
        self.actionDefault_Values.setStatusTip('Default folders and other values')
        self.actionDefault_Values.triggered.connect(self.updateINI)
   
        self.addImgButton.clicked.connect(partial(self.scene.addImg))
        self.clearImgButton.clicked.connect(self.scene.dialogClearScene)
        self.saveSceneImgButton.clicked.connect(partial(self.scene.saveScene))
        self.saveImgButton.clicked.connect(partial(self.scene.saveImg))
        self.scaleBox.valueChanged.connect(self.onScaleBoxValueChanged)
        self.getSizeButton.clicked.connect(self.showSceneSize)
        self.brightnessButton.clicked.connect(self.startBrightnessAndBlur)
        self.gray2colAllButton.clicked.connect(self.startGray2colAllButton)
        self.gray2colSelButton.clicked.connect(self.startGray2colSelButton)
        self.adaptiveThresholdButton.clicked.connect(self.startAdaptiveThreshold)
        self.edgesButton.clicked.connect(self.startSobelXY)
        self.fftButton.clicked.connect(self.startFFT)
        self.dftButton.clicked.connect(self.startDFT)
        self.gaborButton.clicked.connect(self.startGabor)
        self.differenceButton.clicked.connect(self.startDifference)
        self.RGB2GrayButton.clicked.connect(self.starRGB2Gray)

        
 
        self.leftSlider.valueChanged['int'].connect(self. leftSliderChanged)
        self.rightSlider.valueChanged['int'].connect(self.rightSliderChanged)
        self.angleDial.valueChanged['int'].connect(self.angleDialChanged)
        
    def setStart(self):
        self.graphicsView.setAlignment(Qt.AlignLeft|Qt.AlignTop)
        self.scene.setSceneRect(0, 0, 0, 0)
        self.scene.imgScale = self.scaleBox.value()
        self.clearSliders()
        self.infoLabel.setText("")
        self.scene.cv2Images = {}
        self.transformsGroupBox.setEnabled(False)
        self.transformsGroupBox.setEnabled(False)
        self.invertedCheckBox.setChecked(False)

        
        
    def clearSliders(self):
        self.infoLabel_2.setText('')
        self.infoLabel_3.setText('')
        self.scene.currentTransform = 0
        self.leftSlider.setEnabled(False)
        self.leftSlider.setToolTip("")
        self.leftSlider.setWhatsThis("")
        self.leftSlider.setMaximum(99)
        self.leftSlider.setMinimum(0)
        self.leftSlider.setTickInterval(10)        
        self.leftSlider.setSingleStep(1)
        self.leftSlider.setTickPosition(11)

        self.rightSlider.setEnabled(False)
        self.rightSlider.setToolTip("")
        self.rightSlider.setWhatsThis("")
        self.rightSlider.setMaximum(99)
        self.rightSlider.setMinimum(0)
        self.rightSlider.setTickInterval(10)        
        self.rightSlider.setSingleStep(1)
        self.rightSlider.setTickPosition(0) 
        self.paramsGroupBox.setFlat(False)
        self.paramsGroupBox.setStyleSheet('QGroupBox * {color: black; font-weight: normal;}') 
        
        self.angleDial.setEnabled(False)
        self.angleDial.setToolTip(" ")
        self.angleDial.setWhatsThis("")



    def invertCheckBoxEvent(self, checked):
        self.scene.inverted = checked
               
    def showSceneSize(self):
        x = self.scene.sceneRect().width()
        y = self.scene.sceneRect().height()      
        self.infoLabel.setText(f'size: {x}x{y}, {self.scene.findSceneArea()}')

    def onScaleBoxValueChanged(self, val):
        self.scene.imgScale = val
          
    def startBrightnessAndBlur(self):
        self.scene.currentTransform = 1
        self.infoLabel_2.setText('Adaptive Threshold')      
        self.scene.currentBrightnessValue = 0
        self.scene.currentBlurValue = 0
        self.scene.transform1()

        self.infoLabel_2.setText('Brightness and Blur')
        self.scene.currentTransform = 1
        self.leftSlider.setEnabled(True)
        self.rightSlider.setEnabled(True)
        self.leftSlider.setToolTip("Change Brightness  -> 0 .. 99")
        self.leftSlider.setWhatsThis("Change Brightness  -> 0 .. 99")
        self.rightSlider.setToolTip("Change Blur  -> 0 .. 99")
        self.rightSlider.setWhatsThis("Change Blur  -> 0 .. 99")
        self.leftSlider.setMaximum(99)
        self.leftSlider.setMinimum(0)
        self.leftSlider.setTickInterval(10)        
        self.leftSlider.setSingleStep(1)
        self.leftSlider.setTickPosition(11)
        self.rightSlider.setMaximum(99)
        self.rightSlider.setMinimum(0)
        self.rightSlider.setTickInterval(10)        
        self.rightSlider.setSingleStep(1)
        self.rightSlider.setTickPosition(0) 
        self.paramsGroupBox.setFlat(True)
        self.paramsGroupBox.setStyleSheet('QGroupBox * {color: red; font-weight: bold;}')
        
    def startGray2colAllButton(self):
        self.infoLabel_2.setText('Gray to Color All Methods')
        self.scene.currentTransform = 2
        self.scene.transform2(1, 1)
        
    def startGray2colSelButton(self):
        self.scene.currentTransform = 3
        self.infoLabel_2.setText(' Gray to Color')
        self.scene.transform2(0, 1)   
    
    def startSobelXY(self):
        self.scene.currentTransform = 4
        self.infoLabel_2.setText('Edge Detection')
        self.scene.transform4()
 
    def startFFT(self):
        self.scene.currentTransform = 7
        self.infoLabel_2.setText('FFT')
        self.scene.transform7()
    
    def startDFT(self):
        self.scene.currentTransform = 6
        self.infoLabel_2.setText('DFT')
        self.scene.transform6()
        
    def startDenoising(self):
        self.scene.currentTransform = 8
        self.infoLabel_2.setText('Denoising')
        self.scene.transform8()
        
    def startDifference(self):
        self.scene.currentTransform = 9
        self.infoLabel_2.setText('Difference')
        self.scene.transform9()
        
    def starRGB2Gray(self):
        self.scene.currentTransform = 10
        #txt = self.infoLabel_2.text()
        self.infoLabel_2.setText('RGB to Gray')
        self.scene.transform10()
        
    def startAdaptiveThreshold(self):
        self.scene.currentTransform = 5
        self.infoLabel_2.setText('Adaptive Threshold')      
        self.scene.currentBlockSizeValue = 11
        self.scene.currentCValue = 5
        self.scene.transform5()

        self.leftSlider.setEnabled(True)
        self.rightSlider.setEnabled(True)
        self.leftSlider.setToolTip("Adaptive Threshold\n"
"blockSize – Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on.")
        self.leftSlider.setWhatsThis("Adaptive Threshold\n"
"blockSize – Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on.")
        self.rightSlider.setToolTip("Adaptive Threshold\n"
"C – Constant subtracted from the mean or weighted mean (see the details below). Normally, it is positive but may be zero or negative as well.")
        self.rightSlider.setWhatsThis("Adaptive Threshold\n"
"C – Constant subtracted from the mean or weighted mean (see the details below). Normally, it is positive but may be zero or negative as well.")
        self.leftSlider.setMaximum(16)
        self.leftSlider.setMinimum(1)
        self.leftSlider.setTickInterval(1)        
        self.leftSlider.setSingleStep(1)
        self.leftSlider.setTickPosition(11)
        self.rightSlider.setMaximum(20)
        self.rightSlider.setMinimum(-5)
        self.rightSlider.setTickInterval(1)        
        self.rightSlider.setSingleStep(1)
        self.rightSlider.setTickPosition(5)     
        self.paramsGroupBox.setFlat(True)
        self.paramsGroupBox.setStyleSheet('QGroupBox * {color: red; font-weight: bold;}')       

    def startGabor(self):
        self.scene.currentTransform = 8
        self.infoLabel_2.setText('Gabor Filter') 
        self.scene.currentKernelSizeValue = 10
        self.scene.currentSigmaValue = 10
        self.scene.thetaCurrentValue
        self.scene.transform8()
        self.angleDial.setEnabled(True)
        self.leftSlider.setEnabled(True)
        self.rightSlider.setEnabled(True)
        self.leftSlider.setToolTip("Gabor Filter\n"
                                  "kernelSize – Size of a kernel 1..50")
        self.leftSlider.setWhatsThis("Gabor Filter\n"
                                  "kernelSize – Size of a kernel")
        self.rightSlider.setToolTip("Gabor Filter\n"
                                  "Standard Deviation – 1..30")
        self.rightSlider.setWhatsThis("Gabor Filter\n"
                                  "Standard Deviation – 1..30")
        self.angleDial.setToolTip("GABOR Filter - angle 1..4 ~ 1*np.pi/angle")
        self.angleDial.setWhatsThis("GABOR Filter - angle 1..4 ~ 1*np.pi/angle")       
        self.leftSlider.setMaximum(50)
        self.leftSlider.setMinimum(1)
        self.leftSlider.setTickInterval(5)        
        self.leftSlider.setSingleStep(5)
        self.leftSlider.setTickPosition(10)
        self.rightSlider.setMaximum(30)
        self.rightSlider.setMinimum(1)
        self.rightSlider.setTickInterval(5)        
        self.rightSlider.setSingleStep(5)
        self.rightSlider.setTickPosition(10)     
        self.paramsGroupBox.setFlat(True)
        self.paramsGroupBox.setStyleSheet('QGroupBox * {color: red; font-weight: bold;}')       


    def leftSliderChanged(self, value):
        self.leftLabel.setText(str(value))
        if self.scene.currentTransform == 1:
            self.scene.currentBrightnessValue = value
        elif self.scene.currentTransform == 5:
            if value % 2 == 1:return 
            self.scene.currentBlockSizeValue = value
        elif self.scene.currentTransform == 8:
            self.scene.currentKernelSizeValue = value
        else:
            pass
        self.update()
                    
    def rightSliderChanged(self, value):
        self.rightLabel.setText(str(value))
        if self.scene.currentTransform == 1:
            self.scene.currentBlurValue = value
        elif self.scene.currentTransform == 5:
             self.scene.currentCValue = value
        elif self.scene.currentTransform == 8:
            self.scene.currentSigmaValue = value
        else:
            pass
        self.update()  

    def angleDialChanged(self, value): 
        if self.scene.currentTransform == 8:
            self.scene.thetaCurrentValue = value
        self.update()
           
    def update(self):
        if self.scene.currentTransform == 1:
            if len(self.scene.selectedItems()) > 0:
                self.scene.transform1()
        elif self.scene.currentTransform == 5:
            self.infoLabel_2.setText(f'Adaptive Threshold {self.scene.currentBlockSizeValue} {self.scene.currentCValue}')
            if len(self.scene.selectedItems()) > 0:
                self.scene.transform5()
        elif self.scene.currentTransform == 8:
            if len(self.scene.selectedItems()) > 0:
                self.scene.transform8()
        else:
            ...

    def updateINI(self):
        Dialog = QDialog()
        ui = Ui_INI_Dialog()
        ui.setupUi(Dialog)
        Dialog.show()
        Dialog.exec_()
        self.readINI()
        
    def readINI(self):
        self.scene.source_dir = ''
        self.scene.result_dir = ''
        self.scene.color_map = '' 
        self.scene.scale = ''
        if os.path.exists("elilik.ini"):
            f = open("elilik.ini", "r")
            Lines = f.readlines()
            # Strips the newline character
            for line in Lines:
                l = line.strip()
                if "source_dir : " in l:
                    self.scene.source_dir = l.replace("source_dir : ","").strip()
                elif "result_dir : " in l:
                    self.scene.result_dir = l.replace("result_dir : ","").strip()  
                elif "color_map : " in l:
                     s = l.replace("color_map : ","").strip()
                     self.scene.color_map = s.split()
                elif "scale : " in l:
                    self.scene.scale = l.replace("scale : ","").strip()
                else:
                    ...

    def showHelp(self):
        help = showText(os.getcwd()+"/help.html") 
        help.exec_()
 
    def showAbout(self):
        about = showText(os.getcwd()+"/about.html")
        about.resize(280,250)
        about.exec_()
コード例 #31
0
class Start(QMainWindow):
    def __init__(self):
        super(Start, self).__init__()
        self.titles = "Media Player"
        self.left = 500
        self.top = 300
        self.width = 400
        self.height = 200
        self.window_main()
        self.adding_menus()

    def openMultipleFile(self):
        dialogs = QFileDialog(self)
        self.fnames, _ = dialogs.getOpenFileNames(
            self, 'Open Media Files', QDir.homePath(),
            "Videos (*.mp4 *.mkv *.3pg)")
        if self.fnames != '':
            self.playlist = QMediaPlaylist(self)
            self.fnamelist = []
            for playlst in self.fnames:
                self.fnamelist.append(
                    QMediaContent(QUrl.fromLocalFile(playlst)))
            self.playlist.addMedia(self.fnamelist)
            self.playlist.setCurrentIndex(1)
            self.videoWidget = QVideoWidget(self)

            self.mediaPlayer.setVideoOutput(self.videoWidget)
            #        self.videoWidget.setAspectRatioMode(60, 60,Qt.KeepAspectRatioByExpanding)

            self.mediaPlayer.setPlaylist(self.playlist)
            self.playlist.currentIndexChanged.connect(self.mediaNameChange)
            self.mediaPlayer.play()
            self.play.setIcon(self.style().standardIcon(QStyle.SP_MediaPause))
            self.play.setEnabled(True)
            self.stop.setEnabled(True)
            self.loop.setEnabled(True)
            if (len(self.fnamelist) > 1):
                self.forw.setEnabled(True)
                self.shuffl.setEnabled(True)
            self.l1.setText("00:00")
            mediaName = self.fnames[0].rsplit('/', 1)[-1]
            self.fulltitle = mediaName + " - " + self.titles
            self.setWindowTitle(self.fulltitle)
            self.mediaPlayer.durationChanged.connect(self.sliderDuration)

    def openFile(self):
        self.fname, _ = QFileDialog.getOpenFileName(
            self, 'Open Media Files', QDir.homePath(),
            "Videos (*.mp4 *.mkv *.3pg)")

        if self.fname != '':
            mediaName = self.fname.rsplit('/', 1)[-1]
            self.fulltitle = mediaName + " - " + self.titles
            self.setWindowTitle(self.fulltitle)
            self.playlist = QMediaPlaylist(self)
            self.playlist.addMedia(
                QMediaContent(QUrl.fromLocalFile(self.fname)))
            self.playlist.setCurrentIndex(1)
            self.mediaPlayer.setPlaylist(self.playlist)
            self.playlist.currentIndexChanged.connect(self.mediaNameChange)
            self.mediaPlayer.play()
            self.play.setIcon(self.style().standardIcon(QStyle.SP_MediaPause))
            self.play.setEnabled(True)
            self.stop.setEnabled(True)
            self.loop.setEnabled(True)
            self.l1.setText("00:00")
            self.mediaPlayer.durationChanged.connect(self.sliderDuration)

    def window_main(self):
        self.setWindowTitle(self.titles)
        qw = QWidget()
        self.setGeometry(self.left, self.top, qw.maximumWidth(),
                         qw.maximumHeight())
        self.setMinimumSize(540, 0)
        self.setWindowIcon(QIcon("mediaplayer.png"))
        self.video()
        self.show()

    def sliderChanged(self, position):
        pos = position * 1000
        self.mediaPlayer.setPosition(pos)
        self.slider.setValue(position)

    def adding_menus(self):
        menu = Allmenu(self)

    def volumeChange(self, vol):
        self.mediaPlayer.setVolume(vol)

    def sliderDuration(self, duratn):
        milisec = self.mediaPlayer.duration()
        sec = int(milisec / 1000)
        hour = int(sec / 3600)
        min = int((sec / 60) - (hour * 60))
        secs = int(sec - (min * 60) - (hour * 60 * 60))
        self.l2.setText(str(hour) + ":" + str(min) + ":" + str(secs))
        self.slider.setMaximum(sec)

    def sliderDuration2(self, duratn):
        second = int(duratn / 1000)
        self.slider.setValue(second)
        hour = int(second / 3600)
        min = int((second / 60) - (hour * 60))
        secs = int(second - (min * 60) - (hour * 60 * 60))
        if (min < 10):
            min = "0" + str(min)
        else:
            min = str(min)

        if (secs < 10):
            secs = "0" + str(secs)
        else:
            secs = str(secs)

        if (hour == 0):
            self.l1.setText(min + ":" + secs)
        else:
            self.l1.setText(str(hour) + ":" + min + ":" + secs)

    def mediaNameChange(self, index):
        mediaName = self.fnames[index].rsplit('/', 1)[-1]
        self.fulltitle = mediaName + " - " + self.titles
        self.setWindowTitle(self.fulltitle)
        if (self.playlist.playbackMode() == 4):
            self.forw.setEnabled(True)
            self.back.setEnabled(True)
        else:
            if ((index + 1) == self.playlist.mediaCount()):
                self.forw.setEnabled(False)
                self.back.setEnabled(True)
            else:
                self.back.setEnabled(True)

    def video(self):
        self.mediaPlayer = QMediaPlayer(None, QMediaPlayer.VideoSurface)
        self.mediaPlayer.positionChanged.connect(self.sliderDuration2)
        self.mediaPlayer.setVolume(10)

        videoWidget = QVideoWidget()
        layout = QVBoxLayout()

        wid = QWidget(self)
        self.play = QPushButton()
        self.play.setEnabled(False)
        self.play.setFixedWidth(40)
        self.play.setFixedHeight(30)
        self.play.setIcon(self.style().standardIcon(QStyle.SP_MediaPlay))
        self.play.setIconSize(QSize(20, 20))
        self.play.clicked.connect(self.playAction)
        self.play.setShortcut(QKeySequence("Space"))

        self.back = QPushButton()
        self.back.setEnabled(False)
        self.back.setFixedWidth(40)
        self.back.setFixedHeight(25)
        self.back.setStyleSheet("margin-left: 10px")
        self.back.setIcon(self.style().standardIcon(
            QStyle.SP_MediaSeekBackward))
        self.back.setIconSize(QSize(14, 14))
        self.back.clicked.connect(self.prevAction)

        self.back.setShortcut(QKeySequence("Ctrl+b"))

        self.stop = QPushButton()
        self.stop.setEnabled(False)
        self.stop.setFixedWidth(40)
        self.stop.setFixedHeight(25)
        self.stop.setStyleSheet("margin-left: 0px")
        self.stop.setIcon(self.style().standardIcon(QStyle.SP_MediaStop))
        self.stop.setIconSize(QSize(14, 14))
        self.stop.clicked.connect(self.stopAction)
        self.stop.setShortcut(QKeySequence("s"))

        self.forw = QPushButton()
        self.forw.setEnabled(False)
        self.forw.setFixedWidth(40)
        self.forw.setFixedHeight(25)
        self.forw.setStyleSheet("margin-left: 0px")
        self.forw.setIcon(self.style().standardIcon(
            QStyle.SP_MediaSeekForward))
        self.forw.setIconSize(QSize(14, 14))
        self.forw.clicked.connect(self.forwAction)
        self.forw.setShortcut(QKeySequence("Ctrl+f"))

        self.loop = QPushButton()
        self.loop.setEnabled(False)
        self.loop.setFixedWidth(40)
        self.loop.setFixedHeight(25)
        self.loop.setStyleSheet("margin-left: 10px")
        self.loop.setIcon(QIcon(QPixmap("loop.svg")))
        self.loop.setIconSize(QSize(14, 14))
        self.loop.clicked.connect(self.loopAction)
        self.loop.setShortcut(QKeySequence("Ctrl+l"))

        self.shuffl = QPushButton()
        self.shuffl.setEnabled(False)
        self.shuffl.setFixedHeight(25)
        self.shuffl.setStyleSheet("margin-left: 0px")
        self.shuffl.setFixedWidth(40)
        self.shuffl.setFixedHeight(25)
        self.shuffl.setStyleSheet("margin-left: 0px")
        self.shuffl.setIcon(QIcon(QPixmap("shuffl.svg")))
        self.shuffl.setIconSize(QSize(14, 14))
        self.shuffl.clicked.connect(self.shufflAction)
        self.shuffl.setShortcut(QKeySequence("Ctrl+shift+s"))

        spacer = QSpacerItem(40, 20, QSizePolicy.Expanding,
                             QSizePolicy.Minimum)

        self.volume = QDial()
        self.volume.setFixedWidth(40)
        self.volume.setFixedHeight(40)
        self.volume.setMaximum(100)
        self.volume.setMinimum(0)
        self.volume.setToolTip("Volume")
        self.volume.valueChanged.connect(self.volumeChange)

        hlayout = QHBoxLayout()
        hlayout.addWidget(self.play)
        hlayout.addWidget(self.back)
        hlayout.addWidget(self.stop)
        hlayout.addWidget(self.forw)
        hlayout.addWidget(self.loop)
        hlayout.addWidget(self.shuffl)
        hlayout.addItem(spacer)
        hlayout.addWidget(self.volume)

        hslayout = QHBoxLayout()
        self.slider = QSlider(Qt.Horizontal)
        self.slider.setMinimum(0)
        self.slider.setMaximum(0)
        self.l1 = QLabel()
        self.l1.setText("--:--:--")
        self.l2 = QLabel()
        self.l2.setText("--:--:--")
        self.slider.sliderMoved.connect(self.sliderChanged)
        hslayout.addWidget(self.l1)
        hslayout.addWidget(self.slider)
        hslayout.addWidget(self.l2)

        layout.addWidget(videoWidget)

        layout.addLayout(hslayout)
        layout.addLayout(hlayout)
        wid.setLayout(layout)

        self.setCentralWidget(wid)
        self.mediaPlayer.setVideoOutput(videoWidget)

    def playAction(self):
        if (self.mediaPlayer.state() == 1):
            self.mediaPlayer.pause()
            self.play.setIcon(self.style().standardIcon(QStyle.SP_MediaPlay))
        elif (self.mediaPlayer.state() == 2):
            self.mediaPlayer.play()
            self.play.setIcon(self.style().standardIcon(QStyle.SP_MediaPause))

        else:
            self.back.setEnabled(False)
            self.play.setIcon(self.style().standardIcon(QStyle.SP_MediaPlay))

    def stopAction(self):
        self.mediaPlayer.stop()
        self.play.setEnabled(False)
        self.play.setIcon(self.style().standardIcon(QStyle.SP_MediaPlay))
        self.setWindowTitle(self.titles)
        self.l1.setText("--:--:--")
        self.l2.setText("--:--:--")

    def forwAction(self):
        if (self.playlist.playbackMode() == 4):
            self.forw.setEnabled(True)
            self.back.setEnabled(True)
            indexes = random.randint(0, (self.playlist.mediaCount() - 1))
            self.playlist.setCurrentIndex(indexes)
        elif (self.playlist.playbackMode() == 1):
            self.playlist.next()
        else:
            print(self.playlist.currentIndex())
            if ((self.playlist.currentIndex() +
                 2) == self.playlist.mediaCount()):
                self.forw.setEnabled(False)
                self.playlist.next()
                self.back.setEnabled(True)
            else:
                self.playlist.next()
                self.back.setEnabled(True)

    def prevAction(self):
        if (self.playlist.playbackMode() == 4):
            self.forw.setEnabled(True)
            self.back.setEnabled(True)
            indexes = random.randint(0, (self.playlist.mediaCount() - 1))
            self.playlist.setCurrentIndex(indexes)
        elif (self.playlist.playbackMode() == 1):
            self.playlist.previous()
        else:
            if (self.playlist.currentIndex() == 1):
                self.forw.setEnabled(True)
                self.playlist.previous()
                self.back.setEnabled(False)
            else:
                self.playlist.previous()
                self.forw.setEnabled(True)

    def loopAction(self):
        if (self.playlist.playbackMode() != 1):
            self.playlist.setPlaybackMode(QMediaPlaylist.CurrentItemInLoop)
            self.loop.setIcon(QIcon(QPixmap("greenloop.svg")))
            self.shuffl.setIcon(QIcon(QPixmap("shuffl.svg")))
        else:
            self.playlist.setPlaybackMode(QMediaPlaylist.Sequential)
            self.loop.setIcon(QIcon(QPixmap("loop.svg")))

    def shufflAction(self):
        if (self.playlist.playbackMode() != 4):
            self.playlist.setPlaybackMode(QMediaPlaylist.Random)
            self.shuffl.setIcon(QIcon(QPixmap("greenshuffl.svg")))
            self.loop.setIcon(QIcon(QPixmap("loop.svg")))
        else:
            self.playlist.setPlaybackMode(QMediaPlaylist.Sequential)
            self.shuffl.setIcon(QIcon(QPixmap("shuffl.svg")))

    def close(self):
        sys.exit(1)
コード例 #32
0
class ChromAbWidget(QWidget):
    def __init__(self, parent=None):
        super(ChromAbWidget, self).__init__(parent)

        self.maxD = 20
        self.deadZ = 5
        self.isShapeRadial = True
        self.isFalloffExp = True
        self.direction = 100
        self.interpolate = False
        self.numThreads = 4

        self.shapeInfo = QLabel("Shape and Direction:", self)
        self.shapeChoice = QButtonGroup(self)
        self.shapeBtn1 = QRadioButton("Radial")
        self.shapeBtn2 = QRadioButton("Linear")
        self.shapeChoice.addButton(self.shapeBtn1)
        self.shapeChoice.addButton(self.shapeBtn2)
        self.shapeBtn1.setChecked(True)
        self.shapeBtn1.pressed.connect(self.changeShape1)
        self.shapeBtn2.pressed.connect(self.changeShape2)

        self.theDial = QDial()
        self.theDial.setMinimum(0)
        self.theDial.setMaximum(359)
        self.theDial.setValue(100)
        self.theDial.setWrapping(True)
        self.theDial.valueChanged.connect(self.updateDial)

        self.maxInfo = QLabel("Max Displacement: 20px", self)
        self.maxDisplace = QSlider(Qt.Horizontal, self)
        self.maxDisplace.setRange(1, 300)
        self.maxDisplace.setValue(20)
        self.maxDisplace.valueChanged.connect(self.updateMax)

        self.falloffInfo = QLabel("Falloff:", self)
        self.falloffChoice = QButtonGroup(self)
        self.foBtn1 = QRadioButton("Exponential")
        self.foBtn2 = QRadioButton("Linear")
        self.falloffChoice.addButton(self.foBtn1)
        self.falloffChoice.addButton(self.foBtn2)
        self.foBtn1.setChecked(True)
        self.foBtn1.pressed.connect(self.changeFalloff1)
        self.foBtn2.pressed.connect(self.changeFalloff2)

        self.deadInfo = QLabel("Deadzone: 5%", self)
        self.deadzone = QSlider(Qt.Horizontal, self)
        self.deadzone.setRange(0, 100)
        self.deadzone.setValue(5)
        self.deadzone.valueChanged.connect(self.updateDead)

        self.biFilter = QCheckBox(
            "Bilinear Interpolation (slow, but smooths colors)", self)
        self.biFilter.stateChanged.connect(self.updateInterp)

        self.threadInfo = QLabel(
            "Number of Worker Threads (FOR ADVANCED USERS): 4", self)
        self.workThreads = QSlider(Qt.Horizontal, self)
        self.workThreads.setRange(1, 64)
        self.workThreads.setValue(4)
        self.workThreads.valueChanged.connect(self.updateThread)

        vbox = QVBoxLayout()
        vbox.addWidget(self.shapeInfo)
        vbox.addWidget(self.shapeBtn1)
        vbox.addWidget(self.shapeBtn2)
        vbox.addWidget(self.theDial)
        vbox.addWidget(self.maxInfo)
        vbox.addWidget(self.maxDisplace)
        vbox.addWidget(self.falloffInfo)
        vbox.addWidget(self.foBtn1)
        vbox.addWidget(self.foBtn2)
        vbox.addWidget(self.deadInfo)
        vbox.addWidget(self.deadzone)
        vbox.addWidget(self.biFilter)
        vbox.addWidget(self.threadInfo)
        vbox.addWidget(self.workThreads)

        self.setLayout(vbox)
        self.show()

    # Update labels and members
    def updateMax(self, value):
        self.maxInfo.setText("Max Displacement: " + str(value) + "px")
        self.maxD = value

    def updateDead(self, value):
        self.deadInfo.setText("Deadzone: " + str(value) + "%")
        self.deadZ = value

    def changeShape1(self):
        self.isShapeRadial = True

    def changeShape2(self):
        self.isShapeRadial = False

    def changeFalloff1(self):
        self.isFalloffExp = True

    def changeFalloff2(self):
        self.isFalloffExp = False

    def updateDial(self, value):
        self.direction = value

    def updateInterp(self, state):
        if state == Qt.Checked:
            self.interpolate = True
        else:
            self.interpolate = False

    def updateThread(self, value):
        self.threadInfo.setText(
            "Number of Worker Threads (FOR ADVANCED USERS): " + str(value))
        self.numThreads = value

    # Call into C library to process the image
    def applyFilter(self, imgData, imgSize):
        newData = create_string_buffer(imgSize[0] * imgSize[1] * 4)

        dll = LibHandler.GetSharedLibrary()
        dll.ApplyLinearAberration.argtypes = [
            c_longlong, c_longlong, LinearFilterData, Coords, c_void_p,
            c_void_p
        ]
        dll.ApplyRadialAberration.argtypes = [
            c_longlong, c_longlong, RadialFilterData, Coords, c_void_p,
            c_void_p
        ]

        imgCoords = Coords(imgSize[0], imgSize[1])
        # python makes it hard to get a pointer to existing buffers for some reason
        cimgData = c_char * len(imgData)
        threadPool = []
        interp = 0
        if self.interpolate:
            interp = 1
        if self.isShapeRadial:
            falloff = 0
            if self.isFalloffExp:
                falloff = 1
            filterSettings = RadialFilterData(self.maxD, self.deadZ, falloff,
                                              interp)
        else:
            filterSettings = LinearFilterData(self.maxD, self.direction,
                                              interp)
        idx = 0
        for i in range(self.numThreads):
            numPixels = (imgSize[0] * imgSize[1]) // self.numThreads
            if i == self.numThreads - 1:
                numPixels = (imgSize[0] * imgSize[1]
                             ) - idx  # Give the last thread the remainder
            if self.isShapeRadial:
                workerThread = Thread(target=dll.ApplyRadialAberration,
                                      args=(
                                          idx,
                                          numPixels,
                                          filterSettings,
                                          imgCoords,
                                          cimgData.from_buffer(imgData),
                                          byref(newData),
                                      ))
            else:
                workerThread = Thread(target=dll.ApplyLinearAberration,
                                      args=(
                                          idx,
                                          numPixels,
                                          filterSettings,
                                          imgCoords,
                                          cimgData.from_buffer(imgData),
                                          byref(newData),
                                      ))
            threadPool.append(workerThread)
            threadPool[i].start()
            idx += numPixels
        # Join threads to finish
        for i in range(self.numThreads):
            threadPool[i].join()
        return bytes(newData)
コード例 #33
0
class MainWindow(QMainWindow):
    def __init__(self, *args, **kwargs):
        super(MainWindow, self).__init__(*args, **kwargs)

        self.setWindowTitle("Client")

        vbox = QVBoxLayout()
        hbox = QHBoxLayout()
        hbox2 = QHBoxLayout()

        wheel_stack = QStackedLayout()

        widget = QWidget()

        accelerate_btn = QPushButton(widget)
        accelerate_btn.setText("Accelerate")
        # accelerate_btn.move(64, 32)
        accelerate_btn.clicked.connect(accelerate)

        decelerate_btn = QPushButton(widget)
        decelerate_btn.setText("Decelerate")
        # decelerate_btn.move(64, 64)
        decelerate_btn.clicked.connect(decelerate)

        left_btn = QPushButton(widget)
        left_btn.setText("Left")
        # left_btn.move(32, 64)
        left_btn.clicked.connect(left)

        right_btn = QPushButton(widget)
        right_btn.setText("Right")
        # right_btn.move(96, 64)
        right_btn.clicked.connect(right)

        self.throttle = QSlider(widget)
        self.throttle.setOrientation(0x2)
        self.throttle.setProperty("value", 0)

        ss = "::handle {image: url(pedal.svg)}"
        self.throttle.setStyleSheet(ss)
        self.steering = QDial(widget)
        self.steering.setMinimum(0)
        self.steering.setMaximum(100)
        self.steering.setProperty("value", 50)
        self.steering.valueChanged.connect(change_steering)
        self.throttle.valueChanged.connect(change_throttle)

        self.steering_wheel = QPixmap('steering-wheel.svg')
        self.wheel_label = QLabel(self)
        self.wheel_label.setAlignment(QtCore.Qt.AlignCenter)
        self.wheel_label.setMinimumSize(400, 400)
        self.wheel_label.setPixmap(self.steering_wheel)

        self.accel_shortcut = QShortcut(QKeySequence("w"), self)
        self.accel_shortcut.activated.connect(accelerate)

        self.decel_shortcut = QShortcut(QKeySequence("s"), self)
        self.decel_shortcut.activated.connect(decelerate)

        self.left_shortcut = QShortcut(QKeySequence("a"), self)
        self.left_shortcut.activated.connect(left)

        self.right_shortcut = QShortcut(QKeySequence("d"), self)
        self.right_shortcut.activated.connect(right)

        hbox.addWidget(left_btn)
        hbox.addWidget(decelerate_btn)
        hbox.addWidget(right_btn)
        vbox.addWidget(accelerate_btn)
        vbox.addLayout(hbox)
        hbox2.addWidget(self.throttle)
        wheel_stack.addWidget(self.wheel_label)
        wheel_stack.addWidget(self.steering)
        hbox2.addLayout(wheel_stack)
        vbox.addLayout(hbox2)

        main_widget = QWidget()
        main_widget.setLayout(vbox)
        self.setCentralWidget(main_widget)

    def set_throttle(self, tval):
        self.throttle.setProperty("value", tval)

    def set_steering(self, sval):
        self.steering.setProperty("value", sval)
        transform = QTransform()
        transform.rotate(sval * 2 - 100)
        steering_wheel = QPixmap('steering-wheel.svg')
        self.steering_wheel = steering_wheel.transformed(transform)
        self.wheel_label.setPixmap(self.steering_wheel)